[longomatch] Show players in the substitution event
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Show players in the substitution event
- Date: Wed, 5 Nov 2014 19:03:28 +0000 (UTC)
commit f6d984876fc9e76fd788b623ceec1c4fc0e39afd
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Nov 5 19:37:42 2014 +0100
Show players in the substitution event
LongoMatch.Core/StyleConf.cs | 1 +
LongoMatch.Drawing/PlayslistCellRenderer.cs | 136 +++++++++++++-------
data/icons/Makefile.am | 1 +
.../scalable/actions/longomatch-subs-arrow.svg | 53 ++++++++
4 files changed, 146 insertions(+), 45 deletions(-)
---
diff --git a/LongoMatch.Core/StyleConf.cs b/LongoMatch.Core/StyleConf.cs
index 33ff515..b3a3c7a 100644
--- a/LongoMatch.Core/StyleConf.cs
+++ b/LongoMatch.Core/StyleConf.cs
@@ -88,6 +88,7 @@ namespace LongoMatch.Core.Common
public const string SubsLock = "hicolor/scalable/actions/longomatch-player-swap-lock.svg";
public const string SubsUnlock = "hicolor/scalable/actions/longomatch-player-swap-unlock.svg";
+ public const string SubsIcon = "hicolor/scalable/actions/longomatch-subs-arrow.svg";
public const string DefaultShield = "hicolor/scalable/actions/longomatch-default-shield.svg";
public const string EditButton = "hicolor/scalable/actions/longomatch-pencil.svg";
diff --git a/LongoMatch.Drawing/PlayslistCellRenderer.cs b/LongoMatch.Drawing/PlayslistCellRenderer.cs
index edb8034..0f5ca15 100644
--- a/LongoMatch.Drawing/PlayslistCellRenderer.cs
+++ b/LongoMatch.Drawing/PlayslistCellRenderer.cs
@@ -30,7 +30,8 @@ namespace LongoMatch.Drawing
{
public static ISurface EyeSurface = null;
-
+ public static Image subsImage = null;
+
public static void RenderSeparationLine (IDrawingToolkit tk, IContext context, Area
backgroundArea)
{
@@ -44,6 +45,17 @@ namespace LongoMatch.Drawing
tk.DrawLine (new Point (x1, y), new Point (x2, y));
}
+ static void RenderPlayer (IDrawingToolkit tk, Player p, Point imagePoint)
+ {
+ PlayerObject po = new PlayerObject (p);
+ po.Position = new Point (imagePoint.X + StyleConf.ListImageWidth / 2, imagePoint.Y +
StyleConf.ListImageWidth / 2);
+ po.Size = StyleConf.ListImageWidth - 2;
+ tk.End ();
+ po.Draw (tk, null);
+ tk.Begin ();
+ po.Dispose ();
+ }
+
static void RenderCount (Color color, int count, IDrawingToolkit tk, Area backgroundArea,
Area cellArea)
{
double countX1, countX2, countY, countYC;
@@ -72,8 +84,7 @@ namespace LongoMatch.Drawing
if (isExpanded) {
backgroundColor = Config.Style.PaletteBackgroundLight;
textColor = Config.Style.PaletteSelected;
- }
- else {
+ } else {
backgroundColor = Config.Style.PaletteBackground;
textColor = Config.Style.PaletteWidgets;
}
@@ -89,7 +100,7 @@ namespace LongoMatch.Drawing
}
public static void RenderPlayer (Player player, int count, bool isExpanded, IDrawingToolkit
tk,
- IContext context, Area backgroundArea, Area cellArea)
+ IContext context, Area backgroundArea, Area cellArea)
{
Point image, text;
double textWidth;
@@ -100,7 +111,7 @@ namespace LongoMatch.Drawing
tk.Context = context;
tk.Begin ();
- RenderBackgroundAndText (isExpanded, tk, backgroundArea, text, textWidth,
player.ToString());
+ RenderBackgroundAndText (isExpanded, tk, backgroundArea, text, textWidth,
player.ToString ());
/* Photo */
if (player.Photo != null) {
tk.DrawImage (image, StyleConf.ListImageWidth, backgroundArea.Height,
player.Photo, true);
@@ -126,29 +137,22 @@ namespace LongoMatch.Drawing
{
tk.Context = context;
tk.Begin ();
- RenderBackgroundAndText (isExpanded, tk, backgroundArea, cellArea.Start,
cellArea.Width,
- cat.Name);
+ RenderBackgroundAndText (isExpanded, tk, backgroundArea, cellArea.Start,
cellArea.Width, cat.Name);
RenderCount (cat.Color, count, tk, backgroundArea, cellArea);
RenderSeparationLine (tk, context, backgroundArea);
tk.End ();
}
-
- public static void RenderPlay (Color color, Image ss, List<Player> players, bool selected,
string desc,
- int count, bool isExpanded, IDrawingToolkit tk,
- IContext context, Area backgroundArea, Area cellArea, CellState
state)
+
+ static void RenderTimelineEventBase (Color color, Image ss, bool selected, string desc,
IDrawingToolkit tk,
+ IContext context, Area backgroundArea, Area cellArea,
CellState state,
+ out Point selectPoint, out Point textPoint, out Point
imagePoint,
+ out Point circlePoint, out double textWidth)
{
- Point selectPoint, textPoint, imagePoint, circlePoint;
- double textWidth;
-
selectPoint = new Point (backgroundArea.Start.X, backgroundArea.Start.Y);
textPoint = new Point (selectPoint.X + StyleConf.ListSelectedWidth +
StyleConf.ListRowSeparator, selectPoint.Y);
imagePoint = new Point (textPoint.X + StyleConf.ListTextWidth +
StyleConf.ListRowSeparator, selectPoint.Y);
- textWidth = StyleConf.ListTextWidth;
- circlePoint = new Point (selectPoint.X + StyleConf.ListSelectedWidth / 2,
- selectPoint.Y + backgroundArea.Height / 2);
-
- tk.Context = context;
- tk.Begin ();
+ textWidth = StyleConf.ListTextWidth;
+ circlePoint = new Point (selectPoint.X + StyleConf.ListSelectedWidth / 2,
selectPoint.Y + backgroundArea.Height / 2);
tk.LineWidth = 0;
if (state.HasFlag (CellState.Prelit)) {
@@ -157,61 +161,103 @@ namespace LongoMatch.Drawing
tk.FillColor = Config.Style.PaletteBackgroundDark;
}
tk.DrawRectangle (backgroundArea.Start, backgroundArea.Width, backgroundArea.Height);
-
/* Selection rectangle */
tk.LineWidth = 0;
tk.FillColor = color;
tk.DrawRectangle (selectPoint, StyleConf.ListSelectedWidth, backgroundArea.Height);
tk.FillColor = Config.Style.PaletteBackgroundDark;
- tk.DrawCircle (circlePoint, (StyleConf.ListSelectedWidth / 2) - 1);
+ tk.DrawCircle (circlePoint, (StyleConf.ListSelectedWidth / 2) - 1);
if (state.HasFlag (CellState.Selected)) {
tk.FillColor = Config.Style.PaletteBackground;
tk.FillColor = Config.Style.PaletteActive;
- tk.DrawCircle (circlePoint, (StyleConf.ListSelectedWidth / 2) - 2);
+ tk.DrawCircle (circlePoint, (StyleConf.ListSelectedWidth / 2) - 2);
}
-
- tk.FontSize = 10;
- tk.FontWeight = FontWeight.Normal;
- tk.StrokeColor = Config.Style.PaletteSelected;
- tk.FontAlignment = FontAlignment.Left;
- tk.DrawText (textPoint, textWidth, cellArea.Height, desc);
+ if (desc != null) {
+ tk.FontSize = 10;
+ tk.FontWeight = FontWeight.Normal;
+ tk.StrokeColor = Config.Style.PaletteSelected;
+ tk.FontAlignment = FontAlignment.Left;
+ tk.DrawText (textPoint, textWidth, cellArea.Height, desc);
+ }
if (selected) {
if (EyeSurface == null) {
- EyeSurface = Config.DrawingToolkit.CreateSurface (
- Path.Combine (Config.IconsDir, StyleConf.ListEyeIconPath));
+ EyeSurface = Config.DrawingToolkit.CreateSurface (Path.Combine
(Config.IconsDir, StyleConf.ListEyeIconPath));
}
- tk.DrawSurface (EyeSurface, new Point (imagePoint.X - EyeSurface.Width -
StyleConf.ListEyeIconOffset,
- imagePoint.Y + backgroundArea.Height /
2 - EyeSurface.Height / 2));
+ tk.DrawSurface (EyeSurface, new Point (imagePoint.X - EyeSurface.Width -
StyleConf.ListEyeIconOffset, imagePoint.Y + backgroundArea.Height / 2 - EyeSurface.Height / 2));
}
-
if (ss != null) {
tk.DrawImage (imagePoint, StyleConf.ListImageWidth, cellArea.Height, ss,
true);
}
+ }
+
+ public static void RenderSubstitution (Color color, Time evt, Player playerIn, Player
playerOut, bool selected,
+ bool isExpanded, IDrawingToolkit tk, IContext context,
Area backgroundArea,
+ Area cellArea, CellState state)
+ {
+ Point selectPoint, textPoint, imagePoint, circlePoint;
+ Point inPoint, imgPoint, outPoint, timePoint;
+ double textWidth;
+
+ if (subsImage == null) {
+ subsImage = new Image (Path.Combine (Config.IconsDir, StyleConf.SubsIcon));
+ }
+ tk.Context = context;
+ tk.Begin ();
+
+ RenderTimelineEventBase (color, null, selected, null, tk, context, backgroundArea,
cellArea, state,
+ out selectPoint, out textPoint, out imagePoint, out
circlePoint, out textWidth);
+ inPoint = textPoint;
+ imgPoint = new Point (textPoint.X + StyleConf.ListImageWidth +
StyleConf.ListRowSeparator, textPoint.Y);
+ outPoint = new Point (imgPoint.X + 20 + StyleConf.ListRowSeparator, imgPoint.Y);
+ RenderPlayer (tk, playerIn, inPoint);
+ tk.DrawImage (imgPoint, 20, cellArea.Height, subsImage, true);
+ RenderPlayer (tk, playerOut, outPoint);
+
+ timePoint = new Point (outPoint.X + StyleConf.ListImageWidth +
StyleConf.ListRowSeparator, textPoint.Y);
+ tk.FontSize = 10;
+ tk.FontWeight = FontWeight.Normal;
+ tk.StrokeColor = Config.Style.PaletteSelected;
+ tk.FontAlignment = FontAlignment.Left;
+ tk.DrawText (timePoint, 100, cellArea.Height, evt.ToSecondsString ());
+ RenderSeparationLine (tk, context, backgroundArea);
+ tk.End ();
+ }
+
+ public static void RenderPlay (Color color, Image ss, List<Player> players, bool selected,
string desc,
+ int count, bool isExpanded, IDrawingToolkit tk,
+ IContext context, Area backgroundArea, Area cellArea,
CellState state)
+ {
+ Point selectPoint, textPoint, imagePoint, circlePoint;
+ double textWidth;
+
+ tk.Context = context;
+ tk.Begin ();
+
+ RenderTimelineEventBase (color, ss, selected, desc, tk, context, backgroundArea,
cellArea, state,
+ out selectPoint, out textPoint, out imagePoint, out
circlePoint, out textWidth);
+
imagePoint.X += StyleConf.ListImageWidth + StyleConf.ListRowSeparator;
if (players != null && players.Count > 0) {
foreach (Player p in players) {
- PlayerObject po = new PlayerObject (p);
- po.Position = new Point (imagePoint.X + StyleConf.ListImageWidth / 2,
- imagePoint.Y + StyleConf.ListImageWidth / 2);
- po.Size = StyleConf.ListImageWidth - 2;
- tk.End ();
- po.Draw (tk, null);
- tk.Begin ();
- po.Dispose ();
+ RenderPlayer (tk, p, imagePoint);
imagePoint.X += StyleConf.ListImageWidth + StyleConf.ListRowSeparator;
}
}
RenderSeparationLine (tk, context, backgroundArea);
tk.End ();
}
-
+
public static void Render (object item, int count, bool isExpanded, IDrawingToolkit tk,
- IContext context, Area backgroundArea, Area cellArea, CellState
state)
+ IContext context, Area backgroundArea, Area cellArea, CellState
state)
{
if (item is EventType) {
RenderAnalysisCategory (item as EventType, count, isExpanded, tk,
context, backgroundArea, cellArea);
+ } else if (item is SubstitutionEvent) {
+ SubstitutionEvent s = item as SubstitutionEvent;
+ RenderSubstitution (s.Color, s.EventTime, s.In, s.Out, s.Selected,
isExpanded, tk, context,
+ backgroundArea, cellArea, state);
} else if (item is TimelineEvent) {
TimelineEvent p = item as TimelineEvent;
RenderPlay (p.Color, p.Miniature, p.Players, p.Selected, p.Description,
count, isExpanded, tk,
@@ -225,7 +271,7 @@ namespace LongoMatch.Drawing
RenderPlay (p.Play.EventType.Color, p.Miniature, null, p.Selected,
p.Description, count, isExpanded, tk,
context, backgroundArea, cellArea, state);
} else {
- Log.Error ("No renderer for type " + item.GetType());
+ Log.Error ("No renderer for type " + item.GetType ());
}
}
}
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index 7714e39..8b2c923 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -82,6 +82,7 @@ nobase_dist_icons_DATA = Makefile.am \
hicolor/scalable/actions/longomatch-square-fill.svg \
hicolor/scalable/actions/longomatch-square.svg \
hicolor/scalable/actions/longomatch-stop.svg \
+ hicolor/scalable/actions/longomatch-subs-arrow.svg \
hicolor/scalable/actions/longomatch-tab-active-dashboard.svg \
hicolor/scalable/actions/longomatch-tab-active-filter.svg \
hicolor/scalable/actions/longomatch-tab-active-playlist.svg \
diff --git a/data/icons/hicolor/scalable/actions/longomatch-subs-arrow.svg
b/data/icons/hicolor/scalable/actions/longomatch-subs-arrow.svg
new file mode 100644
index 0000000..6f62b97
--- /dev/null
+++ b/data/icons/hicolor/scalable/actions/longomatch-subs-arrow.svg
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="Layer_1"
+ x="0px"
+ y="0px"
+ width="20px"
+ height="20px"
+ viewBox="0 0 20 20"
+ enable-background="new 0 0 20 20"
+ xml:space="preserve"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="longomatch-arrow.svg"><metadata
+ id="metadata8"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage"
/><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs6" /><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1118"
+ inkscape:window-height="669"
+ id="namedview4"
+ showgrid="false"
+ inkscape:zoom="23.922656"
+ inkscape:cx="2.2458444"
+ inkscape:cy="10"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="Layer_1" /><path
+ id="arrow-right"
+ d="m 19.712,13.963 -4.33,-4.33 C 15.264,9.514 15.106,9.451 14.945,9.451 c -0.08,0 -0.161,0.015
-0.236,0.047 -0.232,0.096 -0.383,0.322 -0.383,0.572 v 3.093 H 0.717 c -0.342,0 -0.617,0.276 -0.617,0.618 v
1.238 c 0,0.342 0.275,0.619 0.617,0.619 h 13.609 v 3.092 c 0,0.25 0.15,0.475 0.383,0.57 0.075,0.035
0.156,0.049 0.236,0.049 0.16,0 0.318,-0.064 0.437,-0.182 l 4.33,-4.331 c 0.243,-0.24 0.243,-0.632 0,-0.873 z"
+ inkscape:connector-curvature="0"
+ style="fill:#55d400" /><path
+ style="fill:#d40000"
+ inkscape:connector-curvature="0"
+ id="arrow-right-8"
+ d="m 0.28225,5.5440004 4.33,-4.33 c 0.118,-0.119 0.276,-0.182 0.437,-0.182 0.08,0 0.161,0.015
0.236,0.047 0.232,0.096 0.383,0.322 0.383,0.572 v 3.093 h 13.609 c 0.342,0 0.617,0.276 0.617,0.618 v 1.238 c
0,0.342 -0.275,0.6189996 -0.617,0.6189996 h -13.609 v 3.092 c 0,0.25 -0.15,0.475 -0.383,0.57 -0.075,0.035
-0.156,0.049 -0.236,0.049 -0.16,0 -0.318,-0.064 -0.437,-0.182 l -4.33,-4.3309996 c -0.243,-0.24 -0.243,-0.632
0,-0.873 z" /></svg>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]