annotate FrmMain.cs @ 25:041f05e56496

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