[longomatch] Add a new panel for the preferences



commit 04e94837b27eef09b1a84309236b1ec745c6adb3
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Apr 10 10:59:24 2014 +0200

    Add a new panel for the preferences

 LongoMatch.GUI/Gui/GUIToolkit.cs                   |    6 +-
 .../PreferencesPanel.cs}                           |   32 ++--
 LongoMatch.GUI/LongoMatch.GUI.mdp                  |    8 +-
 .../LongoMatch.Gui.Dialog.PropertiesEditor.cs      |  103 -----------
 .../LongoMatch.Gui.Panel.PreferencesPanel.cs       |  100 +++++++++++
 LongoMatch.GUI/gtk-gui/gui.stetic                  |  189 +++++++++-----------
 LongoMatch.GUI/gtk-gui/objects.xml                 |    8 +
 7 files changed, 216 insertions(+), 230 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/GUIToolkit.cs b/LongoMatch.GUI/Gui/GUIToolkit.cs
index 577bb48..1e0963a 100644
--- a/LongoMatch.GUI/Gui/GUIToolkit.cs
+++ b/LongoMatch.GUI/Gui/GUIToolkit.cs
@@ -251,11 +251,9 @@ namespace LongoMatch.Gui
                
                public void OpenPreferencesEditor()
                {
-                       PropertiesEditor pe = new PropertiesEditor();
+                       PreferencesPanel panel = new PreferencesPanel ();
                        Log.Information ("Open preferences");
-                       pe.TransientFor = mainWindow as Gtk.Window;
-                       pe.Run();
-                       pe.Destroy();
+                       mainWindow.SetPanel (panel);
                }
                
                public void OpenDatabasesManager()
diff --git a/LongoMatch.GUI/Gui/Dialog/PropertiesEditor.cs b/LongoMatch.GUI/Gui/Panel/PreferencesPanel.cs
similarity index 75%
rename from LongoMatch.GUI/Gui/Dialog/PropertiesEditor.cs
rename to LongoMatch.GUI/Gui/Panel/PreferencesPanel.cs
index 012d6af..67f8974 100644
--- a/LongoMatch.GUI/Gui/Dialog/PropertiesEditor.cs
+++ b/LongoMatch.GUI/Gui/Panel/PreferencesPanel.cs
@@ -1,5 +1,5 @@
 //
-//  Copyright (C) 2013 Andoni Morales Alastruey
+//  Copyright (C) 2014 Andoni Morales Alastruey
 //
 //  This program is free software; you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -16,25 +16,28 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 //
 using System;
-using Gtk;
-using Gdk;
+using LongoMatch.Interfaces.GUI;
+using LongoMatch.Handlers;
 using Mono.Unix;
-
+using Gtk;
 using LongoMatch.Gui.Component;
+using Gdk;
 
-namespace LongoMatch.Gui.Dialog
+namespace LongoMatch.Gui.Panel
 {
-       public partial class PropertiesEditor : Gtk.Dialog
+       [System.ComponentModel.ToolboxItem(true)]
+       public partial class PreferencesPanel : Gtk.Bin, IPanel
        {
+               public event BackEventHandle BackEvent;
                Widget selectedPanel;
                ListStore prefsStore;
                
-               public PropertiesEditor ()
+               public PreferencesPanel ()
                {
                        this.Build ();
-                       prefsStore = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(Widget));
-                       treeview.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);  
-                       treeview.AppendColumn ("Desc", new Gtk.CellRendererText (), "text", 1);
+                       prefsStore = new ListStore(typeof(Pixbuf), typeof(string), typeof(Widget));
+                       treeview.AppendColumn ("Icon", new CellRendererPixbuf (), "pixbuf", 0);  
+                       treeview.AppendColumn ("Desc", new CellRendererText (), "text", 1);
                        treeview.CursorChanged += HandleCursorChanged;
                        treeview.Model = prefsStore;
                        treeview.HeadersVisible = false;
@@ -42,8 +45,13 @@ namespace LongoMatch.Gui.Dialog
                        treeview.EnableTreeLines = false;
                        AddPanels ();
                        treeview.SetCursor (new TreePath("0"), null, false);
+                       backbutton.Clicked += (e, s) => {
+                               if (BackEvent != null) {
+                                       BackEvent ();
+                               };
+                       };
                }
