# HG changeset patch # User IBBoard # Date 1267822494 0 # Node ID 4acfce15b222cda36a407427b081591dd05eae1b # Parent ff931ff5891cbd844bed7e38acba5d453dd0c37e Re #88: Complete initial WinForms UI * Switch to modern toolbar style ("toolstrip") and add icons Still need to add buttons for adding units diff -r ff931ff5891c -r 4acfce15b222 FrmMain.cs --- a/FrmMain.cs Sat Feb 27 21:01:52 2010 +0000 +++ b/FrmMain.cs Fri Mar 05 20:54:54 2010 +0000 @@ -43,7 +43,7 @@ private readonly ILog log = LogManager.GetLogger(typeof(FrmMain)); private CommandStack commandStack; - private ToolBarButton[] categoryButtons; + private ToolStripButton[] categoryButtons; public ObjectAddDelegate UnitAddedMethod; public ObjectRemoveDelegate UnitRemovedMethod; @@ -55,16 +55,9 @@ private Dictionary unitWindows; private System.ComponentModel.IContainer components; - private System.Windows.Forms.ToolBar toolBar; - private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy; private System.Windows.Forms.ImageList buttonIcons; - private IBBoard.Windows.Forms.IBBToolBarButton bttnSaveArmy; private System.Windows.Forms.OpenFileDialog openArmyDialog; private System.Windows.Forms.SaveFileDialog saveArmyDialog; - private IBBoard.Windows.Forms.IBBToolBarButton bttnOpenArmy; - private IBBoard.Windows.Forms.IBBToolBarButton bttnSep1; - private IBBoard.Windows.Forms.IBBToolBarButton bttnUndo; - private IBBoard.Windows.Forms.IBBToolBarButton bttnRedo; private System.Windows.Forms.MainMenu mainMenu; private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; @@ -90,6 +83,14 @@ private ToolStripMenuItem miUndo; private ToolStripMenuItem miRedo; private ToolStripMenuItem menuHelp; + private ToolStrip mainToolStrip; + private ToolStripButton bttnNewArmy; + private ToolStripButton bttnOpenArmy; + private ToolStripButton bttnSaveArmy; + private ToolStripSeparator toolStripSeparator3; + private ToolStripSplitButton bttnUndo; + private ToolStripSplitButton bttnRedo; + private ToolStripContainer toolStripContainer; private ToolStripMenuItem miAbout; /// @@ -216,18 +217,7 @@ { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); - 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.toolBar = new System.Windows.Forms.ToolBar(); - this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); - this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); - this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); - this.bttnSep1 = new IBBoard.Windows.Forms.IBBToolBarButton(); - this.bttnUndo = new IBBoard.Windows.Forms.IBBToolBarButton(); this.undoMenu = new System.Windows.Forms.ContextMenu(); - this.bttnRedo = new IBBoard.Windows.Forms.IBBToolBarButton(); this.redoMenu = new System.Windows.Forms.ContextMenu(); this.buttonIcons = new System.Windows.Forms.ImageList(this.components); this.mainMenu = new System.Windows.Forms.MainMenu(this.components); @@ -252,106 +242,27 @@ this.miRedo = new System.Windows.Forms.ToolStripMenuItem(); this.menuHelp = new System.Windows.Forms.ToolStripMenuItem(); this.miAbout = new System.Windows.Forms.ToolStripMenuItem(); + 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.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.bttnUndo = new System.Windows.Forms.ToolStripSplitButton(); + this.bttnRedo = new System.Windows.Forms.ToolStripSplitButton(); + this.toolStripContainer = new System.Windows.Forms.ToolStripContainer(); + 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.menuStrip1.SuspendLayout(); + this.mainToolStrip.SuspendLayout(); + this.toolStripContainer.TopToolStripPanel.SuspendLayout(); + this.toolStripContainer.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); - this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // - // statusBar - // - this.statusBar.Location = new System.Drawing.Point(0, 546); - 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; - // - // toolBar - // - this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; - this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { - this.bttnNewArmy, - this.bttnOpenArmy, - this.bttnSaveArmy, - this.bttnSep1, - this.bttnUndo, - this.bttnRedo}); - this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); - this.toolBar.DropDownArrows = true; - this.toolBar.ImageList = this.buttonIcons; - this.toolBar.Location = new System.Drawing.Point(0, 24); - this.toolBar.Name = "toolBar"; - this.toolBar.ShowToolTips = true; - this.toolBar.Size = new System.Drawing.Size(790, 28); - this.toolBar.TabIndex = 2; - this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); - // - // bttnNewArmy - // - this.bttnNewArmy.ImageIndex = 0; - this.bttnNewArmy.Name = "bttnNewArmy"; - // - // bttnOpenArmy - // - this.bttnOpenArmy.ImageIndex = 2; - this.bttnOpenArmy.Name = "bttnOpenArmy"; - // - // bttnSaveArmy - // - this.bttnSaveArmy.Enabled = false; - this.bttnSaveArmy.ImageIndex = 1; - this.bttnSaveArmy.Name = "bttnSaveArmy"; - // - // bttnSep1 - // - this.bttnSep1.Name = ""; - this.bttnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; - // - // bttnUndo - // - this.bttnUndo.DropDownMenu = this.undoMenu; - this.bttnUndo.Enabled = false; - this.bttnUndo.ImageIndex = 3; - this.bttnUndo.Name = "bttnUndo"; - this.bttnUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; - // - // bttnRedo - // - this.bttnRedo.DropDownMenu = this.redoMenu; - this.bttnRedo.Enabled = false; - this.bttnRedo.ImageIndex = 4; - this.bttnRedo.Name = "bttnRedo"; - this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; - // // buttonIcons // this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); @@ -444,7 +355,7 @@ // miExportArmyAsBasicHTML // this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; - this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(152, 22); + this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22); this.miExportArmyAsBasicHTML.Text = "&basic html"; this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); // @@ -493,7 +404,7 @@ // this.miUndo.Enabled = false; this.miUndo.Name = "miUndo"; - this.miUndo.Size = new System.Drawing.Size(152, 22); + this.miUndo.Size = new System.Drawing.Size(106, 22); this.miUndo.Text = "&undo"; this.miUndo.Click += new System.EventHandler(this.miUndo_Click); // @@ -501,7 +412,7 @@ // this.miRedo.Enabled = false; this.miRedo.Name = "miRedo"; - this.miRedo.Size = new System.Drawing.Size(152, 22); + this.miRedo.Size = new System.Drawing.Size(106, 22); this.miRedo.Text = "&redo"; this.miRedo.Click += new System.EventHandler(this.miRedo_Click); // @@ -516,15 +427,145 @@ // miAbout // this.miAbout.Name = "miAbout"; - this.miAbout.Size = new System.Drawing.Size(152, 22); + 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(3, 0); + this.mainToolStrip.Name = "mainToolStrip"; + this.mainToolStrip.Size = new System.Drawing.Size(151, 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 = "toolStripButton1"; + 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 = "toolStripButton2"; + 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 = "toolStripButton3"; + 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 = "toolStripSplitButton1"; + this.bttnUndo.Click += 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 = "toolStripSplitButton2"; + this.bttnRedo.Click += new System.EventHandler(this.miRedo_Click); + // + // toolStripContainer + // + this.toolStripContainer.BottomToolStripPanelVisible = false; + // + // toolStripContainer.ContentPanel + // + this.toolStripContainer.ContentPanel.Enabled = false; + this.toolStripContainer.ContentPanel.Size = new System.Drawing.Size(790, 1); + this.toolStripContainer.ContentPanel.Visible = false; + this.toolStripContainer.LeftToolStripPanelVisible = false; + this.toolStripContainer.Location = new System.Drawing.Point(0, 24); + this.toolStripContainer.Name = "toolStripContainer"; + this.toolStripContainer.RightToolStripPanelVisible = false; + this.toolStripContainer.Size = new System.Drawing.Size(790, 26); + this.toolStripContainer.TabIndex = 11; + // + // toolStripContainer.TopToolStripPanel + // + this.toolStripContainer.TopToolStripPanel.Controls.Add(this.mainToolStrip); + // + // statusBar + // + this.statusBar.Location = new System.Drawing.Point(0, 546); + 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; + // // FrmMain // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(790, 568); - this.Controls.Add(this.toolBar); + this.Controls.Add(this.toolStripContainer); this.Controls.Add(this.statusBar); this.Controls.Add(this.menuStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -534,11 +575,17 @@ this.Name = "FrmMain"; this.Text = "WarFoundry"; this.Load += new System.EventHandler(this.FrmMain_Load); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.mainToolStrip.ResumeLayout(false); + this.mainToolStrip.PerformLayout(); + this.toolStripContainer.TopToolStripPanel.ResumeLayout(false); + this.toolStripContainer.TopToolStripPanel.PerformLayout(); + this.toolStripContainer.ResumeLayout(false); + this.toolStripContainer.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); - this.menuStrip1.ResumeLayout(false); - this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -784,35 +831,6 @@ } } - private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) - { - if (e.Button == bttnUndo) - { - UndoLastAction(); - } - else if (e.Button == bttnRedo) - { - RedoAction(); - } - else if (e.Button == bttnNewArmy) - { - CreateNewArmy(); - } - else if (e.Button == bttnOpenArmy) - { - OpenArmy(); - } - else if (e.Button == bttnSaveArmy) - { - SaveCurrentArmy(); - } - else - { - //it must be one of our extra buttons for the categories - AddUnitFromCategory((Category)e.Button.Tag); - } - } - public GameSystem CurrentGameSystem { get { return WarFoundryCore.CurrentGameSystem; } @@ -946,7 +964,7 @@ { for (int i = 0; i 835, 17 + + 17, 54 + diff -r ff931ff5891c -r 4acfce15b222 IBBoard.WarFoundry.GUI.WinForms.csproj --- a/IBBoard.WarFoundry.GUI.WinForms.csproj Sat Feb 27 21:01:52 2010 +0000 +++ b/IBBoard.WarFoundry.GUI.WinForms.csproj Fri Mar 05 20:54:54 2010 +0000 @@ -108,6 +108,12 @@ + + + + + + PreserveNewest @@ -145,6 +151,11 @@ Form + + True + True + Resources.resx + UserControl @@ -189,6 +200,11 @@ FrmUnit.cs Designer + + Designer + ResXFileCodeGenerator + Resources.Designer.cs + Designer EquipmentAmountControl.cs diff -r ff931ff5891c -r 4acfce15b222 icons/document-new.png Binary file icons/document-new.png has changed diff -r ff931ff5891c -r 4acfce15b222 icons/document-open.png Binary file icons/document-open.png has changed diff -r ff931ff5891c -r 4acfce15b222 icons/document-save.png Binary file icons/document-save.png has changed diff -r ff931ff5891c -r 4acfce15b222 icons/edit-redo.png Binary file icons/edit-redo.png has changed diff -r ff931ff5891c -r 4acfce15b222 icons/edit-undo.png Binary file icons/edit-undo.png has changed diff -r ff931ff5891c -r 4acfce15b222 icons/list-add.png Binary file icons/list-add.png has changed