Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
comparison FrmMain.cs @ 10:19bdbb80999c
Closes #47 - Remove magic numbers
* Replace "magic number" -1s in WinForms with WarFoundryCore.INFINITY
Also:
* Code cleanup to remove warnings
* Code cleanup to replace space indentation with tabs
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 19 May 2009 18:51:32 +0000 |
parents | 9828ba4f3f36 |
children | f7f65d80951e |
comparison
equal
deleted
inserted
replaced
9:ffb49ec86df7 | 10:19bdbb80999c |
---|---|
36 public class FrmMain : System.Windows.Forms.Form | 36 public class FrmMain : System.Windows.Forms.Form |
37 { | 37 { |
38 private static readonly string AppTitle = "WarFoundry"; | 38 private static readonly string AppTitle = "WarFoundry"; |
39 const string DefaultDataDir = "data"; | 39 const string DefaultDataDir = "data"; |
40 | 40 |
41 private Preferences preferences; | 41 private Preferences preferences; |
42 protected readonly ILog logger = LogManager.GetLogger(typeof(FrmMain)); | 42 protected readonly ILog logger = LogManager.GetLogger(typeof(FrmMain)); |
43 | 43 |
44 private CommandStack commandStack; | 44 private CommandStack commandStack; |
45 private ToolBarButton[] categoryButtons; | 45 private ToolBarButton[] categoryButtons; |
46 | 46 |
47 public ObjectAddDelegate UnitAddedMethod; | 47 public ObjectAddDelegate UnitAddedMethod; |
49 public DoubleValChangedDelegate PointsValueChangedMethod; | 49 public DoubleValChangedDelegate PointsValueChangedMethod; |
50 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; | 50 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; |
51 | 51 |
52 private FrmArmyTree armyTree; | 52 private FrmArmyTree armyTree; |
53 private FrmDebugOutput debugWindow; | 53 private FrmDebugOutput debugWindow; |
54 private string loadedFilePath; | 54 private string loadedFilePath; |
55 | 55 |
56 private System.ComponentModel.IContainer components; | 56 private System.ComponentModel.IContainer components; |
57 private System.Windows.Forms.ToolBar toolBar; | 57 private System.Windows.Forms.ToolBar toolBar; |
58 private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy; | 58 private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy; |
59 private System.Windows.Forms.ImageList buttonIcons; | 59 private System.Windows.Forms.ImageList buttonIcons; |
60 private IBBoard.Windows.Forms.IBBToolBarButton bttnSaveArmy; | 60 private IBBoard.Windows.Forms.IBBToolBarButton bttnSaveArmy; |
61 private System.Windows.Forms.OpenFileDialog openArmyDialog; | 61 private System.Windows.Forms.OpenFileDialog openArmyDialog; |
62 private System.Windows.Forms.SaveFileDialog saveArmyDialog; | 62 private System.Windows.Forms.SaveFileDialog saveArmyDialog; |
63 private IBBoard.Windows.Forms.IBBToolBarButton bttnOpenArmy; | 63 private IBBoard.Windows.Forms.IBBToolBarButton bttnOpenArmy; |
64 private IBBoard.Windows.Forms.IBBToolBarButton bttnSep1; | 64 private IBBoard.Windows.Forms.IBBToolBarButton bttnSep1; |
65 private IBBoard.Windows.Forms.IBBToolBarButton bttnUndo; | 65 private IBBoard.Windows.Forms.IBBToolBarButton bttnUndo; |
66 private IBBoard.Windows.Forms.IBBToolBarButton bttnRedo; | 66 private IBBoard.Windows.Forms.IBBToolBarButton bttnRedo; |
67 private System.Windows.Forms.MainMenu mainMenu; | 67 private System.Windows.Forms.MainMenu mainMenu; |
68 private IBBoard.Windows.Forms.IBBMenuItem menuFile; | 68 private IBBoard.Windows.Forms.IBBMenuItem menuFile; |
69 private IBBoard.Windows.Forms.IBBMenuItem miNewArmy; | 69 private IBBoard.Windows.Forms.IBBMenuItem miNewArmy; |
70 private IBBoard.Windows.Forms.IBBMenuItem miOpenArmy; | 70 private IBBoard.Windows.Forms.IBBMenuItem miOpenArmy; |
71 private IBBoard.Windows.Forms.IBBMenuItem miCloseArmy; | 71 private IBBoard.Windows.Forms.IBBMenuItem miCloseArmy; |
72 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy; | 72 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy; |
73 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs; | 73 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs; |
74 private System.Windows.Forms.MenuItem miSep2; | 74 private System.Windows.Forms.MenuItem miSep2; |
75 private IBBoard.Windows.Forms.IBBMenuItem miChangeSystem; | 75 private IBBoard.Windows.Forms.IBBMenuItem miChangeSystem; |
76 private System.Windows.Forms.MenuItem miSep1; | 76 private System.Windows.Forms.MenuItem miSep1; |
77 private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles; | 77 private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles; |
78 private System.Windows.Forms.MenuItem miSep3; | 78 private System.Windows.Forms.MenuItem miSep3; |
79 private IBBoard.Windows.Forms.IBBMenuItem miExit; | 79 private IBBoard.Windows.Forms.IBBMenuItem miExit; |
80 private IBBoard.Windows.Forms.IBBMenuItem menuEdit; | 80 private IBBoard.Windows.Forms.IBBMenuItem menuEdit; |
81 private IBBoard.Windows.Forms.IBBMenuItem miUndo; | 81 private IBBoard.Windows.Forms.IBBMenuItem miUndo; |
82 private IBBoard.Windows.Forms.IBBMenuItem miRedo; | 82 private IBBoard.Windows.Forms.IBBMenuItem miRedo; |
83 private IBBoard.Windows.Forms.IBBMenuItem menuHelp; | 83 private IBBoard.Windows.Forms.IBBMenuItem menuHelp; |
84 private IBBoard.Windows.Forms.IBBMenuItem miDebugWindow; | 84 private IBBoard.Windows.Forms.IBBMenuItem miDebugWindow; |
85 private IBBoard.Windows.Forms.IBBMenuItem miAbout; | 85 private IBBoard.Windows.Forms.IBBMenuItem miAbout; |
86 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; | 86 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; |
87 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; | 87 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; |
88 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; | 88 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; |
89 private System.Windows.Forms.ContextMenu undoMenu; | 89 private System.Windows.Forms.ContextMenu undoMenu; |
90 private System.Windows.Forms.ContextMenu redoMenu; | 90 private System.Windows.Forms.ContextMenu redoMenu; |
91 private IBBoard.Windows.Forms.ColorableStatusBar statusBar; | 91 private IBBoard.Windows.Forms.ColorableStatusBar statusBar; |
92 private System.Windows.Forms.Timer statusBarTimer; | 92 private System.Windows.Forms.Timer statusBarTimer; |
93 private System.Windows.Forms.Panel pnlRight; | 93 private System.Windows.Forms.Panel pnlRight; |
94 | 94 |
95 public FrmMain(string[] args) | 95 public FrmMain(string[] args) |
96 { | 96 { |
97 this.Closing+=new CancelEventHandler(FrmMain_Closing); | 97 this.Closing+=new CancelEventHandler(FrmMain_Closing); |
98 CommandStack.CommandStackUpdated += new MethodInvoker(commandStack_CommandStackUpdated); | 98 CommandStack.CommandStackUpdated += new MethodInvoker(commandStack_CommandStackUpdated); |
99 LogNotifierHandler.RegisterNotifierHandler(); | 99 LogNotifierHandler.RegisterNotifierHandler(); |
100 | 100 |
101 InitializeComponent(); | 101 InitializeComponent(); |
102 | 102 |
103 Preferences = new Preferences("WarFoundry"); | 103 Preferences = new Preferences("WarFoundry"); |
104 Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString()); | 104 Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString()); |
105 | 105 |
106 //pnlRight.Left = ClientSize.Width - pnlRight.Width - 2; | 106 //pnlRight.Left = ClientSize.Width - pnlRight.Width - 2; |
107 //pnlRight.Top = toolBar.Height + 5; | 107 //pnlRight.Top = toolBar.Height + 5; |
108 //pnlRight.Height = ClientRectangle.Bottom - statusBar.Height - pnlRight.Top - 3; | 108 //pnlRight.Height = ClientRectangle.Bottom - statusBar.Height - pnlRight.Top - 3; |
109 | 109 |
110 foreach (Control ctrl in Controls) | 110 foreach (Control ctrl in Controls) |
111 { | 111 { |
112 ControlTranslator.TranslateControl(ctrl); | 112 ControlTranslator.TranslateControl(ctrl); |
113 } | 113 } |
114 | 114 |
115 foreach(Component comp in components.Components) | 115 foreach(Component comp in components.Components) |
116 { | 116 { |
117 ControlTranslator.TranslateComponent(comp); | 117 ControlTranslator.TranslateComponent(comp); |
118 } | 118 } |
119 | 119 |
120 foreach (IBBMenuItem mi in Menu.MenuItems) | 120 foreach (IBBMenuItem mi in Menu.MenuItems) |
121 { | 121 { |
122 ControlTranslator.TranslateComponent(mi); | 122 ControlTranslator.TranslateComponent(mi); |
123 } | 123 } |
124 | 124 |
125 ControlTranslator.TranslateComponent(openArmyDialog); | 125 ControlTranslator.TranslateComponent(openArmyDialog); |
126 ControlTranslator.TranslateComponent(saveArmyDialog); | 126 ControlTranslator.TranslateComponent(saveArmyDialog); |
127 | 127 |
128 WarFoundryCore.GameSystemChanged+= new GameSystemChangedDelegate(FrmMain_GameSystemChanged); | 128 WarFoundryCore.GameSystemChanged+= new GameSystemChangedDelegate(FrmMain_GameSystemChanged); |
129 WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(FrmMain_ArmyChanged); | 129 WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(FrmMain_ArmyChanged); |
130 UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod); | 130 UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod); |
131 UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod); | 131 UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod); |
132 PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod); | 132 PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod); |
133 //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement); | 133 //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement); |
134 | 134 |
149 if (factory != null && factory is WarFoundryXmlFactory) | 149 if (factory != null && factory is WarFoundryXmlFactory) |
150 { | 150 { |
151 WarFoundryLoader.GetDefault().RegisterFactory((WarFoundryXmlFactory)factory); | 151 WarFoundryLoader.GetDefault().RegisterFactory((WarFoundryXmlFactory)factory); |
152 } | 152 } |
153 | 153 |
154 /* | 154 /* |
155 if (args.Length == 1) | 155 if (args.Length == 1) |
156 { | 156 { |
157 logger.Debug("Attempting to load from file"); | 157 logger.Debug("Attempting to load from file"); |
158 FileInfo file = new FileInfo(args[0]); | 158 FileInfo file = new FileInfo(args[0]); |
159 | 159 |
160 try | 160 try |
200 } | 200 } |
201 | 201 |
202 public static String ArmiesPath | 202 public static String ArmiesPath |
203 { | 203 { |
204 get { return Constants.UserDataPath+Constants.DirectoryChar+"armies"; } | 204 get { return Constants.UserDataPath+Constants.DirectoryChar+"armies"; } |
205 } | 205 } |
206 | 206 |
207 public Preferences Preferences | 207 public Preferences Preferences |
208 { | 208 { |
209 get { return preferences; } | 209 get { return preferences; } |
210 set { preferences = value; } | 210 set { preferences = value; } |
211 } | 211 } |
212 | 212 |
213 public CommandStack CommandStack | 213 public CommandStack CommandStack |
214 { | 214 { |
215 get | 215 get |
216 { | 216 { |
243 /// Required method for Designer support - do not modify | 243 /// Required method for Designer support - do not modify |
244 /// the contents of this method with the code editor. | 244 /// the contents of this method with the code editor. |
245 /// </summary> | 245 /// </summary> |
246 private void InitializeComponent() | 246 private void InitializeComponent() |
247 { | 247 { |
248 this.components = new System.ComponentModel.Container(); | 248 this.components = new System.ComponentModel.Container(); |
249 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); | 249 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); |
250 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); | 250 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); |
251 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); | 251 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); |
252 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); | 252 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); |
253 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); | 253 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); |
254 this.toolBar = new System.Windows.Forms.ToolBar(); | 254 this.toolBar = new System.Windows.Forms.ToolBar(); |
255 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); | 255 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); |
256 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); | 256 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); |
257 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); | 257 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); |
258 this.bttnSep1 = new IBBoard.Windows.Forms.IBBToolBarButton(); | 258 this.bttnSep1 = new IBBoard.Windows.Forms.IBBToolBarButton(); |
259 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolBarButton(); | 259 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolBarButton(); |
260 this.undoMenu = new System.Windows.Forms.ContextMenu(); | 260 this.undoMenu = new System.Windows.Forms.ContextMenu(); |
261 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolBarButton(); | 261 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolBarButton(); |
262 this.redoMenu = new System.Windows.Forms.ContextMenu(); | 262 this.redoMenu = new System.Windows.Forms.ContextMenu(); |
263 this.buttonIcons = new System.Windows.Forms.ImageList(this.components); | 263 this.buttonIcons = new System.Windows.Forms.ImageList(this.components); |
264 this.mainMenu = new System.Windows.Forms.MainMenu(this.components); | 264 this.mainMenu = new System.Windows.Forms.MainMenu(this.components); |
265 this.menuFile = new IBBoard.Windows.Forms.IBBMenuItem(); | 265 this.menuFile = new IBBoard.Windows.Forms.IBBMenuItem(); |
266 this.miNewArmy = new IBBoard.Windows.Forms.IBBMenuItem(); | 266 this.miNewArmy = new IBBoard.Windows.Forms.IBBMenuItem(); |
267 this.miOpenArmy = new IBBoard.Windows.Forms.IBBMenuItem(); | 267 this.miOpenArmy = new IBBoard.Windows.Forms.IBBMenuItem(); |
268 this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem(); | 268 this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem(); |
269 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem(); | 269 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem(); |
270 this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem(); | 270 this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem(); |
271 this.miSep1 = new System.Windows.Forms.MenuItem(); | 271 this.miSep1 = new System.Windows.Forms.MenuItem(); |
272 this.miChangeSystem = new IBBoard.Windows.Forms.IBBMenuItem(); | 272 this.miChangeSystem = new IBBoard.Windows.Forms.IBBMenuItem(); |
273 this.miSep2 = new System.Windows.Forms.MenuItem(); | 273 this.miSep2 = new System.Windows.Forms.MenuItem(); |
274 this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem(); | 274 this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem(); |
275 this.miSep3 = new System.Windows.Forms.MenuItem(); | 275 this.miSep3 = new System.Windows.Forms.MenuItem(); |
276 this.miExit = new IBBoard.Windows.Forms.IBBMenuItem(); | 276 this.miExit = new IBBoard.Windows.Forms.IBBMenuItem(); |
277 this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem(); | 277 this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem(); |
278 this.miUndo = new IBBoard.Windows.Forms.IBBMenuItem(); | 278 this.miUndo = new IBBoard.Windows.Forms.IBBMenuItem(); |
279 this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem(); | 279 this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem(); |
280 this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem(); | 280 this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem(); |
281 this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem(); | 281 this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem(); |
282 this.miDebugWindow = new IBBoard.Windows.Forms.IBBMenuItem(); | 282 this.miDebugWindow = new IBBoard.Windows.Forms.IBBMenuItem(); |
283 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); | 283 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); |
284 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); | 284 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); |
285 this.pnlRight = new System.Windows.Forms.Panel(); | 285 this.pnlRight = new System.Windows.Forms.Panel(); |
286 this.statusBarTimer = new System.Windows.Forms.Timer(this.components); | 286 this.statusBarTimer = new System.Windows.Forms.Timer(this.components); |
287 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); | 287 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); |
288 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); | 288 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); |
289 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); | 289 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); |
290 this.SuspendLayout(); | 290 this.SuspendLayout(); |
291 // | 291 // |
292 // statusBar | 292 // statusBar |
293 // | 293 // |
294 this.statusBar.Location = new System.Drawing.Point(0, 548); | 294 this.statusBar.Location = new System.Drawing.Point(0, 548); |
295 this.statusBar.Name = "statusBar"; | 295 this.statusBar.Name = "statusBar"; |
296 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { | 296 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { |
297 this.sbMainPanel, | 297 this.sbMainPanel, |
298 this.sbErrorPanel, | 298 this.sbErrorPanel, |
299 this.sbPointsPanel}); | 299 this.sbPointsPanel}); |
300 this.statusBar.ShowPanels = true; | 300 this.statusBar.ShowPanels = true; |
301 this.statusBar.Size = new System.Drawing.Size(792, 22); | 301 this.statusBar.Size = new System.Drawing.Size(792, 22); |
302 this.statusBar.TabIndex = 1; | 302 this.statusBar.TabIndex = 1; |
303 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); | 303 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); |
304 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); | 304 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); |
305 // | 305 // |
306 // sbMainPanel | 306 // sbMainPanel |
307 // | 307 // |
308 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; | 308 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; |
309 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; | 309 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; |
310 this.sbMainPanel.Name = "sbMainPanel"; | 310 this.sbMainPanel.Name = "sbMainPanel"; |
311 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; | 311 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; |
312 this.sbMainPanel.Width = 475; | 312 this.sbMainPanel.Width = 475; |
313 // | 313 // |
314 // sbErrorPanel | 314 // sbErrorPanel |
315 // | 315 // |
316 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; | 316 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; |
317 this.sbErrorPanel.Name = "sbErrorPanel"; | 317 this.sbErrorPanel.Name = "sbErrorPanel"; |
318 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; | 318 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; |
319 this.sbErrorPanel.Width = 150; | 319 this.sbErrorPanel.Width = 150; |
320 // | 320 // |
321 // sbPointsPanel | 321 // sbPointsPanel |
322 // | 322 // |
323 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; | 323 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; |
324 this.sbPointsPanel.Name = "sbPointsPanel"; | 324 this.sbPointsPanel.Name = "sbPointsPanel"; |
325 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; | 325 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; |
326 this.sbPointsPanel.ToolTipText = "Current Points Total"; | 326 this.sbPointsPanel.ToolTipText = "Current Points Total"; |
327 this.sbPointsPanel.Width = 150; | 327 this.sbPointsPanel.Width = 150; |
328 // | 328 // |
329 // toolBar | 329 // toolBar |
330 // | 330 // |
331 this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; | 331 this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; |
332 this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { | 332 this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { |
333 this.bttnNewArmy, | 333 this.bttnNewArmy, |
334 this.bttnOpenArmy, | 334 this.bttnOpenArmy, |
335 this.bttnSaveArmy, | 335 this.bttnSaveArmy, |
336 this.bttnSep1, | 336 this.bttnSep1, |
337 this.bttnUndo, | 337 this.bttnUndo, |
338 this.bttnRedo}); | 338 this.bttnRedo}); |
339 this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); | 339 this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); |
340 this.toolBar.DropDownArrows = true; | 340 this.toolBar.DropDownArrows = true; |
341 this.toolBar.ImageList = this.buttonIcons; | 341 this.toolBar.ImageList = this.buttonIcons; |
342 this.toolBar.Location = new System.Drawing.Point(0, 0); | 342 this.toolBar.Location = new System.Drawing.Point(0, 0); |
343 this.toolBar.Name = "toolBar"; | 343 this.toolBar.Name = "toolBar"; |
344 this.toolBar.ShowToolTips = true; | 344 this.toolBar.ShowToolTips = true; |
345 this.toolBar.Size = new System.Drawing.Size(792, 28); | 345 this.toolBar.Size = new System.Drawing.Size(792, 28); |
346 this.toolBar.TabIndex = 2; | 346 this.toolBar.TabIndex = 2; |
347 this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); | 347 this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); |
348 // | 348 // |
349 // bttnNewArmy | 349 // bttnNewArmy |
350 // | 350 // |
351 this.bttnNewArmy.Enabled = false; | 351 this.bttnNewArmy.Enabled = false; |
352 this.bttnNewArmy.ImageIndex = 0; | 352 this.bttnNewArmy.ImageIndex = 0; |
353 this.bttnNewArmy.Name = "bttnNewArmy"; | 353 this.bttnNewArmy.Name = "bttnNewArmy"; |
354 // | 354 // |
355 // bttnOpenArmy | 355 // bttnOpenArmy |
356 // | 356 // |
357 this.bttnOpenArmy.ImageIndex = 2; | 357 this.bttnOpenArmy.ImageIndex = 2; |
358 this.bttnOpenArmy.Name = "bttnOpenArmy"; | 358 this.bttnOpenArmy.Name = "bttnOpenArmy"; |
359 // | 359 // |
360 // bttnSaveArmy | 360 // bttnSaveArmy |
361 // | 361 // |
362 this.bttnSaveArmy.Enabled = false; | 362 this.bttnSaveArmy.Enabled = false; |
363 this.bttnSaveArmy.ImageIndex = 1; | 363 this.bttnSaveArmy.ImageIndex = 1; |
364 this.bttnSaveArmy.Name = "bttnSaveArmy"; | 364 this.bttnSaveArmy.Name = "bttnSaveArmy"; |
365 // | 365 // |
366 // bttnSep1 | 366 // bttnSep1 |
367 // | 367 // |
368 this.bttnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; | 368 this.bttnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; |
369 // | 369 // |
370 // bttnUndo | 370 // bttnUndo |
371 // | 371 // |
372 this.bttnUndo.DropDownMenu = this.undoMenu; | 372 this.bttnUndo.DropDownMenu = this.undoMenu; |
373 this.bttnUndo.Enabled = false; | 373 this.bttnUndo.Enabled = false; |
374 this.bttnUndo.ImageIndex = 3; | 374 this.bttnUndo.ImageIndex = 3; |
375 this.bttnUndo.Name = "bttnUndo"; | 375 this.bttnUndo.Name = "bttnUndo"; |
376 this.bttnUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; | 376 this.bttnUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; |
377 // | 377 // |
378 // bttnRedo | 378 // bttnRedo |
379 // | 379 // |
380 this.bttnRedo.DropDownMenu = this.redoMenu; | 380 this.bttnRedo.DropDownMenu = this.redoMenu; |
381 this.bttnRedo.Enabled = false; | 381 this.bttnRedo.Enabled = false; |
382 this.bttnRedo.ImageIndex = 4; | 382 this.bttnRedo.ImageIndex = 4; |
383 this.bttnRedo.Name = "bttnRedo"; | 383 this.bttnRedo.Name = "bttnRedo"; |
384 this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; | 384 this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; |
385 // | 385 // |
386 // buttonIcons | 386 // buttonIcons |
387 // | 387 // |
388 this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); | 388 this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); |
389 this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent; | 389 this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent; |
390 this.buttonIcons.Images.SetKeyName(0, ""); | 390 this.buttonIcons.Images.SetKeyName(0, ""); |
391 this.buttonIcons.Images.SetKeyName(1, ""); | 391 this.buttonIcons.Images.SetKeyName(1, ""); |
392 this.buttonIcons.Images.SetKeyName(2, ""); | 392 this.buttonIcons.Images.SetKeyName(2, ""); |
393 this.buttonIcons.Images.SetKeyName(3, ""); | 393 this.buttonIcons.Images.SetKeyName(3, ""); |
394 this.buttonIcons.Images.SetKeyName(4, ""); | 394 this.buttonIcons.Images.SetKeyName(4, ""); |
395 this.buttonIcons.Images.SetKeyName(5, ""); | 395 this.buttonIcons.Images.SetKeyName(5, ""); |
396 this.buttonIcons.Images.SetKeyName(6, ""); | 396 this.buttonIcons.Images.SetKeyName(6, ""); |
397 // | 397 // |
398 // mainMenu | 398 // mainMenu |
399 // | 399 // |
400 this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 400 this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
401 this.menuFile, | 401 this.menuFile, |
402 this.menuEdit, | 402 this.menuEdit, |
403 this.menuHelp}); | 403 this.menuHelp}); |
404 // | 404 // |
405 // menuFile | 405 // menuFile |
406 // | 406 // |
407 this.menuFile.Index = 0; | 407 this.menuFile.Index = 0; |
408 this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 408 this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
409 this.miNewArmy, | 409 this.miNewArmy, |
410 this.miOpenArmy, | 410 this.miOpenArmy, |
411 this.miSaveArmy, | 411 this.miSaveArmy, |
412 this.miSaveArmyAs, | 412 this.miSaveArmyAs, |
413 this.miCloseArmy, | 413 this.miCloseArmy, |
414 this.miSep1, | 414 this.miSep1, |
415 this.miChangeSystem, | 415 this.miChangeSystem, |
416 this.miSep2, | 416 this.miSep2, |
417 this.miReloadFiles, | 417 this.miReloadFiles, |
418 this.miSep3, | 418 this.miSep3, |
419 this.miExit}); | 419 this.miExit}); |
420 this.menuFile.Text = "&file"; | 420 this.menuFile.Text = "&file"; |
421 this.menuFile.Name = "menuFile"; | 421 this.menuFile.Name = "menuFile"; |
422 // | 422 // |
423 // miNewArmy | 423 // miNewArmy |
424 // | 424 // |
425 this.miNewArmy.Index = 0; | 425 this.miNewArmy.Index = 0; |
426 this.miNewArmy.Text = "&new army"; | 426 this.miNewArmy.Text = "&new army"; |
427 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); | 427 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); |
428 this.miNewArmy.Name = "miNewArmy"; | 428 this.miNewArmy.Name = "miNewArmy"; |
429 // | 429 // |
430 // miOpenArmy | 430 // miOpenArmy |
431 // | 431 // |
432 this.miOpenArmy.Index = 1; | 432 this.miOpenArmy.Index = 1; |
433 this.miOpenArmy.Text = "&open army"; | 433 this.miOpenArmy.Text = "&open army"; |
434 this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); | 434 this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); |
435 this.miOpenArmy.Name = "miOpenArmy"; | 435 this.miOpenArmy.Name = "miOpenArmy"; |
436 // | 436 // |
437 // miSaveArmy | 437 // miSaveArmy |
438 // | 438 // |
439 this.miSaveArmy.Enabled = false; | 439 this.miSaveArmy.Enabled = false; |
440 this.miSaveArmy.Index = 2; | 440 this.miSaveArmy.Index = 2; |
441 this.miSaveArmy.Text = "&save army"; | 441 this.miSaveArmy.Text = "&save army"; |
442 this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); | 442 this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); |
443 this.miSaveArmy.Name = "miSaveArmy"; | 443 this.miSaveArmy.Name = "miSaveArmy"; |
444 // | 444 // |
445 // miSaveArmyAs | 445 // miSaveArmyAs |
446 // | 446 // |
447 this.miSaveArmyAs.Enabled = false; | 447 this.miSaveArmyAs.Enabled = false; |
448 this.miSaveArmyAs.Index = 3; | 448 this.miSaveArmyAs.Index = 3; |
449 this.miSaveArmyAs.Text = "save army &as..."; | 449 this.miSaveArmyAs.Text = "save army &as..."; |
450 this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); | 450 this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); |
451 this.miSaveArmyAs.Name = "miSaveArmyAs"; | 451 this.miSaveArmyAs.Name = "miSaveArmyAs"; |
452 // | 452 // |
453 // miCloseArmy | 453 // miCloseArmy |
454 // | 454 // |
455 this.miCloseArmy.Enabled = false; | 455 this.miCloseArmy.Enabled = false; |
456 this.miCloseArmy.Index = 4; | 456 this.miCloseArmy.Index = 4; |
457 this.miCloseArmy.Text = "&close army"; | 457 this.miCloseArmy.Text = "&close army"; |
458 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); | 458 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); |
459 this.miCloseArmy.Name = "miCloseArmy"; | 459 this.miCloseArmy.Name = "miCloseArmy"; |
460 // | 460 // |
461 // miSep1 | 461 // miSep1 |
462 // | 462 // |
463 this.miSep1.Index = 5; | 463 this.miSep1.Index = 5; |
464 this.miSep1.Text = "-"; | 464 this.miSep1.Text = "-"; |
465 // | 465 // |
466 // miChangeSystem | 466 // miChangeSystem |
467 // | 467 // |
468 this.miChangeSystem.Index = 6; | 468 this.miChangeSystem.Index = 6; |
469 this.miChangeSystem.Text = "change &game system"; | 469 this.miChangeSystem.Text = "change &game system"; |
470 this.miChangeSystem.Click += new System.EventHandler(this.miChangeSystem_Click); | 470 this.miChangeSystem.Click += new System.EventHandler(this.miChangeSystem_Click); |
471 this.miChangeSystem.Name = "miChangeSystem"; | 471 this.miChangeSystem.Name = "miChangeSystem"; |
472 // | 472 // |
473 // miSep2 | 473 // miSep2 |
474 // | 474 // |
475 this.miSep2.Index = 7; | 475 this.miSep2.Index = 7; |
476 this.miSep2.Text = "-"; | 476 this.miSep2.Text = "-"; |
477 // | 477 // |
478 // miReloadFiles | 478 // miReloadFiles |
479 // | 479 // |
480 this.miReloadFiles.Index = 8; | 480 this.miReloadFiles.Index = 8; |
481 this.miReloadFiles.Text = "&reload files"; | 481 this.miReloadFiles.Text = "&reload files"; |
482 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); | 482 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); |
483 this.miReloadFiles.Name = "miReloadFiles"; | 483 this.miReloadFiles.Name = "miReloadFiles"; |
484 // | 484 // |
485 // miSep3 | 485 // miSep3 |
486 // | 486 // |
487 this.miSep3.Index = 9; | 487 this.miSep3.Index = 9; |
488 this.miSep3.Text = "-"; | 488 this.miSep3.Text = "-"; |
489 // | 489 // |
490 // miExit | 490 // miExit |
491 // | 491 // |
492 this.miExit.Index = 10; | 492 this.miExit.Index = 10; |
493 this.miExit.Text = "e&xit"; | 493 this.miExit.Text = "e&xit"; |
494 this.miExit.Click += new System.EventHandler(this.miExit_Click); | 494 this.miExit.Click += new System.EventHandler(this.miExit_Click); |
495 this.miExit.Name = "miExit"; | 495 this.miExit.Name = "miExit"; |
496 // | 496 // |
497 // menuEdit | 497 // menuEdit |
498 // | 498 // |
499 this.menuEdit.Index = 1; | 499 this.menuEdit.Index = 1; |
500 this.menuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 500 this.menuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
501 this.miUndo, | 501 this.miUndo, |
502 this.miRedo}); | 502 this.miRedo}); |
503 this.menuEdit.Text = "&edit"; | 503 this.menuEdit.Text = "&edit"; |
504 this.menuEdit.Name = "menuEdit"; | 504 this.menuEdit.Name = "menuEdit"; |
505 // | 505 // |
506 // miUndo | 506 // miUndo |
507 // | 507 // |
508 this.miUndo.Enabled = false; | 508 this.miUndo.Enabled = false; |
509 this.miUndo.Index = 0; | 509 this.miUndo.Index = 0; |
510 this.miUndo.Text = "&undo"; | 510 this.miUndo.Text = "&undo"; |
511 this.miUndo.Click += new System.EventHandler(this.miUndo_Click); | 511 this.miUndo.Click += new System.EventHandler(this.miUndo_Click); |
512 this.miUndo.Name = "miUndo"; | 512 this.miUndo.Name = "miUndo"; |
513 // | 513 // |
514 // miRedo | 514 // miRedo |
515 // | 515 // |
516 this.miRedo.Enabled = false; | 516 this.miRedo.Enabled = false; |
517 this.miRedo.Index = 1; | 517 this.miRedo.Index = 1; |
518 this.miRedo.Text = "&redo"; | 518 this.miRedo.Text = "&redo"; |
519 this.miRedo.Click += new System.EventHandler(this.miRedo_Click); | 519 this.miRedo.Click += new System.EventHandler(this.miRedo_Click); |
520 this.miRedo.Name = "miRedo"; | 520 this.miRedo.Name = "miRedo"; |
521 // | 521 // |
522 // menuHelp | 522 // menuHelp |
523 // | 523 // |
524 this.menuHelp.Index = 2; | 524 this.menuHelp.Index = 2; |
525 this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | 525 this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { |
526 this.miAbout, | 526 this.miAbout, |
527 this.miDebugWindow}); | 527 this.miDebugWindow}); |
528 this.menuHelp.Text = "&help"; | 528 this.menuHelp.Text = "&help"; |
529 this.menuHelp.Name = "menuHelp"; | 529 this.menuHelp.Name = "menuHelp"; |
530 // | 530 // |
531 // miAbout | 531 // miAbout |
532 // | 532 // |
533 this.miAbout.Enabled = false; | 533 this.miAbout.Enabled = false; |
534 this.miAbout.Index = 0; | 534 this.miAbout.Index = 0; |
535 this.miAbout.Text = "&about"; | 535 this.miAbout.Text = "&about"; |
536 this.miAbout.Name = "miAbout"; | 536 this.miAbout.Name = "miAbout"; |
537 // | 537 // |
538 // miDebugWindow | 538 // miDebugWindow |
539 // | 539 // |
540 this.miDebugWindow.Index = 1; | 540 this.miDebugWindow.Index = 1; |
541 this.miDebugWindow.Text = "&debug"; | 541 this.miDebugWindow.Text = "&debug"; |
542 this.miDebugWindow.Click += new System.EventHandler(this.miDebugWindow_Click); | 542 this.miDebugWindow.Click += new System.EventHandler(this.miDebugWindow_Click); |
543 this.miDebugWindow.Name = "miDebugWindow"; | 543 this.miDebugWindow.Name = "miDebugWindow"; |
544 // | 544 // |
545 // saveArmyDialog | 545 // saveArmyDialog |
546 // | 546 // |
547 this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; | 547 this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; |
548 // | 548 // |
549 // pnlRight | 549 // pnlRight |
550 // | 550 // |
551 this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | 551 this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
552 | System.Windows.Forms.AnchorStyles.Right))); | 552 | System.Windows.Forms.AnchorStyles.Right))); |
553 this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace; | 553 this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace; |
554 this.pnlRight.Location = new System.Drawing.Point(726, 30); | 554 this.pnlRight.Location = new System.Drawing.Point(726, 30); |
555 this.pnlRight.Name = "pnlRight"; | 555 this.pnlRight.Name = "pnlRight"; |
556 this.pnlRight.Size = new System.Drawing.Size(64, 516); | 556 this.pnlRight.Size = new System.Drawing.Size(64, 516); |
557 this.pnlRight.TabIndex = 4; | 557 this.pnlRight.TabIndex = 4; |
558 this.pnlRight.Visible = false; | 558 this.pnlRight.Visible = false; |
559 this.pnlRight.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlRight_Paint); | 559 this.pnlRight.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlRight_Paint); |
560 // | 560 // |
561 // statusBarTimer | 561 // statusBarTimer |
562 // | 562 // |
563 this.statusBarTimer.Interval = 5000; | 563 this.statusBarTimer.Interval = 5000; |
564 this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick); | 564 this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick); |
565 // | 565 // |
566 // FrmMain | 566 // FrmMain |
567 // | 567 // |
568 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | 568 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
569 this.ClientSize = new System.Drawing.Size(792, 570); | 569 this.ClientSize = new System.Drawing.Size(792, 570); |
570 this.Controls.Add(this.pnlRight); | 570 this.Controls.Add(this.pnlRight); |
571 this.Controls.Add(this.toolBar); | 571 this.Controls.Add(this.toolBar); |
572 this.Controls.Add(this.statusBar); | 572 this.Controls.Add(this.statusBar); |
573 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); | 573 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
574 this.IsMdiContainer = true; | 574 this.IsMdiContainer = true; |
575 this.Menu = this.mainMenu; | 575 this.Menu = this.mainMenu; |
576 this.Name = "FrmMain"; | 576 this.Name = "FrmMain"; |
577 this.Text = "WarFoundry"; | 577 this.Text = "WarFoundry"; |
578 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); | 578 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); |
579 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); | 579 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); |
580 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); | 580 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); |
581 this.ResumeLayout(false); | 581 this.ResumeLayout(false); |
582 this.PerformLayout(); | 582 this.PerformLayout(); |
583 | 583 |
584 } | 584 } |
585 #endregion | 585 #endregion |
586 | 586 |
587 /// <summary> | 587 /// <summary> |
597 //Application.EnableVisualStyles(); | 597 //Application.EnableVisualStyles(); |
598 Application.Run(new FrmMain(args)); | 598 Application.Run(new FrmMain(args)); |
599 } | 599 } |
600 catch(Exception ex) | 600 catch(Exception ex) |
601 { | 601 { |
602 LogManager.GetLogger(typeof(FrmMain)).Fatal(ex); | 602 LogManager.GetLogger(typeof(FrmMain)).Fatal(ex); |
603 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); | 603 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); |
604 } | 604 } |
605 } | 605 } |
606 | 606 |
607 private void miExit_Click(object sender, System.EventArgs e) | 607 private void miExit_Click(object sender, System.EventArgs e) |
621 FrmNewArmy newArmy = new FrmNewArmy(CurrentGameSystem); | 621 FrmNewArmy newArmy = new FrmNewArmy(CurrentGameSystem); |
622 DialogResult dr = newArmy.ShowDialog(); | 622 DialogResult dr = newArmy.ShowDialog(); |
623 | 623 |
624 if (dr == DialogResult.OK) | 624 if (dr == DialogResult.OK) |
625 { | 625 { |
626 CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize); | 626 CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize); |
627 } | 627 } |
628 } | 628 } |
629 } | 629 } |
630 | 630 |
631 private bool openArmy() | 631 private bool openArmy() |
649 | 649 |
650 DialogResult dr = openArmyDialog.ShowDialog(this); | 650 DialogResult dr = openArmyDialog.ShowDialog(this); |
651 | 651 |
652 if (dr == DialogResult.OK) | 652 if (dr == DialogResult.OK) |
653 { | 653 { |
654 /* | 654 /* |
655 try | 655 try |
656 { | 656 { |
657 CurrentArmy = Factory.LoadArmy(openArmyDialog.FileName); | 657 CurrentArmy = Factory.LoadArmy(openArmyDialog.FileName); |
658 return true; | 658 return true; |
659 } | 659 } |
661 { | 661 { |
662 logger.Error(ex); | 662 logger.Error(ex); |
663 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid data file"), MessageBoxButtons.OK, MessageBoxIcon.Error); | 663 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid data file"), MessageBoxButtons.OK, MessageBoxIcon.Error); |
664 return false; | 664 return false; |
665 } | 665 } |
666 * */ | 666 * */ |
667 return false; | 667 return false; |
668 } | 668 } |
669 else | 669 else |
670 { | 670 { |
671 return false; | 671 return false; |
672 } | 672 } |
687 { | 687 { |
688 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); | 688 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); |
689 | 689 |
690 if (dr == DialogResult.Yes) | 690 if (dr == DialogResult.Yes) |
691 { | 691 { |
692 canClose = SaveCurrentArmy(); | 692 canClose = SaveCurrentArmy(); |
693 } | 693 } |
694 else if (dr == DialogResult.No) | 694 else if (dr == DialogResult.No) |
695 { | 695 { |
696 canClose = true; | 696 canClose = true; |
697 } | 697 } |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
741 private bool SaveCurrentArmy() | 741 private bool SaveCurrentArmy() |
742 { | 742 { |
743 bool saved = false; | 743 bool saved = false; |
744 | 744 |
745 if (loadedFilePath != null || PromptForFilePath()) | 745 if (loadedFilePath != null || PromptForFilePath()) |
746 { | 746 { |
747 saved = SaveCurrentArmyToFile(); | 747 saved = SaveCurrentArmyToFile(); |
748 } | 748 } |
749 | 749 |
750 return saved; | 750 return saved; |
751 } | 751 } |
752 | 752 |
753 private bool SaveCurrentArmyAs() | 753 private bool SaveCurrentArmyAs() |
754 { | 754 { |
755 bool saved = false; | 755 bool saved = false; |
756 | 756 |
757 if (PromptForFilePath()) | 757 if (PromptForFilePath()) |
758 { | 758 { |
759 saved = SaveCurrentArmyToFile(); | 759 saved = SaveCurrentArmyToFile(); |
760 } | 760 } |
761 | 761 |
762 return saved; | 762 return saved; |
763 } | 763 } |
764 | 764 |
765 private bool SaveCurrentArmyToFile() | 765 private bool SaveCurrentArmyToFile() |
766 { | 766 { |
767 if (WarFoundrySaver.GetSaver().Save(CurrentArmy, loadedFilePath)) | 767 if (WarFoundrySaver.GetSaver().Save(CurrentArmy, loadedFilePath)) |
768 { | 768 { |
769 miSaveArmy.Enabled = false; | 769 miSaveArmy.Enabled = false; |
770 bttnSaveArmy.Enabled = false; | 770 bttnSaveArmy.Enabled = false; |
771 CommandStack.setCleanMark(); | 771 CommandStack.setCleanMark(); |
772 return true; | 772 return true; |
773 } | 773 } |
774 else | 774 else |
775 { | 775 { |
776 loadedFilePath = null; | 776 loadedFilePath = null; |
777 MessageBox.Show(this, Translation.GetTranslation("SaveFailed"), Translation.GetTranslation("SaveFailedTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); | 777 MessageBox.Show(this, Translation.GetTranslation("SaveFailed"), Translation.GetTranslation("SaveFailedTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); |
778 return false; | 778 return false; |
779 } | 779 } |
780 } | 780 } |
781 | 781 |
782 private bool PromptForFilePath() | 782 private bool PromptForFilePath() |
783 { | 783 { |
784 if (saveArmyDialog.Filter == "") | 784 if (saveArmyDialog.Filter == "") |
785 { | 785 { |
786 string savePath = ArmiesPath; | 786 string savePath = ArmiesPath; |
787 | 787 |
826 { | 826 { |
827 openArmy(); | 827 openArmy(); |
828 } | 828 } |
829 else if (e.Button == bttnSaveArmy) | 829 else if (e.Button == bttnSaveArmy) |
830 { | 830 { |
831 SaveCurrentArmy(); | 831 SaveCurrentArmy(); |
832 } | 832 } |
833 else | 833 else |
834 { | 834 { |
835 //it must be one of our extra buttons for the categories | 835 //it must be one of our extra buttons for the categories |
836 addUnitFromCategory((Category)e.Button.Tag); | 836 addUnitFromCategory((Category)e.Button.Tag); |
838 } | 838 } |
839 | 839 |
840 private GameSystem CurrentGameSystem | 840 private GameSystem CurrentGameSystem |
841 { | 841 { |
842 get { return WarFoundryCore.CurrentGameSystem; } | 842 get { return WarFoundryCore.CurrentGameSystem; } |
843 set { WarFoundryCore.CurrentGameSystem = value; } | 843 set { WarFoundryCore.CurrentGameSystem = value; } |
844 } | 844 } |
845 | 845 |
846 private static Army CurrentArmy | 846 private static Army CurrentArmy |
847 { | 847 { |
848 get { return WarFoundryCore.CurrentArmy; } | 848 get { return WarFoundryCore.CurrentArmy; } |
866 SelectGameSystem(); | 866 SelectGameSystem(); |
867 } | 867 } |
868 | 868 |
869 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem) | 869 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem) |
870 { | 870 { |
871 miNewArmy.Enabled = newSystem != null; | 871 miNewArmy.Enabled = newSystem != null; |
872 bttnNewArmy.Enabled = newSystem != null; | 872 bttnNewArmy.Enabled = newSystem != null; |
873 setAppTitle(); | 873 setAppTitle(); |
874 removeCategoryButtons(); | 874 removeCategoryButtons(); |
875 addCategoryButtons(); | 875 addCategoryButtons(); |
876 } | 876 } |
877 | 877 |
878 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy) | 878 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy) |
879 { | 879 { |
880 setAppTitle(); | 880 setAppTitle(); |
881 | 881 |
882 if (oldArmy != null) | 882 if (oldArmy != null) |
883 { | 883 { |
884 oldArmy.UnitAdded += UnitAddedMethod; | 884 oldArmy.UnitAdded += UnitAddedMethod; |
885 oldArmy.UnitRemoved += UnitRemovedMethod; | 885 oldArmy.UnitRemoved += UnitRemovedMethod; |
886 oldArmy.PointsValueChanged += PointsValueChangedMethod; | 886 oldArmy.PointsValueChanged += PointsValueChangedMethod; |
887 } | 887 } |
888 | 888 |
889 if (CurrentArmy==null) | 889 if (CurrentArmy==null) |
890 { | 890 { |
891 miSaveArmyAs.Enabled = false; | 891 miSaveArmyAs.Enabled = false; |
892 miCloseArmy.Enabled = false; | 892 miCloseArmy.Enabled = false; |
893 disableCategoryButtons(); | 893 disableCategoryButtons(); |
894 } | 894 } |
895 else | 895 else |
896 { | 896 { |
897 newArmy.UnitAdded += UnitAddedMethod; | 897 newArmy.UnitAdded += UnitAddedMethod; |
898 newArmy.UnitRemoved += UnitRemovedMethod; | 898 newArmy.UnitRemoved += UnitRemovedMethod; |
899 newArmy.PointsValueChanged += PointsValueChangedMethod; | 899 newArmy.PointsValueChanged += PointsValueChangedMethod; |
900 //TODO: Clear all buttons | 900 //TODO: Clear all buttons |
901 miSaveArmyAs.Enabled = true; | 901 miSaveArmyAs.Enabled = true; |
902 miCloseArmy.Enabled = true; | 902 miCloseArmy.Enabled = true; |
903 enableCategoryButtons(); | 903 enableCategoryButtons(); |
904 | 904 |
905 if (newArmy.Race.HasCategoryOverrides()) | 905 if (newArmy.Race.HasCategoryOverrides()) |
906 { | 906 { |
907 removeCategoryButtons(); | 907 removeCategoryButtons(); |
908 addCategoryButtons(newArmy.Race.Categories); | 908 addCategoryButtons(newArmy.Race.Categories); |
909 } | 909 } |
910 } | 910 } |
911 | 911 |
912 CommandStack.Reset(); | 912 CommandStack.Reset(); |
913 | 913 |
984 } | 984 } |
985 } | 985 } |
986 | 986 |
987 private void miSaveArmyAs_Click(object sender, System.EventArgs e) | 987 private void miSaveArmyAs_Click(object sender, System.EventArgs e) |
988 { | 988 { |
989 SaveCurrentArmyAs(); | 989 SaveCurrentArmyAs(); |
990 } | 990 } |
991 | 991 |
992 private void commandStack_CommandStackUpdated() | 992 private void commandStack_CommandStackUpdated() |
993 { | 993 { |
994 bttnUndo.Enabled = commandStack.CanUndo(); | 994 bttnUndo.Enabled = commandStack.CanUndo(); |
1059 { | 1059 { |
1060 bttnUndo.ToolTipText = menuItemsUndo[0].Text; | 1060 bttnUndo.ToolTipText = menuItemsUndo[0].Text; |
1061 undoMenu.MenuItems.AddRange(menuItemsUndo); | 1061 undoMenu.MenuItems.AddRange(menuItemsUndo); |
1062 } | 1062 } |
1063 | 1063 |
1064 bool canSave = loadedFilePath != null; | 1064 bool canSave = loadedFilePath != null; |
1065 bttnSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave; | 1065 bttnSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave; |
1066 miSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave; | 1066 miSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave; |
1067 } | 1067 } |
1068 | 1068 |
1069 private void miSaveArmy_Click(object sender, System.EventArgs e) | 1069 private void miSaveArmy_Click(object sender, System.EventArgs e) |
1093 FrmNewUnit newUnit = new FrmNewUnit(CurrentArmy.Race, cat, CurrentArmy); | 1093 FrmNewUnit newUnit = new FrmNewUnit(CurrentArmy.Race, cat, CurrentArmy); |
1094 DialogResult dr = newUnit.ShowDialog(this); | 1094 DialogResult dr = newUnit.ShowDialog(this); |
1095 | 1095 |
1096 if (dr == DialogResult.OK) | 1096 if (dr == DialogResult.OK) |
1097 { | 1097 { |
1098 CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(newUnit.SelectedUnit, cat, CurrentArmy); | 1098 CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(newUnit.SelectedUnit, CurrentArmy); |
1099 commandStack.Execute(cmd); | 1099 commandStack.Execute(cmd); |
1100 } | 1100 } |
1101 } | 1101 } |
1102 | 1102 |
1103 private void FrmMain_UnitAddedMethod(object unitObj) | 1103 private void FrmMain_UnitAddedMethod(object unitObj) |