-
+               
                void AddPanels () {
                        AddPane (Catalog.GetString ("General"),
                                 Stetic.IconLoader.LoadIcon(this, "gtk-preferences", IconSize.Dialog),
@@ -52,7 +60,7 @@ namespace LongoMatch.Gui.Dialog
                                 Stetic.IconLoader.LoadIcon(this, "gtk-media-record", IconSize.Dialog),
                                 new VideoPreferencesPanel());
                        AddPane (Catalog.GetString ("Live analysis"),
-                                Gdk.Pixbuf.LoadFromResource ("camera-video.png"),
+                                Pixbuf.LoadFromResource ("camera-video.png"),
                                 new LiveAnalysisPreferences());
                }
                
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index b98f29c..5b14661 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -34,7 +34,6 @@
     <File subtype="Code" buildaction="Compile" name="Gui/Dialog/SnapshotsDialog.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Dialog/UpdateDialog.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Dialog/CalendarDialog.cs" />
-    <File subtype="Directory" buildaction="Compile" name="Gui/Popup" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/PlayersListTreeWidget.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/PlayListWidget.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/ProjectListWidget.cs" />
@@ -138,8 +137,6 @@
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Component.CoordinatesTagger.cs" 
/>
     <File subtype="Code" buildaction="Compile" name="Gui/Component/GeneralPreferencesPanel.cs" />
     <File subtype="Code" buildaction="Compile" 
name="gtk-gui/LongoMatch.Gui.Component.GeneralPreferencesPanel.cs" />
-    <File subtype="Code" buildaction="Compile" name="Gui/Dialog/PropertiesEditor.cs" />
-    <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Dialog.PropertiesEditor.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/VideoPreferencesPanel.cs" />
     <File subtype="Code" buildaction="Compile" 
name="gtk-gui/LongoMatch.Gui.Component.VideoPreferencesPanel.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/LiveAnalysisPreferences.cs" />
@@ -196,8 +193,9 @@
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Dialog.CalendarDialog.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/AnalysisTemplateEditor.cs" />
     <File subtype="Code" buildaction="Compile" 
name="gtk-gui/LongoMatch.Gui.Component.AnalysisTemplateEditor.cs" />
-    <File subtype="Directory" buildaction="Compile" name="Gui/Helpers" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/BackgroundWidget.cs" />
+    <File subtype="Code" buildaction="Compile" name="Gui/Panel/PreferencesPanel.cs" />
+    <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Panel.PreferencesPanel.cs" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
@@ -217,4 +215,4 @@
     <ProjectReference type="Project" localcopy="True" refto="LongoMatch.GUI.Helpers" />
   </References>
   <LanguageParameters ApplicationIcon="." CodePage="65001" ctype="CSharpProjectParameters" />
-</Project>
\ No newline at end of file
+</Project>
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.PreferencesPanel.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.PreferencesPanel.cs
new file mode 100644
index 0000000..74abfdc
--- /dev/null
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Panel.PreferencesPanel.cs
@@ -0,0 +1,100 @@
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace LongoMatch.Gui.Panel
+{
+       public partial class PreferencesPanel
+       {
+               private global::Gtk.VBox vbox2;
+               private global::Gtk.HPaned hpaned1;
+               private global::Gtk.ScrolledWindow scrolledwindow1;
+               private global::Gtk.TreeView treeview;
+               private global::Gtk.HBox hbox1;
+               private global::Gtk.VBox propsvbox;
+               private global::Gtk.HButtonBox hbuttonbox2;
+               private global::Gtk.Button backbutton;
+               
+               protected virtual void Build ()
+               {
+                       global::Stetic.Gui.Initialize (this);
+                       // Widget LongoMatch.Gui.Panel.PreferencesPanel
+                       global::Stetic.BinContainer.Attach (this);
+                       this.Name = "LongoMatch.Gui.Panel.PreferencesPanel";
+                       // Container child LongoMatch.Gui.Panel.PreferencesPanel.Gtk.Container+ContainerChild
+                       this.vbox2 = new global::Gtk.VBox ();
+                       this.vbox2.Name = "vbox2";
+                       this.vbox2.Spacing = 6;
+                       // Container child vbox2.Gtk.Box+BoxChild
+                       this.hpaned1 = new global::Gtk.HPaned ();
+                       this.hpaned1.CanFocus = true;
+                       this.hpaned1.Name = "hpaned1";
+                       this.hpaned1.Position = 164;
+                       // Container child hpaned1.Gtk.Paned+PanedChild
+                       this.scrolledwindow1 = new global::Gtk.ScrolledWindow ();
+                       this.scrolledwindow1.CanFocus = true;
+                       this.scrolledwindow1.Name = "scrolledwindow1";
+                       this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1));
+                       // Container child scrolledwindow1.Gtk.Container+ContainerChild
+                       this.treeview = new global::Gtk.TreeView ();
+                       this.treeview.CanFocus = true;
+                       this.treeview.Name = "treeview";
+                       this.scrolledwindow1.Add (this.treeview);
+                       this.hpaned1.Add (this.scrolledwindow1);
+                       global::Gtk.Paned.PanedChild w2 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 
[this.scrolledwindow1]));
+                       w2.Resize = false;
+                       // Container child hpaned1.Gtk.Paned+PanedChild
+                       this.hbox1 = new global::Gtk.HBox ();
+                       this.hbox1.Name = "hbox1";
+                       this.hbox1.Spacing = 6;
+                       // Container child hbox1.Gtk.Box+BoxChild
+                       this.propsvbox = new global::Gtk.VBox ();
+                       this.propsvbox.Name = "propsvbox";
+                       this.propsvbox.Spacing = 6;
+                       this.hbox1.Add (this.propsvbox);
+                       global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 
[this.propsvbox]));
+                       w3.Position = 0;
+                       this.hpaned1.Add (this.hbox1);
+                       this.vbox2.Add (this.hpaned1);
+                       global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hpaned1]));
+                       w5.Position = 0;
+                       // Container child vbox2.Gtk.Box+BoxChild
+                       this.hbuttonbox2 = new global::Gtk.HButtonBox ();
+                       this.hbuttonbox2.Name = "hbuttonbox2";
+                       this.hbuttonbox2.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(3));
+                       // Container child hbuttonbox2.Gtk.ButtonBox+ButtonBoxChild
+                       this.backbutton = new global::Gtk.Button ();
+                       this.backbutton.CanFocus = true;
+                       this.backbutton.Name = "backbutton";
+                       this.backbutton.UseUnderline = true;
+                       // Container child backbutton.Gtk.Container+ContainerChild
+                       global::Gtk.Alignment w6 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F);
+                       // Container child GtkAlignment.Gtk.Container+ContainerChild
+                       global::Gtk.HBox w7 = new global::Gtk.HBox ();
+                       w7.Spacing = 2;
+                       // Container child GtkHBox.Gtk.Container+ContainerChild
+                       global::Gtk.Image w8 = new global::Gtk.Image ();
+                       w8.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-go-back", 
global::Gtk.IconSize.Dialog);
+                       w7.Add (w8);
+                       // Container child GtkHBox.Gtk.Container+ContainerChild
+                       global::Gtk.Label w10 = new global::Gtk.Label ();
+                       w10.LabelProp = global::Mono.Unix.Catalog.GetString ("Back");
+                       w10.UseUnderline = true;
+                       w7.Add (w10);
+                       w6.Add (w7);
+                       this.backbutton.Add (w6);
+                       this.hbuttonbox2.Add (this.backbutton);
+                       global::Gtk.ButtonBox.ButtonBoxChild w14 = 
((global::Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox2 [this.backbutton]));
+                       w14.Expand = false;
+                       w14.Fill = false;
+                       this.vbox2.Add (this.hbuttonbox2);
+                       global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.hbuttonbox2]));
+                       w15.Position = 1;
+                       w15.Expand = false;
+                       w15.Fill = false;
+                       this.Add (this.vbox2);
+                       if ((this.Child != null)) {
+                               this.Child.ShowAll ();
+                       }
+                       this.Hide ();
+               }
+       }
+}
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index c7806ba..8a124f9 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -5474,112 +5474,6 @@ Defining &lt;b&gt; Game Units &lt;/b&gt; will help you during the analysis to in
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.PropertiesEditor" design-size="641 353">
-    <property name="MemberName" />
-    <property name="Title" translatable="yes">Preferences</property>
-    <property name="Icon">resource:logo.svg</property>
-    <property name="WindowPosition">CenterOnParent</property>
-    <property name="Modal">True</property>
-    <property name="Gravity">Center</property>
-    <property name="SkipPagerHint">True</property>
-    <property name="SkipTaskbarHint">True</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.HPaned" id="hpaned1">
-            <property name="MemberName" />
-            <property name="CanFocus">True</property>
-            <property name="Position">164</property>
-            <child>
-              <widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
-                <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="ShadowType">In</property>
-                <child>
-                  <widget class="Gtk.TreeView" id="treeview">
-                    <property name="MemberName" />
-                    <property name="CanFocus">True</property>
-                  </widget>
-                </child>
-              </widget>
-              <packing>
-                <property name="Resize">False</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Gtk.HBox" id="hbox1">
-                <property name="MemberName" />
-                <property name="Spacing">6</property>
-                <child>
-                  <widget class="Gtk.VBox" id="propsvbox">
-                    <property name="MemberName" />
-                    <property name="Spacing">6</property>
-                    <child>
-                      <placeholder />
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="Position">0</property>
-                    <property name="AutoSize">True</property>
-                  </packing>
-                </child>
-              </widget>
-            </child>
-          </widget>
-          <packing>
-            <property name="Position">0</property>
-            <property name="AutoSize">True</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>
   <widget class="Gtk.Bin" id="LongoMatch.Gui.Component.VideoPreferencesPanel" design-size="535 337">
     <property name="MemberName" />
     <property name="Visible">False</property>
