[longomatch/newui: 126/157] Split tick events for player and capturer



commit 6fed9138bbd9fe1645990640b11339e960ee87f3
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Aug 28 20:29:18 2014 +0200

    Split tick events for player and capturer

 LongoMatch.Core/Common/EventsBroker.cs          |   16 ++++++++++++----
 LongoMatch.Drawing/Widgets/Dashboard.cs         |    1 +
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs      |    2 +-
 LongoMatch.GUI/Gui/Component/CodingWidget.cs    |   19 ++++++++++++++++---
 LongoMatch.GUI/Gui/Component/DashboardWidget.cs |    8 ++++++--
 5 files changed, 36 insertions(+), 10 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index cb94533..ade7079 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -77,7 +77,8 @@ namespace LongoMatch.Common
                public event CreateThumbnailsHandler CreateThumbnailsEvent;
                
                /* Player and Capturer */
-               public event TickHandler Tick;
+               public event TickHandler PlayerTick;
+               public event TickHandler CapturerTick;
                public event ErrorHandler MultimediaError;
                public event ErrorHandler CaptureError;
                public event CaptureFinishedHandler CaptureFinished;
@@ -279,10 +280,17 @@ namespace LongoMatch.Common
                        }
                }
 
-               public void EmitTick (Time currentTime)
+               public void EmitCapturerTick (Time currentTime)
                {
-                       if (Tick != null) {
-                               Tick (currentTime);
+                       if (CapturerTick != null) {
+                               CapturerTick (currentTime);
+                       }
+               }
+               
+               public void EmitPlayerTick (Time currentTime)
+               {
+                       if (PlayerTick != null) {
+                               PlayerTick (currentTime);
                        }
                }
                
diff --git a/LongoMatch.Drawing/Widgets/Dashboard.cs b/LongoMatch.Drawing/Widgets/Dashboard.cs
index 9ce9bee..02322a4 100644
--- a/LongoMatch.Drawing/Widgets/Dashboard.cs
+++ b/LongoMatch.Drawing/Widgets/Dashboard.cs
@@ -48,6 +48,7 @@ namespace LongoMatch.Drawing.Widgets
                        TagMode = TagMode.Edit;
                        widget.SizeChangedEvent += SizeChanged;
                        FitMode = FitMode.Fit;
+                       CurrentTime = new Time (0);
                        AddTag = new Tag ("", "");
                }
 
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 4e7f45f..a7b9fe0 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -609,7 +609,7 @@ namespace LongoMatch.Gui
                                Tick (currentTime);
                        }
                        
-                       Config.EventsBroker.EmitTick (currentTime);
+                       Config.EventsBroker.EmitPlayerTick (currentTime);
                        return true;
                }
 
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index 274854b..cac0724 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -68,7 +68,8 @@ namespace LongoMatch.Gui.Component
                        timeline.HeightRequest = 200;
                        playspositionviewer1.HeightRequest = 200;
                        
-                       Config.EventsBroker.Tick += HandleTick;
+                       Config.EventsBroker.PlayerTick += HandleTick;
+                       Config.EventsBroker.CapturerTick += HandleCapturerTick;
                        Config.EventsBroker.PlayLoadedEvent += HandlePlayLoaded;
                        LongoMatch.Gui.Helpers.Misc.DisableFocus (this);
                        
@@ -82,7 +83,8 @@ namespace LongoMatch.Gui.Component
                        foreach (Window w in activeWindows) {
                                w.Destroy ();
                        }
-                       Config.EventsBroker.Tick -= HandleTick;
+                       Config.EventsBroker.PlayerTick -= HandleTick;
+                       Config.EventsBroker.CapturerTick -= HandleCapturerTick;
                        Config.EventsBroker.PlayLoadedEvent -= HandlePlayLoaded;
                        buttonswidget.Destroy ();
                        timeline.Destroy ();
@@ -212,9 +214,20 @@ namespace LongoMatch.Gui.Component
                        timeline.SelectedTimeNode = play;
                }
 
+               void HandleCapturerTick (Time currentTime)
+               {
+                       if (projectType != ProjectType.FileProject) {
+                               timeline.CurrentTime = currentTime;
+                               buttonswidget.CurrentTime = currentTime;
+                       }
+               }
+
                void HandleTick (Time currentTime)
                {
-                       timeline.CurrentTime = currentTime;
+                       if (projectType == ProjectType.FileProject) {
+                               timeline.CurrentTime = currentTime;
+                               buttonswidget.CurrentTime = currentTime;
+                       }
                }
 
                void HandlePlayersSelectionChangedEvent (List<Player> players)
diff --git a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
index c5fc71d..b4312da 100644
--- a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
@@ -68,17 +68,21 @@ namespace LongoMatch.Gui.Component
                        addscorebutton.Clicked += HandleAddClicked;
                        addtagbutton.Clicked += HandleAddClicked;
                        addcardbutton.Clicked += HandleAddClicked;
-                       Config.EventsBroker.Tick += HandleTick;
                        Edited = false;
                }
 
                protected override void OnDestroyed ()
                {
-                       Config.EventsBroker.Tick -= HandleTick;
                        tagger.Dispose ();
                        base.OnDestroyed ();
                }
 
+               public Time CurrentTime {
+                       set {
+                               tagger.CurrentTime = value;
+                       }
+               }
+               
                public FitMode FitMode {
                        set {
                                tagger.FitMode = value;


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