Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
diff FrmMainWindow.cs @ 77:68804784bf6f
Re #86: Complete initial GTK# UI
* Add About dialog
* Make sure app builds as "WarFoundry-GTK.exe"
* Move all UI components to IBBoard.WarFoundry.GUI.GTK namespace
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 18 Dec 2010 16:42:51 +0000 |
parents | 52b731576845 |
children | e63209ab2cfa |
line wrap: on
line diff
--- a/FrmMainWindow.cs Tue Nov 23 21:03:46 2010 +0000 +++ b/FrmMainWindow.cs Sat Dec 18 16:42:51 2010 +0000 @@ -3,33 +3,34 @@ // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. using System; -using System.IO; using System.Collections.Generic; using System.Configuration; +using System.IO; +using GLib; using Gtk; using IBBoard; using IBBoard.Commands; +using IBBoard.CustomMath; using IBBoard.GtkSharp; +using IBBoard.GtkSharp.Translatable; using IBBoard.IO; using IBBoard.Lang; using IBBoard.Logging; -using IBBoard.CustomMath; using IBBoard.WarFoundry.API; +using IBBoard.WarFoundry.API.Commands; using IBBoard.WarFoundry.API.Exporters; using IBBoard.WarFoundry.API.Factories; using IBBoard.WarFoundry.API.Factories.Xml; using IBBoard.WarFoundry.API.Objects; -using WFObjects = IBBoard.WarFoundry.API.Objects; -using IBBoard.WarFoundry.API.Commands; +using IBBoard.WarFoundry.API.Requirements; using IBBoard.WarFoundry.API.Savers; -using IBBoard.WarFoundry.API.Requirements; -using IBBoard.WarFoundry.GTK.Widgets; +using IBBoard.WarFoundry.GUI.GTK.Widgets; using IBBoard.WarFoundry.Plugin.Rollcall; using IBBoard.Xml; using log4net; -using GLib; +using WFObjects = IBBoard.WarFoundry.API.Objects; -namespace IBBoard.WarFoundry.GTK +namespace IBBoard.WarFoundry.GUI.GTK { public partial class FrmMainWindow: Gtk.Window { @@ -126,7 +127,7 @@ mainColumn.SetCellDataFunc(mainCell, new TreeCellDataFunc(RenderCategoryTreeObjectName)); treeUnits.Model = new TreeStore(typeof(WarFoundryObject)); logger.Debug("Loading preferences"); - Preferences = new Preferences("WarFoundryGTK"); + Preferences = new Preferences("WarFoundry-GTK"); logger.Debug("Loading translations"); try @@ -149,6 +150,7 @@ WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(OnArmyChanged); Destroyed += new EventHandler(OnWindowDestroyed); //TODO: Translate and subscribe to other events + ControlTranslator.TranslateWidget(this); UnitAddedMethod = new ObjectAddDelegate(OnUnitAdded); UnitRemovedMethod = new ObjectRemoveDelegate(OnUnitRemoved); PointsValueChangedMethod = new DoubleValChangedDelegate(OnPointsValueChanged); @@ -368,7 +370,7 @@ } while (model.IterNext(ref iter)); } - + private void RemoveUnitTab(WFObjects.Unit unit) { UnitDisplayWidget widget = DictionaryUtils.GetValue(unitToWidgetMap, unit); @@ -720,7 +722,7 @@ saveArmyButton.Sensitive = commandStack.IsDirty() && WarFoundryCore.CurrentArmy != null; miSaveArmy.Sensitive = commandStack.IsDirty() && WarFoundryCore.CurrentArmy != null; } - + private void RedoMenuActivated(object sender, EventArgs e) { if (sender is MenuItem) @@ -855,7 +857,7 @@ return SaveArmyToPath(WarFoundryCore.CurrentArmy, filePath); } - + private bool SaveArmyToPath(Army army, string filePath) { bool success = false; @@ -908,12 +910,12 @@ { if (dr == ResponseType.No) { - //They don't care about their changes + //They don't care about their changes canClose = true; } else { - //Assume cancel or close with the X button + //Assume cancel or close with the X button canClose = false; } @@ -1000,7 +1002,7 @@ ShowUnitWidget(unit); } } - + private void ShowUnitWidget(WFObjects.Unit unit) { UnitDisplayWidget widget; @@ -1090,7 +1092,7 @@ OnTreeUnitsPopupMenu(o, null); } } - + protected virtual void NotebookPageRemoved(object o, Gtk.RemovedArgs args) { Widget widget = args.Widget; @@ -1100,7 +1102,12 @@ unitToWidgetMap.Remove(((UnitDisplayWidget)widget).Unit); } } - - + + protected virtual void HelpAboutActivated(object sender, System.EventArgs e) + { + FrmAbout form = FrmAbout.GetForm(); + form.Run(); + form.Hide(); + } } }