[longomatch] Add event time in timenodes
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add event time in timenodes
- Date: Wed, 24 Sep 2014 20:26:41 +0000 (UTC)
commit 551623b22493f63fdeee0116cb7d91ea539df96f
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Sep 8 18:22:12 2014 +0200
Add event time in timenodes
LongoMatch.Core/Common/EventsBroker.cs | 4 +-
LongoMatch.Core/Handlers/Handlers.cs | 4 +-
LongoMatch.Core/Store/Project.cs | 3 +-
LongoMatch.Core/Store/TimeNode.cs | 36 ++++++++++++++++++++--
LongoMatch.Drawing/Widgets/DashboardCanvas.cs | 6 ++-
LongoMatch.GUI/Gui/Component/CodingWidget.cs | 4 +-
LongoMatch.GUI/Gui/Component/DashboardWidget.cs | 4 +-
LongoMatch.Services/Services/EventsManager.cs | 6 ++--
8 files changed, 49 insertions(+), 18 deletions(-)
---
diff --git a/LongoMatch.Core/Common/EventsBroker.cs b/LongoMatch.Core/Common/EventsBroker.cs
index 06d3196..0a1eb18 100644
--- a/LongoMatch.Core/Common/EventsBroker.cs
+++ b/LongoMatch.Core/Common/EventsBroker.cs
@@ -89,9 +89,9 @@ namespace LongoMatch.Core.Common
public void EmitNewTag (EventType eventType, List<Player> players = null,
List<Tag> tags = null, Time start = null, Time stop = null,
- Score score = null, PenaltyCard card = null) {
+ Time eventTime = null, Score score = null, PenaltyCard card = null) {
if (NewTagEvent != null)
- NewTagEvent (eventType, players, tags, start, stop, score, card);
+ NewTagEvent (eventType, players, tags, start, stop, eventTime, score, card);
}
public void EmitNewEvent (TimelineEvent evt) {
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index 642e824..18f46ab 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -35,8 +35,8 @@ namespace LongoMatch.Core.Handlers
public delegate void EventLoadedHandler (TimelineEvent evt);
/* A new play needs to be create for a specific category at the current play time */
public delegate void NewEventHandler (EventType eventType,List<Player> players,
- List<Tag> tags,Time start,Time stop,Score score,
- PenaltyCard card);
+ 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);
/* An event was edited */
diff --git a/LongoMatch.Core/Store/Project.cs b/LongoMatch.Core/Store/Project.cs
index 2825c01..5a84e56 100644
--- a/LongoMatch.Core/Store/Project.cs
+++ b/LongoMatch.Core/Store/Project.cs
@@ -175,7 +175,7 @@ namespace LongoMatch.Core.Store
Timers.Clear();
}
- public TimelineEvent AddEvent (EventType type, Time start, Time stop, Image miniature,
+ public TimelineEvent AddEvent (EventType type, Time start, Time stop, Time eventTime, Image
miniature,
Score score, PenaltyCard card, bool addToTimeline=true)
{
TimelineEvent evt;
@@ -193,6 +193,7 @@ namespace LongoMatch.Core.Store
evt.Name = name;
evt.Start = start;
evt.Stop = stop;
+ evt.EventTime = eventTime;
evt.EventType = type;
evt.Notes = "";
evt.Miniature = miniature;
diff --git a/LongoMatch.Core/Store/TimeNode.cs b/LongoMatch.Core/Store/TimeNode.cs
index 9dabe55..2fbfabc 100644
--- a/LongoMatch.Core/Store/TimeNode.cs
+++ b/LongoMatch.Core/Store/TimeNode.cs
@@ -33,6 +33,8 @@ namespace LongoMatch.Core.Store
[Serializable]
public class TimeNode
{
+ Time start, stop, eventTime;
+
#region Constructors
public TimeNode() {
Rate = 1;
@@ -52,16 +54,42 @@ namespace LongoMatch.Core.Store
/// Start Time
/// </summary>
public Time Start {
- get;
- set;
+ get {
+ return start;
+ }
+ set {
+ start = value;
+ if (start > eventTime) {
+ eventTime = start;
+ }
+ }
}
/// <summary>
/// Stop time
/// </summary>
public Time Stop {
- get;
- set;
+ get {
+ return stop;
+ }
+ set {
+ stop = value;
+ if (stop < eventTime) {
+ eventTime = stop;
+ }
+ }
+ }
+
+ /// <summary>
+ /// The time at which the event takes place
+ /// </summary>
+ public Time EventTime {
+ get {
+ return eventTime;
+ }
+ set {
+ eventTime = value;
+ }
}
/// <summary>
diff --git a/LongoMatch.Drawing/Widgets/DashboardCanvas.cs b/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
index e08d57e..ebee1f3 100644
--- a/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
+++ b/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
@@ -260,7 +260,7 @@ namespace LongoMatch.Drawing.Widgets
{
TaggerObject tagger;
EventButton button;
- Time start = null, stop = null;
+ Time start = null, stop = null, eventTime = null;
List<Tag> tags = null;
PenaltyCard card = null;
Score score = null;
@@ -284,9 +284,11 @@ namespace LongoMatch.Drawing.Widgets
if (button.TagMode == TagMode.Predefined) {
stop = CurrentTime + button.Stop;
start = CurrentTime - button.Start;
+ eventTime = CurrentTime;
} else {
stop = CurrentTime;
start = tagger.Start - button.Start;
+ eventTime = tagger.Start;
}
if (tagger is CategoryObject) {
@@ -306,7 +308,7 @@ namespace LongoMatch.Drawing.Widgets
score = (button as ScoreButton).Score;
}
- NewTagEvent (button.EventType, null, tags, start, stop, score, card);
+ NewTagEvent (button.EventType, null, tags, start, stop, eventTime, score, card);
}
}
}
diff --git a/LongoMatch.GUI/Gui/Component/CodingWidget.cs b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
index 3e87df8..5830a7a 100644
--- a/LongoMatch.GUI/Gui/Component/CodingWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/CodingWidget.cs
@@ -246,9 +246,9 @@ namespace LongoMatch.Gui.Component
}
void HandleNewTagEvent (EventType eventType, List<Player> players, List<Tag> tags,
- Time start, Time stop, Score score, PenaltyCard card)
+ Time start, Time stop, Time eventTime, Score score, PenaltyCard card)
{
- TimelineEvent play = project.AddEvent (eventType, start, stop, null, score, card,
false);
+ TimelineEvent play = project.AddEvent (eventType, start, stop, eventTime, null,
score, card, false);
play.Players = selectedPlayers ?? new List<Player> ();
play.Tags = tags ?? new List<Tag> ();
if (eventType.TagFieldPosition || eventType.TagGoalPosition ||
eventType.TagHalfFieldPosition) {
diff --git a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
index 38abd13..93e9e08 100644
--- a/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/DashboardWidget.cs
@@ -362,11 +362,11 @@ namespace LongoMatch.Gui.Component
}
void HandleNewTagEvent (EventType evntType, List<Player> players, List<Tag> tags,
- Time start, Time stop, Score score, PenaltyCard card)
+ Time start, Time stop, Time eventTime, Score score, PenaltyCard card)
{
/* Forward event until we have players integrted in the dashboard layout */
if (NewTagEvent != null) {
- NewTagEvent (evntType , players, tags, start, stop, score, card);
+ NewTagEvent (evntType , players, tags, start, stop, eventTime, score, card);
}
//Config.EventsBroker.EmitNewTag (button, players, tags, start, stop);
}
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index 197a465..d364a27 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -231,7 +231,7 @@ namespace LongoMatch.Services
}
public void OnNewTag (EventType evType, List<Player> players, List<Tag> tags,
- Time start, Time stop, Score score, PenaltyCard card)
+ Time start, Time stop, Time eventTime, Score score, PenaltyCard card)
{
Image frame;
@@ -250,7 +250,7 @@ namespace LongoMatch.Services
start.ToMSecondsString(), stop.ToMSecondsString(),
evType.Name));
/* Add the new created play to the project and update the GUI*/
- var play = openedProject.AddEvent (evType, start, stop, frame, score, card);
+ var play = openedProject.AddEvent (evType, start, stop, eventTime, frame, score,
card);
if (players != null) {
play.Players = players;
}
@@ -317,7 +317,7 @@ namespace LongoMatch.Services
List<TimelineEvent> plays = new List<TimelineEvent> ();
plays.Add (play);
OnPlaysDeleted (plays);
- var newplay = openedProject.AddEvent (evType, play.Start, play.Stop, play.Miniature,
null, null);
+ var newplay = openedProject.AddEvent (evType, play.Start, play.Stop, play.EventTime,
play.Miniature, null, null);
newplay.Name = play.Name;
newplay.Notes = play.Notes;
newplay.Drawings = play.Drawings;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]