[longomatch] Change the events API to receive the src buttons



commit bbac8f10ad77b95e0b8efd48bd19f0ae518fcb4f
Author: Jorge Zapata <jorgeluis zapata gmail com>
Date:   Fri Apr 17 12:28:39 2015 +0200

    Change the events API to receive the src buttons

 LongoMatch.Core/Common/EventsBroker.cs             |   21 +++++++++++++------
 LongoMatch.Core/Handlers/Handlers.cs               |    6 ++--
 LongoMatch.Core/Store/DashboardButton.cs           |    8 +++---
 .../CanvasObjects/Dashboard/TimerObject.cs         |    4 +-
 LongoMatch.GUI/Gui/Component/CodingWidget.cs       |    4 +-
 LongoMatch.Services/EventsManager.cs               |    2 +-
 6 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index 3616c63..14912ba 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -103,10 +103,13 @@ namespace LongoMatch.Core.Common
                                NewEventEvent (eventType, players, team, tags, start, stop, eventTime, score, 
card, null);
                }
 
-               public void EmitNewDashboardEvent (TimelineEvent evt, DashboardButton btn, bool edit)
+               public void EmitNewDashboardEvent (TimelineEvent evt, DashboardButton btn, bool edit, 
List<DashboardButton> from)
                {
-                       if (NewDashboardEventEvent != null)
-                               NewDashboardEventEvent (evt, btn, edit);
+                       if (NewDashboardEventEvent != null) {
+                               if (from == null)
+                                       from = new List<DashboardButton> ();
+                               NewDashboardEventEvent (evt, btn, edit, from);
+                       }
                }
 
                public void EmitEventsDeleted (List<TimelineEvent> events)
@@ -439,17 +442,21 @@ namespace LongoMatch.Core.Common
                        }
                }
 
-               public void EmitTimeNodeStartedEvent (TimeNode node, TimerButton btn)
+               public void EmitTimeNodeStartedEvent (TimeNode node, TimerButton btn, List<DashboardButton> 
from)
                {
                        if (TimeNodeStartedEvent != null) {
-                               TimeNodeStartedEvent (node, btn);
+                               if (from == null)
+                                       from = new List<DashboardButton> ();
+                               TimeNodeStartedEvent (node, btn, from);
                        }
                }
 
-               public void EmitTimeNodeStoppedEvent (TimeNode node, TimerButton btn)
+               public void EmitTimeNodeStoppedEvent (TimeNode node, TimerButton btn, List<DashboardButton> 
from)
                {
                        if (TimeNodeStoppedEvent != null) {
-                               TimeNodeStoppedEvent (node, btn);
+                               if (from == null)
+                                       from = new List<DashboardButton> ();
+                               TimeNodeStoppedEvent (node, btn, from);
                        }
                }
 
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index a4763c5..3a15e81 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -40,11 +40,11 @@ namespace LongoMatch.Core.Handlers
                                                                                        List<Tag> tags,Time 
start,Time stop,Time EventTime,
                                                                                        Score 
score,PenaltyCard card,DashboardButton btn);
        /* Add a new play to the current project from Dashboard */
-       public delegate void NewDashboardEventHandler (TimelineEvent evt,DashboardButton btn,bool edit);
+       public delegate void NewDashboardEventHandler (TimelineEvent evt,DashboardButton btn,bool edit, 
List<DashboardButton> from);
        /* An event was edited */
        public delegate void TimeNodeChangedHandler (TimeNode tNode,Time time);
-       public delegate void TimeNodeStartedHandler (TimeNode tn, TimerButton btn);
-       public delegate void TimeNodeStoppedHandler (TimeNode tn, TimerButton btn);
+       public delegate void TimeNodeStartedHandler (TimeNode tn, TimerButton btn, List<DashboardButton> 
from);
+       public delegate void TimeNodeStoppedHandler (TimeNode tn, TimerButton btn, List<DashboardButton> 
from);
        /* Edit EventType properties */
        public delegate void EditEventTypeHandler (EventType cat);
        /* A list of plays needs to be deleted */
