[longomatch] Show the selection icon in the timeline
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Show the selection icon in the timeline
- Date: Wed, 24 Sep 2014 20:13:51 +0000 (UTC)
commit 7989f8c3dae53837906845fb5057d51e34e25865
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Aug 22 22:19:13 2014 +0200
Show the selection icon in the timeline
LongoMatch.Core/StyleConf.cs | 2 +
LongoMatch.Drawing/CanvasObjects/PlayObject.cs | 14 +++++++++++++
LongoMatch.Drawing/CanvasObjects/TimelineObject.cs | 21 ++++++++++++++++++++
.../actions/longomatch-timeline-select-left.svg | 17 ++++++++++++++++
.../actions/longomatch-timeline-select-right.svg | 21 ++++++++++++++++++++
5 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch.Core/StyleConf.cs b/LongoMatch.Core/StyleConf.cs
index b7d42a3..e054fae 100644
--- a/LongoMatch.Core/StyleConf.cs
+++ b/LongoMatch.Core/StyleConf.cs
@@ -56,6 +56,8 @@ namespace LongoMatch.Common
public const int TimelineLabelHSpacing = 10;
public const int TimelineLabelVSpacing = 2;
public const int TimelineLineSize = 6;
+ public const string TimelineSelectionLeft =
"hicolor/scalable/actions/longomatch-timeline-select-left.svg";
+ public const string TimelineSelectionRight =
"hicolor/scalable/actions/longomatch-timeline-select-right.svg";
public const string PlayerBackground = "player/background.svg";
public const string PlayerHomeNumber = "player/home-number.svg";
diff --git a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
index f30c156..bdb3392 100644
--- a/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/PlayObject.cs
@@ -30,6 +30,16 @@ namespace LongoMatch.Drawing.CanvasObjects
{
}
+ public ISurface SelectionLeft {
+ get;
+ set;
+ }
+
+ public ISurface SelectionRight {
+ get;
+ set;
+ }
+
public override string Description {
get {
return Play.Name;
@@ -89,6 +99,10 @@ namespace LongoMatch.Drawing.CanvasObjects
DrawLine (tk, start, stop, lineWidth);
DrawBorders (tk, start, stop, lineWidth);
}
+ if (Selected) {
+ tk.DrawSurface (SelectionLeft, new Point (start - SelectionLeft.Width / 2,
OffsetY));
+ tk.DrawSurface (SelectionRight, new Point (stop - SelectionRight.Width / 2,
OffsetY));
+ }
tk.End ();
}
}
diff --git a/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
b/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
index efa01af..b6d46b0 100644
--- a/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/TimelineObject.cs
@@ -22,6 +22,7 @@ using LongoMatch.Common;
using LongoMatch.Interfaces;
using LongoMatch.Interfaces.Drawing;
using LongoMatch.Store.Drawables;
+using System.IO;
namespace LongoMatch.Drawing.CanvasObjects
{
@@ -31,17 +32,28 @@ namespace LongoMatch.Drawing.CanvasObjects
List<TimeNodeObject> nodes;
double secondsPerPixel;
protected Time maxTime;
+ protected ISurface selectionBorderL, selectionBorderR;
public TimelineObject (Time maxTime, double offsetY, Color background)
{
this.background = background;
this.nodes = new List<TimeNodeObject> ();
this.maxTime = maxTime;
+ selectionBorderL = LoadBorder (StyleConf.TimelineSelectionLeft);
+ selectionBorderR = LoadBorder (StyleConf.TimelineSelectionRight);
+
Visible = true;
CurrentTime = new Time (0);
OffsetY = offsetY;
SecondsPerPixel = 0.1;
}
+
+ protected override void Dispose (bool disposing)
+ {
+ selectionBorderL.Dispose ();
+ selectionBorderR.Dispose ();
+ base.Dispose (disposing);
+ }
public double SecondsPerPixel {
set {
@@ -153,6 +165,13 @@ namespace LongoMatch.Drawing.CanvasObjects
{
s.Drawable.Move (s, p, start);
}
+
+ ISurface LoadBorder (string name)
+ {
+ Image img = Image.LoadFromFile (Path.Combine (Config.IconsDir, name));
+ img.Scale (StyleConf.TimelineCategoryHeight, StyleConf.TimelineCategoryHeight);
+ return Config.DrawingToolkit.CreateSurface (img.Width, img.Height, img);
+ }
}
public class CategoryTimeline: TimelineObject
@@ -169,6 +188,8 @@ namespace LongoMatch.Drawing.CanvasObjects
public void AddPlay (Play play)
{
PlayObject po = new PlayObject (play);
+ po.SelectionLeft = selectionBorderL;
+ po.SelectionRight = selectionBorderR;
po.OffsetY = OffsetY;
po.SecondsPerPixel = SecondsPerPixel;
po.MaxTime = maxTime;
diff --git a/data/icons/hicolor/scalable/actions/longomatch-timeline-select-left.svg
b/data/icons/hicolor/scalable/actions/longomatch-timeline-select-left.svg
new file mode 100644
index 0000000..810094d
--- /dev/null
+++ b/data/icons/hicolor/scalable/actions/longomatch-timeline-select-left.svg
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="20px" viewBox="0 0 10 20" enable-background="new 0 0 10 20"
xml:space="preserve">
+<radialGradient id="SVGID_1_" cx="0.5591" cy="0.4927" r="8.4427" gradientUnits="userSpaceOnUse">
+ <stop offset="0" style="stop-color:#50B44B"/>
+ <stop offset="1" style="stop-color:#FFFFFF;stop-opacity:0"/>
+</radialGradient>
+<polygon fill="url(#SVGID_1_)" points="1,9 0,9 0,0 9,0 9,1 1,1 "/>
+<radialGradient id="SVGID_2_" cx="-2.4409" cy="14.4922" r="8.4429" gradientTransform="matrix(-4.371139e-08
-1 1 -4.371139e-08 -14 16.9995)" gradientUnits="userSpaceOnUse">
+ <stop offset="0" style="stop-color:#50B44B"/>
+ <stop offset="1" style="stop-color:#FFFFFF;stop-opacity:0"/>
+</radialGradient>
+<polygon fill="url(#SVGID_2_)" points="9,19 9,20 0,20 0,11 1,11 1,19 "/>
+<path fill="none" stroke="#000000" stroke-miterlimit="10" d="M4.837-0.414"/>
+</svg>
diff --git a/data/icons/hicolor/scalable/actions/longomatch-timeline-select-right.svg
b/data/icons/hicolor/scalable/actions/longomatch-timeline-select-right.svg
new file mode 100644
index 0000000..4b5d5bc
--- /dev/null
+++ b/data/icons/hicolor/scalable/actions/longomatch-timeline-select-right.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="10px" height="20px" viewBox="0 0 10 20" enable-background="new 0 0 10 20"
xml:space="preserve">
+<g>
+
+ <radialGradient id="SVGID_1_" cx="0.5298" cy="0.4927" r="8.4427" gradientTransform="matrix(-1
0 0 1 9.9707 0)" gradientUnits="userSpaceOnUse">
+ <stop offset="0" style="stop-color:#50B44B"/>
+ <stop offset="1" style="stop-color:#FFFFFF;stop-opacity:0"/>
+ </radialGradient>
+ <polygon fill="url(#SVGID_1_)" points="9,9 10,9 10,0 1,0 1,1 9,1 "/>
+
+ <radialGradient id="SVGID_2_" cx="-2.4419" cy="14.4629" r="8.4431"
gradientTransform="matrix(4.375628e-08 -1 -1 -4.375628e-08 23.9712 16.9995)" gradientUnits="userSpaceOnUse">
+ <stop offset="0" style="stop-color:#50B44B"/>
+ <stop offset="1" style="stop-color:#FFFFFF;stop-opacity:0"/>
+ </radialGradient>
+ <polygon fill="url(#SVGID_2_)" points="1,19 1,20 10,20 10,11 9,11 9,19 "/>
+</g>
+<path fill="none" stroke="#000000" stroke-miterlimit="10" d="M4.837-0.414"/>
+</svg>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]