this.label35 = new System.Windows.Forms.Label();\r
this.labelFuelHistory = new System.Windows.Forms.Label();\r
this.labelNDock = new System.Windows.Forms.Label();\r
- this.panelDock = new System.Windows.Forms.Panel();\r
- this.label8 = new System.Windows.Forms.Label();\r
- this.label7 = new System.Windows.Forms.Label();\r
- this.label6 = new System.Windows.Forms.Label();\r
- this.label5 = new System.Windows.Forms.Label();\r
this.panel1 = new System.Windows.Forms.Panel();\r
this.labelConstruct3 = new System.Windows.Forms.Label();\r
this.label12 = new System.Windows.Forms.Label();\r
this.labelCheckFleet4 = new System.Windows.Forms.Label();\r
this.labelCheckFleet1 = new System.Windows.Forms.Label();\r
this.labelQuestCount = new System.Windows.Forms.Label();\r
- this.questPanel = new KancolleSniffer.View.QuestPanel();\r
this.panelRepairList = new KancolleSniffer.View.RepairListForMain();\r
+ this.ndockPanel = new KancolleSniffer.View.NDockPanel();\r
this.missionPanel = new KancolleSniffer.View.MissionPanel();\r
+ this.questPanel = new KancolleSniffer.View.QuestPanel();\r
this.panelHeadquarters.SuspendLayout();\r
this.panelShipInfo.SuspendLayout();\r
this.panelBattleInfo.SuspendLayout();\r
this.panelMaterialHistory.SuspendLayout();\r
- this.panelDock.SuspendLayout();\r
this.panel1.SuspendLayout();\r
this.contextMenuStripNotifyIcon.SuspendLayout();\r
this.contextMenuStripMain.SuspendLayout();\r
this.labelNDock.Text = "入渠";\r
this.labelNDock.Click += new System.EventHandler(this.labelNDock_Click);\r
// \r
- // panelDock\r
- // \r
- this.panelDock.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
- this.panelDock.Controls.Add(this.label8);\r
- this.panelDock.Controls.Add(this.label7);\r
- this.panelDock.Controls.Add(this.label6);\r
- this.panelDock.Controls.Add(this.label5);\r
- this.panelDock.Location = new System.Drawing.Point(6, 209);\r
- this.panelDock.Name = "panelDock";\r
- this.panelDock.Size = new System.Drawing.Size(140, 64);\r
- this.panelDock.TabIndex = 4;\r
- this.panelDock.Click += new System.EventHandler(this.labelNDock_Click);\r
- // \r
- // label8\r
- // \r
- this.label8.AutoSize = true;\r
- this.label8.Location = new System.Drawing.Point(2, 48);\r
- this.label8.Name = "label8";\r
- this.label8.Size = new System.Drawing.Size(29, 12);\r
- this.label8.TabIndex = 3;\r
- this.label8.Text = "第四";\r
- this.label8.Click += new System.EventHandler(this.labelNDock_Click);\r
- // \r
- // label7\r
- // \r
- this.label7.AutoSize = true;\r
- this.label7.Location = new System.Drawing.Point(2, 33);\r
- this.label7.Name = "label7";\r
- this.label7.Size = new System.Drawing.Size(29, 12);\r
- this.label7.TabIndex = 2;\r
- this.label7.Text = "第三";\r
- this.label7.Click += new System.EventHandler(this.labelNDock_Click);\r
- // \r
- // label6\r
- // \r
- this.label6.AutoSize = true;\r
- this.label6.Location = new System.Drawing.Point(2, 18);\r
- this.label6.Name = "label6";\r
- this.label6.Size = new System.Drawing.Size(29, 12);\r
- this.label6.TabIndex = 1;\r
- this.label6.Text = "第二";\r
- this.label6.Click += new System.EventHandler(this.labelNDock_Click);\r
- // \r
- // label5\r
- // \r
- this.label5.AutoSize = true;\r
- this.label5.Location = new System.Drawing.Point(2, 3);\r
- this.label5.Name = "label5";\r
- this.label5.Size = new System.Drawing.Size(29, 12);\r
- this.label5.TabIndex = 0;\r
- this.label5.Text = "第一";\r
- this.label5.Click += new System.EventHandler(this.labelNDock_Click);\r
- // \r
// panel1\r
// \r
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
this.labelQuestCount.TabIndex = 57;\r
this.labelQuestCount.Text = "0";\r
// \r
- // questPanel\r
- // \r
- this.questPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
- this.questPanel.Location = new System.Drawing.Point(6, 356);\r
- this.questPanel.Name = "questPanel";\r
- this.questPanel.Size = new System.Drawing.Size(220, 94);\r
- this.questPanel.TabIndex = 56;\r
- // \r
// panelRepairList\r
// \r
this.panelRepairList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
this.panelRepairList.Visible = false;\r
this.panelRepairList.Click += new System.EventHandler(this.panelRepairList_Click);\r
// \r
+ // ndockPanel\r
+ // \r
+ this.ndockPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
+ this.ndockPanel.Location = new System.Drawing.Point(6, 209);\r
+ this.ndockPanel.Name = "ndockPanel";\r
+ this.ndockPanel.Size = new System.Drawing.Size(140, 64);\r
+ this.ndockPanel.TabIndex = 59;\r
+ // \r
// missionPanel\r
// \r
- this.missionPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
this.missionPanel.Location = new System.Drawing.Point(6, 290);\r
this.missionPanel.Name = "missionPanel";\r
this.missionPanel.Size = new System.Drawing.Size(220, 49);\r
this.missionPanel.TabIndex = 58;\r
// \r
+ // questPanel\r
+ // \r
+ this.questPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
+ this.questPanel.Location = new System.Drawing.Point(6, 356);\r
+ this.questPanel.Name = "questPanel";\r
+ this.questPanel.Size = new System.Drawing.Size(220, 94);\r
+ this.questPanel.TabIndex = 56;\r
+ // \r
// MainForm\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
this.ClientSize = new System.Drawing.Size(232, 456);\r
this.ContextMenuStrip = this.contextMenuStripMain;\r
+ this.Controls.Add(this.panelRepairList);\r
+ this.Controls.Add(this.ndockPanel);\r
this.Controls.Add(this.missionPanel);\r
this.Controls.Add(this.labelQuestCount);\r
this.Controls.Add(this.questPanel);\r
this.Controls.Add(this.labelBullSq1);\r
this.Controls.Add(this.labelFuelSq1);\r
this.Controls.Add(this.labelRepairListButton);\r
- this.Controls.Add(this.panelRepairList);\r
this.Controls.Add(this.label31);\r
this.Controls.Add(this.labelMaterialHistoryButton);\r
this.Controls.Add(this.label36);\r
this.Controls.Add(this.labelQuest);\r
this.Controls.Add(this.panel1);\r
this.Controls.Add(this.labelConstruct);\r
- this.Controls.Add(this.panelDock);\r
this.Controls.Add(this.labelNDock);\r
this.Controls.Add(this.panelShipInfo);\r
this.Controls.Add(this.labelFleet1);\r
this.panelBattleInfo.PerformLayout();\r
this.panelMaterialHistory.ResumeLayout(false);\r
this.panelMaterialHistory.PerformLayout();\r
- this.panelDock.ResumeLayout(false);\r
- this.panelDock.PerformLayout();\r
this.panel1.ResumeLayout(false);\r
this.panel1.PerformLayout();\r
this.contextMenuStripNotifyIcon.ResumeLayout(false);\r
private System.Windows.Forms.Label label1;\r
private System.Windows.Forms.Panel panelShipInfo;\r
private System.Windows.Forms.Label labelNDock;\r
- private System.Windows.Forms.Panel panelDock;\r
- private System.Windows.Forms.Label label8;\r
- private System.Windows.Forms.Label label7;\r
- private System.Windows.Forms.Label label6;\r
- private System.Windows.Forms.Label label5;\r
private System.Windows.Forms.Panel panel1;\r
private System.Windows.Forms.Label labelConstruct;\r
private System.Windows.Forms.Label labelConstruct3;\r
private QuestPanel questPanel;\r
private System.Windows.Forms.Label labelQuestCount;\r
private MissionPanel missionPanel;\r
+ private NDockPanel ndockPanel;\r
}\r
}\r
\r
private int _currentFleet;\r
private bool _combinedFleet;\r
private readonly MainShipLabels _mainLabels = new MainShipLabels();\r
- private readonly MainNDockLabels _ndockLabels = new MainNDockLabels();\r
private NumberAndHistory _numberAndHistory;\r
private readonly ListFormGroup _listFormGroup;\r
\r
labelPresetAkashiTimer.BackColor = CustomColors.ColumnColors.Bright;\r
SetupQuestPanel();\r
panelRepairList.CreateLabels(panelRepairList_Click);\r
+ ndockPanel.SetClickHandler(labelNDock_Click);\r
missionPanel.SetClickHandler(labelMission_Click);\r
PerformZoom();\r
}\r
Panel7Ships = panel7Ships,\r
PanelCombinedFleet = panelCombinedFleet\r
}, ShowShipOnShipList);\r
- _ndockLabels.Create(panelDock, labelNDock_Click);\r
}\r
\r
private void CreateNumberAndHistory(NotificationManager manager)\r
\r
private void UpdateNDocLabels()\r
{\r
- _ndockLabels.SetName(Sniffer.NDock);\r
+ ndockPanel.SetName(Sniffer.NDock);\r
SetNDockLabel();\r
}\r
\r
private void UpdateTimers()\r
{\r
missionPanel.UpdateTimers(Sniffer, _now, (Config.ShowEndTime & TimerKind.Mission) != 0);\r
- for (var i = 0; i < Sniffer.NDock.Length; i++)\r
- {\r
- var entry = Sniffer.NDock[i];\r
- _ndockLabels.SetTimer(i, entry.Timer, _now, (Config.ShowEndTime & TimerKind.NDock) != 0);\r
- }\r
+ ndockPanel.UpdateTimers(Sniffer, _now, (Config.ShowEndTime & TimerKind.NDock) != 0);\r
var kdock = new[] {labelConstruct1, labelConstruct2, labelConstruct3, labelConstruct4};\r
for (var i = 0; i < kdock.Length; i++)\r
{\r
+++ /dev/null
-// Copyright (C) 2019 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-// http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-\r
-using System;\r
-using System.Drawing;\r
-using System.Windows.Forms;\r
-using KancolleSniffer.Model;\r
-\r
-namespace KancolleSniffer.View\r
-{\r
- public class MainNDockLabels\r
- {\r
- private readonly NDockLabels[] _ndockLabels = new NDockLabels[DockInfo.DockCount];\r
-\r
- private class NDockLabels : ControlsArranger\r
- {\r
- public ShipLabel.Name Name { get; set; }\r
- public Label Timer { get; set; }\r
-\r
- public override Control[] Controls => new Control[] {Timer, Name};\r
- }\r
-\r
- public void Create(Control parent, EventHandler onClick)\r
- {\r
- const int lh = 15;\r
- for (var i = 0; i < _ndockLabels.Length; i++)\r
- {\r
- var y = i * lh;\r
- _ndockLabels[i] = new NDockLabels\r
- {\r
- Name = new ShipLabel.Name(new Point(29, y + 3), ShipNameWidth.NDock),\r
- Timer = new GrowLeftLabel\r
- {\r
- Location = new Point(138, y + 2),\r
- GrowLeft = true,\r
- MinimumSize = new Size(0, lh),\r
- TextAlign = ContentAlignment.MiddleLeft,\r
- Cursor = Cursors.Hand\r
- }\r
- };\r
- _ndockLabels[i].Arrange(parent);\r
- _ndockLabels[i].SetClickHandler(onClick);\r
- }\r
- }\r
-\r
- public void SetName(NameAndTimer[] ndock)\r
- {\r
- for (var i = 0; i < _ndockLabels.Length; i++)\r
- _ndockLabels[i].Name.SetName(ndock[i].Name);\r
- }\r
-\r
- public void SetTimer(int dock, AlarmTimer timer, DateTime now, bool finishTime)\r
- {\r
- var label = _ndockLabels[dock].Timer;\r
- label.ForeColor = timer.IsFinished(now) ? CUDColors.Red : Color.Black;\r
- label.Text = timer.ToString(now, finishTime);\r
- }\r
- }\r
-}
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2019 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the "License");\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+// http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+\r
+using System;\r
+using System.Drawing;\r
+using System.Linq;\r
+using System.Windows.Forms;\r
+using KancolleSniffer.Model;\r
+\r
+namespace KancolleSniffer.View\r
+{\r
+ public class NDockPanel : Panel\r
+ {\r
+ private const int TopMargin = 3;\r
+ private const int LeftMargin = 2;\r
+ private const int LineHeight = 15;\r
+ private readonly NDockLabels[] _labels = new NDockLabels[DockInfo.DockCount];\r
+\r
+ private class NDockLabels\r
+ {\r
+ public Label Number { get; set; }\r
+ public ShipLabel.Name Name { get; set; }\r
+ public Label Timer { get; set; }\r
+ }\r
+\r
+ public NDockPanel()\r
+ {\r
+ BorderStyle = BorderStyle.FixedSingle;\r
+ for (var i = 0; i < _labels.Length; i++)\r
+ {\r
+ var y = TopMargin + i * LineHeight;\r
+ _labels[i] = new NDockLabels\r
+ {\r
+ Number = new Label\r
+ {\r
+ Location = new Point(LeftMargin, y),\r
+ AutoSize = true,\r
+ Text = "第" + new[] {"一", "二", "三", "四"}[i]\r
+ },\r
+ Name = new ShipLabel.Name(new Point(LeftMargin + 27, y), ShipNameWidth.NDock),\r
+ Timer = new GrowLeftLabel\r
+ {\r
+ Location = new Point(LeftMargin + 136, y - 1),\r
+ GrowLeft = true,\r
+ MinimumSize = new Size(0, LineHeight),\r
+ TextAlign = ContentAlignment.MiddleLeft,\r
+ Cursor = Cursors.Hand\r
+ }\r
+ };\r
+ }\r
+ Controls.AddRange(_labels.SelectMany(l => new Control[] {l.Number, l.Name, l.Timer}).ToArray());\r
+ SetCursor();\r
+ }\r
+\r
+ private void SetCursor()\r
+ {\r
+ Cursor = Cursors.Hand;\r
+ foreach (Control control in Controls)\r
+ control.Cursor = Cursors.Hand;\r
+ }\r
+\r
+ public void SetClickHandler(EventHandler onClick)\r
+ {\r
+ Click += onClick;\r
+ foreach (Control control in Controls)\r
+ control.Click += onClick;\r
+ }\r
+\r
+ public void SetName(NameAndTimer[] ndock)\r
+ {\r
+ for (var i = 0; i < _labels.Length; i++)\r
+ _labels[i].Name.SetName(ndock[i].Name);\r
+ }\r
+\r
+ public void UpdateTimers(Sniffer sniffer, DateTime now, bool showEndTime)\r
+ {\r
+ foreach (var entry in _labels.Zip(sniffer.NDock,\r
+ (label, ndock) => new {label = label.Timer, timer = ndock.Timer}))\r
+ {\r
+ entry.label.ForeColor = entry.timer.IsFinished(now) ? CUDColors.Red : Color.Black;\r
+ entry.label.Text = entry.timer.ToString(now, showEndTime);\r
+ }\r
+ }\r
+ }\r
+}
\ No newline at end of file