[longomatch] Fix detaching player widget



commit 1ce1fab893b4e35b531f124f048111f4144251d2
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Jun 22 14:05:43 2014 +0200

    Fix detaching player widget

 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs         |    5 -
 LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs |    9 --
 .../gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs    |    1 -
 LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic       |    1 -
 LongoMatch.GUI/Gui/Component/AnalysisComponent.cs  |   73 ++++++++-------
 .../LongoMatch.Gui.Component.AnalysisComponent.cs  |   74 +--------------
 .../LongoMatch.Gui.Component.ProjectPeriods.cs     |    1 -
 LongoMatch.GUI/gtk-gui/gui.stetic                  |   97 +------------------
 8 files changed, 46 insertions(+), 215 deletions(-)
---
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 66e4db2..60dc943 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -145,11 +145,6 @@ namespace LongoMatch.Gui
                        }
                }
                
-               public bool Detached {
-                       get;
-                       set;
-               }
-               
                public bool ShowControls {
                        set {
                                controlsbox.Visible = value;
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs 
b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
index 5a974d3..9223e50 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerCapturerBin.cs
@@ -152,15 +152,6 @@ namespace LongoMatch.Gui
                        }
                }
                
-               public bool Detached {
-                       set {
-                               playerbin.Detached = value;
-                       }
-                       get {
-                               return playerbin.Detached;
-                       }
-               }
-               
                public Time StreamLength {
                        get {
                                return playerbin.StreamLength;
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs 
b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
index 80dc178..af59547 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerCapturerBin.cs
@@ -28,7 +28,6 @@ namespace LongoMatch.Gui
                        this.playerbin = new global::LongoMatch.Gui.PlayerBin ();
                        this.playerbin.Events = ((global::Gdk.EventMask)(256));
                        this.playerbin.Name = "playerbin";
-                       this.playerbin.Detached = false;
                        this.hbox4.Add (this.playerbin);
                        global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox4 
[this.playerbin]));
                        w1.Position = 0;
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
index 87e24a8..10b78c4 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
@@ -571,7 +571,6 @@
               <widget class="LongoMatch.Gui.PlayerBin" id="playerbin">
                 <property name="MemberName" />
                 <property name="Events">ButtonPressMask</property>
-                <property name="Detached">False</property>
               </widget>
               <packing>
                 <property name="Position">0</property>
diff --git a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs 
b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
index f973cd1..921505a 100644
--- a/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
+++ b/LongoMatch.GUI/Gui/Component/AnalysisComponent.cs
@@ -43,6 +43,7 @@ namespace LongoMatch.Gui.Component
                        this.Build ();
                        projectType = ProjectType.None;
                        playsSelection.Visible = true;
+                       detachedPlayer = false;
 
                        playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.Player;
                        ConnectSignals();
@@ -91,13 +92,9 @@ namespace LongoMatch.Gui.Component
                                Config.EventsBroker.EmitKeyPressed(o, (int)args.Event.Key, 
(int)args.Event.State));
                }
                
