[longomatch] Add a new config setting for the default analysis template



commit 282a2dd6377af549d66b63696fa6f41b8300780d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu May 29 15:00:52 2014 +0200

    Add a new config setting for the default analysis template

 LongoMatch.Core/Config.cs                          |   11 +++++
 .../Gui/Component/GeneralPreferencesPanel.cs       |   21 ++++++++++
 LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs        |    2 +-
 ...oMatch.Gui.Component.GeneralPreferencesPanel.cs |   31 +++++++++++++--
 LongoMatch.GUI/gtk-gui/gui.stetic                  |   41 ++++++++++++++++++++
 5 files changed, 101 insertions(+), 5 deletions(-)
---
diff --git a/LongoMatch.Core/Config.cs b/LongoMatch.Core/Config.cs
index ee87866..0de7ef1 100644
--- a/LongoMatch.Core/Config.cs
+++ b/LongoMatch.Core/Config.cs
@@ -366,6 +366,15 @@ namespace LongoMatch
                        }
                }
                
+               public static string DefaultTemplate {
+                       get {
+                               return state.defaultTemplate;
+                       }
+                       set {
+                               state.defaultTemplate = value;
+                               Save ();
+                       }
+               }
                #endregion
 
        }
@@ -390,6 +399,7 @@ namespace LongoMatch
                public string autorenderDir;
                public string lastRenderDir;
                public bool reviewPlaysInSameWindow;
+               public string defaultTemplate;
                
                public ConfigState () {
                        /* Set default values */
@@ -411,6 +421,7 @@ namespace LongoMatch
                        autorenderDir = null;
                        lastRenderDir = null;
                        reviewPlaysInSameWindow = true;
+                       defaultTemplate = null;
                }
        }
 }
