Mercurial > repos > IBBoard.WarFoundry.GUI.GTK
comparison Widgets/TransformXmlWidget.cs @ 167:9808adf2d566 default tip
Re #419: Remove assumptions of a file-based install
* Update GTK# GUI to use Streams version of XSLT export
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 28 Nov 2012 20:25:53 +0000 |
parents | cff58ea990c4 |
children |
comparison
equal
deleted
inserted
replaced
166:ef94bed818e1 | 167:9808adf2d566 |
---|---|
4 using System; | 4 using System; |
5 using System.IO; | 5 using System.IO; |
6 using System.Collections.Generic; | 6 using System.Collections.Generic; |
7 using IBBoard.GtkSharp; | 7 using IBBoard.GtkSharp; |
8 using IBBoard.GtkSharp.Translatable; | 8 using IBBoard.GtkSharp.Translatable; |
9 using IBBoard.WarFoundry.API.Exporters; | |
10 using IBBoard.IO; | |
9 | 11 |
10 namespace IBBoard.WarFoundry.GUI.GTK | 12 namespace IBBoard.WarFoundry.GUI.GTK |
11 { | 13 { |
12 [System.ComponentModel.ToolboxItem(true)] | 14 [System.ComponentModel.ToolboxItem(true)] |
13 public partial class TransformXmlWidget : Gtk.Bin | 15 public partial class TransformXmlWidget : Gtk.Bin |
21 ControlTranslator.TranslateWidget(this); | 23 ControlTranslator.TranslateWidget(this); |
22 } | 24 } |
23 | 25 |
24 private void FillXsltList() | 26 private void FillXsltList() |
25 { | 27 { |
26 DirectoryInfo dir = new DirectoryInfo(System.IO.Path.Combine(Constants.ExecutablePath, "xsl")); | 28 NamedStream[] streams = WarFoundryXmlWithXslExporter.GetDefault().GetXsltStreams(); |
27 List<FileInfo> files = new List<FileInfo>(dir.GetFiles("*.xsl")); | 29 ComboBoxUtils.FillCombo(transformList, streams, delegate(NamedStream xslStream) { return xslStream.Name; }); |
28 ComboBoxUtils.FillCombo(transformList, files, delegate(FileInfo file) { return file.Name; }); | |
29 } | 30 } |
30 | 31 |
31 public bool IsValid | 32 public bool IsValid |
32 { | 33 { |
33 get { return !doTransformWidget.Active || ComboBoxUtils.GetSelectedItem<FileInfo>(transformList) != null; } | 34 get { return !doTransformWidget.Active || ComboBoxUtils.GetSelectedItem<Stream>(transformList) != null; } |
34 } | 35 } |
35 | 36 |
36 public bool TransformEnabled | 37 public bool TransformEnabled |
37 { | 38 { |
38 get { return doTransformWidget.Active; } | 39 get { return doTransformWidget.Active; } |
39 } | 40 } |
40 | 41 |
41 public string GetXsltPath() | 42 public Stream GetXsltStream() |
42 { | 43 { |
43 return ComboBoxUtils.GetSelectedItem<FileInfo>(transformList).FullName; | 44 return ComboBoxUtils.GetSelectedItem<Stream>(transformList); |
44 } | 45 } |
45 | 46 |
46 protected void OnDoTransformWidgetToggled(object sender, System.EventArgs e) | 47 protected void OnDoTransformWidgetToggled(object sender, System.EventArgs e) |
47 { | 48 { |
48 bool enabled = doTransformWidget.Active; | 49 bool enabled = doTransformWidget.Active; |