@@ -10296,4 +10190,87 @@ Defining &lt;b&gt; Game Units &lt;/b&gt; will help you during the analysis to in
       </widget>
     </child>
   </widget>
+  <widget class="Gtk.Bin" id="LongoMatch.Gui.Panel.PreferencesPanel" design-size="663 352">
+    <property name="MemberName" />
+    <property name="Visible">False</property>
+    <child>
+      <widget class="Gtk.VBox" id="vbox2">
+        <property name="MemberName" />
+        <property name="Spacing">6</property>
+        <child>
+          <widget class="Gtk.HPaned" id="hpaned1">
+            <property name="MemberName" />
+            <property name="CanFocus">True</property>
+            <property name="Position">164</property>
+            <child>
+              <widget class="Gtk.ScrolledWindow" id="scrolledwindow1">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="ShadowType">In</property>
+                <child>
+                  <widget class="Gtk.TreeView" id="treeview">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="Resize">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.HBox" id="hbox1">
+                <property name="MemberName" />
+                <property name="Spacing">6</property>
+                <child>
+                  <widget class="Gtk.VBox" id="propsvbox">
+                    <property name="MemberName" />
+                    <property name="Spacing">6</property>
+                    <child>
+                      <placeholder />
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="Position">0</property>
+                    <property name="AutoSize">True</property>
+                  </packing>
+                </child>
+              </widget>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">0</property>
+            <property name="AutoSize">True</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="Gtk.HButtonBox" id="hbuttonbox2">
+            <property name="MemberName" />
+            <property name="Size">1</property>
+            <property name="LayoutStyle">Start</property>
+            <child>
+              <widget class="Gtk.Button" id="backbutton">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="Type">TextAndIcon</property>
+                <property name="Icon">stock:gtk-go-back Dialog</property>
+                <property name="Label" translatable="yes">Back</property>
+                <property name="UseUnderline">True</property>
+              </widget>
+              <packing>
+                <property name="Expand">False</property>
+                <property name="Fill">False</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">1</property>
+            <property name="AutoSize">False</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </stetic-interface>
\ No newline at end of file
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index a56f237..ee9b5fc 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -509,4 +509,12 @@
     <itemgroups />
     <signals />
   </object>
+  <object type="LongoMatch.Gui.Panel.PreferencesPanel" palette-category="General" allow-children="false" 
base-type="Gtk.Bin">
+    <itemgroups />
+    <signals>
+      <itemgroup label="IPanel Signals">
+        <signal name="BackEvent" />
+      </itemgroup>
+    </signals>
+  </object>
 </objects>
\ No newline at end of file


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