diff FrmMain.cs @ 130:9d5d885965f9

Fixes #258: New toolbar and menu bar need translations * Update FrmMain to use new toolstrip buttons * Update English translations to include a default "undo" and "redo" translation
author IBBoard <dev@ibboard.co.uk>
date Tue, 09 Mar 2010 21:05:06 +0000
parents 5f21ecd030d0
children acb4456598ce
line wrap: on
line diff
--- a/FrmMain.cs	Sun Mar 07 20:54:06 2010 +0000
+++ b/FrmMain.cs	Tue Mar 09 21:05:06 2010 +0000
@@ -82,12 +82,12 @@
 		private IBBToolStripMenuItem miRedo;
 		private IBBToolStripMenuItem menuHelp;
 		private ToolStrip mainToolStrip;
-		private ToolStripButton bttnNewArmy;
-		private ToolStripButton bttnOpenArmy;
-		private ToolStripButton bttnSaveArmy;
+		private IBBToolStripButton bttnNewArmy;
+		private IBBToolStripButton bttnOpenArmy;
+		private IBBToolStripButton bttnSaveArmy;
 		private ToolStripSeparator toolStripSeparator3;
-		private ToolStripSplitButton bttnUndo;
-		private ToolStripSplitButton bttnRedo;
+		private IBBToolStripSplitButton bttnUndo;
+		private IBBToolStripSplitButton bttnRedo;
 		private ToolStrip catToolStrip;
 		private ToolStripPanel toolStripPanel;
 		private IBBToolStripMenuItem miAbout;
@@ -239,12 +239,12 @@
 			this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
 			this.mainToolStrip = new System.Windows.Forms.ToolStrip();
-			this.bttnNewArmy = new System.Windows.Forms.ToolStripButton();
-			this.bttnOpenArmy = new System.Windows.Forms.ToolStripButton();
-			this.bttnSaveArmy = new System.Windows.Forms.ToolStripButton();
+			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 System.Windows.Forms.ToolStripSplitButton();
-			this.bttnRedo = new System.Windows.Forms.ToolStripSplitButton();
+			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();
@@ -253,9 +253,9 @@
 			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();
+			((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).BeginInit();
+			((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).BeginInit();
+			((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).BeginInit();
 			this.SuspendLayout();
 			// 
 			// saveArmyDialog
@@ -551,7 +551,7 @@
 			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.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
 			this.IsMdiContainer = true;
 			this.MainMenuStrip = this.menuStrip;
 			this.Menu = this.mainMenu;
@@ -562,9 +562,9 @@
 			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();
+			((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).EndInit();
+			((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).EndInit();
+			((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).EndInit();
 			this.ResumeLayout(false);
 			this.PerformLayout();
 
@@ -947,12 +947,12 @@
 		{
 			int catCount = cats.Length;
 			Category cat;
-			ToolStripButton[] categoryButtons = new ToolStripButton[catCount];
+			IBBToolStripButton[] categoryButtons = new IBBToolStripButton[catCount];
 
 			for (int i = 0; i < catCount; i++)
 			{
 				cat = cats[i];
-				ToolStripButton button = new ToolStripButton();
+				IBBToolStripButton button = new IBBToolStripButton();
 				button.Text = cat.Name;
 				button.Tag = cat;
 				button.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.list_add;
@@ -961,14 +961,14 @@
 				categoryButtons[i] = button;
 			}
 
-			this.Invoke(new ArrayMethodInvoker<ToolStripButton>(catToolStrip.Items.AddRange), new object[]{ categoryButtons });
+			this.Invoke(new ArrayMethodInvoker<IBBToolStripButton>(catToolStrip.Items.AddRange), new object[]{ categoryButtons });
 		}
 
 		private void CreateUnitForCategoryButtonClick(object sender, EventArgs e)
 		{
-			if (sender is ToolStripButton)
+			if (sender is IBBToolStripButton)
 			{
-				ToolStripButton button = (ToolStripButton)sender;
+				IBBToolStripButton button = (IBBToolStripButton)sender;
 				object tag = button.Tag;
 
 				if (tag is Category)
@@ -992,7 +992,7 @@
 
 		private void SetCategoryButtonState(bool state)
 		{
-			foreach (ToolStripButton button in catToolStrip.Items)
+			foreach (IBBToolStripButton button in catToolStrip.Items)
 			{
 				button.Enabled = state;
 			}
@@ -1035,6 +1035,15 @@
 
 				dropDownItems.Add(cmd.Description, null, redoMenu_Click);
 			}
+
+			if (redoLength > 0)
+			{
+				bttnRedo.Text = commandStack.PeekRedoCommand(1).Description;
+			}
+			else
+			{
+				bttnRedo.Text = Translation.GetTranslation("bttnRedo");
+			}
 		}
 
 		private void PopulateUndoMenu()
@@ -1055,6 +1064,15 @@
 
 				dropDownItems.Add(cmd.UndoDescription, null, undoMenu_Click);
 			}
+
+			if (undoLength > 0)
+			{
+				bttnUndo.Text = commandStack.PeekUndoCommand(1).UndoDescription;
+			}
+			else
+			{
+				bttnUndo.Text = Translation.GetTranslation("bttnUndo");
+			}
 		}
 
 		private void miSaveArmy_Click(object sender, System.EventArgs e)