diff --git a/LongoMatch.GUI/Gui/Component/GeneralPreferencesPanel.cs 
b/LongoMatch.GUI/Gui/Component/GeneralPreferencesPanel.cs
index 8f23581..6d51645 100644
--- a/LongoMatch.GUI/Gui/Component/GeneralPreferencesPanel.cs
+++ b/LongoMatch.GUI/Gui/Component/GeneralPreferencesPanel.cs
@@ -28,12 +28,14 @@ namespace LongoMatch.Gui.Component
        {
        
                ListStore langsStore;
+               ListStore templates;
                CheckButton autosavecb;
                
                public GeneralPreferencesPanel ()
                {
                        this.Build ();
                        FillLangs();
+                       FillTemplates ();
                        autosavecb  = new CheckButton();
                        table1.Attach (autosavecb, 1, 2, 1, 2,
                                       AttachOptions.Shrink,
@@ -62,6 +64,25 @@ namespace LongoMatch.Gui.Component
                        langcombobox.Changed += HandleChanged;
                }
 
+               void FillTemplates () {
+                       int i = 0, active = -1;
+                       templates = new ListStore (typeof(string));
+
+                       foreach (string name in Config.CategoriesTemplatesProvider.TemplatesNames) {
+                               if (name == Config.DefaultTemplate) {
+                                       active = i;
+                               }
+                               templates.AppendValues (name);
+                               i++;
+                       }
+                       templatescombobox.Model = templates;
+                       if (active != -1) {
+                               templatescombobox.Active = active;
+                       }
+                       templatescombobox.Changed += (sender, e) => {
+                               Config.DefaultTemplate = templatescombobox.ActiveText;};
+               }
+
                void HandleChanged (object sender, EventArgs e)
                {
                        TreeIter iter;
diff --git a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
index 5efea35..37488e9 100644
--- a/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/NewProjectPanel.cs
@@ -144,7 +144,7 @@ namespace LongoMatch.Gui.Panel
 
                        foreach (string template in Config.CategoriesTemplatesProvider.TemplatesNames) {
                                tagscombobox.AppendText(template);
-                               if(template == "default")
+                               if (template == Config.DefaultTemplate)
                                        index = i;
                                i++;
                        }
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GeneralPreferencesPanel.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GeneralPreferencesPanel.cs
index d2efa19..8b7b9c8 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GeneralPreferencesPanel.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.GeneralPreferencesPanel.cs
@@ -7,7 +7,9 @@ namespace LongoMatch.Gui.Component
                private global::Gtk.Table table1;
                private global::Gtk.Label label1;
                private global::Gtk.Label label2;
+               private global::Gtk.Label label3;
                private global::Gtk.ComboBox langcombobox;
+               private global::Gtk.ComboBox templatescombobox;
 
                protected virtual void Build ()
                {
@@ -37,13 +39,34 @@ namespace LongoMatch.Gui.Component
                        w2.BottomAttach = ((uint)(2));
                        w2.YOptions = ((global::Gtk.AttachOptions)(4));
                        // Container child table1.Gtk.Table+TableChild
+                       this.label3 = new global::Gtk.Label ();
+                       this.label3.Name = "label3";
+                       this.label3.LabelProp = global::Mono.Unix.Catalog.GetString ("Default analysis 
template");
+                       this.table1.Add (this.label3);
+                       global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table1 
[this.label3]));
+                       w3.TopAttach = ((uint)(2));
+                       w3.BottomAttach = ((uint)(3));
+                       w3.XOptions = ((global::Gtk.AttachOptions)(4));
+                       w3.YOptions = ((global::Gtk.AttachOptions)(4));
+                       // Container child table1.Gtk.Table+TableChild
                        this.langcombobox = global::Gtk.ComboBox.NewText ();
                        this.langcombobox.Name = "langcombobox";
                        this.table1.Add (this.langcombobox);
-                       global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.table1 
[this.langcombobox]));
-                       w3.LeftAttach = ((uint)(1));
-                       w3.RightAttach = ((uint)(2));
-                       w3.YOptions = ((global::Gtk.AttachOptions)(4));
+                       global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table1 
[this.langcombobox]));
+                       w4.LeftAttach = ((uint)(1));
+                       w4.RightAttach = ((uint)(2));
+                       w4.YOptions = ((global::Gtk.AttachOptions)(4));
+                       // Container child table1.Gtk.Table+TableChild
+                       this.templatescombobox = global::Gtk.ComboBox.NewText ();
+                       this.templatescombobox.Name = "templatescombobox";
+                       this.table1.Add (this.templatescombobox);
+                       global::Gtk.Table.TableChild w5 = ((global::Gtk.Table.TableChild)(this.table1 
[this.templatescombobox]));
+                       w5.TopAttach = ((uint)(2));
+                       w5.BottomAttach = ((uint)(3));
+                       w5.LeftAttach = ((uint)(1));
+                       w5.RightAttach = ((uint)(2));
+                       w5.XOptions = ((global::Gtk.AttachOptions)(4));
+                       w5.YOptions = ((global::Gtk.AttachOptions)(4));
                        this.Add (this.table1);
                        if ((this.Child != null)) {
                                this.Child.ShowAll ();
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 430d546..524a196 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -5245,6 +5245,25 @@ Defining &lt;b&gt; Game Units &lt;/b&gt; will help you during the analysis to in
           </packing>
         </child>
         <child>
+          <widget class="Gtk.Label" id="label3">
+            <property name="MemberName" />
+            <property name="LabelProp" translatable="yes">Default analysis template</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.ComboBox" id="langcombobox">
             <property name="MemberName" />
             <property name="IsTextCombo">True</property>
@@ -5263,6 +5282,28 @@ Defining &lt;b&gt; Game Units &lt;/b&gt; will help you during the analysis to in
             <property name="YShrink">False</property>
           </packing>
         </child>
+        <child>
+          <widget class="Gtk.ComboBox" id="templatescombobox">
+            <property name="MemberName" />
+            <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>
     </child>
   </widget>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]