Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmMain.cs @ 17:475d3cdb75f4
* White space cleanup
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 17 Jun 2009 14:05:31 +0000 |
parents | 76a15df10fa6 |
children | b1588ef12a2a |
rev | line source |
---|---|
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
1 // This file (FrmMain.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
2 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
4 |
0 | 5 using System; |
6 using System.Drawing; | |
7 using System.Drawing.Drawing2D; | |
8 using System.Collections; | |
9 using System.ComponentModel; | |
10 using System.Windows.Forms; | |
11 using System.Data; | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
12 using System.IO; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
13 using System.Threading; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
14 using log4net; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
15 using IBBoard; |
0 | 16 using IBBoard.CustomMath; |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
17 using IBBoard.Commands; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
18 using IBBoard.IO; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
19 using IBBoard.Lang; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
20 using IBBoard.Log4Net; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
21 using IBBoard.Windows.Forms; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
22 using IBBoard.Windows.Forms.I18N; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
23 using IBBoard.Xml; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
24 using IBBoard.WarFoundry.API; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
25 using IBBoard.WarFoundry.API.Commands; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
26 using IBBoard.WarFoundry.API.Objects; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
27 using IBBoard.WarFoundry.API.Savers; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
28 using IBBoard.WarFoundry.API.Factories; |
7 | 29 using IBBoard.WarFoundry.API.Factories.Xml; |
0 | 30 |
31 namespace IBBoard.WarFoundry | |
32 { | |
33 /// <summary> | |
34 /// Summary description for Form1. | |
35 /// </summary> | |
36 public class FrmMain : System.Windows.Forms.Form | |
37 { | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
38 private static readonly string AppTitle = "WarFoundry"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
39 const string DefaultDataDir = "data"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
40 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
41 private Preferences preferences; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
42 protected readonly ILog logger = LogManager.GetLogger(typeof(FrmMain)); |
0 | 43 |
44 private CommandStack commandStack; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
45 private ToolBarButton[] categoryButtons; |
0 | 46 |
47 public ObjectAddDelegate UnitAddedMethod; | |
48 public ObjectRemoveDelegate UnitRemovedMethod; | |
49 public DoubleValChangedDelegate PointsValueChangedMethod; | |
50 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; | |
51 | |
52 private FrmArmyTree armyTree; | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
53 private FrmDebugOutput debugWindow; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
54 private string loadedFilePath; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
55 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
56 private System.ComponentModel.IContainer components; |
0 | 57 private System.Windows.Forms.ToolBar toolBar; |
58 private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy; | |
59 private System.Windows.Forms.ImageList buttonIcons; | |
60 private IBBoard.Windows.Forms.IBBToolBarButton bttnSaveArmy; | |
61 private System.Windows.Forms.OpenFileDialog openArmyDialog; | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
62 private System.Windows.Forms.SaveFileDialog saveArmyDialog; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
63 private IBBoard.Windows.Forms.IBBToolBarButton bttnOpenArmy; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
64 private IBBoard.Windows.Forms.IBBToolBarButton bttnSep1; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
65 private IBBoard.Windows.Forms.IBBToolBarButton bttnUndo; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
66 private IBBoard.Windows.Forms.IBBToolBarButton bttnRedo; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
67 private System.Windows.Forms.MainMenu mainMenu; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
68 private IBBoard.Windows.Forms.IBBMenuItem menuFile; |
0 | 69 private IBBoard.Windows.Forms.IBBMenuItem miNewArmy; |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
70 private IBBoard.Windows.Forms.IBBMenuItem miOpenArmy; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
71 private IBBoard.Windows.Forms.IBBMenuItem miCloseArmy; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
72 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
73 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
74 private System.Windows.Forms.MenuItem miSep2; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
75 private IBBoard.Windows.Forms.IBBMenuItem miChangeSystem; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
76 private System.Windows.Forms.MenuItem miSep1; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
77 private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
78 private System.Windows.Forms.MenuItem miSep3; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
79 private IBBoard.Windows.Forms.IBBMenuItem miExit; |
0 | 80 private IBBoard.Windows.Forms.IBBMenuItem menuEdit; |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
81 private IBBoard.Windows.Forms.IBBMenuItem miUndo; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
82 private IBBoard.Windows.Forms.IBBMenuItem miRedo; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
83 private IBBoard.Windows.Forms.IBBMenuItem menuHelp; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
84 private IBBoard.Windows.Forms.IBBMenuItem miDebugWindow; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
85 private IBBoard.Windows.Forms.IBBMenuItem miAbout; |
0 | 86 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; |
87 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; | |
88 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; | |
89 private System.Windows.Forms.ContextMenu undoMenu; | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
90 private System.Windows.Forms.ContextMenu redoMenu; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
91 private IBBoard.Windows.Forms.ColorableStatusBar statusBar; |
0 | 92 private System.Windows.Forms.Timer statusBarTimer; |
93 private System.Windows.Forms.Panel pnlRight; | |
94 | |
95 public FrmMain(string[] args) | |
96 { | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
97 this.Closing+=new CancelEventHandler(FrmMain_Closing); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
98 CommandStack.CommandStackUpdated += new MethodInvoker(commandStack_CommandStackUpdated); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
99 LogNotifierHandler.RegisterNotifierHandler(); |
0 | 100 |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
101 InitializeComponent(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
102 |
15
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
103 Preferences = new Preferences("WarFoundry"); |
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
104 try |
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
105 { |
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
106 Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString()); |
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
107 } |
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
108 catch (TranslationLoadException ex) |
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
109 { |
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
110 logger.Error(ex); |
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
111 MessageBox.Show(this, "Translation loading failed for language " + Preferences["language"].ToString(), "Translation failure", MessageBoxButtons.OK, MessageBoxIcon.Error); |
13
f7f65d80951e
Closes #38 - Stop missing translation being fatal
IBBoard <dev@ibboard.co.uk>
parents:
10
diff
changeset
|
112 } |
0 | 113 |
114 //pnlRight.Left = ClientSize.Width - pnlRight.Width - 2; | |
115 //pnlRight.Top = toolBar.Height + 5; | |
116 //pnlRight.Height = ClientRectangle.Bottom - statusBar.Height - pnlRight.Top - 3; | |
117 | |
118 foreach (Control ctrl in Controls) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
119 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
120 ControlTranslator.TranslateControl(ctrl); |
0 | 121 } |
122 | |
123 foreach(Component comp in components.Components) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
124 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
125 ControlTranslator.TranslateComponent(comp); |
0 | 126 } |
127 | |
128 foreach (IBBMenuItem mi in Menu.MenuItems) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
129 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
130 ControlTranslator.TranslateComponent(mi); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
131 } |
0 | 132 |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
133 ControlTranslator.TranslateComponent(openArmyDialog); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
134 ControlTranslator.TranslateComponent(saveArmyDialog); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
135 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
136 WarFoundryCore.GameSystemChanged+= new GameSystemChangedDelegate(FrmMain_GameSystemChanged); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
137 WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(FrmMain_ArmyChanged); |
0 | 138 UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod); |
139 UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod); | |
140 PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod); | |
141 //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement); | |
142 | |
143 sbErrorPanel.Color = Color.Red; | |
144 | |
145 armyTree = new FrmArmyTree(CommandStack); | |
146 armyTree.MdiParent = this; | |
147 armyTree.Show(); | |
148 armyTree.StartPosition = FormStartPosition.Manual; | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
149 armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
150 ControlTranslator.TranslateControl(armyTree); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
151 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
152 // hack to load default files |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
153 WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir)); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
154 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
155 IWarFoundryFactory factory = WarFoundryFactoryFactory.GetFactoryFactory().GetFactory(typeof(WarFoundryXmlFactory)); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
156 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
157 if (factory != null && factory is WarFoundryXmlFactory) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
158 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
159 WarFoundryLoader.GetDefault().RegisterFactory((WarFoundryXmlFactory)factory); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
160 } |
0 | 161 |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
162 /* |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
163 if (args.Length == 1) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
164 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
165 logger.Debug("Attempting to load from file"); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
166 FileInfo file = new FileInfo(args[0]); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
167 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
168 try |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
169 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
170 if (file.Extension.Equals("."+Factory.GetArmyFileExtension())) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
171 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
172 WarFoundryCore.CurrentArmy = Factory.CreateArmyFromFile(file); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
173 logger.InfoFormat("Loaded army from {0}", file.FullName); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
174 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
175 else if (file.Extension.Equals("."+Factory.GetSystemFileExtension())) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
176 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
177 WarFoundryCore.CurrentGameSystem = Factory.CreateGameSystemFromFile(file); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
178 logger.InfoFormat("Loaded game system from {0}", file.FullName); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
179 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
180 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
181 catch (InvalidFileException ex) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
182 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
183 MessageBox.Show(Translation.GetTranslation("InvalidFileLoadError", "The file loaded ({0}) was not a valid WarFoundry file", file.FullName), Translation.GetTranslation("InvalidFileLoadTitle", "Invalid data file", null), MessageBoxButtons.OK, MessageBoxIcon.Error); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
184 logger.Error(ex); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
185 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
186 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
187 else |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
188 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
189 string gameSystemID = Preferences.GetStringProperty("currSystem"); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
190 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
191 if (gameSystemID!=null && !"".Equals(gameSystemID)) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
192 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
193 logger.Debug("Attempting to load current game system from properties"); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
194 GameSystem sys = Factory.GetGameSystem(gameSystemID); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
195 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
196 if (sys!=null) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
197 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
198 WarFoundryCore.CurrentGameSystem = sys; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
199 logger.InfoFormat("Loaded game system {0} from properties", gameSystemID); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
200 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
201 } |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
202 }*/ |
0 | 203 } |
204 | |
205 public static string DataPath | |
206 { | |
207 get { return Constants.ExecutablePath+Constants.DirectoryChar+"data"; } | |
208 } | |
209 | |
210 public static String ArmiesPath | |
211 { | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
212 get { return Constants.UserDataPath+Constants.DirectoryChar+"armies"; } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
213 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
214 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
215 public Preferences Preferences |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
216 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
217 get { return preferences; } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
218 set { preferences = value; } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
219 } |
0 | 220 |
221 public CommandStack CommandStack | |
222 { | |
223 get | |
224 { | |
225 if (commandStack == null) | |
226 { | |
227 commandStack = new CommandStack(); | |
228 } | |
229 | |
230 return commandStack; | |
231 } | |
232 } | |
233 | |
234 /// <summary> | |
235 /// Clean up any resources being used. | |
236 /// </summary> | |
237 protected override void Dispose( bool disposing ) | |
238 { | |
239 if( disposing ) | |
240 { | |
241 if (components != null) | |
242 { | |
243 components.Dispose(); | |
244 } | |
245 } | |
246 base.Dispose( disposing ); | |
247 } | |
248 | |
249 #region Windows Form Designer generated code | |
250 /// <summary> | |
251 /// Required method for Designer support - do not modify | |
252 /// the contents of this method with the code editor. | |
253 /// </summary> | |
254 private void InitializeComponent() | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
255 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
256 this.components = new System.ComponentModel.Container(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
257 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
258 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
259 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
260 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
261 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
262 this.toolBar = new System.Windows.Forms.ToolBar(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
263 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
264 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
265 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
266 this.bttnSep1 = new IBBoard.Windows.Forms.IBBToolBarButton(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
267 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolBarButton(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
268 this.undoMenu = new System.Windows.Forms.ContextMenu(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
269 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolBarButton(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
270 this.redoMenu = new System.Windows.Forms.ContextMenu(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
271 this.buttonIcons = new System.Windows.Forms.ImageList(this.components); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
272 this.mainMenu = new System.Windows.Forms.MainMenu(this.components); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
273 this.menuFile = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
274 this.miNewArmy = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
275 this.miOpenArmy = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
276 this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
277 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
278 this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
279 this.miSep1 = new System.Windows.Forms.MenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
280 this.miChangeSystem = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
281 this.miSep2 = new System.Windows.Forms.MenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
282 this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
283 this.miSep3 = new System.Windows.Forms.MenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
284 this.miExit = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
285 this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
286 this.miUndo = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
287 this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
288 this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
289 this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
290 this.miDebugWindow = new IBBoard.Windows.Forms.IBBMenuItem(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
291 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
292 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
293 this.pnlRight = new System.Windows.Forms.Panel(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
294 this.statusBarTimer = new System.Windows.Forms.Timer(this.components); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
295 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
296 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
297 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
298 this.SuspendLayout(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
299 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
300 // statusBar |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
301 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
302 this.statusBar.Location = new System.Drawing.Point(0, 548); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
303 this.statusBar.Name = "statusBar"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
304 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
305 this.sbMainPanel, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
306 this.sbErrorPanel, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
307 this.sbPointsPanel}); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
308 this.statusBar.ShowPanels = true; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
309 this.statusBar.Size = new System.Drawing.Size(792, 22); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
310 this.statusBar.TabIndex = 1; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
311 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
312 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
313 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
314 // sbMainPanel |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
315 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
316 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
317 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
318 this.sbMainPanel.Name = "sbMainPanel"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
319 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
320 this.sbMainPanel.Width = 475; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
321 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
322 // sbErrorPanel |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
323 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
324 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
325 this.sbErrorPanel.Name = "sbErrorPanel"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
326 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
327 this.sbErrorPanel.Width = 150; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
328 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
329 // sbPointsPanel |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
330 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
331 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
332 this.sbPointsPanel.Name = "sbPointsPanel"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
333 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
334 this.sbPointsPanel.ToolTipText = "Current Points Total"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
335 this.sbPointsPanel.Width = 150; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
336 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
337 // toolBar |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
338 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
339 this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
340 this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
341 this.bttnNewArmy, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
342 this.bttnOpenArmy, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
343 this.bttnSaveArmy, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
344 this.bttnSep1, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
345 this.bttnUndo, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
346 this.bttnRedo}); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
347 this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
348 this.toolBar.DropDownArrows = true; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
349 this.toolBar.ImageList = this.buttonIcons; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
350 this.toolBar.Location = new System.Drawing.Point(0, 0); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
351 this.toolBar.Name = "toolBar"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
352 this.toolBar.ShowToolTips = true; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
353 this.toolBar.Size = new System.Drawing.Size(792, 28); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
354 this.toolBar.TabIndex = 2; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
355 this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
356 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
357 // bttnNewArmy |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
358 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
359 this.bttnNewArmy.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
360 this.bttnNewArmy.ImageIndex = 0; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
361 this.bttnNewArmy.Name = "bttnNewArmy"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
362 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
363 // bttnOpenArmy |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
364 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
365 this.bttnOpenArmy.ImageIndex = 2; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
366 this.bttnOpenArmy.Name = "bttnOpenArmy"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
367 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
368 // bttnSaveArmy |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
369 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
370 this.bttnSaveArmy.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
371 this.bttnSaveArmy.ImageIndex = 1; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
372 this.bttnSaveArmy.Name = "bttnSaveArmy"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
373 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
374 // bttnSep1 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
375 // |
15
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
376 this.bttnSep1.Name = ""; |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
377 this.bttnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
378 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
379 // bttnUndo |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
380 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
381 this.bttnUndo.DropDownMenu = this.undoMenu; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
382 this.bttnUndo.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
383 this.bttnUndo.ImageIndex = 3; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
384 this.bttnUndo.Name = "bttnUndo"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
385 this.bttnUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
386 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
387 // bttnRedo |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
388 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
389 this.bttnRedo.DropDownMenu = this.redoMenu; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
390 this.bttnRedo.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
391 this.bttnRedo.ImageIndex = 4; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
392 this.bttnRedo.Name = "bttnRedo"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
393 this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
394 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
395 // buttonIcons |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
396 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
397 this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
398 this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
399 this.buttonIcons.Images.SetKeyName(0, ""); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
400 this.buttonIcons.Images.SetKeyName(1, ""); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
401 this.buttonIcons.Images.SetKeyName(2, ""); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
402 this.buttonIcons.Images.SetKeyName(3, ""); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
403 this.buttonIcons.Images.SetKeyName(4, ""); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
404 this.buttonIcons.Images.SetKeyName(5, ""); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
405 this.buttonIcons.Images.SetKeyName(6, ""); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
406 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
407 // mainMenu |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
408 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
409 this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
410 this.menuFile, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
411 this.menuEdit, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
412 this.menuHelp}); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
413 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
414 // menuFile |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
415 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
416 this.menuFile.Index = 0; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
417 this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
418 this.miNewArmy, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
419 this.miOpenArmy, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
420 this.miSaveArmy, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
421 this.miSaveArmyAs, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
422 this.miCloseArmy, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
423 this.miSep1, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
424 this.miChangeSystem, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
425 this.miSep2, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
426 this.miReloadFiles, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
427 this.miSep3, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
428 this.miExit}); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
429 this.menuFile.Text = "&file"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
430 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
431 // miNewArmy |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
432 // |
15
76a15df10fa6
Re #88 - Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
13
diff
changeset
|
433 this.miNewArmy.Enabled = false; |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
434 this.miNewArmy.Index = 0; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
435 this.miNewArmy.Text = "&new army"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
436 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
437 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
438 // miOpenArmy |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
439 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
440 this.miOpenArmy.Index = 1; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
441 this.miOpenArmy.Text = "&open army"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
442 this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
443 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
444 // miSaveArmy |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
445 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
446 this.miSaveArmy.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
447 this.miSaveArmy.Index = 2; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
448 this.miSaveArmy.Text = "&save army"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
449 this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
450 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
451 // miSaveArmyAs |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
452 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
453 this.miSaveArmyAs.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
454 this.miSaveArmyAs.Index = 3; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
455 this.miSaveArmyAs.Text = "save army &as..."; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
456 this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
457 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
458 // miCloseArmy |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
459 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
460 this.miCloseArmy.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
461 this.miCloseArmy.Index = 4; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
462 this.miCloseArmy.Text = "&close army"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
463 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
464 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
465 // miSep1 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
466 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
467 this.miSep1.Index = 5; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
468 this.miSep1.Text = "-"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
469 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
470 // miChangeSystem |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
471 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
472 this.miChangeSystem.Index = 6; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
473 this.miChangeSystem.Text = "change &game system"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
474 this.miChangeSystem.Click += new System.EventHandler(this.miChangeSystem_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
475 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
476 // miSep2 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
477 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
478 this.miSep2.Index = 7; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
479 this.miSep2.Text = "-"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
480 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
481 // miReloadFiles |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
482 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
483 this.miReloadFiles.Index = 8; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
484 this.miReloadFiles.Text = "&reload files"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
485 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
486 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
487 // miSep3 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
488 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
489 this.miSep3.Index = 9; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
490 this.miSep3.Text = "-"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
491 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
492 // miExit |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
493 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
494 this.miExit.Index = 10; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
495 this.miExit.Text = "e&xit"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
496 this.miExit.Click += new System.EventHandler(this.miExit_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
497 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
498 // menuEdit |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
499 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
500 this.menuEdit.Index = 1; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
501 this.menuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
502 this.miUndo, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
503 this.miRedo}); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
504 this.menuEdit.Text = "&edit"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
505 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
506 // miUndo |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
507 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
508 this.miUndo.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
509 this.miUndo.Index = 0; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
510 this.miUndo.Text = "&undo"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
511 this.miUndo.Click += new System.EventHandler(this.miUndo_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
512 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
513 // miRedo |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
514 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
515 this.miRedo.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
516 this.miRedo.Index = 1; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
517 this.miRedo.Text = "&redo"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
518 this.miRedo.Click += new System.EventHandler(this.miRedo_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
519 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
520 // menuHelp |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
521 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
522 this.menuHelp.Index = 2; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
523 this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
524 this.miAbout, |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
525 this.miDebugWindow}); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
526 this.menuHelp.Text = "&help"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
527 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
528 // miAbout |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
529 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
530 this.miAbout.Enabled = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
531 this.miAbout.Index = 0; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
532 this.miAbout.Text = "&about"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
533 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
534 // miDebugWindow |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
535 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
536 this.miDebugWindow.Index = 1; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
537 this.miDebugWindow.Text = "&debug"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
538 this.miDebugWindow.Click += new System.EventHandler(this.miDebugWindow_Click); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
539 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
540 // saveArmyDialog |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
541 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
542 this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
543 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
544 // pnlRight |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
545 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
546 this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
547 | System.Windows.Forms.AnchorStyles.Right))); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
548 this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
549 this.pnlRight.Location = new System.Drawing.Point(726, 30); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
550 this.pnlRight.Name = "pnlRight"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
551 this.pnlRight.Size = new System.Drawing.Size(64, 516); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
552 this.pnlRight.TabIndex = 4; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
553 this.pnlRight.Visible = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
554 this.pnlRight.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlRight_Paint); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
555 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
556 // statusBarTimer |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
557 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
558 this.statusBarTimer.Interval = 5000; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
559 this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
560 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
561 // FrmMain |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
562 // |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
563 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
564 this.ClientSize = new System.Drawing.Size(792, 570); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
565 this.Controls.Add(this.pnlRight); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
566 this.Controls.Add(this.toolBar); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
567 this.Controls.Add(this.statusBar); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
568 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
569 this.IsMdiContainer = true; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
570 this.Menu = this.mainMenu; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
571 this.Name = "FrmMain"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
572 this.Text = "WarFoundry"; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
573 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
574 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
575 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
576 this.ResumeLayout(false); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
577 this.PerformLayout(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
578 |
0 | 579 } |
580 #endregion | |
581 | |
582 /// <summary> | |
583 /// The main entry point for the application. | |
584 /// </summary> | |
585 [STAThread] | |
586 static void Main(string[] args) | |
587 { | |
588 try | |
589 { | |
590 ///TODO: Work out how to auto-embed the Manifest file so that we can have visual styles without having a .manifest file floating around | |
591 //and without using the line below, which causes the toolbar buttons to lose their icons | |
592 //Application.EnableVisualStyles(); | |
593 Application.Run(new FrmMain(args)); | |
594 } | |
595 catch(Exception ex) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
596 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
597 LogManager.GetLogger(typeof(FrmMain)).Fatal(ex); |
0 | 598 MessageBox.Show(null, "A major, unexpected and fatal error ocurred while starting the application: \r\n\r\n"+ex.Message+"\r\n\r\n"+ex.StackTrace, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error); |
599 } | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
600 } |
0 | 601 |
602 private void miExit_Click(object sender, System.EventArgs e) | |
603 { | |
604 Application.Exit(); | |
605 } | |
606 | |
607 private void miNewArmy_Click(object sender, System.EventArgs e) | |
608 { | |
609 createNewArmy(); | |
610 } | |
611 | |
612 private void createNewArmy() | |
613 { | |
614 if (closeCurrentArmy()) | |
615 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
616 FrmNewArmy newArmy = new FrmNewArmy(CurrentGameSystem); |
0 | 617 DialogResult dr = newArmy.ShowDialog(); |
618 | |
619 if (dr == DialogResult.OK) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
620 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
621 CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize); |
0 | 622 } |
623 } | |
624 } | |
625 | |
626 private bool openArmy() | |
627 { | |
628 if (closeCurrentArmy()) | |
629 { | |
630 if (openArmyDialog.Filter=="") | |
631 { | |
632 string savePath = ArmiesPath; | |
633 | |
634 if (!Directory.Exists(savePath)) | |
635 { | |
636 Directory.CreateDirectory(savePath); | |
637 } | |
638 | |
639 openArmyDialog.InitialDirectory = savePath; | |
640 openArmyDialog.Filter = Translation.GetTranslation("armyFileFilter")+"|*.army"; | |
641 openArmyDialog.Title = Translation.GetTranslation("openArmyDialog"); | |
642 | |
643 } | |
644 | |
645 DialogResult dr = openArmyDialog.ShowDialog(this); | |
646 | |
647 if (dr == DialogResult.OK) | |
648 { | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
649 /* |
0 | 650 try |
651 { | |
652 CurrentArmy = Factory.LoadArmy(openArmyDialog.FileName); | |
653 return true; | |
654 } | |
655 catch (InvalidFileException ex) | |
656 { | |
657 logger.Error(ex); | |
658 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid data file"), MessageBoxButtons.OK, MessageBoxIcon.Error); | |
659 return false; | |
660 } | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
661 * */ |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
662 return false; |
0 | 663 } |
664 else | |
665 { | |
666 return false; | |
667 } | |
668 } | |
669 else | |
670 { | |
671 return false; | |
672 } | |
673 } | |
674 | |
675 private bool closeCurrentArmy() | |
676 { | |
677 if (CurrentArmy!=null) | |
678 { | |
679 bool canClose = false; | |
680 | |
681 if (CommandStack.IsDirty()) | |
682 { | |
683 DialogResult dr = MessageBox.Show(this, "The army \""+CurrentArmy.Name+"\" has been modified.\r\nSave changes before closing army?", "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3); | |
684 | |
685 if (dr == DialogResult.Yes) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
686 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
687 canClose = SaveCurrentArmy(); |
0 | 688 } |
689 else if (dr == DialogResult.No) | |
690 { | |
691 canClose = true; | |
692 } | |
693 //else they said cancel and we default to "canClose = false" so do nothing | |
694 } | |
695 else | |
696 { | |
697 canClose = true; | |
698 } | |
699 | |
700 if (canClose) | |
701 { | |
702 //do close | |
703 disableCategoryButtons(); | |
704 CurrentArmy = null; | |
705 return true; | |
706 } | |
707 else | |
708 { | |
709 return false; | |
710 } | |
711 } | |
712 else | |
713 { | |
714 disableCategoryButtons(); | |
715 //pretend we succeeded | |
716 return true; | |
717 } | |
718 } | |
719 | |
720 private void undoLastAction() | |
721 { | |
722 if (commandStack.CanUndo()) | |
723 { | |
724 commandStack.Undo(); | |
725 } | |
726 } | |
727 | |
728 private void redoAction() | |
729 { | |
730 if (commandStack.CanRedo()) | |
731 { | |
732 commandStack.Redo(); | |
733 } | |
734 } | |
735 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
736 private bool SaveCurrentArmy() |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
737 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
738 bool saved = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
739 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
740 if (loadedFilePath != null || PromptForFilePath()) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
741 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
742 saved = SaveCurrentArmyToFile(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
743 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
744 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
745 return saved; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
746 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
747 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
748 private bool SaveCurrentArmyAs() |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
749 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
750 bool saved = false; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
751 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
752 if (PromptForFilePath()) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
753 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
754 saved = SaveCurrentArmyToFile(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
755 } |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
756 |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
757 return saved; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
758 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
759 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
760 private bool SaveCurrentArmyToFile() |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
761 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
762 if (WarFoundrySaver.GetSaver().Save(CurrentArmy, loadedFilePath)) |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
763 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
764 miSaveArmy.Enabled = false; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
765 bttnSaveArmy.Enabled = false; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
766 CommandStack.setCleanMark(); |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
767 return true; |
0 | 768 } |
769 else | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
770 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
771 loadedFilePath = null; |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
772 MessageBox.Show(this, Translation.GetTranslation("SaveFailed"), Translation.GetTranslation("SaveFailedTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); |
0 | 773 return false; |
774 } | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
775 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
776 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
777 private bool PromptForFilePath() |
0 | 778 { |
779 if (saveArmyDialog.Filter == "") | |
780 { | |
781 string savePath = ArmiesPath; | |
782 | |
783 if (!Directory.Exists(savePath)) | |
784 { | |
785 Directory.CreateDirectory(savePath); | |
786 } | |
787 | |
788 saveArmyDialog.InitialDirectory = savePath; | |
789 saveArmyDialog.Filter = Translation.GetTranslation("armyFileFilter")+"|*.army"; | |
790 saveArmyDialog.Title = Translation.GetTranslation("saveArmyDialog"); | |
791 } | |
792 | |
793 DialogResult dr = saveArmyDialog.ShowDialog(this); | |
794 | |
795 if (dr == DialogResult.OK) | |
796 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
797 loadedFilePath = saveArmyDialog.FileName; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
798 return true; |
0 | 799 } |
800 else | |
801 { | |
802 return false; | |
803 } | |
804 } | |
805 | |
806 private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) | |
807 { | |
808 if (e.Button == bttnUndo) | |
809 { | |
810 undoLastAction(); | |
811 } | |
812 else if (e.Button == bttnRedo) | |
813 { | |
814 redoAction(); | |
815 } | |
816 else if (e.Button == bttnNewArmy) | |
817 { | |
818 createNewArmy(); | |
819 } | |
820 else if (e.Button == bttnOpenArmy) | |
821 { | |
822 openArmy(); | |
823 } | |
824 else if (e.Button == bttnSaveArmy) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
825 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
826 SaveCurrentArmy(); |
0 | 827 } |
828 else | |
829 { | |
830 //it must be one of our extra buttons for the categories | |
831 addUnitFromCategory((Category)e.Button.Tag); | |
832 } | |
833 } | |
834 | |
835 private GameSystem CurrentGameSystem | |
836 { | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
837 get { return WarFoundryCore.CurrentGameSystem; } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
838 set { WarFoundryCore.CurrentGameSystem = value; } |
0 | 839 } |
840 | |
841 private static Army CurrentArmy | |
842 { | |
843 get { return WarFoundryCore.CurrentArmy; } | |
844 set { WarFoundryCore.CurrentArmy = value; } | |
845 } | |
846 | |
847 private void SelectGameSystem() | |
848 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
849 FrmSelectSystem selectSystem = new FrmSelectSystem(); |
0 | 850 DialogResult dr = selectSystem.ShowDialog(this); |
851 | |
852 if (dr==DialogResult.OK) | |
853 { | |
854 closeCurrentArmy(); | |
855 CurrentGameSystem = selectSystem.GameSystem; | |
856 } | |
857 } | |
858 | |
859 private void miChangeSystem_Click(object sender, System.EventArgs e) | |
860 { | |
861 SelectGameSystem(); | |
862 } | |
863 | |
864 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
865 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
866 miNewArmy.Enabled = newSystem != null; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
867 bttnNewArmy.Enabled = newSystem != null; |
0 | 868 setAppTitle(); |
869 removeCategoryButtons(); | |
870 addCategoryButtons(); | |
871 } | |
872 | |
873 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy) | |
874 { | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
875 setAppTitle(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
876 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
877 if (oldArmy != null) |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
878 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
879 oldArmy.UnitAdded += UnitAddedMethod; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
880 oldArmy.UnitRemoved += UnitRemovedMethod; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
881 oldArmy.PointsValueChanged += PointsValueChangedMethod; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
882 } |
0 | 883 |
884 if (CurrentArmy==null) | |
885 { | |
886 miSaveArmyAs.Enabled = false; | |
887 miCloseArmy.Enabled = false; | |
888 disableCategoryButtons(); | |
889 } | |
890 else | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
891 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
892 newArmy.UnitAdded += UnitAddedMethod; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
893 newArmy.UnitRemoved += UnitRemovedMethod; |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
894 newArmy.PointsValueChanged += PointsValueChangedMethod; |
0 | 895 //TODO: Clear all buttons |
896 miSaveArmyAs.Enabled = true; | |
897 miCloseArmy.Enabled = true; | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
898 enableCategoryButtons(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
899 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
900 if (newArmy.Race.HasCategoryOverrides()) |
0 | 901 { |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
902 removeCategoryButtons(); |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
903 addCategoryButtons(newArmy.Race.Categories); |
0 | 904 } |
905 } | |
906 | |
907 CommandStack.Reset(); | |
908 | |
909 miSaveArmy.Enabled = false; | |
910 bttnSaveArmy.Enabled = false; | |
911 | |
912 setPointsPanelText(); | |
913 } | |
914 | |
915 private void addCategoryButtons() | |
916 { | |
917 if (CurrentGameSystem!=null) | |
918 { | |
919 addCategoryButtons(CurrentGameSystem.Categories); | |
920 } | |
921 } | |
922 | |
923 private void addCategoryButtons(Category[] cats) | |
924 { | |
925 int catCount = cats.Length; | |
926 Category cat; | |
927 categoryButtons = new ToolBarButton[catCount+1]; | |
928 | |
929 ToolBarButton sep = new ToolBarButton(); | |
930 sep.Style = ToolBarButtonStyle.Separator; | |
931 categoryButtons[0] = sep; | |
932 | |
933 IBBToolBarButton button; | |
934 | |
935 for (int i = 0; i<catCount; i++) | |
936 { | |
937 cat = cats[i]; | |
938 button = new IBBToolBarButton(); | |
939 ///button.Name = "bttnAddCategory" + cat.Name[0].ToString(); | |
940 button.Text = cat.Name.ToString();//String.Format(Translation.GetTranslation("bttnAddCategory"), cat.Name); | |
941 button.Tag = cat; | |
942 button.ImageIndex = 6; | |
943 button.Enabled = false; | |
944 categoryButtons[i+1] = button; | |
945 } | |
946 | |
947 this.Invoke(new ToolBarButtonRangeDelegate(toolBar.Buttons.AddRange), new object[]{categoryButtons}); | |
948 } | |
949 | |
950 private void removeCategoryButtons() | |
951 { | |
952 if (categoryButtons!=null) | |
953 { | |
954 for (int i = 0; i<categoryButtons.Length; i++) | |
955 { | |
956 this.Invoke(new ToolBarButtonDelegate(toolBar.Buttons.Remove), new object[]{categoryButtons[i]}); | |
957 } | |
958 } | |
959 } | |
960 | |
961 private void enableCategoryButtons() | |
962 { | |
963 setCategoryButtonState(true); | |
964 } | |
965 | |
966 private void disableCategoryButtons() | |
967 { | |
968 setCategoryButtonState(false); | |
969 } | |
970 | |
971 private void setCategoryButtonState(bool state) | |
972 { | |
973 if (categoryButtons!=null) | |
974 { | |
975 for (int i = 0; i<categoryButtons.Length; i++) | |
976 { | |
977 categoryButtons[i].Enabled = state; | |
978 } | |
979 } | |
980 } | |
981 | |
982 private void miSaveArmyAs_Click(object sender, System.EventArgs e) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
983 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
984 SaveCurrentArmyAs(); |
0 | 985 } |
986 | |
987 private void commandStack_CommandStackUpdated() | |
988 { | |
989 bttnUndo.Enabled = commandStack.CanUndo(); | |
990 miUndo.Enabled = bttnUndo.Enabled; | |
991 bttnRedo.Enabled = commandStack.CanRedo(); | |
992 miRedo.Enabled = bttnRedo.Enabled; | |
993 MenuItem[] menuItems = null; | |
994 int redoLength = commandStack.RedoLength; | |
995 int maxRedo = Math.Min(10, redoLength); | |
996 | |
997 if (redoLength > 0) | |
998 { | |
999 menuItems = new MenuItem[maxRedo]; | |
1000 Command com; | |
1001 MenuItem mi; | |
1002 | |
1003 for (int i = 0; i < maxRedo; i++) | |
1004 { | |
1005 com = commandStack.PeekRedoCommand(i+1); | |
1006 | |
1007 if (com == null) | |
1008 { | |
1009 break; | |
1010 } | |
1011 | |
1012 mi = new MenuItem(com.Description); | |
1013 mi.Click+=new EventHandler(redoMenu_Click); | |
1014 menuItems[i] = mi; | |
1015 } | |
1016 } | |
1017 | |
1018 redoMenu.MenuItems.Clear(); | |
1019 | |
1020 if (menuItems!=null && menuItems[0]!=null) | |
1021 { | |
1022 bttnRedo.ToolTipText = menuItems[0].Text; | |
1023 redoMenu.MenuItems.AddRange(menuItems); | |
1024 } | |
1025 | |
1026 int undoLength = commandStack.UndoLength; | |
1027 int maxUndo = Math.Min(10, undoLength); | |
1028 MenuItem[] menuItemsUndo = null; | |
1029 | |
1030 if (undoLength > 0) | |
1031 { | |
1032 menuItemsUndo = new MenuItem[maxUndo]; | |
1033 Command com; | |
1034 MenuItem mi; | |
1035 | |
1036 for (int i = 0; i < maxUndo; i++) | |
1037 { | |
1038 com = commandStack.PeekUndoCommand(i+1); | |
1039 | |
1040 if (com == null) | |
1041 { | |
1042 break; | |
1043 } | |
1044 | |
1045 mi = new MenuItem(com.UndoDescription); | |
1046 mi.Click+=new EventHandler(undoMenu_Click); | |
1047 menuItemsUndo[i] = mi; | |
1048 } | |
1049 } | |
1050 | |
1051 undoMenu.MenuItems.Clear(); | |
1052 | |
1053 if (menuItemsUndo!=null && menuItemsUndo[0]!=null) | |
1054 { | |
1055 bttnUndo.ToolTipText = menuItemsUndo[0].Text; | |
1056 undoMenu.MenuItems.AddRange(menuItemsUndo); | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
1057 } |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
1058 |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
1059 bool canSave = loadedFilePath != null; |
0 | 1060 bttnSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave; |
1061 miSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave; | |
1062 } | |
1063 | |
1064 private void miSaveArmy_Click(object sender, System.EventArgs e) | |
1065 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
1066 SaveCurrentArmy(); |
0 | 1067 } |
1068 | |
1069 private void setAppTitle() | |
1070 { | |
1071 string str = AppTitle; | |
1072 | |
1073 if (CurrentGameSystem!=null) | |
1074 { | |
1075 str+= " - "+CurrentGameSystem.Name; | |
1076 } | |
1077 | |
1078 if (CurrentArmy!=null) | |
1079 { | |
1080 str+= " - "+CurrentArmy.Name; | |
1081 } | |
1082 | |
1083 this.Text = str; | |
1084 } | |
1085 | |
1086 private void addUnitFromCategory(Category cat) | |
1087 { | |
1088 FrmNewUnit newUnit = new FrmNewUnit(CurrentArmy.Race, cat, CurrentArmy); | |
1089 DialogResult dr = newUnit.ShowDialog(this); | |
1090 | |
1091 if (dr == DialogResult.OK) | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
1092 { |
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
1093 CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(newUnit.SelectedUnit, CurrentArmy); |
0 | 1094 commandStack.Execute(cmd); |
1095 } | |
1096 } | |
1097 | |
1098 private void FrmMain_UnitAddedMethod(object unitObj) | |
1099 { | |
1100 if (unitObj is Unit) | |
1101 { | |
1102 Unit unit = (Unit)unitObj; | |
1103 sbErrorPanel.Text = ""; | |
1104 } | |
1105 } | |
1106 | |
1107 private void FrmMain_UnitRemovedMethod(object unitObj) | |
1108 { | |
1109 if (unitObj is Unit) | |
1110 { | |
1111 Unit unit = (Unit)unitObj; | |
1112 sbErrorPanel.Text = ""; | |
1113 | |
1114 //check if window is open, and close it if it is | |
1115 foreach (Form frm in this.MdiChildren) | |
1116 { | |
1117 if (frm is FrmUnit) | |
1118 { | |
1119 if (((FrmUnit)frm).Unit == unit) | |
1120 { | |
1121 frm.Close(); | |
1122 break; | |
1123 } | |
1124 } | |
1125 } | |
1126 } | |
1127 } | |
1128 | |
1129 /*private void FrmMain_FailedUnitRequirement(FailedUnitRequirement failedRequirement) | |
1130 { | |
1131 sbErrorPanel.Text = Translation.GetTranslation("UnitRequirementFailed", "Unit Requirement Failed"); | |
1132 sbErrorPanel.Tag = failedRequirement.Description; | |
1133 }*/ | |
1134 | |
1135 /*public void MdiChildMoved() | |
1136 { | |
1137 Point mouseAt = PointToClient(ActiveMdiChild.Location); | |
1138 | |
1139 if (Comparisons.ValueWithinAmount(pnlRight.Right, ActiveMdiChild.Right, 10)) | |
1140 { | |
1141 pnlRight.Visible = true; | |
1142 //pnlRight.Container.Add(ActiveMdiChild); | |
1143 } | |
1144 else | |
1145 { | |
1146 pnlRight.Visible = false; | |
1147 } | |
1148 }*/ | |
1149 | |
1150 public void pnlRight_Paint(object sender, System.Windows.Forms.PaintEventArgs e) | |
1151 { | |
1152 HatchBrush dockCueBrush = new HatchBrush(HatchStyle.LightDownwardDiagonal, Color.White, Color.Gray); | |
1153 Pen dockCuePen = new Pen(dockCueBrush, 10); | |
1154 e.Graphics.DrawRectangle(dockCuePen, new Rectangle(pnlRight.Left, pnlRight.Top, pnlRight.Width, pnlRight.Height)); | |
1155 } | |
1156 | |
1157 private void miUndo_Click(object sender, System.EventArgs e) | |
1158 { | |
1159 undoLastAction(); | |
1160 } | |
1161 | |
1162 private void miRedo_Click(object sender, System.EventArgs e) | |
1163 { | |
1164 redoAction(); | |
1165 } | |
1166 | |
1167 private void miCloseArmy_Click(object sender, EventArgs e) | |
1168 { | |
1169 closeCurrentArmy(); | |
1170 } | |
1171 | |
1172 private void miOpenArmy_Click(object sender, EventArgs e) | |
1173 { | |
1174 openArmy(); | |
1175 } | |
1176 | |
1177 private void FrmMain_PointsValueChangedMethod(WarFoundryObject obj, double oldVal, double newVal) | |
1178 { | |
1179 if (obj is Army) | |
1180 { | |
1181 setPointsPanelText(); | |
1182 } | |
1183 } | |
1184 | |
1185 private void setPointsPanelText() | |
1186 { | |
1187 if (CurrentArmy==null) | |
1188 { | |
1189 sbPointsPanel.Text = ""; | |
1190 sbPointsPanel.ResetColor(); | |
1191 } | |
1192 else | |
1193 { | |
1194 sbPointsPanel.Text = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.PointsTotal, CurrentArmy.MaxPoints); | |
1195 | |
1196 if (CurrentArmy.PointsTotal>CurrentArmy.MaxPoints) | |
1197 { | |
1198 sbPointsPanel.Color = Color.Red; | |
1199 } | |
1200 else | |
1201 { | |
1202 sbPointsPanel.ResetColor(); | |
1203 } | |
1204 } | |
1205 } | |
1206 | |
1207 private void redoMenu_Click(object sender, EventArgs e) | |
1208 { | |
1209 if (sender is MenuItem) | |
1210 { | |
1211 MenuItem mi = (MenuItem)sender; | |
1212 | |
1213 if (mi.Parent == redoMenu) | |
1214 { | |
1215 //we know it's an redo menu item so find it's index and redo everything | |
1216 int max = mi.Index; | |
1217 | |
1218 for (int i = 0; i <= max; i++) | |
1219 { | |
1220 commandStack.Redo(); | |
1221 } | |
1222 } | |
1223 } | |
1224 } | |
1225 | |
1226 private void undoMenu_Click(object sender, EventArgs e) | |
1227 { | |
1228 if (sender is MenuItem) | |
1229 { | |
1230 MenuItem mi = (MenuItem)sender; | |
1231 | |
1232 if (mi.Parent == undoMenu) | |
1233 { | |
1234 //we know it's an undo menu item so find it's index and undo everything | |
1235 int max = mi.Index; | |
1236 for (int i = 0; i <= max; i++) | |
1237 { | |
1238 commandStack.Undo(); | |
1239 } | |
1240 } | |
1241 } | |
1242 } | |
1243 | |
1244 private void statusBar_DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent) | |
1245 { | |
1246 statusBar.ColorableStatusBarDrawItem(sender, sbdevent); | |
1247 } | |
1248 | |
1249 private void miDebugWindow_Click(object sender, EventArgs e) | |
1250 { | |
1251 if (debugWindow == null || debugWindow.IsDisposed) | |
1252 { | |
1253 debugWindow = new FrmDebugOutput(); | |
1254 } | |
1255 | |
1256 debugWindow.Show(); | |
1257 debugWindow.Focus(); | |
1258 } | |
1259 | |
1260 private void FrmMain_Closing(object sender, CancelEventArgs e) | |
1261 { | |
1262 if (!closeCurrentArmy()) | |
1263 { | |
1264 e.Cancel = true; | |
1265 } | |
1266 } | |
1267 | |
1268 private void miReloadFiles_Click(object sender, System.EventArgs e) | |
1269 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
1270 WarFoundryLoader.GetDefault().LoadFiles(); |
0 | 1271 sbMainPanel.Text = Translation.GetTranslation("GameSystemFilesReloaded", "Game system and race files reloaded"); |
1272 statusBarTimer.Enabled = true; | |
1273 } | |
1274 | |
1275 private void statusBarTimer_Tick(object sender, System.EventArgs e) | |
1276 { | |
1277 sbMainPanel.Text = ""; | |
1278 statusBarTimer.Enabled = false; | |
1279 } | |
1280 | |
1281 private void statusBar_PanelClick(object sender, StatusBarPanelClickEventArgs e) | |
1282 { | |
1283 if (e.StatusBarPanel == sbErrorPanel && sbErrorPanel.Text!="") | |
1284 { | |
1285 MessageBox.Show(this, sbErrorPanel.TagString, Translation.GetTranslation("FailedRequirementMessage"), MessageBoxButtons.OK, MessageBoxIcon.Warning); | |
1286 } | |
1287 } | |
1288 } | |
1289 } |