comparison FrmMain.cs @ 124:4acfce15b222

Re #88: Complete initial WinForms UI * Switch to modern toolbar style ("toolstrip") and add icons Still need to add buttons for adding units
author IBBoard <dev@ibboard.co.uk>
date Fri, 05 Mar 2010 20:54:54 +0000
parents ff931ff5891c
children 25c989ef2a8d
comparison
equal deleted inserted replaced
123:ff931ff5891c 124:4acfce15b222
41 41
42 private Preferences preferences; 42 private Preferences preferences;
43 private readonly ILog log = LogManager.GetLogger(typeof(FrmMain)); 43 private readonly ILog log = LogManager.GetLogger(typeof(FrmMain));
44 44
45 private CommandStack commandStack; 45 private CommandStack commandStack;
46 private ToolBarButton[] categoryButtons; 46 private ToolStripButton[] categoryButtons;
47 47
48 public ObjectAddDelegate UnitAddedMethod; 48 public ObjectAddDelegate UnitAddedMethod;
49 public ObjectRemoveDelegate UnitRemovedMethod; 49 public ObjectRemoveDelegate UnitRemovedMethod;
50 public DoubleValChangedDelegate PointsValueChangedMethod; 50 public DoubleValChangedDelegate PointsValueChangedMethod;
51 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; 51 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod;
53 private FrmArmyTree armyTree; 53 private FrmArmyTree armyTree;
54 private string loadedFilePath; 54 private string loadedFilePath;
55 private Dictionary<string, FrmUnit> unitWindows; 55 private Dictionary<string, FrmUnit> unitWindows;
56 56
57 private System.ComponentModel.IContainer components; 57 private System.ComponentModel.IContainer components;
58 private System.Windows.Forms.ToolBar toolBar;
59 private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy;
60 private System.Windows.Forms.ImageList buttonIcons; 58 private System.Windows.Forms.ImageList buttonIcons;
61 private IBBoard.Windows.Forms.IBBToolBarButton bttnSaveArmy;
62 private System.Windows.Forms.OpenFileDialog openArmyDialog; 59 private System.Windows.Forms.OpenFileDialog openArmyDialog;
63 private System.Windows.Forms.SaveFileDialog saveArmyDialog; 60 private System.Windows.Forms.SaveFileDialog saveArmyDialog;
64 private IBBoard.Windows.Forms.IBBToolBarButton bttnOpenArmy;
65 private IBBoard.Windows.Forms.IBBToolBarButton bttnSep1;
66 private IBBoard.Windows.Forms.IBBToolBarButton bttnUndo;
67 private IBBoard.Windows.Forms.IBBToolBarButton bttnRedo;
68 private System.Windows.Forms.MainMenu mainMenu; 61 private System.Windows.Forms.MainMenu mainMenu;
69 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; 62 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel;
70 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; 63 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel;
71 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; 64 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel;
72 private System.Windows.Forms.ContextMenu undoMenu; 65 private System.Windows.Forms.ContextMenu undoMenu;
88 private ToolStripMenuItem miExit; 81 private ToolStripMenuItem miExit;
89 private ToolStripMenuItem menuEdit; 82 private ToolStripMenuItem menuEdit;
90 private ToolStripMenuItem miUndo; 83 private ToolStripMenuItem miUndo;
91 private ToolStripMenuItem miRedo; 84 private ToolStripMenuItem miRedo;
92 private ToolStripMenuItem menuHelp; 85 private ToolStripMenuItem menuHelp;
86 private ToolStrip mainToolStrip;
87 private ToolStripButton bttnNewArmy;
88 private ToolStripButton bttnOpenArmy;
89 private ToolStripButton bttnSaveArmy;
90 private ToolStripSeparator toolStripSeparator3;
91 private ToolStripSplitButton bttnUndo;
92 private ToolStripSplitButton bttnRedo;
93 private ToolStripContainer toolStripContainer;
93 private ToolStripMenuItem miAbout; 94 private ToolStripMenuItem miAbout;
94 95
95 /// <summary> 96 /// <summary>
96 /// The main entry point for the application. 97 /// The main entry point for the application.
97 /// </summary> 98 /// </summary>
214 /// </summary> 215 /// </summary>
215 private void InitializeComponent() 216 private void InitializeComponent()
216 { 217 {
217 this.components = new System.ComponentModel.Container(); 218 this.components = new System.ComponentModel.Container();
218 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); 219 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
219 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
220 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
221 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
222 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
223 this.toolBar = new System.Windows.Forms.ToolBar();
224 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
225 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
226 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolBarButton();
227 this.bttnSep1 = new IBBoard.Windows.Forms.IBBToolBarButton();
228 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolBarButton();
229 this.undoMenu = new System.Windows.Forms.ContextMenu(); 220 this.undoMenu = new System.Windows.Forms.ContextMenu();
230 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolBarButton();
231 this.redoMenu = new System.Windows.Forms.ContextMenu(); 221 this.redoMenu = new System.Windows.Forms.ContextMenu();
232 this.buttonIcons = new System.Windows.Forms.ImageList(this.components); 222 this.buttonIcons = new System.Windows.Forms.ImageList(this.components);
233 this.mainMenu = new System.Windows.Forms.MainMenu(this.components); 223 this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
234 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); 224 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog();
235 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); 225 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog();
250 this.menuEdit = new System.Windows.Forms.ToolStripMenuItem(); 240 this.menuEdit = new System.Windows.Forms.ToolStripMenuItem();
251 this.miUndo = new System.Windows.Forms.ToolStripMenuItem(); 241 this.miUndo = new System.Windows.Forms.ToolStripMenuItem();
252 this.miRedo = new System.Windows.Forms.ToolStripMenuItem(); 242 this.miRedo = new System.Windows.Forms.ToolStripMenuItem();
253 this.menuHelp = new System.Windows.Forms.ToolStripMenuItem(); 243 this.menuHelp = new System.Windows.Forms.ToolStripMenuItem();
254 this.miAbout = new System.Windows.Forms.ToolStripMenuItem(); 244 this.miAbout = new System.Windows.Forms.ToolStripMenuItem();
245 this.mainToolStrip = new System.Windows.Forms.ToolStrip();
246 this.bttnNewArmy = new System.Windows.Forms.ToolStripButton();
247 this.bttnOpenArmy = new System.Windows.Forms.ToolStripButton();
248 this.bttnSaveArmy = new System.Windows.Forms.ToolStripButton();
249 this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
250 this.bttnUndo = new System.Windows.Forms.ToolStripSplitButton();
251 this.bttnRedo = new System.Windows.Forms.ToolStripSplitButton();
252 this.toolStripContainer = new System.Windows.Forms.ToolStripContainer();
253 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
254 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
255 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
256 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
257 this.menuStrip1.SuspendLayout();
258 this.mainToolStrip.SuspendLayout();
259 this.toolStripContainer.TopToolStripPanel.SuspendLayout();
260 this.toolStripContainer.SuspendLayout();
255 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); 261 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit();
256 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); 262 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit();
257 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); 263 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit();
258 this.menuStrip1.SuspendLayout();
259 this.SuspendLayout(); 264 this.SuspendLayout();
260 //
261 // statusBar
262 //
263 this.statusBar.Location = new System.Drawing.Point(0, 546);
264 this.statusBar.Name = "statusBar";
265 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
266 this.sbMainPanel,
267 this.sbErrorPanel,
268 this.sbPointsPanel});
269 this.statusBar.ShowPanels = true;
270 this.statusBar.Size = new System.Drawing.Size(790, 22);
271 this.statusBar.TabIndex = 1;
272 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick);
273 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem);
274 //
275 // sbMainPanel
276 //
277 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
278 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
279 this.sbMainPanel.Name = "sbMainPanel";
280 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
281 this.sbMainPanel.Width = 473;
282 //
283 // sbErrorPanel
284 //
285 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
286 this.sbErrorPanel.Name = "sbErrorPanel";
287 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
288 this.sbErrorPanel.Width = 150;
289 //
290 // sbPointsPanel
291 //
292 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
293 this.sbPointsPanel.Name = "sbPointsPanel";
294 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
295 this.sbPointsPanel.ToolTipText = "current points total";
296 this.sbPointsPanel.Width = 150;
297 //
298 // toolBar
299 //
300 this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
301 this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
302 this.bttnNewArmy,
303 this.bttnOpenArmy,
304 this.bttnSaveArmy,
305 this.bttnSep1,
306 this.bttnUndo,
307 this.bttnRedo});
308 this.toolBar.ButtonSize = new System.Drawing.Size(16, 16);
309 this.toolBar.DropDownArrows = true;
310 this.toolBar.ImageList = this.buttonIcons;
311 this.toolBar.Location = new System.Drawing.Point(0, 24);
312 this.toolBar.Name = "toolBar";
313 this.toolBar.ShowToolTips = true;
314 this.toolBar.Size = new System.Drawing.Size(790, 28);
315 this.toolBar.TabIndex = 2;
316 this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
317 //
318 // bttnNewArmy
319 //
320 this.bttnNewArmy.ImageIndex = 0;
321 this.bttnNewArmy.Name = "bttnNewArmy";
322 //
323 // bttnOpenArmy
324 //
325 this.bttnOpenArmy.ImageIndex = 2;
326 this.bttnOpenArmy.Name = "bttnOpenArmy";
327 //
328 // bttnSaveArmy
329 //
330 this.bttnSaveArmy.Enabled = false;
331 this.bttnSaveArmy.ImageIndex = 1;
332 this.bttnSaveArmy.Name = "bttnSaveArmy";
333 //
334 // bttnSep1
335 //
336 this.bttnSep1.Name = "";
337 this.bttnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
338 //
339 // bttnUndo
340 //
341 this.bttnUndo.DropDownMenu = this.undoMenu;
342 this.bttnUndo.Enabled = false;
343 this.bttnUndo.ImageIndex = 3;
344 this.bttnUndo.Name = "bttnUndo";
345 this.bttnUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
346 //
347 // bttnRedo
348 //
349 this.bttnRedo.DropDownMenu = this.redoMenu;
350 this.bttnRedo.Enabled = false;
351 this.bttnRedo.ImageIndex = 4;
352 this.bttnRedo.Name = "bttnRedo";
353 this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton;
354 // 265 //
355 // buttonIcons 266 // buttonIcons
356 // 267 //
357 this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); 268 this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream")));
358 this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent; 269 this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent;
442 this.miExportArmyAs.Text = "export army as..."; 353 this.miExportArmyAs.Text = "export army as...";
443 // 354 //
444 // miExportArmyAsBasicHTML 355 // miExportArmyAsBasicHTML
445 // 356 //
446 this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML"; 357 this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML";
447 this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(152, 22); 358 this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22);
448 this.miExportArmyAsBasicHTML.Text = "&basic html"; 359 this.miExportArmyAsBasicHTML.Text = "&basic html";
449 this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click); 360 this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click);
450 // 361 //
451 // miCloseArmy 362 // miCloseArmy
452 // 363 //
491 // 402 //
492 // miUndo 403 // miUndo
493 // 404 //
494 this.miUndo.Enabled = false; 405 this.miUndo.Enabled = false;
495 this.miUndo.Name = "miUndo"; 406 this.miUndo.Name = "miUndo";
496 this.miUndo.Size = new System.Drawing.Size(152, 22); 407 this.miUndo.Size = new System.Drawing.Size(106, 22);
497 this.miUndo.Text = "&undo"; 408 this.miUndo.Text = "&undo";
498 this.miUndo.Click += new System.EventHandler(this.miUndo_Click); 409 this.miUndo.Click += new System.EventHandler(this.miUndo_Click);
499 // 410 //
500 // miRedo 411 // miRedo
501 // 412 //
502 this.miRedo.Enabled = false; 413 this.miRedo.Enabled = false;
503 this.miRedo.Name = "miRedo"; 414 this.miRedo.Name = "miRedo";
504 this.miRedo.Size = new System.Drawing.Size(152, 22); 415 this.miRedo.Size = new System.Drawing.Size(106, 22);
505 this.miRedo.Text = "&redo"; 416 this.miRedo.Text = "&redo";
506 this.miRedo.Click += new System.EventHandler(this.miRedo_Click); 417 this.miRedo.Click += new System.EventHandler(this.miRedo_Click);
507 // 418 //
508 // menuHelp 419 // menuHelp
509 // 420 //
514 this.menuHelp.Text = "&help"; 425 this.menuHelp.Text = "&help";
515 // 426 //
516 // miAbout 427 // miAbout
517 // 428 //
518 this.miAbout.Name = "miAbout"; 429 this.miAbout.Name = "miAbout";
519 this.miAbout.Size = new System.Drawing.Size(152, 22); 430 this.miAbout.Size = new System.Drawing.Size(109, 22);
520 this.miAbout.Text = "&about"; 431 this.miAbout.Text = "&about";
521 this.miAbout.Click += new System.EventHandler(this.miAbout_Click); 432 this.miAbout.Click += new System.EventHandler(this.miAbout_Click);
522 // 433 //
434 // mainToolStrip
435 //
436 this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None;
437 this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
438 this.bttnNewArmy,
439 this.bttnOpenArmy,
440 this.bttnSaveArmy,
441 this.toolStripSeparator3,
442 this.bttnUndo,
443 this.bttnRedo});
444 this.mainToolStrip.Location = new System.Drawing.Point(3, 0);
445 this.mainToolStrip.Name = "mainToolStrip";
446 this.mainToolStrip.Size = new System.Drawing.Size(151, 25);
447 this.mainToolStrip.TabIndex = 8;
448 //
449 // bttnNewArmy
450 //
451 this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
452 this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new;
453 this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
454 this.bttnNewArmy.Name = "bttnNewArmy";
455 this.bttnNewArmy.Size = new System.Drawing.Size(23, 22);
456 this.bttnNewArmy.Text = "toolStripButton1";
457 this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
458 //
459 // bttnOpenArmy
460 //
461 this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
462 this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open;
463 this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
464 this.bttnOpenArmy.Name = "bttnOpenArmy";
465 this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22);
466 this.bttnOpenArmy.Text = "toolStripButton2";
467 this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
468 //
469 // bttnSaveArmy
470 //
471 this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
472 this.bttnSaveArmy.Enabled = false;
473 this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save;
474 this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
475 this.bttnSaveArmy.Name = "bttnSaveArmy";
476 this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22);
477 this.bttnSaveArmy.Text = "toolStripButton3";
478 this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
479 //
480 // toolStripSeparator3
481 //
482 this.toolStripSeparator3.Name = "toolStripSeparator3";
483 this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
484 //
485 // bttnUndo
486 //
487 this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
488 this.bttnUndo.Enabled = false;
489 this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo;
490 this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta;
491 this.bttnUndo.Name = "bttnUndo";
492 this.bttnUndo.Size = new System.Drawing.Size(32, 22);
493 this.bttnUndo.Text = "toolStripSplitButton1";
494 this.bttnUndo.Click += new System.EventHandler(this.miUndo_Click);
495 //
496 // bttnRedo
497 //
498 this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
499 this.bttnRedo.Enabled = false;
500 this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo;
501 this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta;
502 this.bttnRedo.Name = "bttnRedo";
503 this.bttnRedo.Size = new System.Drawing.Size(32, 22);
504 this.bttnRedo.Text = "toolStripSplitButton2";
505 this.bttnRedo.Click += new System.EventHandler(this.miRedo_Click);
506 //
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);
526 //
527 // statusBar
528 //
529 this.statusBar.Location = new System.Drawing.Point(0, 546);
530 this.statusBar.Name = "statusBar";
531 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
532 this.sbMainPanel,
533 this.sbErrorPanel,
534 this.sbPointsPanel});
535 this.statusBar.ShowPanels = true;
536 this.statusBar.Size = new System.Drawing.Size(790, 22);
537 this.statusBar.TabIndex = 1;
538 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick);
539 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem);
540 //
541 // sbMainPanel
542 //
543 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
544 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
545 this.sbMainPanel.Name = "sbMainPanel";
546 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
547 this.sbMainPanel.Width = 473;
548 //
549 // sbErrorPanel
550 //
551 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
552 this.sbErrorPanel.Name = "sbErrorPanel";
553 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
554 this.sbErrorPanel.Width = 150;
555 //
556 // sbPointsPanel
557 //
558 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
559 this.sbPointsPanel.Name = "sbPointsPanel";
560 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
561 this.sbPointsPanel.ToolTipText = "current points total";
562 this.sbPointsPanel.Width = 150;
563 //
523 // FrmMain 564 // FrmMain
524 // 565 //
525 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); 566 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
526 this.ClientSize = new System.Drawing.Size(790, 568); 567 this.ClientSize = new System.Drawing.Size(790, 568);
527 this.Controls.Add(this.toolBar); 568 this.Controls.Add(this.toolStripContainer);
528 this.Controls.Add(this.statusBar); 569 this.Controls.Add(this.statusBar);
529 this.Controls.Add(this.menuStrip1); 570 this.Controls.Add(this.menuStrip1);
530 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 571 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
531 this.IsMdiContainer = true; 572 this.IsMdiContainer = true;
532 this.MainMenuStrip = this.menuStrip1; 573 this.MainMenuStrip = this.menuStrip1;
533 this.Menu = this.mainMenu; 574 this.Menu = this.mainMenu;
534 this.Name = "FrmMain"; 575 this.Name = "FrmMain";
535 this.Text = "WarFoundry"; 576 this.Text = "WarFoundry";
536 this.Load += new System.EventHandler(this.FrmMain_Load); 577 this.Load += new System.EventHandler(this.FrmMain_Load);
578 this.menuStrip1.ResumeLayout(false);
579 this.menuStrip1.PerformLayout();
580 this.mainToolStrip.ResumeLayout(false);
581 this.mainToolStrip.PerformLayout();
582 this.toolStripContainer.TopToolStripPanel.ResumeLayout(false);
583 this.toolStripContainer.TopToolStripPanel.PerformLayout();
584 this.toolStripContainer.ResumeLayout(false);
585 this.toolStripContainer.PerformLayout();
537 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); 586 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit();
538 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); 587 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit();
539 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); 588 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit();
540 this.menuStrip1.ResumeLayout(false);
541 this.menuStrip1.PerformLayout();
542 this.ResumeLayout(false); 589 this.ResumeLayout(false);
543 this.PerformLayout(); 590 this.PerformLayout();
544 591
545 } 592 }
546 #endregion 593 #endregion
782 { 829 {
783 return null; 830 return null;
784 } 831 }
785 } 832 }
786 833
787 private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
788 {
789 if (e.Button == bttnUndo)
790 {
791 UndoLastAction();
792 }
793 else if (e.Button == bttnRedo)
794 {
795 RedoAction();
796 }
797 else if (e.Button == bttnNewArmy)
798 {
799 CreateNewArmy();
800 }
801 else if (e.Button == bttnOpenArmy)
802 {
803 OpenArmy();
804 }
805 else if (e.Button == bttnSaveArmy)
806 {
807 SaveCurrentArmy();
808 }
809 else
810 {
811 //it must be one of our extra buttons for the categories
812 AddUnitFromCategory((Category)e.Button.Tag);
813 }
814 }
815
816 public GameSystem CurrentGameSystem 834 public GameSystem CurrentGameSystem
817 { 835 {
818 get { return WarFoundryCore.CurrentGameSystem; } 836 get { return WarFoundryCore.CurrentGameSystem; }
819 set { WarFoundryCore.CurrentGameSystem = value; } 837 set { WarFoundryCore.CurrentGameSystem = value; }
820 } 838 }
944 { 962 {
945 if (categoryButtons!=null) 963 if (categoryButtons!=null)
946 { 964 {
947 for (int i = 0; i<categoryButtons.Length; i++) 965 for (int i = 0; i<categoryButtons.Length; i++)
948 { 966 {
949 this.Invoke(new ToolBarButtonDelegate(toolBar.Buttons.Remove), new object[]{categoryButtons[i]}); 967 //this.Invoke(new ToolBarButtonDelegate(toolBar.Buttons.Remove), new object[]{categoryButtons[i]});
950 } 968 }
951 } 969 }
952 } 970 }
953 971
954 private void AddCategoryButtons(Category[] cats) 972 private void AddCategoryButtons(Category[] cats)
955 { 973 {
956 int catCount = cats.Length; 974 int catCount = cats.Length;
957 Category cat; 975 Category cat;
958 categoryButtons = new ToolBarButton[catCount + 1]; 976 categoryButtons = new ToolStripButton[catCount + 1];
959 977
960 ToolBarButton sep = new ToolBarButton(); 978 ToolStripButton button;
961 sep.Style = ToolBarButtonStyle.Separator;
962 categoryButtons[0] = sep;
963
964 IBBToolBarButton button;
965 979
966 for (int i = 0; i < catCount; i++) 980 for (int i = 0; i < catCount; i++)
967 { 981 {
968 cat = cats[i]; 982 cat = cats[i];
969 button = new IBBToolBarButton(); 983 button = new ToolStripButton();
970 button.Text = cat.Name; 984 button.Text = cat.Name;
971 button.Tag = cat; 985 button.Tag = cat;
972 button.ImageIndex = 6; 986 //button.ImageIndex = 6;
973 button.Enabled = false; 987 button.Enabled = false;
974 categoryButtons[i + 1] = button; 988 categoryButtons[i] = button;
975 } 989 }
976 990
977 this.Invoke(new ToolBarButtonRangeDelegate(toolBar.Buttons.AddRange), new object[] { categoryButtons }); 991 //TODO: add buttons to ToolStrip in toolStripContainer.TopToolStrip
992 //this.Invoke(new ToolBarButtonRangeDelegate(toolBar.Buttons.AddRange), new object[] { categoryButtons });
978 } 993 }
979 994
980 private void EnableCategoryButtons() 995 private void EnableCategoryButtons()
981 { 996 {
982 SetCategoryButtonState(true); 997 SetCategoryButtonState(true);