Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
changeset 122:2479414b16f6
Re #361: Add XML output to GTK GUI
* Add initial form and load XSLT file list
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 27 Sep 2011 21:01:49 +0100 |
parents | 3ec818926241 |
children | f58f69ea2435 |
files | FrmExportXml.cs IBBoard.WarFoundry.GUI.GTK.csproj gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmExportXml.cs gtk-gui/gui.stetic |
diffstat | 4 files changed, 354 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FrmExportXml.cs Tue Sep 27 21:01:49 2011 +0100 @@ -0,0 +1,34 @@ +// This file (FrmExportXml.cs) is a part of the IBBoard.WarFoundry.GUI.GTK project and is copyright 2011 IBBoard +// +// 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 IBBoard.GtkSharp; +using System.Collections.Generic; + +namespace IBBoard.WarFoundry.GUI.GTK +{ + public partial class FrmExportXml : Gtk.Dialog + { + public FrmExportXml() + { + this.Build(); + FillXsltList(); + } + + private void FillXsltList() + { + DirectoryInfo dir = new DirectoryInfo(System.IO.Path.Combine(Constants.ExecutablePath, "xsl")); + List<FileInfo> files = new List<FileInfo>(dir.GetFiles("*.xsl")); + ComboBoxUtils.FillCombo(transformList, files, delegate(FileInfo file) { return file.Name; }); + } + + protected void OnDoTransformWidgetToggled (object sender, System.EventArgs e) + { + bool enabled = doTransformWidget.Active; + lblTransform.Sensitive = enabled; + transformList.Sensitive = enabled; + } + } +} +
--- a/IBBoard.WarFoundry.GUI.GTK.csproj Sun Sep 25 20:59:44 2011 +0100 +++ b/IBBoard.WarFoundry.GUI.GTK.csproj Tue Sep 27 21:01:49 2011 +0100 @@ -72,6 +72,8 @@ <Compile Include="gtk-gui\IBBoard.WarFoundry.GUI.GTK.FrmAboutCredits.cs" /> <Compile Include="FrmPreferences.cs" /> <Compile Include="gtk-gui\IBBoard.WarFoundry.GUI.GTK.FrmPreferences.cs" /> + <Compile Include="FrmExportXml.cs" /> + <Compile Include="gtk-gui\IBBoard.WarFoundry.GUI.GTK.FrmExportXml.cs" /> </ItemGroup> <ItemGroup> <Content Include="App.png" />
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gtk-gui/IBBoard.WarFoundry.GUI.GTK.FrmExportXml.cs Tue Sep 27 21:01:49 2011 +0100 @@ -0,0 +1,132 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace IBBoard.WarFoundry.GUI.GTK +{ + public partial class FrmExportXml + { + private global::Gtk.Table table; + private global::Gtk.CheckButton doTransformWidget; + private global::IBBoard.GtkSharp.Translatable.TranslatableLabel lblOutputFile; + private global::IBBoard.GtkSharp.Translatable.TranslatableLabel lblTransform; + private global::Gtk.FileChooserButton saveAsPath; + private global::Gtk.ComboBox transformList; + private global::Gtk.Button buttonCancel; + private global::Gtk.Button buttonOk; + + protected virtual void Build () + { + global::Stetic.Gui.Initialize (this); + // Widget IBBoard.WarFoundry.GUI.GTK.FrmExportXml + this.Name = "IBBoard.WarFoundry.GUI.GTK.FrmExportXml"; + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + // Internal child IBBoard.WarFoundry.GUI.GTK.FrmExportXml.VBox + global::Gtk.VBox w1 = this.VBox; + w1.Name = "dialog1_VBox"; + w1.BorderWidth = ((uint)(2)); + // Container child dialog1_VBox.Gtk.Box+BoxChild + this.table = new global::Gtk.Table (((uint)(3)), ((uint)(2)), false); + this.table.Name = "table"; + this.table.RowSpacing = ((uint)(6)); + this.table.ColumnSpacing = ((uint)(6)); + // Container child table.Gtk.Table+TableChild + this.doTransformWidget = new global::Gtk.CheckButton (); + this.doTransformWidget.CanFocus = true; + this.doTransformWidget.Name = "doTransformWidget"; + this.doTransformWidget.Label = global::Mono.Unix.Catalog.GetString ("Transform output?"); + this.doTransformWidget.DrawIndicator = true; + this.doTransformWidget.UseUnderline = true; + this.table.Add (this.doTransformWidget); + global::Gtk.Table.TableChild w2 = ((global::Gtk.Table.TableChild)(this.table [this.doTransformWidget])); + w2.TopAttach = ((uint)(1)); + w2.BottomAttach = ((uint)(2)); + w2.LeftAttach = ((uint)(1)); + w2.RightAttach = ((uint)(2)); + w2.XOptions = ((global::Gtk.AttachOptions)(4)); + w2.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table.Gtk.Table+TableChild + this.lblOutputFile = new global::IBBoard.GtkSharp.Translatable.TranslatableLabel (); + this.lblOutputFile.Name = "lblOutputFile"; + this.lblOutputFile.Xalign = 1F; + this.lblOutputFile.LabelProp = global::Mono.Unix.Catalog.GetString ("Save as:"); + this.table.Add (this.lblOutputFile); + global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table [this.lblOutputFile])); + w3.XOptions = ((global::Gtk.AttachOptions)(4)); + w3.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table.Gtk.Table+TableChild + this.lblTransform = new global::IBBoard.GtkSharp.Translatable.TranslatableLabel (); + this.lblTransform.Sensitive = false; + this.lblTransform.Name = "lblTransform"; + this.lblTransform.LabelProp = global::Mono.Unix.Catalog.GetString ("Transform:"); + this.table.Add (this.lblTransform); + global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table [this.lblTransform])); + w4.TopAttach = ((uint)(2)); + w4.BottomAttach = ((uint)(3)); + w4.XOptions = ((global::Gtk.AttachOptions)(4)); + w4.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table.Gtk.Table+TableChild + this.saveAsPath = new global::Gtk.FileChooserButton (global::Mono.Unix.Catalog.GetString ("Select A File"), ((global::Gtk.FileChooserAction)(0))); + this.saveAsPath.Name = "saveAsPath"; + this.table.Add (this.saveAsPath); + global::Gtk.Table.TableChild w5 = ((global::Gtk.Table.TableChild)(this.table [this.saveAsPath])); + w5.LeftAttach = ((uint)(1)); + w5.RightAttach = ((uint)(2)); + w5.XOptions = ((global::Gtk.AttachOptions)(4)); + w5.YOptions = ((global::Gtk.AttachOptions)(4)); + // Container child table.Gtk.Table+TableChild + this.transformList = global::Gtk.ComboBox.NewText (); + this.transformList.Sensitive = false; + this.transformList.Name = "transformList"; + this.table.Add (this.transformList); + global::Gtk.Table.TableChild w6 = ((global::Gtk.Table.TableChild)(this.table [this.transformList])); + w6.TopAttach = ((uint)(2)); + w6.BottomAttach = ((uint)(3)); + w6.LeftAttach = ((uint)(1)); + w6.RightAttach = ((uint)(2)); + w6.XOptions = ((global::Gtk.AttachOptions)(4)); + w6.YOptions = ((global::Gtk.AttachOptions)(4)); + w1.Add (this.table); + global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(w1 [this.table])); + w7.Position = 0; + w7.Expand = false; + w7.Fill = false; + // Internal child IBBoard.WarFoundry.GUI.GTK.FrmExportXml.ActionArea + global::Gtk.HButtonBox w8 = this.ActionArea; + w8.Name = "dialog1_ActionArea"; + w8.Spacing = 10; + w8.BorderWidth = ((uint)(5)); + w8.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.buttonCancel = new global::Gtk.Button (); + this.buttonCancel.CanDefault = true; + this.buttonCancel.CanFocus = true; + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.UseStock = true; + this.buttonCancel.UseUnderline = true; + this.buttonCancel.Label = "gtk-cancel"; + this.AddActionWidget (this.buttonCancel, -6); + global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8 [this.buttonCancel])); + w9.Expand = false; + w9.Fill = false; + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.buttonOk = new global::Gtk.Button (); + this.buttonOk.CanDefault = true; + this.buttonOk.CanFocus = true; + this.buttonOk.Name = "buttonOk"; + this.buttonOk.UseStock = true; + this.buttonOk.UseUnderline = true; + this.buttonOk.Label = "gtk-ok"; + this.AddActionWidget (this.buttonOk, -5); + global::Gtk.ButtonBox.ButtonBoxChild w10 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8 [this.buttonOk])); + w10.Position = 1; + w10.Expand = false; + w10.Fill = false; + if ((this.Child != null)) { + this.Child.ShowAll (); + } + this.DefaultWidth = 400; + this.DefaultHeight = 300; + this.Show (); + this.doTransformWidget.Toggled += new global::System.EventHandler (this.OnDoTransformWidgetToggled); + } + } +}
--- a/gtk-gui/gui.stetic Sun Sep 25 20:59:44 2011 +0100 +++ b/gtk-gui/gui.stetic Tue Sep 27 21:01:49 2011 +0100 @@ -5,8 +5,8 @@ <target-gtk-version>2.12</target-gtk-version> </configuration> <import> - <widget-library name="../../IBBoard.GtkSharp/bin/Release/IBBoard.GtkSharp.dll" /> - <widget-library name="../bin/Release/WarFoundry-GTK.exe" internal="true" /> + <widget-library name="../../IBBoard.GtkSharp/bin/Debug/IBBoard.GtkSharp.dll" /> + <widget-library name="../bin/Debug/WarFoundry-GTK.exe" internal="true" /> </import> <widget class="Gtk.Window" id="IBBoard.WarFoundry.GUI.GTK.FrmMainWindow" design-size="832 659"> <action-group name="Default"> @@ -165,6 +165,12 @@ <property name="StockId">gtk-preferences</property> <signal name="Activated" handler="miPreferencesClicked" /> </action> + <action id="transformedXmlAction"> + <property name="Type">Action</property> + <property name="Label" translatable="yes">transformed xml</property> + <property name="ShortLabel" translatable="yes">transformed xml</property> + <signal name="Activated" handler="OnTransformedXmlActionActivated" /> + </action> </action-group> <property name="MemberName" /> <property name="Title" translatable="yes">MainWindow</property> @@ -183,6 +189,7 @@ <node type="Menuitem" action="miSaveArmyAs" /> <node type="Menu" action="miExportArmyAs"> <node type="Menuitem" action="miExportArmyAsBasicHTML" /> + <node type="Menuitem" action="transformedXmlAction" /> </node> <node type="Menuitem" action="miCloseArmy" /> <node type="Separator" /> @@ -2525,4 +2532,181 @@ </widget> </child> </widget> + <widget class="Gtk.Dialog" id="IBBoard.WarFoundry.GUI.GTK.FrmExportXml" design-size="400 300"> + <property name="MemberName" /> + <property name="WindowPosition">CenterOnParent</property> + <property name="Buttons">2</property> + <property name="HelpButton">False</property> + <child internal-child="VBox"> + <widget class="Gtk.VBox" id="dialog1_VBox"> + <property name="MemberName" /> + <property name="BorderWidth">2</property> + <child> + <widget class="Gtk.Table" id="table"> + <property name="MemberName" /> + <property name="NRows">3</property> + <property name="NColumns">2</property> + <property name="RowSpacing">6</property> + <property name="ColumnSpacing">6</property> + <child> + <placeholder /> + </child> + <child> + <widget class="Gtk.CheckButton" id="doTransformWidget"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="Label" translatable="yes">Transform output?</property> + <property name="DrawIndicator">True</property> + <property name="HasLabel">True</property> + <property name="UseUnderline">True</property> + <signal name="Toggled" handler="OnDoTransformWidgetToggled" /> + </widget> + <packing> + <property name="TopAttach">1</property> + <property name="BottomAttach">2</property> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="IBBoard.GtkSharp.Translatable.TranslatableLabel" id="lblOutputFile"> + <property name="MemberName" /> + <property name="Xalign">1</property> + <property name="LabelProp" translatable="yes">Save as:</property> + </widget> + <packing> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="IBBoard.GtkSharp.Translatable.TranslatableLabel" id="lblTransform"> + <property name="MemberName" /> + <property name="Sensitive">False</property> + <property name="LabelProp" translatable="yes">Transform:</property> + </widget> + <packing> + <property name="TopAttach">2</property> + <property name="BottomAttach">3</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.FileChooserButton" id="saveAsPath"> + <property name="MemberName" /> + </widget> + <packing> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + <child> + <widget class="Gtk.ComboBox" id="transformList"> + <property name="MemberName" /> + <property name="Sensitive">False</property> + <property name="IsTextCombo">True</property> + <property name="Items" translatable="yes" /> + </widget> + <packing> + <property name="TopAttach">2</property> + <property name="BottomAttach">3</property> + <property name="LeftAttach">1</property> + <property name="RightAttach">2</property> + <property name="AutoSize">True</property> + <property name="XOptions">Fill</property> + <property name="YOptions">Fill</property> + <property name="XExpand">False</property> + <property name="XFill">True</property> + <property name="XShrink">False</property> + <property name="YExpand">False</property> + <property name="YFill">True</property> + <property name="YShrink">False</property> + </packing> + </child> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + </widget> + </child> + <child internal-child="ActionArea"> + <widget class="Gtk.HButtonBox" id="dialog1_ActionArea"> + <property name="MemberName" /> + <property name="Spacing">10</property> + <property name="BorderWidth">5</property> + <property name="Size">2</property> + <property name="LayoutStyle">End</property> + <child> + <widget class="Gtk.Button" id="buttonCancel"> + <property name="MemberName" /> + <property name="CanDefault">True</property> + <property name="CanFocus">True</property> + <property name="UseStock">True</property> + <property name="Type">StockItem</property> + <property name="StockId">gtk-cancel</property> + <property name="ResponseId">-6</property> + <property name="label">gtk-cancel</property> + </widget> + <packing> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Button" id="buttonOk"> + <property name="MemberName" /> + <property name="CanDefault">True</property> + <property name="CanFocus">True</property> + <property name="UseStock">True</property> + <property name="Type">StockItem</property> + <property name="StockId">gtk-ok</property> + <property name="ResponseId">-5</property> + <property name="label">gtk-ok</property> + </widget> + <packing> + <property name="Position">1</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> </stetic-interface> \ No newline at end of file