diff --git a/LongoMatch.Core/Store/DashboardButton.cs b/LongoMatch.Core/Store/DashboardButton.cs
index 65796b8..450545b 100644
--- a/LongoMatch.Core/Store/DashboardButton.cs
+++ b/LongoMatch.Core/Store/DashboardButton.cs
@@ -202,23 +202,23 @@ namespace LongoMatch.Core.Store
                        }
                }
 
-               public void Start (Time start) {
+               public void Start (Time start, List<DashboardButton> from) {
                        if (currentNode != null)
                                return;
 
                        if (Timer != null) {
                                currentNode = Timer.Start (start);
-                               Config.EventsBroker.EmitTimeNodeStartedEvent (currentNode, this);
+                               Config.EventsBroker.EmitTimeNodeStartedEvent (currentNode, this, from);
                        }
                }
 
-               public void Stop (Time stop) {
+               public void Stop (Time stop, List<DashboardButton> from) {
                        if (currentNode == null)
                                return;
 
                        if (Timer != null) {
                                Timer.Stop (stop);
-                               Config.EventsBroker.EmitTimeNodeStoppedEvent (currentNode, this);
+                               Config.EventsBroker.EmitTimeNodeStoppedEvent (currentNode, this, from);
                                currentNode = null;
                        }
                }
diff --git a/LongoMatch.Drawing/CanvasObjects/Dashboard/TimerObject.cs 
b/LongoMatch.Drawing/CanvasObjects/Dashboard/TimerObject.cs
index b5a799a..750baba 100644
--- a/LongoMatch.Drawing/CanvasObjects/Dashboard/TimerObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/Dashboard/TimerObject.cs
@@ -96,11 +96,11 @@ namespace LongoMatch.Drawing.CanvasObjects.Dashboard
                        base.ClickReleased ();
                        if (Button.StartTime == null) {
                                Log.Debug ("Start timer at " + CurrentTime.ToMSecondsString ());
-                               Button.Start (CurrentTime);
+                               Button.Start (CurrentTime, null);
                        } else {
                                Log.Debug ("Stop timer at " + CurrentTime.ToMSecondsString ());
                                if (Button.StartTime.MSeconds != CurrentTime.MSeconds) {
-                                       Button.Stop (CurrentTime);
+                                       Button.Stop (CurrentTime, null);
                                } else {
                                        Button.Cancel ();
                                }
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index 4d34c30..b274162 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -342,7 +342,7 @@ namespace LongoMatch.Gui.Component
                        play.Tags = tags ?? new List<Tag> ();
                        teamtagger.ResetSelection ();
                        selectedPlayers = null;
-                       Config.EventsBroker.EmitNewDashboardEvent (play, btn, true);
+                       Config.EventsBroker.EmitNewDashboardEvent (play, btn, true, null);
                }
 
                void HandlePlayersSubstitutionEvent (Team team, Player p1, Player p2,
@@ -360,7 +360,7 @@ namespace LongoMatch.Gui.Component
                        
                }
 
-               void HandleTimeNodeStoppedEvent (TimeNode tn, TimerButton btn)
+               void HandleTimeNodeStoppedEvent (TimeNode tn, TimerButton btn, List<DashboardButton> from)
                {
                        timeline.AddTimerNode (btn.Timer, tn);
                }
diff --git a/LongoMatch.Services/EventsManager.cs b/LongoMatch.Services/EventsManager.cs
index aa36152..974679e 100644
--- a/LongoMatch.Services/EventsManager.cs
+++ b/LongoMatch.Services/EventsManager.cs
@@ -291,7 +291,7 @@ namespace LongoMatch.Services
                        AddNewPlay (play);
                }
 
-               public void HandleNewDashboardEvent (TimelineEvent play, DashboardButton btn, bool edit)
+               public void HandleNewDashboardEvent (TimelineEvent play, DashboardButton btn, bool edit, 
List<DashboardButton> from)
                {
                        if (openedProject == null)
                                return;


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