[longomatch] Refactor the TimeNode events
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Refactor the TimeNode events
- Date: Fri, 17 Apr 2015 16:28:02 +0000 (UTC)
commit e3bab15becde3cbe97f579f839e778cb1bf96634
Author: Jorge Zapata <jorgeluis zapata gmail com>
Date: Wed Apr 15 18:20:59 2015 +0200
Refactor the TimeNode events
Now an event is triggered when a timer starts and when a timer stops
instead of only when a timer is added to the timeline
LongoMatch.Core/Common/EventsBroker.cs | 16 ++++++++++++----
LongoMatch.Core/Handlers/Handlers.cs | 3 ++-
LongoMatch.Core/Store/DashboardButton.cs | 3 ++-
LongoMatch.GUI/Gui/Component/CodingWidget.cs | 6 +++---
4 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index dfb3bca..3616c63 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -36,9 +36,10 @@ namespace LongoMatch.Core.Common
public event LoadEventHandler LoadEventEvent;
public event EventLoadedHandler EventLoadedEvent;
public event EventEditedHandler EventEditedEvent;
- public event TimerNodeAddedHandler TimerNodeAddedEvent;
public event MoveEventHandler MoveToEventTypeEvent;
public event TimeNodeChangedHandler TimeNodeChanged;
+ public event TimeNodeStartedHandler TimeNodeStartedEvent;
+ public event TimeNodeStoppedHandler TimeNodeStoppedEvent;
public event SnapshotSeriesHandler SnapshotSeries;
public event DuplicateEventsHandler DuplicateEventsEvent;
public event TeamsTagsChangedHandler TeamTagsChanged;
@@ -438,10 +439,17 @@ namespace LongoMatch.Core.Common
}
}
- public void EmitTimerNodeAddedEvent (TimerButton btn, TimeNode node)
+ public void EmitTimeNodeStartedEvent (TimeNode node, TimerButton btn)
{
- if (TimerNodeAddedEvent != null) {
- TimerNodeAddedEvent (btn, node);
+ if (TimeNodeStartedEvent != null) {
+ TimeNodeStartedEvent (node, btn);
+ }
+ }
+
+ public void EmitTimeNodeStoppedEvent (TimeNode node, TimerButton btn)
+ {
+ if (TimeNodeStoppedEvent != null) {
+ TimeNodeStoppedEvent (node, btn);
}
}
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index 03d0426..a4763c5 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -43,7 +43,8 @@ namespace LongoMatch.Core.Handlers
public delegate void NewDashboardEventHandler (TimelineEvent evt,DashboardButton btn,bool edit);
/* An event was edited */
public delegate void TimeNodeChangedHandler (TimeNode tNode,Time time);
- public delegate void TimerNodeAddedHandler (TimerButton btn,TimeNode tn);
+ public delegate void TimeNodeStartedHandler (TimeNode tn, TimerButton btn);
+ public delegate void TimeNodeStoppedHandler (TimeNode tn, TimerButton btn);
/* 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 60090c2..65796b8 100644
--- a/LongoMatch.Core/Store/DashboardButton.cs
+++ b/LongoMatch.Core/Store/DashboardButton.cs
@@ -208,6 +208,7 @@ namespace LongoMatch.Core.Store
if (Timer != null) {
currentNode = Timer.Start (start);
+ Config.EventsBroker.EmitTimeNodeStartedEvent (currentNode, this);
}
}
@@ -217,7 +218,7 @@ namespace LongoMatch.Core.Store
if (Timer != null) {
Timer.Stop (stop);
- Config.EventsBroker.EmitTimerNodeAddedEvent (this, currentNode);
+ Config.EventsBroker.EmitTimeNodeStoppedEvent (currentNode, this);
currentNode = null;
}
}
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index f6a385e..4d34c30 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -77,7 +77,7 @@ namespace LongoMatch.Gui.Component
Config.EventsBroker.CapturerTick += HandleCapturerTick;
Config.EventsBroker.EventLoadedEvent += HandlePlayLoaded;
Config.EventsBroker.EventsDeletedEvent += HandleEventsDeletedEvent;
- Config.EventsBroker.TimerNodeAddedEvent += HandleTimerNodeAddedEvent;
+ Config.EventsBroker.TimeNodeStoppedEvent += HandleTimeNodeStoppedEvent;
Config.EventsBroker.EventEditedEvent += HandleEventEdited;
;
LongoMatch.Gui.Helpers.Misc.SetFocus (this, false);
@@ -104,7 +104,7 @@ namespace LongoMatch.Gui.Component
Config.EventsBroker.PlayerTick -= HandleTick;
Config.EventsBroker.CapturerTick -= HandleCapturerTick;
Config.EventsBroker.EventLoadedEvent -= HandlePlayLoaded;
- Config.EventsBroker.TimerNodeAddedEvent -= HandleTimerNodeAddedEvent;
+ Config.EventsBroker.TimeNodeStoppedEvent -= HandleTimeNodeStoppedEvent;
Config.EventsBroker.EventEditedEvent -= HandleEventEdited;
Config.EventsBroker.EventsDeletedEvent += HandleEventsDeletedEvent;
buttonswidget.Destroy ();
@@ -360,7 +360,7 @@ namespace LongoMatch.Gui.Component
}
- void HandleTimerNodeAddedEvent (TimerButton btn, TimeNode tn)
+ void HandleTimeNodeStoppedEvent (TimeNode tn, TimerButton btn)
{
timeline.AddTimerNode (btn.Timer, tn);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]