-               void DetachPlayer (bool detach) {
-                       if (detach == detachedPlayer)
-                               return;
-                               
-                       detachedPlayer = detach;
-                       
-                       if (detach) {
+               public void DetachPlayer () {
+                       playercapturer.Pause();
+                       if (!detachedPlayer) {
                                EventBox box;
                                Log.Debug("Detaching player");
                                
@@ -120,14 +117,15 @@ namespace LongoMatch.Gui.Component
                                playercapturer.Reparent(this.videowidgetsbox);
                                playerWindow.Destroy();
                        }
-                       playercapturer.Detached = detach;
+                       playercapturer.Play();
+                       detachedPlayer = !detachedPlayer;
                }
                
                public void CloseOpenedProject () {
                        openedProject = null;
                        projectType = ProjectType.None;
                        if (detachedPlayer)
-                               DetachPlayer(false);
+                               DetachPlayer();
                        ClearWidgets();
                }
                
@@ -146,33 +144,48 @@ namespace LongoMatch.Gui.Component
                        playsSelection.SetProject (project, filter);
                }
                
+               void CreateCommonUI () {
+                       videowidgetsbox = new HBox ();
+                       playsSelection = new PlaysSelectionWidget ();
+                       codingwidget = new CodingWidget();
+                       playercapturer = new PlayerCapturerBin ();
+                       if (projectType == ProjectType.FileProject) {
+                               playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.Player;
+                       } else {
+                               if (projectType == ProjectType.FakeCaptureProject) {
+                                       playercapturer.Mode = 
PlayerCapturerBin.PlayerOperationMode.FakeCapturer;
+                               } else {
+                                       playercapturer.Mode = 
PlayerCapturerBin.PlayerOperationMode.PreviewCapturer;
+                               }
+                               playercapturer.PeriodsNames = openedProject.Categories.GamePeriods;
+                               playercapturer.PeriodsTimers = openedProject.Periods;
+                       }
+                       playsSelection.Show ();
+                       codingwidget.Show ();
+                       playercapturer.Show ();
+                       videowidgetsbox.Show();
+               }
+               
                void CreateCodingUI () {
                        HPaned centralpane, rightpane;
                        VBox vbox;
-                       PeriodsRecoder periodsrecorder;
                        
                        ClearWidgets ();
 
                        centralpane = new HPaned();
                        rightpane = new HPaned ();
                        vbox = new VBox ();
-                       
-                       playsSelection = new PlaysSelectionWidget ();
-                       codingwidget = new CodingWidget();
-                       periodsrecorder = new PeriodsRecoder ();
-                       playercapturer = null;
-                       
                        centralpane.Show ();
                        rightpane.Show ();
                        vbox.Show();
-                       playsSelection.Show ();
-                       codingwidget.Show ();
-                       periodsrecorder.Show ();
+                       
+                       CreateCommonUI ();
                        
                        centralpane.Pack1 (playsSelection, true, true);
                        centralpane.Pack2 (rightpane, true, true);
                        rightpane.Pack1 (vbox, true, true);
-                       vbox.PackStart (periodsrecorder, false, true, 0);
+                       videowidgetsbox.Add (playercapturer);
+                       vbox.PackStart (videowidgetsbox, false, true, 0);
                        vbox.PackEnd (codingwidget, true, true, 0);
                        Add (centralpane);
                }
@@ -186,30 +199,18 @@ namespace LongoMatch.Gui.Component
                        centralpane = new VPaned();
                        uppane = new HPaned ();
                        rightpane = new HPaned();
-                       
-                       playsSelection = new PlaysSelectionWidget ();
-                       codingwidget = new CodingWidget();
-                       playercapturer = new PlayerCapturerBin ();
-                       if(projectType == ProjectType.FileProject) {
-                               playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.Player;
-                       } else {
-                               playercapturer.Mode = PlayerCapturerBin.PlayerOperationMode.PreviewCapturer;
-                               playercapturer.PeriodsNames = openedProject.Categories.GamePeriods;
-                               playercapturer.PeriodsTimers = openedProject.Periods;
-                       }
-                       
                        centralpane.Show ();
                        uppane.Show ();
                        rightpane.Show ();
-                       playsSelection.Show ();
-                       codingwidget.Show ();
-                       playercapturer.Show ();
+                       
+                       CreateCommonUI ();
                        
                        centralpane.Pack1 (uppane, true, true);
                        centralpane.Pack2 (codingwidget, true, true);
                        uppane.Pack1 (playsSelection, true, true);
                        uppane.Pack2 (rightpane, true, true);
-                       rightpane.Pack1 (playercapturer, true, true);
+                       videowidgetsbox.Add (playercapturer);
+                       rightpane.Pack1 (videowidgetsbox, true, true);
                        Add (centralpane);
                }
                
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs
index d0c1499..c286d1d 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.AnalysisComponent.cs
@@ -8,16 +8,8 @@ namespace LongoMatch.Gui.Component
                private global::Gtk.VPaned vpaned1;
                private global::Gtk.HPaned hpaned;
                private global::LongoMatch.Gui.Component.PlaysSelectionWidget playsSelection;
-               private global::Gtk.HPaned hpaned1;
-               private global::Gtk.VBox downbox;
                private global::Gtk.HBox videowidgetsbox;
                private global::LongoMatch.Gui.PlayerCapturerBin playercapturer;
-               private global::Gtk.HBox righthbox;
-               private global::Gtk.VBox tagsvbox;
-               private global::Gtk.Frame notesframe;
-               private global::Gtk.Alignment GtkAlignment22;
-               private global::LongoMatch.Gui.Component.NotesWidget notes;
-               private global::Gtk.Label GtkLabel31;
                private global::LongoMatch.Gui.Component.CodingWidget codingwidget;
 
                protected virtual void Build ()
@@ -47,15 +39,6 @@ namespace LongoMatch.Gui.Component
                        global::Gtk.Paned.PanedChild w3 = ((global::Gtk.Paned.PanedChild)(this.hpaned 
[this.playsSelection]));
                        w3.Resize = false;
                        // Container child hpaned.Gtk.Paned+PanedChild
-                       this.hpaned1 = new global::Gtk.HPaned ();
-                       this.hpaned1.CanFocus = true;
-                       this.hpaned1.Name = "hpaned1";
-                       this.hpaned1.Position = 1046;
-                       // Container child hpaned1.Gtk.Paned+PanedChild
-                       this.downbox = new global::Gtk.VBox ();
-                       this.downbox.Name = "downbox";
-                       this.downbox.Spacing = 6;
-                       // Container child downbox.Gtk.Box+BoxChild
                        this.videowidgetsbox = new global::Gtk.HBox ();
                        this.videowidgetsbox.Name = "videowidgetsbox";
                        this.videowidgetsbox.Spacing = 6;
@@ -63,62 +46,13 @@ namespace LongoMatch.Gui.Component
                        this.playercapturer = new global::LongoMatch.Gui.PlayerCapturerBin ();
                        this.playercapturer.Events = ((global::Gdk.EventMask)(256));
                        this.playercapturer.Name = "playercapturer";
-                       this.playercapturer.Detached = false;
                        this.videowidgetsbox.Add (this.playercapturer);
                        global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.videowidgetsbox 
[this.playercapturer]));
                        w4.Position = 0;
-                       this.downbox.Add (this.videowidgetsbox);
-                       global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.downbox 
[this.videowidgetsbox]));
-                       w5.Position = 0;
-                       this.hpaned1.Add (this.downbox);
-                       global::Gtk.Paned.PanedChild w6 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 
[this.downbox]));
-                       w6.Resize = false;
-                       w6.Shrink = false;
-                       // Container child hpaned1.Gtk.Paned+PanedChild
-                       this.righthbox = new global::Gtk.HBox ();
-                       this.righthbox.WidthRequest = 100;
-                       this.righthbox.Name = "righthbox";
-                       this.righthbox.Spacing = 6;
-                       // Container child righthbox.Gtk.Box+BoxChild
-                       this.tagsvbox = new global::Gtk.VBox ();
-                       this.tagsvbox.WidthRequest = 100;
-                       this.tagsvbox.Name = "tagsvbox";
-                       this.tagsvbox.Spacing = 6;
-                       // Container child tagsvbox.Gtk.Box+BoxChild
-                       this.notesframe = new global::Gtk.Frame ();
-                       this.notesframe.Name = "notesframe";
-                       this.notesframe.ShadowType = ((global::Gtk.ShadowType)(0));
-                       // Container child notesframe.Gtk.Container+ContainerChild
-                       this.GtkAlignment22 = new global::Gtk.Alignment (0F, 0F, 1F, 1F);
-                       this.GtkAlignment22.Name = "GtkAlignment22";
-                       this.GtkAlignment22.LeftPadding = ((uint)(12));
-                       // Container child GtkAlignment22.Gtk.Container+ContainerChild
-                       this.notes = new global::LongoMatch.Gui.Component.NotesWidget ();
-                       this.notes.Events = ((global::Gdk.EventMask)(256));
-                       this.notes.Name = "notes";
-                       this.GtkAlignment22.Add (this.notes);
-                       this.notesframe.Add (this.GtkAlignment22);
-                       this.GtkLabel31 = new global::Gtk.Label ();
-                       this.GtkLabel31.Name = "GtkLabel31";
-                       this.GtkLabel31.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Notes</b>");
-                       this.GtkLabel31.UseMarkup = true;
-                       this.notesframe.LabelWidget = this.GtkLabel31;
-                       this.tagsvbox.Add (this.notesframe);
-                       global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.tagsvbox 
[this.notesframe]));
-                       w9.Position = 0;
-                       this.righthbox.Add (this.tagsvbox);
-                       global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.righthbox 
[this.tagsvbox]));
-                       w10.Position = 0;
-                       this.hpaned1.Add (this.righthbox);
-                       global::Gtk.Paned.PanedChild w11 = ((global::Gtk.Paned.PanedChild)(this.hpaned1 
[this.righthbox]));
-                       w11.Resize = false;
-                       w11.Shrink = false;
-                       this.hpaned.Add (this.hpaned1);
-                       global::Gtk.Paned.PanedChild w12 = ((global::Gtk.Paned.PanedChild)(this.hpaned 
[this.hpaned1]));
-                       w12.Shrink = false;
+                       this.hpaned.Add (this.videowidgetsbox);
                        this.vpaned1.Add (this.hpaned);
