changeset 32:eab45344cd56

Re #172: Add GTK# UI for showing debugging messages * Add starts of an implementation by subscribing to event and logging out for now Also: * Add file logger to logging config * Tidy up some code
author IBBoard <dev@ibboard.co.uk>
date Mon, 21 Sep 2009 19:17:27 +0000
parents ca863c693550
children 441cfc410987
files FrmMainWindow.cs IBBoard.WarFoundry.GUI.GTK.csproj WarFoundryGTK.exe.log4net gtk-gui/gui.stetic
diffstat 4 files changed, 36 insertions(+), 20 deletions(-) [+]
line diff
     1.1 --- a/FrmMainWindow.cs	Tue Sep 15 19:34:17 2009 +0000
     1.2 +++ b/FrmMainWindow.cs	Mon Sep 21 19:17:27 2009 +0000
     1.3 @@ -134,6 +134,7 @@
     1.4  			WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + "data"));
     1.5  			WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory());
     1.6  			WarFoundryLoader.GetDefault().RegisterNonNativeFactory(RollcallFactory.GetFactory());
     1.7 +			WarFoundryLoader.GetDefault().FileLoadingFinished += FileLoadingFinished;
     1.8  			WarFoundrySaver.SetFileSaver(new WarFoundryXmlSaver());
     1.9  
    1.10  			logger.Debug("Initialising complete - seeing if we can load default army or system");
    1.11 @@ -189,6 +190,14 @@
    1.12  			}
    1.13  		}
    1.14  
    1.15 +		private void FileLoadingFinished (List<FileLoadFailure> failures)
    1.16 +		{
    1.17 +			foreach(FileLoadFailure failure in failures)
    1.18 +			{
    1.19 +				logger.Warn("Failed to load " + failure.FailedFile.FullName + ": " + failure.Message);
    1.20 +			}
    1.21 +		}
    1.22 +
    1.23  		private void RenderCategoryTreeObjectName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
    1.24  		{
    1.25  			object o = model.GetValue(iter, 0);
    1.26 @@ -198,13 +207,13 @@
    1.27  				ArmyCategory c = (ArmyCategory)o;
    1.28  				string name = "";
    1.29  
    1.30 -				if (Preferences.GetBooleanProperty("ShowCatPercentage"))
    1.31 +				if (!Preferences.GetBooleanProperty("ShowCatPercentage"))
    1.32  				{
    1.33 -					name = Translation.GetTranslation("categoryTreeCatName", "{0} - {1}pts", c.Name, c.PointsTotal);
    1.34 +					name = Translation.GetTranslation("categoryTreeCatName", "{0} - {1}pts", c.Name, c.Points);
    1.35  				}
    1.36  				else
    1.37  				{
    1.38 -					name = Translation.GetTranslation("categoryTreeCatNamePercentage", "{0} - {1}pts ({2}%)", c.Name, c.PointsTotal, (c.ParentArmy.PointsTotal > 0 ? Math.Round((c.PointsTotal / c.ParentArmy.PointsTotal) * 100) : 0));
    1.39 +					name = Translation.GetTranslation("categoryTreeCatNamePercentage", "{0} - {1}pts ({2}%)", c.Name, c.Points, (c.ParentArmy.Points > 0 ? Math.Round((c.Points / c.ParentArmy.Points) * 100) : 0));
    1.40  				}
    1.41  
    1.42  				(cell as CellRendererText).Text = name;
    1.43 @@ -212,7 +221,7 @@
    1.44  			else if (o is IBBoard.WarFoundry.API.Objects.Unit)
    1.45  			{
    1.46  				IBBoard.WarFoundry.API.Objects.Unit u = (IBBoard.WarFoundry.API.Objects.Unit)o;
    1.47 -				string name = Translation.GetTranslation("categoryTreeCatName", "{0} - {1}pts", u.Name, u.PointsValue);
    1.48 +				string name = Translation.GetTranslation("unitTreeCatName", "{0} - {1}pts", u.Name, u.Points);
    1.49  				(cell as CellRendererText).Text = name;
    1.50  			}
    1.51  		}
     2.1 --- a/IBBoard.WarFoundry.GUI.GTK.csproj	Tue Sep 15 19:34:17 2009 +0000
     2.2 +++ b/IBBoard.WarFoundry.GUI.GTK.csproj	Mon Sep 21 19:17:27 2009 +0000
     2.3 @@ -61,7 +61,9 @@
     2.4      <None Include="translations\en.translation">
     2.5        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     2.6      </None>
     2.7 -    <None Include="WarFoundryGTK.exe.log4net" />
     2.8 +    <None Include="WarFoundryGTK.exe.log4net">
     2.9 +      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    2.10 +    </None>
    2.11      <None Include="gtk-gui\gui.stetic" />
    2.12      <None Include="gtk-gui\objects.xml" />
    2.13      <None Include="COPYING" />
     3.1 --- a/WarFoundryGTK.exe.log4net	Tue Sep 15 19:34:17 2009 +0000
     3.2 +++ b/WarFoundryGTK.exe.log4net	Mon Sep 21 19:17:27 2009 +0000
     3.3 @@ -1,15 +1,23 @@
     3.4  <?xml version="1.0" encoding="utf-8" ?>
     3.5 -<!-- This section contains the log4net configuration settings -->
     3.6  <log4net>
     3.7 -    <!-- Define some output appenders -->	
     3.8 -    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
     3.9 -        <layout type="log4net.Layout.PatternLayout">
    3.10 -            <param name="ConversionPattern" value="%-5p [%d{HH:MM:ss}]: %C{1}.%M() - Line: %L - %m%n" />
    3.11 -        </layout>
    3.12 -    </appender>
    3.13 -    <!-- Setup the root category, add the appenders and set the default priority -->
    3.14 -    <root>
    3.15 -        <level value="DEBUG" />
    3.16 -        <appender-ref ref="ConsoleAppender" />
    3.17 -    </root>
    3.18 +	<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
    3.19 +		<layout type="log4net.Layout.PatternLayout">
    3.20 +			<conversionPattern value="%-5p [%d{HH:MM:ss}]: %C{1}.%M() - Line: %L - %m%n" />
    3.21 +		</layout>
    3.22 +	</appender>
    3.23 +	<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
    3.24 +		<file value="logs/WarFoundry.log" />
    3.25 +		<appendToFile value="false" />
    3.26 +		<rollingStyle value="Size" />
    3.27 +		<maxSizeRollBackups value="-1" />
    3.28 +		<maximumFileSize value="100MB" />
    3.29 +		<layout type="log4net.Layout.PatternLayout">
    3.30 +			<conversionPattern value="%-5p [%d{HH:MM:ss}]: %C{1}.%M() - Line: %L - %m%n" />
    3.31 +		</layout>
    3.32 +	</appender>
    3.33 +	<root>
    3.34 +		<level value="DEBUG" />
    3.35 +		<appender-ref ref="ConsoleAppender" />
    3.36 +		<appender-ref ref="RollingLogFileAppender" />
    3.37 +	</root>
    3.38  </log4net>
     4.1 --- a/gtk-gui/gui.stetic	Tue Sep 15 19:34:17 2009 +0000
     4.2 +++ b/gtk-gui/gui.stetic	Mon Sep 21 19:17:27 2009 +0000
     4.3 @@ -294,7 +294,6 @@
     4.4      <property name="SkipTaskbarHint">True</property>
     4.5      <property name="Buttons">2</property>
     4.6      <property name="HelpButton">False</property>
     4.7 -    <property name="HasSeparator">False</property>
     4.8      <child internal-child="VBox">
     4.9        <widget class="Gtk.VBox" id="dialog_VBox">
    4.10          <property name="MemberName" />
    4.11 @@ -531,7 +530,6 @@
    4.12      <property name="SkipTaskbarHint">True</property>
    4.13      <property name="Buttons">2</property>
    4.14      <property name="HelpButton">False</property>
    4.15 -    <property name="HasSeparator">False</property>
    4.16      <child internal-child="VBox">
    4.17        <widget class="Gtk.VBox" id="dialog1_VBox">
    4.18          <property name="MemberName" />
    4.19 @@ -638,7 +636,6 @@
    4.20      <property name="SkipTaskbarHint">True</property>
    4.21      <property name="Buttons">2</property>
    4.22      <property name="HelpButton">False</property>
    4.23 -    <property name="HasSeparator">False</property>
    4.24      <child internal-child="VBox">
    4.25        <widget class="Gtk.VBox" id="dialog1_VBox">
    4.26          <property name="MemberName" />