[longomatch] Respect individual colors for score and penalty card events
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Respect individual colors for score and penalty card events
- Date: Wed, 24 Sep 2014 20:26:31 +0000 (UTC)
commit 1f380a101242f6a669b40157ef954027c116a7e0
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Sep 8 17:41:17 2014 +0200
Respect individual colors for score and penalty card events
LongoMatch.Core/Store/DashboardButton.cs | 12 +++++++++++
LongoMatch.Core/Store/Score.cs | 6 +++++
LongoMatch.Core/Store/TimelineEvent.cs | 21 ++++++++++++++++++++
LongoMatch.Drawing/CanvasObjects/PlayObject.cs | 4 +-
LongoMatch.Drawing/CanvasObjects/PositionObject.cs | 2 +-
LongoMatch.Drawing/PlayslistCellRenderer.cs | 8 +------
6 files changed, 43 insertions(+), 10 deletions(-)
---
diff --git a/LongoMatch.Core/Store/DashboardButton.cs b/LongoMatch.Core/Store/DashboardButton.cs
index 5182941..2d9687e 100644
--- a/LongoMatch.Core/Store/DashboardButton.cs
+++ b/LongoMatch.Core/Store/DashboardButton.cs
@@ -281,6 +281,18 @@ namespace LongoMatch.Core.Store
}
}
+ public override Color BackgroundColor {
+ get {
+ return Score != null ? Score.Color : null;
+ }
+ set {
+ if (Score != null) {
+ Score.Color = value;
+ }
+ }
+ }
+
+
[JsonIgnore]
public ScoreEventType ScoreEventType {
get {
diff --git a/LongoMatch.Core/Store/Score.cs b/LongoMatch.Core/Store/Score.cs
index 0e44506..e010eec 100644
--- a/LongoMatch.Core/Store/Score.cs
+++ b/LongoMatch.Core/Store/Score.cs
@@ -16,6 +16,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
using System;
+using LongoMatch.Core.Common;
namespace LongoMatch.Core.Store
{
@@ -32,6 +33,11 @@ namespace LongoMatch.Core.Store
Points = points;
}
+ public Color Color {
+ get;
+ set;
+ }
+
public string Name {
get;
set;
diff --git a/LongoMatch.Core/Store/TimelineEvent.cs b/LongoMatch.Core/Store/TimelineEvent.cs
index 2cca280..8002021 100644
--- a/LongoMatch.Core/Store/TimelineEvent.cs
+++ b/LongoMatch.Core/Store/TimelineEvent.cs
@@ -152,6 +152,13 @@ namespace LongoMatch.Core.Store
Start.ToMSecondsString() + " - " + Stop.ToMSecondsString();
}
}
+
+ [JsonIgnore]
+ public virtual Color Color {
+ get {
+ return EventType.Color;
+ }
+ }
#endregion
#region Public methods
@@ -231,6 +238,13 @@ namespace LongoMatch.Core.Store
get;
set;
}
+
+ [JsonIgnore]
+ public override Color Color {
+ get {
+ return PenaltyCard != null ? PenaltyCard.Color : EventType.Color;
+ }
+ }
}
[Serializable]
@@ -240,6 +254,13 @@ namespace LongoMatch.Core.Store
get;
set;
}
+
+ [JsonIgnore]
+ public override Color Color {
+ get {
+ return Score != null ? Score.Color : EventType.Color;
+ }
+ }
}
}
diff --git a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
index 1437a39..b166c5b 100644
--- a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
@@ -58,8 +58,8 @@ namespace LongoMatch.Drawing.CanvasObjects
y = OffsetY + Height / 2;
tk.LineWidth = lineWidth;
- tk.FillColor = Play.EventType.Color;
- tk.StrokeColor = Play.EventType.Color;
+ tk.FillColor = Play.Color;
+ tk.StrokeColor = Play.Color;
if (stop - start <= lineWidth) {
tk.LineWidth = 0;
tk.DrawCircle (new Point (start + (stop - start) / 2, y), 3);
diff --git a/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
b/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
index 13a18ef..e83ea57 100644
--- a/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PositionObject.cs
@@ -115,7 +115,7 @@ namespace LongoMatch.Drawing.CanvasObjects
tk.Begin ();
if (Play != null) {
- color = Play.EventType.Color;
+ color = Play.Color;
} else {
color = Constants.TAGGER_POINT_COLOR;
}
diff --git a/LongoMatch.Drawing/PlayslistCellRenderer.cs b/LongoMatch.Drawing/PlayslistCellRenderer.cs
index 1834fb2..03e1762 100644
--- a/LongoMatch.Drawing/PlayslistCellRenderer.cs
+++ b/LongoMatch.Drawing/PlayslistCellRenderer.cs
@@ -197,14 +197,8 @@ namespace LongoMatch.Drawing
RenderAnalysisCategory (item as EventType, count, isExpanded, tk,
context, backgroundArea, cellArea);
} else if (item is TimelineEvent) {
- Color color;
TimelineEvent p = item as TimelineEvent;
- if (p is PenaltyCardEvent) {
- color = (p as PenaltyCardEvent).PenaltyCard.Color;
- } else {
- color = p.EventType.Color;
- }
- RenderPlay (color, p.Miniature, p.Selected, p.Description, count, isExpanded,
tk,
+ RenderPlay (p.Color, p.Miniature, p.Selected, p.Description, count,
isExpanded, tk,
context, backgroundArea, cellArea, state);
} else if (item is Player) {
RenderPlayer (item as Player, count, isExpanded, tk, context, backgroundArea,
cellArea);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]