-                       global::Gtk.Paned.PanedChild w13 = ((global::Gtk.Paned.PanedChild)(this.vpaned1 
[this.hpaned]));
-                       w13.Resize = false;
+                       global::Gtk.Paned.PanedChild w6 = ((global::Gtk.Paned.PanedChild)(this.vpaned1 
[this.hpaned]));
+                       w6.Resize = false;
                        // Container child vpaned1.Gtk.Paned+PanedChild
                        this.codingwidget = new global::LongoMatch.Gui.Component.CodingWidget ();
                        this.codingwidget.Events = ((global::Gdk.EventMask)(256));
@@ -129,8 +63,6 @@ namespace LongoMatch.Gui.Component
                                this.Child.ShowAll ();
                        }
                        w1.SetUiManager (UIManager);
-                       this.tagsvbox.Hide ();
-                       this.righthbox.Hide ();
                        this.Hide ();
                }
        }
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.ProjectPeriods.cs 
b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.ProjectPeriods.cs
index b3fc01d..2e2c253 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.ProjectPeriods.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.Component.ProjectPeriods.cs
@@ -29,7 +29,6 @@ namespace LongoMatch.Gui.Component
                        this.playerbin2 = new global::LongoMatch.Gui.PlayerBin ();
                        this.playerbin2.Events = ((global::Gdk.EventMask)(256));
                        this.playerbin2.Name = "playerbin2";
-                       this.playerbin2.Detached = false;
                        this.vbox2.Add (this.playerbin2);
                        global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vbox2 
[this.playerbin2]));
                        w1.Position = 0;
diff --git a/LongoMatch.GUI/gtk-gui/gui.stetic b/LongoMatch.GUI/gtk-gui/gui.stetic
index 5635f56..9eeaa99 100644
--- a/LongoMatch.GUI/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI/gtk-gui/gui.stetic
@@ -5447,103 +5447,20 @@ You can continue with the current capture, cancel it or save your project.
               </packing>
             </child>
             <child>
-              <widget class="Gtk.HPaned" id="hpaned1">
+              <widget class="Gtk.HBox" id="videowidgetsbox">
                 <property name="MemberName" />
-                <property name="CanFocus">True</property>
-                <property name="Position">1046</property>
-                <child>
-                  <widget class="Gtk.VBox" id="downbox">
-                    <property name="MemberName" />
-                    <property name="Spacing">6</property>
-                    <child>
-                      <widget class="Gtk.HBox" id="videowidgetsbox">
-                        <property name="MemberName" />
-                        <property name="Spacing">6</property>
-                        <child>
-                          <widget class="LongoMatch.Gui.PlayerCapturerBin" id="playercapturer">
-                            <property name="MemberName" />
-                            <property name="Events">ButtonPressMask</property>
-                            <property name="Detached">False</property>
-                          </widget>
-                          <packing>
-                            <property name="Position">0</property>
-                            <property name="AutoSize">False</property>
-                          </packing>
-                        </child>
-                      </widget>
-                      <packing>
-                        <property name="Position">0</property>
-                        <property name="AutoSize">False</property>
-                      </packing>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="Resize">False</property>
-                    <property name="Shrink">False</property>
-                  </packing>
-                </child>
+                <property name="Spacing">6</property>
                 <child>
-                  <widget class="Gtk.HBox" id="righthbox">
+                  <widget class="LongoMatch.Gui.PlayerCapturerBin" id="playercapturer">
                     <property name="MemberName" />
-                    <property name="WidthRequest">100</property>
-                    <property name="Visible">False</property>
-                    <property name="Spacing">6</property>
-                    <child>
-                      <widget class="Gtk.VBox" id="tagsvbox">
-                        <property name="MemberName" />
-                        <property name="WidthRequest">100</property>
-                        <property name="Visible">False</property>
-                        <property name="Spacing">6</property>
-                        <child>
-                          <widget class="Gtk.Frame" id="notesframe">
-                            <property name="MemberName" />
-                            <property name="ShadowType">None</property>
-                            <child>
-                              <widget class="Gtk.Alignment" id="GtkAlignment22">
-                                <property name="MemberName" />
-                                <property name="Xalign">0</property>
-                                <property name="Yalign">0</property>
-                                <property name="LeftPadding">12</property>
-                                <child>
-                                  <widget class="LongoMatch.Gui.Component.NotesWidget" id="notes">
-                                    <property name="MemberName" />
-                                    <property name="Events">ButtonPressMask</property>
-                                  </widget>
-                                </child>
-                              </widget>
-                            </child>
-                            <child>
-                              <widget class="Gtk.Label" id="GtkLabel31">
-                                <property name="MemberName" />
-                                <property name="LabelProp" 
translatable="yes">&lt;b&gt;Notes&lt;/b&gt;</property>
-                                <property name="UseMarkup">True</property>
-                              </widget>
-                              <packing>
-                                <property name="type">label_item</property>
-                              </packing>
-                            </child>
-                          </widget>
-                          <packing>
-                            <property name="Position">0</property>
-                            <property name="AutoSize">False</property>
-                          </packing>
-                        </child>
-                      </widget>
-                      <packing>
-                        <property name="Position">0</property>
-                        <property name="AutoSize">False</property>
-                      </packing>
-                    </child>
+                    <property name="Events">ButtonPressMask</property>
                   </widget>
                   <packing>
-                    <property name="Resize">False</property>
-                    <property name="Shrink">False</property>
+                    <property name="Position">0</property>
+                    <property name="AutoSize">False</property>
                   </packing>
                 </child>
               </widget>
-              <packing>
-                <property name="Shrink">False</property>
-              </packing>
             </child>
           </widget>
           <packing>
@@ -6052,7 +5969,6 @@ You can continue with the current capture, cancel it or save your project.
                             <property name="MemberName" />
                             <property name="CanFocus">True</property>
                             <property name="Label" translatable="yes">New project using a video 
file</property>
-                            <property name="Active">True</property>
                             <property name="DrawIndicator">True</property>
                             <property name="HasLabel">True</property>
                             <property name="UseUnderline">True</property>
@@ -9409,7 +9325,6 @@ Click 2 players to swap them</property>
           <widget class="LongoMatch.Gui.PlayerBin" id="playerbin2">
             <property name="MemberName" />
             <property name="Events">ButtonPressMask</property>
-            <property name="Detached">False</property>
           </widget>
           <packing>
             <property name="Position">0</property>


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