From 4c8bde2705c12fe0cd032dcb6c9c1aa4eb3eccda Mon Sep 17 00:00:00 2001 From: Kazuhiro Fujieda Date: Sun, 5 Apr 2020 17:47:49 +0900 Subject: [PATCH] =?utf8?q?Click=E3=81=AE=E3=83=8F=E3=83=B3=E3=83=89?= =?utf8?q?=E3=83=A9=E3=82=92Panel=E5=81=B4=E3=81=AB=E7=A7=BB=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- KancolleSniffer/MainForm.Designer.cs | 46 +++++++++++++++++------------------- KancolleSniffer/MainForm.cs | 30 ++--------------------- KancolleSniffer/View/MissionPanel.cs | 27 ++++++++++++++++++--- KancolleSniffer/View/NDockPanel.cs | 27 ++++++++++++++++++--- 4 files changed, 72 insertions(+), 58 deletions(-) diff --git a/KancolleSniffer/MainForm.Designer.cs b/KancolleSniffer/MainForm.Designer.cs index e312a1d..ffa0fdd 100644 --- a/KancolleSniffer/MainForm.Designer.cs +++ b/KancolleSniffer/MainForm.Designer.cs @@ -63,10 +63,10 @@ namespace KancolleSniffer this.labelCondTimerTitle = new System.Windows.Forms.Label(); this.labelCondTimer = new System.Windows.Forms.Label(); this.labelAkashiRepairTimer = new System.Windows.Forms.Label(); - this.labelNDock = new System.Windows.Forms.Label(); + this.labelNDockCaption = new System.Windows.Forms.Label(); this.labelConstruct = new System.Windows.Forms.Label(); this.labelQuest = new System.Windows.Forms.Label(); - this.labelMission = new System.Windows.Forms.Label(); + this.labelMissionCaption = new System.Windows.Forms.Label(); this.timerMain = new System.Windows.Forms.Timer(this.components); this.notifyIconMain = new System.Windows.Forms.NotifyIcon(this.components); this.contextMenuStripNotifyIcon = new System.Windows.Forms.ContextMenuStrip(this.components); @@ -272,16 +272,15 @@ namespace KancolleSniffer this.labelAkashiRepairTimer.Size = new System.Drawing.Size(32, 12); this.labelAkashiRepairTimer.TabIndex = 43; // - // labelNDock + // labelNDockCaption // - this.labelNDock.AutoSize = true; - this.labelNDock.Cursor = System.Windows.Forms.Cursors.Hand; - this.labelNDock.Location = new System.Drawing.Point(8, 195); - this.labelNDock.Name = "labelNDock"; - this.labelNDock.Size = new System.Drawing.Size(29, 12); - this.labelNDock.TabIndex = 3; - this.labelNDock.Text = "入渠"; - this.labelNDock.Click += new System.EventHandler(this.labelNDock_Click); + this.labelNDockCaption.AutoSize = true; + this.labelNDockCaption.Cursor = System.Windows.Forms.Cursors.Hand; + this.labelNDockCaption.Location = new System.Drawing.Point(8, 195); + this.labelNDockCaption.Name = "labelNDockCaption"; + this.labelNDockCaption.Size = new System.Drawing.Size(29, 12); + this.labelNDockCaption.TabIndex = 3; + this.labelNDockCaption.Text = "入渠"; // // labelConstruct // @@ -301,16 +300,15 @@ namespace KancolleSniffer this.labelQuest.TabIndex = 8; this.labelQuest.Text = "任務"; // - // labelMission + // labelMissionCaption // - this.labelMission.AutoSize = true; - this.labelMission.Cursor = System.Windows.Forms.Cursors.Hand; - this.labelMission.Location = new System.Drawing.Point(8, 276); - this.labelMission.Name = "labelMission"; - this.labelMission.Size = new System.Drawing.Size(29, 12); - this.labelMission.TabIndex = 10; - this.labelMission.Text = "遠征"; - this.labelMission.Click += new System.EventHandler(this.labelMission_Click); + this.labelMissionCaption.AutoSize = true; + this.labelMissionCaption.Cursor = System.Windows.Forms.Cursors.Hand; + this.labelMissionCaption.Location = new System.Drawing.Point(8, 276); + this.labelMissionCaption.Name = "labelMissionCaption"; + this.labelMissionCaption.Size = new System.Drawing.Size(29, 12); + this.labelMissionCaption.TabIndex = 10; + this.labelMissionCaption.Text = "遠征"; // // timerMain // @@ -732,10 +730,10 @@ namespace KancolleSniffer this.Controls.Add(this.labelCheckFleet4); this.Controls.Add(this.labelFleet4); this.Controls.Add(this.labelCheckFleet1); - this.Controls.Add(this.labelMission); + this.Controls.Add(this.labelMissionCaption); this.Controls.Add(this.labelQuest); this.Controls.Add(this.labelConstruct); - this.Controls.Add(this.labelNDock); + this.Controls.Add(this.labelNDockCaption); this.Controls.Add(this.panelShipInfo); this.Controls.Add(this.labelFleet1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; @@ -761,10 +759,10 @@ namespace KancolleSniffer #endregion private System.Windows.Forms.Panel panelShipInfo; - private System.Windows.Forms.Label labelNDock; + private System.Windows.Forms.Label labelNDockCaption; private System.Windows.Forms.Label labelConstruct; private System.Windows.Forms.Label labelQuest; - private System.Windows.Forms.Label labelMission; + private System.Windows.Forms.Label labelMissionCaption; private System.Windows.Forms.Timer timerMain; private System.Windows.Forms.Label labelCondTimerTitle; private System.Windows.Forms.Label labelCondTimer; diff --git a/KancolleSniffer/MainForm.cs b/KancolleSniffer/MainForm.cs index c9962a9..4cf4600 100644 --- a/KancolleSniffer/MainForm.cs +++ b/KancolleSniffer/MainForm.cs @@ -96,8 +96,8 @@ namespace KancolleSniffer labelPresetAkashiTimer.BackColor = CustomColors.ColumnColors.Bright; SetupQuestPanel(); panelRepairList.CreateLabels(panelRepairList_Click); - ndockPanel.SetClickHandler(labelNDock_Click); - missionPanel.SetClickHandler(labelMission_Click); + ndockPanel.SetClickHandler(labelNDockCaption); + missionPanel.SetClickHandler(labelMissionCaption); materialHistoryPanel.SetClickHandler(labelMaterialCaption, labelMaterialHistoryButton); SetupUpdateable(); PerformZoom(); @@ -905,37 +905,11 @@ namespace KancolleSniffer private void UpdateNDocLabels() { ndockPanel.Update(); - SetNDockLabel(); - } - - private void SetNDockLabel() - { - labelNDock.Text = (Config.ShowEndTime & TimerKind.NDock) != 0 ? "入渠終了" : "入渠"; - } - - private void labelNDock_Click(object sender, EventArgs e) - { - Config.ShowEndTime ^= TimerKind.NDock; - SetNDockLabel(); - UpdateTimers(); } private void UpdateMissionLabels() { missionPanel.Update(); - SetMissionLabel(); - } - - private void SetMissionLabel() - { - labelMission.Text = (Config.ShowEndTime & TimerKind.Mission) != 0 ? "遠征終了" : "遠征"; - } - - private void labelMission_Click(object sender, EventArgs e) - { - Config.ShowEndTime ^= TimerKind.Mission; - SetMissionLabel(); - UpdateTimers(); } private void UpdateTimers() diff --git a/KancolleSniffer/View/MissionPanel.cs b/KancolleSniffer/View/MissionPanel.cs index 7869e62..2c8815c 100644 --- a/KancolleSniffer/View/MissionPanel.cs +++ b/KancolleSniffer/View/MissionPanel.cs @@ -28,6 +28,7 @@ namespace KancolleSniffer.View private const int LineHeight = 15; private const int Lines = 3; private readonly MissionLabels[] _labels = new MissionLabels[Lines]; + private Label _caption; private class MissionLabels { @@ -73,6 +74,13 @@ namespace KancolleSniffer.View } Controls.AddRange(_labels.SelectMany(l => new Control[] {l.Number, l.Params, l.Name, l.Timer}).ToArray()); SetCursor(); + SetClickHandler(); + } + + public void SetClickHandler(Label caption) + { + caption.Click += ClickHandler; + _caption = caption; } private void SetCursor() @@ -82,11 +90,18 @@ namespace KancolleSniffer.View control.Cursor = Cursors.Hand; } - public void SetClickHandler(EventHandler onClick) + private void SetClickHandler() { - Click += onClick; + Click += ClickHandler; foreach (Control control in Controls) - control.Click += onClick; + control.Click += ClickHandler; + } + + private void ClickHandler(Object sender, EventArgs e) + { + Context.Config.ShowEndTime ^= TimerKind.Mission; + SetCaption(); + UpdateTimers(); } public new void Update() @@ -101,6 +116,12 @@ namespace KancolleSniffer.View _labels[i].Name.Text = names[i]; ToolTip.SetToolTip(_labels[i].Name, inPort ? "" : fleetParams); } + SetCaption(); + } + + private void SetCaption() + { + _caption.Text = (Context.Config.ShowEndTime & TimerKind.Mission) != 0 ? "遠征終了" : "遠征"; } public void UpdateTimers() diff --git a/KancolleSniffer/View/NDockPanel.cs b/KancolleSniffer/View/NDockPanel.cs index 9e4732c..0c35fcd 100644 --- a/KancolleSniffer/View/NDockPanel.cs +++ b/KancolleSniffer/View/NDockPanel.cs @@ -26,6 +26,7 @@ namespace KancolleSniffer.View private const int LeftMargin = 2; private const int LineHeight = 15; private readonly NDockLabels[] _labels = new NDockLabels[DockInfo.DockCount]; + private Label _caption; private class NDockLabels { @@ -63,6 +64,13 @@ namespace KancolleSniffer.View } Controls.AddRange(_labels.SelectMany(l => new Control[] {l.Number, l.Name, l.Timer}).ToArray()); SetCursor(); + SetClickHandler(); + } + + public void SetClickHandler(Label caption) + { + caption.Click += ClickHandler; + _caption = caption; } private void SetCursor() @@ -72,17 +80,30 @@ namespace KancolleSniffer.View control.Cursor = Cursors.Hand; } - public void SetClickHandler(EventHandler onClick) + private void SetClickHandler() { - Click += onClick; + Click += ClickHandler; foreach (Control control in Controls) - control.Click += onClick; + control.Click += ClickHandler; + } + + private void ClickHandler(object sender, EventArgs e) + { + Context.Config.ShowEndTime ^= TimerKind.NDock; + SetCaption(); + UpdateTimers(); } public new void Update() { for (var i = 0; i < _labels.Length; i++) _labels[i].Name.SetName(Context.Sniffer.NDock[i].Name); + SetCaption(); + } + + private void SetCaption() + { + _caption.Text = (Context.Config.ShowEndTime & TimerKind.NDock) != 0 ? "入渠終了" : "入渠"; } public void UpdateTimers() -- 2.11.0