Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
changeset 210:694f23814ec2
Re #354: Single-button Add Unit
* Make the form translatable
* Update FrmArmyTree so it doesn't look out of place (ContextMenuStrip and update the icons)
* Add "change selection on right-click" code to solve calculation issues
* Hide categories that don't have entries (assume they're not relevant to that race)
Also:
* Clean up code and replace space indents with tabs
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 20 Aug 2011 20:58:16 +0100 |
parents | a11faa64c333 |
children | 848fb363a8cb |
files | FrmArmyTree.cs FrmArmyTree.resx FrmMain.cs FrmNewUnitFromTree.Designer.cs FrmNewUnitFromTree.cs IBBoard.WarFoundry.GUI.WinForms.csproj Properties/Resources.Designer.cs Properties/Resources.resx Resources/edit-delete.png Resources/edit-edit.png translations/en.translation |
diffstat | 11 files changed, 754 insertions(+), 716 deletions(-) [+] |
line wrap: on
line diff
--- a/FrmArmyTree.cs Sat Aug 20 17:05:45 2011 +0100 +++ b/FrmArmyTree.cs Sat Aug 20 20:58:16 2011 +0100 @@ -25,9 +25,9 @@ private System.Windows.Forms.TreeView treeView; private IContainer components; private Dictionary<string, TreeNode> nodes; - private System.Windows.Forms.ContextMenu contextMenu; - private IBBMenuItem miDeleteUnit; - private IBBMenuItem miEditUnit; + private System.Windows.Forms.ContextMenuStrip contextMenu; + private IBBToolStripMenuItem miDeleteUnit; + private IBBToolStripMenuItem miEditUnit; private ObjectAddDelegate UnitAddedMethod; private ObjectRemoveDelegate UnitRemovedMethod; @@ -37,11 +37,11 @@ private IBBToolBarButton bttnDelete; private ImageList imageList; private CommandStack commandStack; - public GameSystem CurrentGameSystem - { - get { return WarFoundryCore.CurrentGameSystem; } - set { WarFoundryCore.CurrentGameSystem = value; } - } + public GameSystem CurrentGameSystem + { + get { return WarFoundryCore.CurrentGameSystem; } + set { WarFoundryCore.CurrentGameSystem = value; } + } public FrmArmyTree(CommandStack cmdStack) { @@ -68,14 +68,15 @@ ControlTranslator.TranslateComponent(comp); } - foreach (IBBMenuItem mi in contextMenu.MenuItems) + foreach (IBBToolStripMenuItem mi in contextMenu.Items) { - ControlTranslator.TranslateComponent(mi); + ControlTranslator.TranslateComponent(mi); } - foreach (TreeNode node in nodes.Values) - { - node.Text = CreateNodeName((ICostedWarFoundryObject)node.Tag); - } + + foreach (TreeNode node in nodes.Values) + { + node.Text = CreateNodeName((ICostedWarFoundryObject)node.Tag); + } } /// <summary> @@ -102,100 +103,108 @@ /// </summary> private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmArmyTree)); - this.contextMenu = new System.Windows.Forms.ContextMenu(); - this.miEditUnit = new IBBoard.Windows.Forms.IBBMenuItem(); - this.miDeleteUnit = new IBBoard.Windows.Forms.IBBMenuItem(); - this.imageList = new System.Windows.Forms.ImageList(this.components); - this.toolBar = new System.Windows.Forms.ToolBar(); - this.bttnEdit = new IBBoard.Windows.Forms.IBBToolBarButton(); - this.bttnDelete = new IBBoard.Windows.Forms.IBBToolBarButton(); - this.treeView = new System.Windows.Forms.TreeView(); - this.SuspendLayout(); - // - // contextMenu - // - this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { - this.miEditUnit, - this.miDeleteUnit}); - this.contextMenu.Popup += new System.EventHandler(this.contextMenu_Popup); - // - // miEditUnit - // - this.miEditUnit.Index = 0; - this.miEditUnit.Text = "&edit unit"; - this.miEditUnit.Click += new System.EventHandler(this.miEdit_Click); - // - // miDeleteUnit - // - this.miDeleteUnit.Index = 1; - this.miDeleteUnit.Text = "&delete unit"; - this.miDeleteUnit.Click += new System.EventHandler(this.miDelete_Click); - // - // imageList - // - this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); - this.imageList.TransparentColor = System.Drawing.Color.Transparent; - this.imageList.Images.SetKeyName(0, "gtk-edit.png"); - this.imageList.Images.SetKeyName(1, "edit-delete.png"); - // - // toolBar - // - this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { - this.bttnEdit, - this.bttnDelete}); - this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); - this.toolBar.DropDownArrows = true; - this.toolBar.ImageList = this.imageList; - this.toolBar.Location = new System.Drawing.Point(0, 0); - this.toolBar.Name = "toolBar"; - this.toolBar.ShowToolTips = true; - this.toolBar.Size = new System.Drawing.Size(240, 28); - this.toolBar.TabIndex = 3; - this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); - // - // bttnEdit - // - this.bttnEdit.Enabled = false; - this.bttnEdit.ImageIndex = 0; - this.bttnEdit.Name = "bttnEdit"; - // - // bttnDelete - // - this.bttnDelete.Enabled = false; - this.bttnDelete.ImageIndex = 1; - this.bttnDelete.Name = "bttnDelete"; - // - // treeView - // - this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.treeView.ContextMenu = this.contextMenu; - this.treeView.FullRowSelect = true; - this.treeView.Location = new System.Drawing.Point(0, 28); - this.treeView.Name = "treeView"; - this.treeView.Size = new System.Drawing.Size(240, 250); - this.treeView.TabIndex = 0; - this.treeView.DoubleClick += new System.EventHandler(this.treeView_DoubleClick); - this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); - this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown); - // - // FrmArmyTree - // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(240, 277); - this.ControlBox = false; - this.Controls.Add(this.toolBar); - this.Controls.Add(this.treeView); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FrmArmyTree"; - this.Text = "FrmArmyTree"; - this.ResumeLayout(false); - this.PerformLayout(); + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmArmyTree)); + this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.miDeleteUnit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.imageList = new System.Windows.Forms.ImageList(this.components); + this.toolBar = new System.Windows.Forms.ToolBar(); + this.bttnEdit = new IBBoard.Windows.Forms.IBBToolBarButton(); + this.bttnDelete = new IBBoard.Windows.Forms.IBBToolBarButton(); + this.treeView = new System.Windows.Forms.TreeView(); + this.miEditUnit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.contextMenu.SuspendLayout(); + this.SuspendLayout(); + // + // contextMenu + // + this.contextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.miEditUnit, + this.miDeleteUnit}); + this.contextMenu.Name = "contextMenu"; + this.contextMenu.Size = new System.Drawing.Size(137, 48); + this.contextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenu_Opening); + // + // miDeleteUnit + // + this.miDeleteUnit.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_delete; + this.miDeleteUnit.Name = "miDeleteUnit"; + this.miDeleteUnit.Size = new System.Drawing.Size(136, 22); + this.miDeleteUnit.Text = "&delete unit"; + this.miDeleteUnit.Click += new System.EventHandler(this.miDelete_Click); + // + // imageList + // + this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); + this.imageList.TransparentColor = System.Drawing.Color.Transparent; + this.imageList.Images.SetKeyName(0, "edit-edit.png"); + this.imageList.Images.SetKeyName(1, "edit-delete.png"); + // + // toolBar + // + this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { + this.bttnEdit, + this.bttnDelete}); + this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); + this.toolBar.DropDownArrows = true; + this.toolBar.ImageList = this.imageList; + this.toolBar.Location = new System.Drawing.Point(0, 0); + this.toolBar.Name = "toolBar"; + this.toolBar.ShowToolTips = true; + this.toolBar.Size = new System.Drawing.Size(240, 28); + this.toolBar.TabIndex = 3; + this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); + // + // bttnEdit + // + this.bttnEdit.Enabled = false; + this.bttnEdit.ImageIndex = 0; + this.bttnEdit.Name = "bttnEdit"; + // + // bttnDelete + // + this.bttnDelete.Enabled = false; + this.bttnDelete.ImageIndex = 1; + this.bttnDelete.Name = "bttnDelete"; + // + // treeView + // + this.treeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.treeView.ContextMenuStrip = this.contextMenu; + this.treeView.FullRowSelect = true; + this.treeView.Location = new System.Drawing.Point(0, 28); + this.treeView.Name = "treeView"; + this.treeView.Size = new System.Drawing.Size(240, 250); + this.treeView.TabIndex = 0; + this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect); + this.treeView.DoubleClick += new System.EventHandler(this.treeView_DoubleClick); + this.treeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView_MouseDown); + // + // miEditUnit + // + this.miEditUnit.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_edit; + this.miEditUnit.Name = "miEditUnit"; + this.miEditUnit.Size = new System.Drawing.Size(136, 22); + this.miEditUnit.Text = "&edit unit"; + this.miEditUnit.Click += new System.EventHandler(this.miEdit_Click); + // + // FrmArmyTree + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(240, 277); + this.ControlBox = false; + this.Controls.Add(this.toolBar); + this.Controls.Add(this.treeView); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "FrmArmyTree"; + this.Text = "FrmArmyTree"; + this.contextMenu.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); } #endregion @@ -247,7 +256,7 @@ private string CreateNodeName(ICostedWarFoundryObject obj) { - return Translation.GetTranslation("treeNodeText", "{0} ({1} pts)", obj.Name, obj.Points, CurrentGameSystem.GetPointsAbbrev(obj.Points)); + return Translation.GetTranslation("treeNodeText", "{0} ({1} pts)", obj.Name, obj.Points, CurrentGameSystem.GetPointsAbbrev(obj.Points)); } private void NodePointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) @@ -337,25 +346,10 @@ } } - - private void contextMenu_Popup(object sender, System.EventArgs e) + private void contextMenu_Opening(object sender, CancelEventArgs e) { TreeNode node = treeView.SelectedNode; - - if (node!=null && node.Tag is Unit) - { - foreach(MenuItem item in contextMenu.MenuItems) - { - item.Visible = true; - } - } - else - { - foreach(MenuItem item in contextMenu.MenuItems) - { - item.Visible = false; - } - } + e.Cancel = (node == null || !(node.Tag is Unit)); } private void treeView_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) @@ -363,15 +357,7 @@ if (e.Button == MouseButtons.Right) { TreeNode tn = treeView.GetNodeAt(e.X, e.Y); - - if (tn!=null) - { - treeView.SelectedNode = tn; - } - else - { - treeView.SelectedNode = null; - } + treeView.SelectedNode = tn; } }
--- a/FrmArmyTree.resx Sat Aug 20 17:05:45 2011 +0100 +++ b/FrmArmyTree.resx Sat Aug 20 20:58:16 2011 +0100 @@ -112,54 +112,54 @@ <value>2.0</value> </resheader> <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <metadata name="contextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="contextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> - <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>133, 17</value> </metadata> <data name="imageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64"> <value> - AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w + AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 - ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABO + ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABA BwAAAk1TRnQBSQFMAgEBAgEAAQQBAAEEAQABEAEAARABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgDAAFA - AwABEAMAAQEBAAEYBgABDEUAAagCVgGRAZQBkwGtAbABrwYAAZABlAGSAZ4BnwG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GHAUoBIGYAA4Ee/wGFAYoBiAYA + AYcBSgEgAd0BuwGcAXcBfAF6A9kMvQm8A78DwAF3AXwBegHdAbsBnAGHAUoBIGYAA7EegQGjAaYBpQYA + Aa0BjwF6AYcBSgEgAYUBigGIA+cD1wzWBtUD2gPcAYUBigGIAYcBSgEgAa0BjwF6lgABhQGKAYgD8Qnr + D+oD6QGFAYoBiJwAAaABowGiAYUBigGIAYUBigGIAYUBigGIAYUBigGIAYUBigGIAYUBigGIAYUBigGI + AYUBigGIAYUBigGIAYUBigGIAaABowGiZgABQgFNAT4HAAE+AwABKAMAAUADAAEQAwABAQEAAQEFAAGA + FwAD/wEAAv8BjAFjBAABwAEBAYABAwQAAcABAQGAAQMEAAHAAQEBwAEHBAABwAEBAcABBwQAAcABAAHA + AQcEAAHAAQIGAAHAAQEGAAHABwABwAcAAcAHAAHABwABwAEDBgABwAEDBgAC/wHAAQMEAAL/AcABAwQA + Cw== </value> </data> </root> \ No newline at end of file
--- a/FrmMain.cs Sat Aug 20 17:05:45 2011 +0100 +++ b/FrmMain.cs Sat Aug 20 20:58:16 2011 +0100 @@ -40,13 +40,13 @@ { private static readonly string AppTitle = "WarFoundry"; internal static readonly string VERSION = "0.1"; - const string DefaultDataDir = "data"; - /* public static string pointsAbbrevSingle; - public static string pointsAbbrevPlural; - public static string pointsAbbreviation; - public static string pointsNameSingle; - public static string pointsNamePlural; - public static string pointsName;*/ + const string DefaultDataDir = "data"; + /* public static string pointsAbbrevSingle; + public static string pointsAbbrevPlural; + public static string pointsAbbreviation; + public static string pointsNameSingle; + public static string pointsNamePlural; + public static string pointsName;*/ private Preferences preferences; private readonly ILog log = LogManager.GetLogger(typeof(FrmMain)); @@ -59,7 +59,7 @@ //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; private FrmArmyTree armyTree; - private FrmNewUnitFromTree newUnitTree; + private FrmNewUnitFromTree newUnitTree; private string loadedFilePath; private Dictionary<string, FrmUnit> unitWindows; @@ -72,7 +72,7 @@ private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; private System.Windows.Forms.ContextMenu undoMenu; private System.Windows.Forms.ContextMenu redoMenu; - private IBBoard.Windows.Forms.ColorableStatusBar statusBar; + private IBBoard.Windows.Forms.ColorableStatusBar statusBar; private MenuStrip menuStrip; private IBBToolStripMenuItem menuFile; private IBBToolStripMenuItem miNewArmy; @@ -156,7 +156,7 @@ PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod); //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement); - + sbErrorPanel.Color = Color.Red; SetPointsPanelToolTipText(); @@ -185,23 +185,23 @@ armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10); } - private FrmNewUnitFromTree GetNewUnitTree() - { - if (newUnitTree == null || newUnitTree.IsDisposed) - { - CreateNewUnitTree(); - } + private FrmNewUnitFromTree GetNewUnitTree() + { + if (newUnitTree == null || newUnitTree.IsDisposed) + { + CreateNewUnitTree(); + } - return newUnitTree; - } + return newUnitTree; + } - private void CreateNewUnitTree() - { - newUnitTree = new FrmNewUnitFromTree(); - newUnitTree.MdiParent = this; - newUnitTree.StartPosition = FormStartPosition.Manual; - newUnitTree.Location = new Point(10, 10); - } + private void CreateNewUnitTree() + { + newUnitTree = new FrmNewUnitFromTree(); + newUnitTree.MdiParent = this; + newUnitTree.StartPosition = FormStartPosition.Manual; + newUnitTree.Location = new Point(10, 10); + } private void TranslateControls() { @@ -209,10 +209,10 @@ ControlTranslator.TranslateComponents(components.Components); ControlTranslator.TranslateComponent(openArmyDialog); ControlTranslator.TranslateComponent(saveArmyDialog); - //translate pointspanel and tooltip - SetPointsPanelToolTipText(); - SetPointsPanelText(); - } + //translate pointspanel and tooltip + SetPointsPanelToolTipText(); + SetPointsPanelText(); + } void TranslationChanged() { @@ -270,371 +270,371 @@ /// </summary> private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); - this.undoMenu = new System.Windows.Forms.ContextMenu(); - this.redoMenu = new System.Windows.Forms.ContextMenu(); - this.mainMenu = new System.Windows.Forms.MainMenu(this.components); - this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); - this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); - this.menuStrip = new System.Windows.Forms.MenuStrip(); - this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miSaveArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.menuEdit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miUndo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miRedo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.miPreferences = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); - this.mainToolStrip = new System.Windows.Forms.ToolStrip(); - this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); - this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); - this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); - this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); - this.catToolStrip = new System.Windows.Forms.ToolStrip(); - this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); - this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); - this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); - this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); - this.toolStripPanel = new System.Windows.Forms.ToolStripPanel(); - this.menuStrip.SuspendLayout(); - this.mainToolStrip.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); - this.SuspendLayout(); - // - // saveArmyDialog - // - this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; - // - // menuStrip - // - this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.menuFile, - this.menuEdit, - this.menuHelp}); - this.menuStrip.Location = new System.Drawing.Point(0, 0); - this.menuStrip.Name = "menuStrip"; - this.menuStrip.Size = new System.Drawing.Size(790, 24); - this.menuStrip.TabIndex = 6; - this.menuStrip.Text = "menuStrip1"; - // - // menuFile - // - this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miNewArmy, - this.miOpenArmy, - this.miSaveArmy, - this.miSaveArmyAs, - this.miExportArmyAs, - this.miCloseArmy, - this.toolStripSeparator1, - this.miReloadFiles, - this.toolStripSeparator2, - this.miExit}); - this.menuFile.Name = "menuFile"; - this.menuFile.Size = new System.Drawing.Size(33, 20); - this.menuFile.Text = "&file"; - // - // miNewArmy - // - this.miNewArmy.Name = "miNewArmy"; - this.miNewArmy.Size = new System.Drawing.Size(164, 22); - this.miNewArmy.Text = "&new army"; - this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); - // - // miOpenArmy - // - this.miOpenArmy.Name = "miOpenArmy"; - this.miOpenArmy.Size = new System.Drawing.Size(164, 22); - this.miOpenArmy.Text = "&open army"; - this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); - // - // miSaveArmy - // - this.miSaveArmy.Enabled = false; - this.miSaveArmy.Name = "miSaveArmy"; - this.miSaveArmy.Size = new System.Drawing.Size(164, 22); - this.miSaveArmy.Text = "&save army"; - this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); - // - // miSaveArmyAs - // - this.miSaveArmyAs.Enabled = false; - this.miSaveArmyAs.Name = "miSaveArmyAs"; - this.miSaveArmyAs.Size = new System.Drawing.Size(164, 22); - this.miSaveArmyAs.Text = "save army &as..."; - this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); - // - // miExportArmyAs - // - this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miExportArmyAsBasicHTML}); - this.miExportArmyAs.Enabled = false; - this.miExportArmyAs.Name = "miExportArmyAs"; - this.miExportArmyAs.Size = new System.Drawing.Size(164, 22); - this.miExportArmyAs.Text = "export army as..."; - // - // miExportArmyAsBasicHTML - // - this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; - this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22); - this.miExportArmyAsBasicHTML.Text = "&basic html"; - this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); - // - // miCloseArmy - // - this.miCloseArmy.Enabled = false; - this.miCloseArmy.Name = "miCloseArmy"; - this.miCloseArmy.Size = new System.Drawing.Size(164, 22); - this.miCloseArmy.Text = "&close army"; - this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(161, 6); - // - // miReloadFiles - // - this.miReloadFiles.Name = "miReloadFiles"; - this.miReloadFiles.Size = new System.Drawing.Size(164, 22); - this.miReloadFiles.Text = "&reload files"; - this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6); - // - // miExit - // - this.miExit.Name = "miExit"; - this.miExit.Size = new System.Drawing.Size(164, 22); - this.miExit.Text = "e&xit"; - this.miExit.Click += new System.EventHandler(this.miExit_Click); - // - // menuEdit - // - this.menuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miUndo, - this.miRedo, - this.toolStripSeparator4, - this.miPreferences}); - this.menuEdit.Name = "menuEdit"; - this.menuEdit.Size = new System.Drawing.Size(36, 20); - this.menuEdit.Text = "&edit"; - // - // miUndo - // - this.miUndo.Enabled = false; - this.miUndo.Name = "miUndo"; - this.miUndo.Size = new System.Drawing.Size(142, 22); - this.miUndo.Text = "&undo"; - this.miUndo.Click += new System.EventHandler(this.miUndo_Click); - // - // miRedo - // - this.miRedo.Enabled = false; - this.miRedo.Name = "miRedo"; - this.miRedo.Size = new System.Drawing.Size(142, 22); - this.miRedo.Text = "&redo"; - this.miRedo.Click += new System.EventHandler(this.miRedo_Click); - // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(139, 6); - // - // miPreferences - // - this.miPreferences.Name = "miPreferences"; - this.miPreferences.Size = new System.Drawing.Size(142, 22); - this.miPreferences.Text = "&preferences"; - this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click); - // - // menuHelp - // - this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miAbout}); - this.menuHelp.Name = "menuHelp"; - this.menuHelp.Size = new System.Drawing.Size(39, 20); - this.menuHelp.Text = "&help"; - // - // miAbout - // - this.miAbout.Name = "miAbout"; - this.miAbout.Size = new System.Drawing.Size(109, 22); - this.miAbout.Text = "&about"; - this.miAbout.Click += new System.EventHandler(this.miAbout_Click); - // - // mainToolStrip - // - this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None; - this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.bttnNewArmy, - this.bttnOpenArmy, - this.bttnSaveArmy, - this.toolStripSeparator3, - this.bttnUndo, - this.bttnRedo}); - this.mainToolStrip.Location = new System.Drawing.Point(0, 24); - this.mainToolStrip.Name = "mainToolStrip"; - this.mainToolStrip.Size = new System.Drawing.Size(182, 25); - this.mainToolStrip.TabIndex = 8; - // - // bttnNewArmy - // - this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new; - this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnNewArmy.Name = "bttnNewArmy"; - this.bttnNewArmy.Size = new System.Drawing.Size(23, 22); - this.bttnNewArmy.Text = "new army"; - this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); - // - // bttnOpenArmy - // - this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open; - this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnOpenArmy.Name = "bttnOpenArmy"; - this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22); - this.bttnOpenArmy.Text = "open army"; - this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); - // - // bttnSaveArmy - // - this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnSaveArmy.Enabled = false; - this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save; - this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnSaveArmy.Name = "bttnSaveArmy"; - this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22); - this.bttnSaveArmy.Text = "save army"; - this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); - // - // bttnUndo - // - this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnUndo.Enabled = false; - this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo; - this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnUndo.Name = "bttnUndo"; - this.bttnUndo.Size = new System.Drawing.Size(32, 22); - this.bttnUndo.Text = "undo"; - this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click); - // - // bttnRedo - // - this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.bttnRedo.Enabled = false; - this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo; - this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta; - this.bttnRedo.Name = "bttnRedo"; - this.bttnRedo.Size = new System.Drawing.Size(32, 22); - this.bttnRedo.Text = "redo"; - this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click); - // - // catToolStrip - // - this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None; - this.catToolStrip.Location = new System.Drawing.Point(161, 24); - this.catToolStrip.Name = "catToolStrip"; - this.catToolStrip.Size = new System.Drawing.Size(111, 25); - this.catToolStrip.TabIndex = 9; - this.catToolStrip.Visible = false; - // - // statusBar - // - this.statusBar.Location = new System.Drawing.Point(0, 586); - this.statusBar.Name = "statusBar"; - this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { - this.sbMainPanel, - this.sbErrorPanel, - this.sbPointsPanel}); - this.statusBar.ShowPanels = true; - this.statusBar.Size = new System.Drawing.Size(790, 22); - this.statusBar.TabIndex = 1; - this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); - this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); - // - // sbMainPanel - // - this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; - this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; - this.sbMainPanel.Name = "sbMainPanel"; - this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; - this.sbMainPanel.Width = 473; - // - // sbErrorPanel - // - this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; - this.sbErrorPanel.Name = "sbErrorPanel"; - this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; - this.sbErrorPanel.Width = 150; - // - // sbPointsPanel - // - this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; - this.sbPointsPanel.Name = "sbPointsPanel"; - this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; - this.sbPointsPanel.ToolTipText = "current points total"; - this.sbPointsPanel.Width = 150; - // - // toolStripPanel - // - this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top; - this.toolStripPanel.Location = new System.Drawing.Point(0, 24); - this.toolStripPanel.Name = "toolStripPanel"; - this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; - this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.toolStripPanel.Size = new System.Drawing.Size(790, 0); - // - // FrmMain - // - this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); - this.ClientSize = new System.Drawing.Size(790, 608); - this.Controls.Add(this.mainToolStrip); - this.Controls.Add(this.toolStripPanel); - this.Controls.Add(this.statusBar); - this.Controls.Add(this.catToolStrip); - this.Controls.Add(this.menuStrip); - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.IsMdiContainer = true; - this.MainMenuStrip = this.menuStrip; - this.Menu = this.mainMenu; - this.Name = "FrmMain"; - this.Text = "WarFoundry"; - this.Load += new System.EventHandler(this.FrmMain_Load); - this.menuStrip.ResumeLayout(false); - this.menuStrip.PerformLayout(); - this.mainToolStrip.ResumeLayout(false); - this.mainToolStrip.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); + this.undoMenu = new System.Windows.Forms.ContextMenu(); + this.redoMenu = new System.Windows.Forms.ContextMenu(); + this.mainMenu = new System.Windows.Forms.MainMenu(this.components); + this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); + this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miSaveArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.menuEdit = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miUndo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miRedo = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.miPreferences = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); + this.mainToolStrip = new System.Windows.Forms.ToolStrip(); + this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); + this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); + this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); + this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton(); + this.catToolStrip = new System.Windows.Forms.ToolStrip(); + this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); + this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); + this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); + this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); + this.toolStripPanel = new System.Windows.Forms.ToolStripPanel(); + this.menuStrip.SuspendLayout(); + this.mainToolStrip.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); + this.SuspendLayout(); + // + // saveArmyDialog + // + this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; + // + // menuStrip + // + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuFile, + this.menuEdit, + this.menuHelp}); + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(790, 24); + this.menuStrip.TabIndex = 6; + this.menuStrip.Text = "menuStrip1"; + // + // menuFile + // + this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.miNewArmy, + this.miOpenArmy, + this.miSaveArmy, + this.miSaveArmyAs, + this.miExportArmyAs, + this.miCloseArmy, + this.toolStripSeparator1, + this.miReloadFiles, + this.toolStripSeparator2, + this.miExit}); + this.menuFile.Name = "menuFile"; + this.menuFile.Size = new System.Drawing.Size(33, 20); + this.menuFile.Text = "&file"; + // + // miNewArmy + // + this.miNewArmy.Name = "miNewArmy"; + this.miNewArmy.Size = new System.Drawing.Size(164, 22); + this.miNewArmy.Text = "&new army"; + this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); + // + // miOpenArmy + // + this.miOpenArmy.Name = "miOpenArmy"; + this.miOpenArmy.Size = new System.Drawing.Size(164, 22); + this.miOpenArmy.Text = "&open army"; + this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); + // + // miSaveArmy + // + this.miSaveArmy.Enabled = false; + this.miSaveArmy.Name = "miSaveArmy"; + this.miSaveArmy.Size = new System.Drawing.Size(164, 22); + this.miSaveArmy.Text = "&save army"; + this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); + // + // miSaveArmyAs + // + this.miSaveArmyAs.Enabled = false; + this.miSaveArmyAs.Name = "miSaveArmyAs"; + this.miSaveArmyAs.Size = new System.Drawing.Size(164, 22); + this.miSaveArmyAs.Text = "save army &as..."; + this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); + // + // miExportArmyAs + // + this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.miExportArmyAsBasicHTML}); + this.miExportArmyAs.Enabled = false; + this.miExportArmyAs.Name = "miExportArmyAs"; + this.miExportArmyAs.Size = new System.Drawing.Size(164, 22); + this.miExportArmyAs.Text = "export army as..."; + // + // miExportArmyAsBasicHTML + // + this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; + this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22); + this.miExportArmyAsBasicHTML.Text = "&basic html"; + this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); + // + // miCloseArmy + // + this.miCloseArmy.Enabled = false; + this.miCloseArmy.Name = "miCloseArmy"; + this.miCloseArmy.Size = new System.Drawing.Size(164, 22); + this.miCloseArmy.Text = "&close army"; + this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(161, 6); + // + // miReloadFiles + // + this.miReloadFiles.Name = "miReloadFiles"; + this.miReloadFiles.Size = new System.Drawing.Size(164, 22); + this.miReloadFiles.Text = "&reload files"; + this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6); + // + // miExit + // + this.miExit.Name = "miExit"; + this.miExit.Size = new System.Drawing.Size(164, 22); + this.miExit.Text = "e&xit"; + this.miExit.Click += new System.EventHandler(this.miExit_Click); + // + // menuEdit + // + this.menuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.miUndo, + this.miRedo, + this.toolStripSeparator4, + this.miPreferences}); + this.menuEdit.Name = "menuEdit"; + this.menuEdit.Size = new System.Drawing.Size(36, 20); + this.menuEdit.Text = "&edit"; + // + // miUndo + // + this.miUndo.Enabled = false; + this.miUndo.Name = "miUndo"; + this.miUndo.Size = new System.Drawing.Size(142, 22); + this.miUndo.Text = "&undo"; + this.miUndo.Click += new System.EventHandler(this.miUndo_Click); + // + // miRedo + // + this.miRedo.Enabled = false; + this.miRedo.Name = "miRedo"; + this.miRedo.Size = new System.Drawing.Size(142, 22); + this.miRedo.Text = "&redo"; + this.miRedo.Click += new System.EventHandler(this.miRedo_Click); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(139, 6); + // + // miPreferences + // + this.miPreferences.Name = "miPreferences"; + this.miPreferences.Size = new System.Drawing.Size(142, 22); + this.miPreferences.Text = "&preferences"; + this.miPreferences.Click += new System.EventHandler(this.miPreferences_Click); + // + // menuHelp + // + this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.miAbout}); + this.menuHelp.Name = "menuHelp"; + this.menuHelp.Size = new System.Drawing.Size(39, 20); + this.menuHelp.Text = "&help"; + // + // miAbout + // + this.miAbout.Name = "miAbout"; + this.miAbout.Size = new System.Drawing.Size(109, 22); + this.miAbout.Text = "&about"; + this.miAbout.Click += new System.EventHandler(this.miAbout_Click); + // + // mainToolStrip + // + this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None; + this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.bttnNewArmy, + this.bttnOpenArmy, + this.bttnSaveArmy, + this.toolStripSeparator3, + this.bttnUndo, + this.bttnRedo}); + this.mainToolStrip.Location = new System.Drawing.Point(0, 24); + this.mainToolStrip.Name = "mainToolStrip"; + this.mainToolStrip.Size = new System.Drawing.Size(182, 25); + this.mainToolStrip.TabIndex = 8; + // + // bttnNewArmy + // + this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new; + this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnNewArmy.Name = "bttnNewArmy"; + this.bttnNewArmy.Size = new System.Drawing.Size(23, 22); + this.bttnNewArmy.Text = "new army"; + this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); + // + // bttnOpenArmy + // + this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open; + this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnOpenArmy.Name = "bttnOpenArmy"; + this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22); + this.bttnOpenArmy.Text = "open army"; + this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); + // + // bttnSaveArmy + // + this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnSaveArmy.Enabled = false; + this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save; + this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnSaveArmy.Name = "bttnSaveArmy"; + this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22); + this.bttnSaveArmy.Text = "save army"; + this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); + // + // bttnUndo + // + this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnUndo.Enabled = false; + this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo; + this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnUndo.Name = "bttnUndo"; + this.bttnUndo.Size = new System.Drawing.Size(32, 22); + this.bttnUndo.Text = "undo"; + this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click); + // + // bttnRedo + // + this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.bttnRedo.Enabled = false; + this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo; + this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta; + this.bttnRedo.Name = "bttnRedo"; + this.bttnRedo.Size = new System.Drawing.Size(32, 22); + this.bttnRedo.Text = "redo"; + this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click); + // + // catToolStrip + // + this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None; + this.catToolStrip.Location = new System.Drawing.Point(161, 24); + this.catToolStrip.Name = "catToolStrip"; + this.catToolStrip.Size = new System.Drawing.Size(111, 25); + this.catToolStrip.TabIndex = 9; + this.catToolStrip.Visible = false; + // + // statusBar + // + this.statusBar.Location = new System.Drawing.Point(0, 586); + this.statusBar.Name = "statusBar"; + this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { + this.sbMainPanel, + this.sbErrorPanel, + this.sbPointsPanel}); + this.statusBar.ShowPanels = true; + this.statusBar.Size = new System.Drawing.Size(790, 22); + this.statusBar.TabIndex = 1; + this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); + this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); + // + // sbMainPanel + // + this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; + this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; + this.sbMainPanel.Name = "sbMainPanel"; + this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; + this.sbMainPanel.Width = 473; + // + // sbErrorPanel + // + this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; + this.sbErrorPanel.Name = "sbErrorPanel"; + this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; + this.sbErrorPanel.Width = 150; + // + // sbPointsPanel + // + this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; + this.sbPointsPanel.Name = "sbPointsPanel"; + this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; + this.sbPointsPanel.ToolTipText = "current points total"; + this.sbPointsPanel.Width = 150; + // + // toolStripPanel + // + this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top; + this.toolStripPanel.Location = new System.Drawing.Point(0, 24); + this.toolStripPanel.Name = "toolStripPanel"; + this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; + this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.toolStripPanel.Size = new System.Drawing.Size(790, 0); + // + // FrmMain + // + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.ClientSize = new System.Drawing.Size(790, 608); + this.Controls.Add(this.mainToolStrip); + this.Controls.Add(this.toolStripPanel); + this.Controls.Add(this.statusBar); + this.Controls.Add(this.catToolStrip); + this.Controls.Add(this.menuStrip); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.IsMdiContainer = true; + this.MainMenuStrip = this.menuStrip; + this.Menu = this.mainMenu; + this.Name = "FrmMain"; + this.Text = "WarFoundry"; + this.Load += new System.EventHandler(this.FrmMain_Load); + this.menuStrip.ResumeLayout(false); + this.menuStrip.PerformLayout(); + this.mainToolStrip.ResumeLayout(false); + this.mainToolStrip.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); } #endregion @@ -835,7 +835,7 @@ private bool SaveCurrentArmyToFile(string filePath) { - if (WarFoundrySaver.GetSaver().Save(filePath, CurrentArmy)) + if (WarFoundrySaver.GetSaver().Save(filePath, CurrentArmy)) { loadedFilePath = filePath; miSaveArmy.Enabled = false; @@ -894,16 +894,16 @@ { SetAppTitle(); - if (newSystem == null) - { - Preferences["currSystem"] = ""; - } - else - { - Preferences["currSystem"] = newSystem.ID; - } + if (newSystem == null) + { + Preferences["currSystem"] = ""; + } + else + { + Preferences["currSystem"] = newSystem.ID; + } - Preferences.Save(); + Preferences.Save(); RemoveCategoryButtons(); } @@ -913,7 +913,7 @@ loadedFilePath = null; miSaveArmy.Enabled = false; bttnSaveArmy.Enabled = false; - //TODO: Subscribe to an "army changed" event here + //TODO: Subscribe to an "army changed" event here SetPointsPanelText(); SetAppTitle(); } @@ -976,7 +976,7 @@ miExportArmyAs.Enabled = false; DisableCategoryButtons(); GetArmyTree().Hide(); - GetNewUnitTree().Hide(); + GetNewUnitTree().Hide(); } private void SetNonNullArmyState(Army newArmy) @@ -987,7 +987,7 @@ miCloseArmy.Enabled = true; miExportArmyAs.Enabled = true; GetArmyTree().Show(); - GetNewUnitTree().Show(); + GetNewUnitTree().Show(); } private void SetCategoryButtons(Category[] cats) @@ -1202,18 +1202,18 @@ if (dr == DialogResult.OK) { - UnitType unitType = newUnit.SelectedUnit; - CreateUnitInCategory(unitType, cat); + UnitType unitType = newUnit.SelectedUnit; + CreateUnitInCategory(unitType, cat); } } - internal void CreateUnitInCategory(UnitType unitType, Category cat) - { - ArmyCategory armyCat = CurrentArmy.GetCategory(cat); - CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(unitType, armyCat); - commandStack.Execute(cmd); - OpenUnitDialog(cmd.Unit); - } + internal void CreateUnitInCategory(UnitType unitType, Category cat) + { + ArmyCategory armyCat = CurrentArmy.GetCategory(cat); + CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(unitType, armyCat); + commandStack.Execute(cmd); + OpenUnitDialog(cmd.Unit); + } internal void OpenUnitDialog(Unit unit) { @@ -1244,27 +1244,27 @@ private void FrmMain_UnitAddedMethod(object unitObj) { - ValidateArmy(); + ValidateArmy(); } - private void ValidateArmy() - { - ICollection<string> failureMessages; - if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages))) - { - sbErrorPanel.Text = ""; - sbErrorPanel.Tag = ""; - } - else - { - sbErrorPanel.Text = failureMessages.Count + " validation errors"; - sbErrorPanel.Tag = String.Join("\n", new List<string>(failureMessages).ToArray()); - } - } + private void ValidateArmy() + { + ICollection<string> failureMessages; + if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages))) + { + sbErrorPanel.Text = ""; + sbErrorPanel.Tag = ""; + } + else + { + sbErrorPanel.Text = failureMessages.Count + " validation errors"; + sbErrorPanel.Tag = String.Join("\n", new List<string>(failureMessages).ToArray()); + } + } private void FrmMain_UnitRemovedMethod(object unitObj) { - ValidateArmy(); + ValidateArmy(); if (unitObj is Unit) { @@ -1313,7 +1313,7 @@ } } - private void SetPointsPanelText() + private void SetPointsPanelText() { if (CurrentArmy==null) { @@ -1322,8 +1322,8 @@ } else { - string pointsPanelText = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentGameSystem.GetPointsName(CurrentArmy.Points), CurrentArmy.MaxPoints, CurrentGameSystem.GetPointsName(CurrentArmy.MaxPoints)); - sbPointsPanel.Text = pointsPanelText; + string pointsPanelText = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentGameSystem.GetPointsName(CurrentArmy.Points), CurrentArmy.MaxPoints, CurrentGameSystem.GetPointsName(CurrentArmy.MaxPoints)); + sbPointsPanel.Text = pointsPanelText; if (CurrentArmy.Points>CurrentArmy.MaxPoints) { @@ -1336,10 +1336,10 @@ } } - private void SetPointsPanelToolTipText() - { - sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value"); - } + private void SetPointsPanelToolTipText() + { + sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value"); + } private void redoMenu_Click(object sender, EventArgs e) {
--- a/FrmNewUnitFromTree.Designer.cs Sat Aug 20 17:05:45 2011 +0100 +++ b/FrmNewUnitFromTree.Designer.cs Sat Aug 20 20:58:16 2011 +0100 @@ -31,7 +31,7 @@ this.components = new System.ComponentModel.Container(); this.unitTypeTree = new System.Windows.Forms.TreeView(); this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.addUnitMenuItem = new IBBoard.Windows.Forms.IBBToolStripMenuItem(); this.contextMenu.SuspendLayout(); this.SuspendLayout(); // @@ -46,21 +46,23 @@ this.unitTypeTree.Size = new System.Drawing.Size(199, 287); this.unitTypeTree.TabIndex = 0; this.unitTypeTree.DoubleClick += new System.EventHandler(this.unitTypeTree_DoubleClick); + this.unitTypeTree.MouseDown += new System.Windows.Forms.MouseEventHandler(this.unitTypeTree_MouseDown); // // contextMenu // this.contextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItem1}); + this.addUnitMenuItem}); this.contextMenu.Name = "contextMenu"; - this.contextMenu.Size = new System.Drawing.Size(154, 26); - // - // toolStripMenuItem1 + this.contextMenu.Size = new System.Drawing.Size(163, 48); + this.contextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenu_Opening); // - this.toolStripMenuItem1.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.list_add; - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(153, 22); - this.toolStripMenuItem1.Text = "Add Unit Type"; - this.toolStripMenuItem1.Click += new System.EventHandler(this.AddUnitClicked); + // addUnitMenuItem + // + this.addUnitMenuItem.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.list_add; + this.addUnitMenuItem.Name = "addUnitMenuItem"; + this.addUnitMenuItem.Size = new System.Drawing.Size(162, 22); + this.addUnitMenuItem.Text = "add unit of type"; + this.addUnitMenuItem.Click += new System.EventHandler(this.AddUnitClicked); // // FrmNewUnitFromTree // @@ -71,7 +73,7 @@ this.Controls.Add(this.unitTypeTree); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.Name = "FrmNewUnitFromTree"; - this.Text = "Available Unit Types"; + this.Text = "available unit types"; this.contextMenu.ResumeLayout(false); this.ResumeLayout(false); @@ -81,6 +83,6 @@ private System.Windows.Forms.TreeView unitTypeTree; private System.Windows.Forms.ContextMenuStrip contextMenu; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; + private Windows.Forms.IBBToolStripMenuItem addUnitMenuItem; } } \ No newline at end of file
--- a/FrmNewUnitFromTree.cs Sat Aug 20 17:05:45 2011 +0100 +++ b/FrmNewUnitFromTree.cs Sat Aug 20 20:58:16 2011 +0100 @@ -1,99 +1,125 @@ using System; -using System.Collections.Generic; using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; +using IBBoard.Lang; +using IBBoard.WarFoundry.API; using IBBoard.WarFoundry.API.Objects; -using IBBoard.WarFoundry.API; +using IBBoard.Windows.Forms; +using IBBoard.Windows.Forms.I18N; namespace IBBoard.WarFoundry.GUI.WinForms { - public partial class FrmNewUnitFromTree : Form - { - public FrmNewUnitFromTree() - { - InitializeComponent(); - WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(ArmyChanged); - } + public partial class FrmNewUnitFromTree : IBBForm + { + public FrmNewUnitFromTree() + { + InitializeComponent(); + WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(ArmyChanged); + TranslateForm(); + Translation.TranslationChanged += new MethodInvoker(TranslateForm); + } - private void ArmyChanged(Army oldArmy, Army newArmy) - { - unitTypeTree.Nodes.Clear(); + private void TranslateForm() + { + ControlTranslator.TranslateControl(this); + ControlTranslator.TranslateComponent(addUnitMenuItem); + } - if (newArmy != null) - { - BuildTree(newArmy.Race); - } - } + private void ArmyChanged(Army oldArmy, Army newArmy) + { + unitTypeTree.Nodes.Clear(); + + if (newArmy != null) + { + BuildTree(newArmy.Race); + } + } - private void BuildTree(Race race) - { - foreach (Category cat in race.Categories) - { - UnitType[] unitTypes = race.GetUnitTypes(cat); - TreeNode[] unitNodes = new TreeNode[unitTypes.Length]; + private void BuildTree(Race race) + { + foreach (Category cat in race.Categories) + { + UnitType[] unitTypes = race.GetUnitTypes(cat); + + if (unitTypes.Length > 0) + { + AddCategoryUnitTypesToTree(cat, unitTypes); + } + } - for (int i = 0; i < unitTypes.Length; i++) - { - UnitType unitType = unitTypes[i]; - TreeNode temp = new TreeNode(unitType.Name); - temp.Tag = unitType; - unitNodes[i] = temp; - } + unitTypeTree.Show(); + } + + private void AddCategoryUnitTypesToTree(Category cat, UnitType[] unitTypes) + { + TreeNode[] unitNodes = new TreeNode[unitTypes.Length]; - TreeNode catTemp = new TreeNode(cat.Name, unitNodes); - catTemp.Tag = cat; - unitTypeTree.Nodes.Add(catTemp); - catTemp.ExpandAll(); - } - - unitTypeTree.Show(); - } + for (int i = 0; i < unitTypes.Length; i++) + { + UnitType unitType = unitTypes[i]; + TreeNode temp = new TreeNode(unitType.Name); + temp.Tag = unitType; + unitNodes[i] = temp; + } - private void unitTypeTree_DoubleClick(object sender, EventArgs e) - { - AddUnitType(); - } + TreeNode catTemp = new TreeNode(cat.Name, unitNodes); + catTemp.Tag = cat; + unitTypeTree.Nodes.Add(catTemp); + catTemp.ExpandAll(); + } + + private void unitTypeTree_DoubleClick(object sender, EventArgs e) + { + AddUnitType(); + } - private void AddUnitType() - { - TreeNode selected = unitTypeTree.SelectedNode; - AddUnitType(selected); - } + private void AddUnitType() + { + TreeNode selected = unitTypeTree.SelectedNode; + AddUnitType(selected); + } - private void AddUnitType(TreeNode selected) - { - object tagData = selected.Tag; + private void AddUnitType(TreeNode selected) + { + object tagData = selected.Tag; + + if (tagData is UnitType) + { + UnitType unit = (UnitType)tagData; + Category cat = (Category)selected.Parent.Tag; + MdiParent.CreateUnitInCategory(unit, cat); + } + } - if (tagData is UnitType) - { - UnitType unit = (UnitType)tagData; - Category cat = (Category)selected.Parent.Tag; - MdiParent.CreateUnitInCategory(unit, cat); - } - } + public new FrmMain MdiParent + { + get { return (FrmMain)base.MdiParent; } + set { base.MdiParent = value; } + } - public new FrmMain MdiParent - { - get { return (FrmMain)base.MdiParent; } - set { base.MdiParent = value; } - } + private void AddUnitClicked(object sender, EventArgs e) + { + TreeNode node = unitTypeTree.SelectedNode; + + if (node != null) + { + AddUnitType(node); + } + } - private void AddUnitClicked(object sender, EventArgs e) - { - //FIXME: We need to do some kind of maths here - // context menu position appears to be relative to the window, not the tree control! - int left = contextMenu.Left - unitTypeTree.Left; - int top = contextMenu.Top - unitTypeTree.Top; - TreeNode node = unitTypeTree.GetNodeAt(left, top); + private void contextMenu_Opening(object sender, CancelEventArgs e) + { + TreeNode node = unitTypeTree.SelectedNode; + e.Cancel = (node == null || !(node.Tag is UnitType)); + } - if (node != null) - { - AddUnitType(node); - } - } - } + private void unitTypeTree_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Right) + { + TreeNode tn = unitTypeTree.GetNodeAt(e.X, e.Y); + unitTypeTree.SelectedNode = tn; + } + } + } }
--- a/IBBoard.WarFoundry.GUI.WinForms.csproj Sat Aug 20 17:05:45 2011 +0100 +++ b/IBBoard.WarFoundry.GUI.WinForms.csproj Sat Aug 20 20:58:16 2011 +0100 @@ -120,6 +120,8 @@ <Content Include="icons\list-add.png" /> <Content Include="icons\warning-sml.png" /> <Content Include="libs\log4net.dll" /> + <None Include="Resources\edit-delete.png" /> + <None Include="Resources\edit-edit.png" /> <Content Include="WarFoundryPref.xml"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content>
--- a/Properties/Resources.Designer.cs Sat Aug 20 17:05:45 2011 +0100 +++ b/Properties/Resources.Designer.cs Sat Aug 20 20:58:16 2011 +0100 @@ -81,6 +81,20 @@ } } + internal static System.Drawing.Bitmap edit_delete { + get { + object obj = ResourceManager.GetObject("edit-delete", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap edit_edit { + get { + object obj = ResourceManager.GetObject("edit-edit", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + internal static System.Drawing.Bitmap edit_redo { get { object obj = ResourceManager.GetObject("edit-redo", resourceCulture);
--- a/Properties/Resources.resx Sat Aug 20 17:05:45 2011 +0100 +++ b/Properties/Resources.resx Sat Aug 20 20:58:16 2011 +0100 @@ -112,31 +112,37 @@ <value>2.0</value> </resheader> <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> - <data name="edit-redo" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\icons\edit-redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> - </data> - <data name="edit-undo" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\icons\edit-undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> - </data> - <data name="document-save" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\icons\document-save.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> - </data> - <data name="document-new" type="System.Resources.ResXFileRef, System.Windows.Forms"> - <value>..\icons\document-new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> - </data> + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <data name="document-open" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\icons\document-open.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> <data name="list-add" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\icons\list-add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="edit-undo" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\icons\edit-undo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="document-new" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\icons\document-new.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="edit-redo" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\icons\edit-redo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="document-save" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\icons\document-save.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> <data name="warning-sml" type="System.Resources.ResXFileRef, System.Windows.Forms"> <value>..\icons\warning-sml.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> + <data name="edit-delete" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\edit-delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> + <data name="edit-edit" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\edit-edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> + </data> </root> \ No newline at end of file
--- a/translations/en.translation Sat Aug 20 17:05:45 2011 +0100 +++ b/translations/en.translation Sat Aug 20 20:58:16 2011 +0100 @@ -131,4 +131,6 @@ <translation id="treeNodeText">{0} ({1} {2})</translation> <translation id="setUnitEquipmentItemName">( {0} {1} each)</translation> <translation id="FailedRequirementMessage">Army Requirement Failures</translation> + <translation id="FrmNewUnitFromTree">Available Unit Types</translation> + <translation id="addUnitMenuItem">Add Unit of Type</translation> </translations> \ No newline at end of file