changeset 43:4e127ce8682f

Re #86: Complete initial GTK# UI * Keep UI tidier by hiding category tree until we have an army * Implement reloading files
author IBBoard <dev@ibboard.co.uk>
date Wed, 11 Aug 2010 19:23:43 +0000
parents 35ad26ac59c0
children 44e6833bb41a
files FrmMainWindow.cs gtk-gui/IBBoard.WarFoundry.GTK.FrmMainWindow.cs gtk-gui/gui.stetic
diffstat 3 files changed, 20 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/FrmMainWindow.cs	Wed Aug 11 19:11:00 2010 +0000
+++ b/FrmMainWindow.cs	Wed Aug 11 19:23:43 2010 +0000
@@ -369,6 +369,7 @@
 
 		protected virtual void OnReloadFilesActivated(object sender, System.EventArgs e)
 		{
+			WarFoundryLoader.GetDefault().LoadFiles();
 		}
 
 		protected virtual void OnSaveArmyAsActivated(object sender, System.EventArgs e)
@@ -455,12 +456,12 @@
 			SetAppTitle();
 			SetArmyTree(newArmy);
 
-			if (oldArmy!=null)
+			if (oldArmy != null)
 			{
-				oldArmy.UnitAdded-= UnitAddedMethod;
-				oldArmy.UnitRemoved-= UnitRemovedMethod;
-				oldArmy.PointsValueChanged-= PointsValueChangedMethod;
-				oldArmy.FailedRequirement-=FailedUnitRequirementMethod;
+				oldArmy.UnitAdded -= UnitAddedMethod;
+				oldArmy.UnitRemoved -= UnitRemovedMethod;
+				oldArmy.PointsValueChanged -= PointsValueChangedMethod;
+				oldArmy.FailedRequirement -= FailedUnitRequirementMethod;
 			}
 
 			unitToWidgetMap.Clear();
@@ -470,16 +471,16 @@
 				unitsNotebook.RemovePage(0);
 			}
 
-			if (newArmy==null)
+			if (newArmy == null)
 			{
 				DisableCategoryButtons();
 			}
 			else
 			{
-				newArmy.UnitAdded+= UnitAddedMethod;
-				newArmy.UnitRemoved+= UnitRemovedMethod;
-				newArmy.PointsValueChanged+= PointsValueChangedMethod;
-				newArmy.FailedRequirement+=FailedUnitRequirementMethod;
+				newArmy.UnitAdded += UnitAddedMethod;
+				newArmy.UnitRemoved += UnitRemovedMethod;
+				newArmy.PointsValueChanged += PointsValueChangedMethod;
+				newArmy.FailedRequirement += FailedUnitRequirementMethod;
 				//TODO: Clear all buttons
 				EnableCategoryButtons();
 
@@ -490,9 +491,11 @@
 				}
 			}
 
-			miCloseArmy.Sensitive = newArmy!=null;
-			miSaveArmyAs.Sensitive = newArmy!=null;
-			miExportArmy.Sensitive = newArmy!=null;
+			bool nonNullNewArmy = (newArmy != null);
+			miCloseArmy.Sensitive = nonNullNewArmy;
+			miSaveArmyAs.Sensitive = nonNullNewArmy;
+			miExportArmy.Sensitive = nonNullNewArmy;
+			hpaned2.Visible = nonNullNewArmy;
 			loadedArmyPath = null;
 			//New army has no changes, so we can't save it
 			miSaveArmy.Sensitive = false;
--- a/gtk-gui/IBBoard.WarFoundry.GTK.FrmMainWindow.cs	Wed Aug 11 19:11:00 2010 +0000
+++ b/gtk-gui/IBBoard.WarFoundry.GTK.FrmMainWindow.cs	Wed Aug 11 19:23:43 2010 +0000
@@ -211,6 +211,7 @@
 			}
 			this.DefaultWidth = 832;
 			this.DefaultHeight = 659;
+			this.hpaned2.Hide();
 			this.Show();
 			this.miCreateArmy.Activated += new global::System.EventHandler(this.OnCreateArmyActivated);
 			this.miOpenArmy.Activated += new global::System.EventHandler(this.OnOpenArmyActivated);
--- a/gtk-gui/gui.stetic	Wed Aug 11 19:11:00 2010 +0000
+++ b/gtk-gui/gui.stetic	Wed Aug 11 19:23:43 2010 +0000
@@ -53,10 +53,9 @@
         <property name="StockId">gtk-close</property>
         <signal name="Activated" handler="OnCloseArmyActivated" />
       </action>
-      <action id="miReloadFiles">
+      <action id="refreshAction">
         <property name="Type">Action</property>
         <property name="Label" translatable="yes">Reload files</property>
-        <property name="Sensitive">False</property>
         <property name="ShortLabel" translatable="yes">Reload files</property>
         <property name="StockId">gtk-refresh</property>
         <signal name="Activated" handler="OnReloadFilesActivated" />
@@ -179,7 +178,7 @@
                 </node>
                 <node type="Menuitem" action="miCloseArmy" />
                 <node type="Separator" />
-                <node type="Menuitem" action="miReloadFiles" />
+                <node type="Menuitem" action="refreshAction" />
                 <node type="Separator" />
                 <node type="Menuitem" action="miExit" />
               </node>
@@ -227,6 +226,7 @@
         <child>
           <widget class="Gtk.HPaned" id="hpaned2">
             <property name="MemberName" />
+            <property name="Visible">False</property>
             <property name="CanFocus">True</property>
             <property name="Position">178</property>
             <child>