Changeset 511

Show
Ignore:
Timestamp:
03/06/10 11:33:28 (6 months ago)
Author:
ibboard
Message:

Re #88: Complete initial WinForms UI

  • Swap ToolStripContainer for ToolStripPanel to work with MDI
  • Populate category/unit creation tool strip

Still needs work to make sure that cat/unit strip ends up after the main strip

Location:
IBBoard.WarFoundry.GUI.WinForms/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • IBBoard.WarFoundry.GUI.WinForms/trunk/FrmMain.cs

    r507 r511  
    6767        private IBBoard.Windows.Forms.ColorableStatusBar statusBar; 
    6868        private System.Windows.Forms.Timer statusBarTimer; 
    69         private MenuStrip menuStrip1; 
     69        private MenuStrip menuStrip; 
    7070        private ToolStripMenuItem menuFile; 
    7171        private ToolStripMenuItem miNewArmy; 
     
    9191        private ToolStripSplitButton bttnUndo; 
    9292        private ToolStripSplitButton bttnRedo; 
    93         private ToolStripContainer toolStripContainer; 
     93        private ToolStrip catToolStrip; 
     94        private ToolStripPanel toolStripPanel; 
    9495        private ToolStripMenuItem miAbout; 
    9596 
     
    120121 
    121122            InitializeComponent(); 
     123            toolStripPanel.Join(mainToolStrip, 0, 0); 
     124            toolStripPanel.Join(catToolStrip, 1, 0); 
    122125 
    123126            Preferences = new Preferences("WarFoundry"); 
     
    131134                MessageBox.Show(this, "Translation loading failed for language " + Preferences["language"].ToString(), "Translation failure", MessageBoxButtons.OK, MessageBoxIcon.Error); 
    132135            } 
    133  
    134             //pnlRight.Left = ClientSize.Width - pnlRight.Width - 2; 
    135             //pnlRight.Top = toolBar.Height + 5; 
    136             //pnlRight.Height = ClientRectangle.Bottom - statusBar.Height - pnlRight.Top - 3; 
    137136 
    138137            ControlTranslator.TranslateControls(Controls); 
     
    225224            this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); 
    226225            this.statusBarTimer = new System.Windows.Forms.Timer(this.components); 
    227             this.menuStrip1 = new System.Windows.Forms.MenuStrip(); 
     226            this.menuStrip = new System.Windows.Forms.MenuStrip(); 
    228227            this.menuFile = new System.Windows.Forms.ToolStripMenuItem(); 
    229228            this.miNewArmy = new System.Windows.Forms.ToolStripMenuItem(); 
     
    250249            this.bttnUndo = new System.Windows.Forms.ToolStripSplitButton(); 
    251250            this.bttnRedo = new System.Windows.Forms.ToolStripSplitButton(); 
    252             this.toolStripContainer = new System.Windows.Forms.ToolStripContainer(); 
     251            this.catToolStrip = new System.Windows.Forms.ToolStrip(); 
    253252            this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); 
    254253            this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); 
    255254            this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); 
    256255            this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); 
    257             this.menuStrip1.SuspendLayout(); 
     256            this.toolStripPanel = new System.Windows.Forms.ToolStripPanel(); 
     257            this.menuStrip.SuspendLayout(); 
    258258            this.mainToolStrip.SuspendLayout(); 
    259             this.toolStripContainer.TopToolStripPanel.SuspendLayout(); 
    260             this.toolStripContainer.SuspendLayout(); 
    261             ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); 
    262             ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); 
    263             ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); 
     259            ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).BeginInit(); 
     260            ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).BeginInit(); 
     261            ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).BeginInit(); 
    264262            this.SuspendLayout(); 
    265263            //  
    266264            // buttonIcons 
    267265            //  
    268             this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); 
     266            this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer) (resources.GetObject("buttonIcons.ImageStream"))); 
    269267            this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent; 
    270268            this.buttonIcons.Images.SetKeyName(0, ""); 
     
    285283            this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick); 
    286284            //  
    287             // menuStrip1 
    288             //  
    289             this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 
     285            // menuStrip 
     286            //  
     287            this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 
    290288            this.menuFile, 
    291289            this.menuEdit, 
    292290            this.menuHelp}); 
    293             this.menuStrip1.Location = new System.Drawing.Point(0, 0); 
    294             this.menuStrip1.Name = "menuStrip1"; 
    295             this.menuStrip1.Size = new System.Drawing.Size(790, 24); 
    296             this.menuStrip1.TabIndex = 6; 
    297             this.menuStrip1.Text = "menuStrip1"; 
     291            this.menuStrip.Location = new System.Drawing.Point(0, 0); 
     292            this.menuStrip.Name = "menuStrip"; 
     293            this.menuStrip.Size = new System.Drawing.Size(790, 24); 
     294            this.menuStrip.TabIndex = 6; 
     295            this.menuStrip.Text = "menuStrip1"; 
    298296            //  
    299297            // menuFile 
     
    442440            this.bttnUndo, 
    443441            this.bttnRedo}); 
    444             this.mainToolStrip.Location = new System.Drawing.Point(3, 0); 
     442            this.mainToolStrip.Location = new System.Drawing.Point(0, 24); 
    445443            this.mainToolStrip.Name = "mainToolStrip"; 
    446             this.mainToolStrip.Size = new System.Drawing.Size(151, 25); 
     444            this.mainToolStrip.Size = new System.Drawing.Size(182, 25); 
    447445            this.mainToolStrip.TabIndex = 8; 
    448446            //  
     
    454452            this.bttnNewArmy.Name = "bttnNewArmy"; 
    455453            this.bttnNewArmy.Size = new System.Drawing.Size(23, 22); 
    456             this.bttnNewArmy.Text = "toolStripButton1"; 
     454            this.bttnNewArmy.Text = "new army"; 
    457455            this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); 
    458456            //  
     
    464462            this.bttnOpenArmy.Name = "bttnOpenArmy"; 
    465463            this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22); 
    466             this.bttnOpenArmy.Text = "toolStripButton2"; 
     464            this.bttnOpenArmy.Text = "open army"; 
    467465            this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); 
    468466            //  
     
    475473            this.bttnSaveArmy.Name = "bttnSaveArmy"; 
    476474            this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22); 
    477             this.bttnSaveArmy.Text = "toolStripButton3"; 
     475            this.bttnSaveArmy.Text = "save army"; 
    478476            this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); 
    479477            //  
     
    481479            //  
    482480            this.toolStripSeparator3.Name = "toolStripSeparator3"; 
    483             this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); 
     481            this.toolStripSeparator3.Size = new System.Drawing.Size(6, 23); 
    484482            //  
    485483            // bttnUndo 
     
    491489            this.bttnUndo.Name = "bttnUndo"; 
    492490            this.bttnUndo.Size = new System.Drawing.Size(32, 22); 
    493             this.bttnUndo.Text = "toolStripSplitButton1"; 
     491            this.bttnUndo.Text = "undo"; 
    494492            this.bttnUndo.Click += new System.EventHandler(this.miUndo_Click); 
    495493            //  
     
    502500            this.bttnRedo.Name = "bttnRedo"; 
    503501            this.bttnRedo.Size = new System.Drawing.Size(32, 22); 
    504             this.bttnRedo.Text = "toolStripSplitButton2"; 
     502            this.bttnRedo.Text = "redo"; 
    505503            this.bttnRedo.Click += new System.EventHandler(this.miRedo_Click); 
    506504            //  
    507             // toolStripContainer 
    508             //  
    509             this.toolStripContainer.BottomToolStripPanelVisible = false; 
    510             //  
    511             // toolStripContainer.ContentPanel 
    512             //  
    513             this.toolStripContainer.ContentPanel.Enabled = false; 
    514             this.toolStripContainer.ContentPanel.Size = new System.Drawing.Size(790, 1); 
    515             this.toolStripContainer.ContentPanel.Visible = false; 
    516             this.toolStripContainer.LeftToolStripPanelVisible = false; 
    517             this.toolStripContainer.Location = new System.Drawing.Point(0, 24); 
    518             this.toolStripContainer.Name = "toolStripContainer"; 
    519             this.toolStripContainer.RightToolStripPanelVisible = false; 
    520             this.toolStripContainer.Size = new System.Drawing.Size(790, 26); 
    521             this.toolStripContainer.TabIndex = 11; 
    522             //  
    523             // toolStripContainer.TopToolStripPanel 
    524             //  
    525             this.toolStripContainer.TopToolStripPanel.Controls.Add(this.mainToolStrip); 
     505            // catToolStrip 
     506            //  
     507            this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None; 
     508            this.catToolStrip.Location = new System.Drawing.Point(161, 24); 
     509            this.catToolStrip.Name = "catToolStrip"; 
     510            this.catToolStrip.Size = new System.Drawing.Size(111, 25); 
     511            this.catToolStrip.TabIndex = 9; 
     512            this.catToolStrip.Visible = false; 
    526513            //  
    527514            // statusBar 
     
    562549            this.sbPointsPanel.Width = 150; 
    563550            //  
     551            // toolStripPanel 
     552            //  
     553            this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top; 
     554            this.toolStripPanel.Location = new System.Drawing.Point(0, 24); 
     555            this.toolStripPanel.Name = "toolStripPanel"; 
     556            this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal; 
     557            this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0); 
     558            this.toolStripPanel.Size = new System.Drawing.Size(790, 0); 
     559            //  
    564560            // FrmMain 
    565561            //  
    566562            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 
    567563            this.ClientSize = new System.Drawing.Size(790, 568); 
    568             this.Controls.Add(this.toolStripContainer); 
     564            this.Controls.Add(this.mainToolStrip); 
     565            this.Controls.Add(this.toolStripPanel); 
     566            this.Controls.Add(this.catToolStrip); 
    569567            this.Controls.Add(this.statusBar); 
    570             this.Controls.Add(this.menuStrip1); 
    571             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 
     568            this.Controls.Add(this.menuStrip); 
     569            this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon"))); 
    572570            this.IsMdiContainer = true; 
    573             this.MainMenuStrip = this.menuStrip1; 
     571            this.MainMenuStrip = this.menuStrip; 
    574572            this.Menu = this.mainMenu; 
    575573            this.Name = "FrmMain"; 
    576574            this.Text = "WarFoundry"; 
    577575            this.Load += new System.EventHandler(this.FrmMain_Load); 
    578             this.menuStrip1.ResumeLayout(false); 
    579             this.menuStrip1.PerformLayout(); 
     576            this.menuStrip.ResumeLayout(false); 
     577            this.menuStrip.PerformLayout(); 
    580578            this.mainToolStrip.ResumeLayout(false); 
    581579            this.mainToolStrip.PerformLayout(); 
    582             this.toolStripContainer.TopToolStripPanel.ResumeLayout(false); 
    583             this.toolStripContainer.TopToolStripPanel.PerformLayout(); 
    584             this.toolStripContainer.ResumeLayout(false); 
    585             this.toolStripContainer.PerformLayout(); 
    586             ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); 
    587             ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); 
    588             ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); 
     580            ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).EndInit(); 
     581            ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).EndInit(); 
     582            ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).EndInit(); 
    589583            this.ResumeLayout(false); 
    590584            this.PerformLayout(); 
     
    963957            if (categoryButtons!=null) 
    964958            { 
    965                 for (int i = 0; i<categoryButtons.Length; i++) 
    966                 { 
    967                     //this.Invoke(new ToolBarButtonDelegate(toolBar.Buttons.Remove), new object[]{categoryButtons[i]}); 
    968                 } 
     959                this.Invoke(new MethodInvoker(catToolStrip.Items.Clear)); 
    969960            } 
    970961        } 
     
    974965            int catCount = cats.Length; 
    975966            Category cat; 
    976             categoryButtons = new ToolStripButton[catCount + 1]; 
     967            categoryButtons = new ToolStripButton[catCount]; 
    977968 
    978969            ToolStripButton button; 
     
    984975                button.Text = cat.Name; 
    985976                button.Tag = cat; 
    986                 //button.ImageIndex = 6; 
     977                button.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.list_add; 
    987978                button.Enabled = false; 
    988979                categoryButtons[i] = button; 
    989980            } 
    990981 
    991             //TODO: add buttons to ToolStrip in toolStripContainer.TopToolStrip 
    992             //this.Invoke(new ToolBarButtonRangeDelegate(toolBar.Buttons.AddRange), new object[] { categoryButtons }); 
     982            this.Invoke(new ArrayMethodInvoker<ToolStripButton>(catToolStrip.Items.AddRange), new object[]{ categoryButtons }); 
    993983        } 
    994984 
    995985        private void EnableCategoryButtons() 
    996986        { 
     987            catToolStrip.Visible = true; 
    997988            SetCategoryButtonState(true); 
    998989        } 
     
    1000991        private void DisableCategoryButtons() 
    1001992        { 
     993            catToolStrip.Visible = false; 
    1002994            SetCategoryButtonState(false); 
    1003995        } 
  • IBBoard.WarFoundry.GUI.WinForms/trunk/FrmMain.resx

    r507 r511  
    253253    <value>707, 17</value> 
    254254  </metadata> 
    255   <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
     255  <metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
    256256    <value>835, 17</value> 
    257257  </metadata> 
    258258  <metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
    259259    <value>17, 54</value> 
     260  </metadata> 
     261  <metadata name="catToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 
     262    <value>138, 54</value> 
    260263  </metadata> 
    261264  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />