[longomatch] Add button originating event in event handlers.



commit 2cb63e5ee88212ddf650be19f16bf5ed45756b34
Author: Julien Moutte <julien fluendo com>
Date:   Fri Apr 10 19:14:55 2015 +0200

    Add button originating event in event handlers.
    
    We will use this to implement link buttons actions.

 LongoMatch.Core/Common/EventsBroker.cs          |    8 ++++----
 LongoMatch.Core/Handlers/Handlers.cs            |    8 ++++----
 LongoMatch.Drawing/Widgets/DashboardCanvas.cs   |    2 +-
 LongoMatch.GUI/Gui/Component/CodingWidget.cs    |    4 ++--
 LongoMatch.GUI/Gui/Component/DashboardWidget.cs |    4 ++--
 LongoMatch.Services/EventsManager.cs            |    4 ++--
 6 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index f84d946..1c35e5c 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -30,7 +30,7 @@ namespace LongoMatch.Core.Common
        {
        
                public event NewEventHandler NewEventEvent;
-               public event NewTimelineEventHandler NewDashboardEventEvent;
+               public event NewDashboardEventHandler NewDashboardEventEvent;
                public event EventCreatedHandler EventCreatedEvent;
                public event DeleteEventsHandler EventsDeletedEvent;
                public event LoadEventHandler LoadEventEvent;
@@ -99,13 +99,13 @@ namespace LongoMatch.Core.Common
                                          Time eventTime = null, Score score = null, PenaltyCard card = null)
                {
                        if (NewEventEvent != null)
-                               NewEventEvent (eventType, players, team, tags, start, stop, eventTime, score, 
card);
+                               NewEventEvent (eventType, players, team, tags, start, stop, eventTime, score, 
card, null);
                }
 
-               public void EmitNewDashboardEvent (TimelineEvent evt)
+               public void EmitNewDashboardEvent (TimelineEvent evt, DashboardButton btn)
                {
                        if (NewDashboardEventEvent != null)
-                               NewDashboardEventEvent (evt);
+                               NewDashboardEventEvent (evt, btn);
                }
 
                public void EmitEventsDeleted (List<TimelineEvent> events)
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index 6628111..8b9c3d0 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -37,10 +37,10 @@ namespace LongoMatch.Core.Handlers
        public delegate void EventCreatedHandler (TimelineEvent evt);
        /* A new play needs to be created for a specific category at the current play time */
        public delegate void NewEventHandler (EventType eventType,List<Player> players,TeamType team,
-                                             List<Tag> tags,Time start,Time stop,Time EventTime,
-                                             Score score,PenaltyCard card);
-       /* Add a new play to the current project */
-       public delegate void NewTimelineEventHandler (TimelineEvent evt);
+                                                                                       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);
        /* An event was edited */
        public delegate void TimeNodeChangedHandler (TimeNode tNode,Time time);
        public delegate void TimerNodeAddedHandler (Timer timer,TimeNode tn);
diff --git a/LongoMatch.Drawing/Widgets/DashboardCanvas.cs b/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
index 4dcb17f..4f056c4 100644
--- a/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
+++ b/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
@@ -372,7 +372,7 @@ namespace LongoMatch.Drawing.Widgets
                                score = (button as ScoreButton).Score;
                        }
                        
-                       NewTagEvent (button.EventType, null, TeamType.NONE, tags, start, stop, eventTime, 
score, card);
+                       NewTagEvent (button.EventType, null, TeamType.NONE, tags, start, stop, eventTime, 
score, card, button);
                }
        }
 }
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index aee2826..2e9a8c1 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -334,7 +334,7 @@ namespace LongoMatch.Gui.Component
                }
 
                void HandleNewTagEvent (EventType eventType, List<Player> players, TeamType team, List<Tag> 
tags,
-                                       Time start, Time stop, Time eventTime, Score score, PenaltyCard card)
+                                       Time start, Time stop, Time eventTime, Score score, PenaltyCard card, 
DashboardButton btn)
                {
                        TimelineEvent play = project.AddEvent (eventType, start, stop, eventTime, null, 
score, card, false);
                        play.Team = teamtagger.SelectedTeam;
@@ -342,7 +342,7 @@ namespace LongoMatch.Gui.Component
                        play.Tags = tags ?? new List<Tag> ();
                        teamtagger.ResetSelection ();
                        selectedPlayers = null;
-                       Config.EventsBroker.EmitNewDashboardEvent (play);
+                       Config.EventsBroker.EmitNewDashboardEvent (play, btn);
                }
 
                void HandlePlayersSubstitutionEvent (Team team, Player p1, Player p2,
diff --git a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
index 26bd7a3..676e3a4 100644
--- a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
@@ -420,11 +420,11 @@ namespace LongoMatch.Gui.Component
                }
 
                void HandleNewTagEvent (EventType evntType, List<Player> players, TeamType team, List<Tag> 
tags,
-                                       Time start, Time stop, Time eventTime, Score score, PenaltyCard card)
+                                       Time start, Time stop, Time eventTime, Score score, PenaltyCard card, 
DashboardButton btn)
                {
                        /* Forward event until we have players integrted in the dashboard layout */
                        if (NewTagEvent != null) {
-                               NewTagEvent (evntType, players, team, tags, start, stop, eventTime, score, 
card);
+                               NewTagEvent (evntType, players, team, tags, start, stop, eventTime, score, 
card, btn);
                        }
                        //Config.EventsBroker.EmitNewTag (button, players, tags, start, stop);
                }
diff --git a/LongoMatch.Services/EventsManager.cs b/LongoMatch.Services/EventsManager.cs
index f01040b..b3e2819 100644
--- a/LongoMatch.Services/EventsManager.cs
+++ b/LongoMatch.Services/EventsManager.cs
@@ -291,7 +291,7 @@ namespace LongoMatch.Services
                }
 
                public void OnNewTag (EventType evType, List<Player> players, TeamType team, List<Tag> tags,
-                                     Time start, Time stop, Time eventTime, Score score, PenaltyCard card)
+                                     Time start, Time stop, Time eventTime, Score score, PenaltyCard card, 
DashboardButton btn)
                {
                        if (player == null || openedProject == null)
                                return;
@@ -318,7 +318,7 @@ namespace LongoMatch.Services
                        AddNewPlay (play);
                }
 
-               public void HandleNewPlay (TimelineEvent play)
+               public void HandleNewPlay (TimelineEvent play, DashboardButton btn)
                {
                        if (openedProject == null)
                                return;


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