[longomatch] Remove segment closed events in favor of null play selection



commit 0e6abc06429bc1f21937193daa1255d4d188807c
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Jul 1 12:14:49 2014 +0200

    Remove segment closed events in favor of null play selection

 LongoMatch.Core/Common/EventsBroker.cs             |    8 --------
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs         |    2 +-
 .../Gui/Component/PlaysPositionViewer.cs           |   20 +++++++++-----------
 LongoMatch.Services/Services/Core.cs               |    1 -
 LongoMatch.Services/Services/EventsManager.cs      |   12 +++++-------
 LongoMatch.Services/Services/HotKeysManager.cs     |    6 +-----
 LongoMatch.Services/Services/PlaylistManager.cs    |    1 -
 7 files changed, 16 insertions(+), 34 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index 002995a..49d1edb 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -83,7 +83,6 @@ namespace LongoMatch.Common
                public event ErrorHandler MultimediaError;
                public event ErrorHandler CaptureError;
                public event CaptureFinishedHandler CaptureFinished;
-               public event SegmentClosedHandler SegmentClosed;
                public event NextButtonClickedHandler Next;
                public event PrevButtonClickedHandler Prev;
                public event DrawFrameHandler DrawFrame;
@@ -314,13 +313,6 @@ namespace LongoMatch.Common
                        }
                }
                
-               public void EmitSegmentClosed ()
-               {
-                       if (SegmentClosed != null) {
-                               SegmentClosed ();
-                       }
-               }
-               
                public void EmitTeamTagsChanged ()
                {
                        if (TeamTagsChanged != null) {
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index e58b69e..feac6a8 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -269,7 +269,7 @@ namespace LongoMatch.Gui
                        SetScaleValue (SCALE_FPS);
                        //timescale.Sensitive = true;
                        loadedPlay = null;
-                       Config.EventsBroker.EmitSegmentClosed ();
+                       Config.EventsBroker.EmitPlaySelected (null);
                }
 
                public void SetSensitive() {
diff --git a/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs 
b/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
index bcaf8cb..1053497 100644
--- a/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
+++ b/LongoMatch.GUI/Gui/Component/PlaysPositionViewer.cs
@@ -40,7 +40,6 @@ namespace LongoMatch.Gui.Component
                        hfield.Tagger.ShowMenuEvent += HandleShowMenuEvent;
                        goal.Tagger.ShowMenuEvent += HandleShowMenuEvent;
                        Config.EventsBroker.PlaySelected += HandlePlaySelected;
-                       Config.EventsBroker.SegmentClosed += HandleSegmentClosed;
                        menu = new PlaysMenu ();
                }
 
@@ -72,16 +71,15 @@ namespace LongoMatch.Gui.Component
                
                void HandlePlaySelected (Play play)
                {
-                       field.Tagger.SelectPlay (play);
-                       hfield.Tagger.SelectPlay (play);
-                       goal.Tagger.SelectPlay (play);
-               }
-
-               void HandleSegmentClosed ()
-               {
-                       field.Tagger.ClearSelection ();
-                       hfield.Tagger.ClearSelection ();
-                       goal.Tagger.ClearSelection ();
+                       if (play != null) {
+                               field.Tagger.SelectPlay (play);
+                               hfield.Tagger.SelectPlay (play);
+                               goal.Tagger.SelectPlay (play);
+                       } else {
+                               field.Tagger.ClearSelection ();
+                               hfield.Tagger.ClearSelection ();
+                               goal.Tagger.ClearSelection ();
+                       }
                }
 
                void HandleShowMenuEvent (System.Collections.Generic.List<Play> plays)
diff --git a/LongoMatch.Services/Services/Core.cs b/LongoMatch.Services/Services/Core.cs
index bfec6eb..9e2c245 100644
--- a/LongoMatch.Services/Services/Core.cs
+++ b/LongoMatch.Services/Services/Core.cs
@@ -105,7 +105,6 @@ namespace LongoMatch.Services
                        
                        /* Start the hotkeys manager */
                        hkManager = new HotKeysManager ();
-                       hkManager.newMarkEvent += eManager.OnNewTag;
 
                        /* Start playlists manager */
                        plManager = new PlaylistManager(Config.GUIToolkit, videoRenderer);
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index a8d0029..449af86 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -97,7 +97,6 @@ namespace LongoMatch.Services
                        
                        Config.EventsBroker.OpenedProjectChanged += HandleOpenedProjectChanged;
 
-                       Config.EventsBroker.SegmentClosed += OnSegmentClosedEvent;
                        Config.EventsBroker.Prev += OnPrev;
                        Config.EventsBroker.DrawFrame += OnDrawFrame;
                        Config.EventsBroker.PlaybackRateChanged += HandlePlaybackRateChanged;
@@ -300,7 +299,11 @@ namespace LongoMatch.Services
 
                void OnPlaySelected(Play play)
                {
-                       LoadPlay (play, play.Start, true);
+                       if (play != null) {
+                               LoadPlay (play, play.Start, true);
+                       } else {
+                               loadedPlay = null;
+                       }
                }
 
                protected virtual void OnTimeNodeChanged(TimeNode tNode, object val)
@@ -341,11 +344,6 @@ namespace LongoMatch.Services
                        filter.Update();
                }
 
-               protected virtual void OnSegmentClosedEvent()
-               {
-                       loadedPlay = null;
-               }
-
                protected virtual void OnSnapshotSeries(Play play) {
                        player.Pause();
                        guiToolkit.ExportFrameSeries(openedProject, play, Config.SnapshotsDir);
diff --git a/LongoMatch.Services/Services/HotKeysManager.cs b/LongoMatch.Services/Services/HotKeysManager.cs
index 53d3aca..b1a7ba3 100644
--- a/LongoMatch.Services/Services/HotKeysManager.cs
+++ b/LongoMatch.Services/Services/HotKeysManager.cs
@@ -38,8 +38,6 @@ namespace LongoMatch.Services
 
        public class HotKeysManager
        {
-               public event NewTagHandler newMarkEvent;
-               
                Dictionary<HotKey, Category> dic;
                bool ignoreKeys;
                
@@ -78,9 +76,7 @@ namespace LongoMatch.Services
                        hotkey.Key= key;
                        hotkey.Modifier= (int) ((ModifierType)state & (ModifierType.Mod1Mask | 
ModifierType.Mod5Mask | ModifierType.ShiftMask));
                        if(dic.TryGetValue(hotkey, out cat)) {
-                               if(newMarkEvent != null) {
-                                       newMarkEvent(cat);
-                               }
+                               Config.EventsBroker.EmitNewTag (cat);
 #endif
                        }
                }
diff --git a/LongoMatch.Services/Services/PlaylistManager.cs b/LongoMatch.Services/Services/PlaylistManager.cs
index 1e85bc8..8638205 100644
--- a/LongoMatch.Services/Services/PlaylistManager.cs
+++ b/LongoMatch.Services/Services/PlaylistManager.cs
@@ -88,7 +88,6 @@ namespace LongoMatch.Services
                        Config.EventsBroker.PlayListNodeAddedEvent += OnPlayListNodeAdded;
                        Config.EventsBroker.PlayListNodeSelectedEvent += LoadPlaylistPlay;
                        Config.EventsBroker.RenderPlaylist += OnRenderPlaylistEvent;
-                       Config.EventsBroker.SegmentClosed += () => {selectedTimeNode = null;};
                        Config.EventsBroker.Next += () => {Next ();};
                        Config.EventsBroker.Prev += () => {
                                if(selectedTimeNode is PlayListPlay)


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