[longomatch] Draw tagged players in the list
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Draw tagged players in the list
- Date: Wed, 8 Oct 2014 00:12:43 +0000 (UTC)
commit 481450d4607c06c06221de62c152cd64870425c7
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Oct 7 13:21:20 2014 +0200
Draw tagged players in the list
LongoMatch.Core/StyleConf.cs | 3 +-
LongoMatch.Drawing/PlayslistCellRenderer.cs | 32 ++++++++++++++++------
LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs | 11 ++++++-
3 files changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/LongoMatch.Core/StyleConf.cs b/LongoMatch.Core/StyleConf.cs
index d4b1591..c5b23f9 100644
--- a/LongoMatch.Core/StyleConf.cs
+++ b/LongoMatch.Core/StyleConf.cs
@@ -53,7 +53,8 @@ namespace LongoMatch.Core.Common
public const int NewTaggerSpacing = 35;
public const int ListSelectedWidth = 16;
- public const int ListTextWidth = 200;
+ public const int ListRowSeparator = 10;
+ public const int ListTextWidth = 180;
public const int ListImageWidth = 50;
public const int ListCategoryHeight = 50;
public const int ListCountRadio = 10;
diff --git a/LongoMatch.Drawing/PlayslistCellRenderer.cs b/LongoMatch.Drawing/PlayslistCellRenderer.cs
index f3c2789..5540dcd 100644
--- a/LongoMatch.Drawing/PlayslistCellRenderer.cs
+++ b/LongoMatch.Drawing/PlayslistCellRenderer.cs
@@ -21,6 +21,8 @@ using LongoMatch.Core.Common;
using LongoMatch.Core.Store;
using LongoMatch.Core.Store.Playlists;
using System.IO;
+using System.Collections.Generic;
+using LongoMatch.Drawing.CanvasObjects;
namespace LongoMatch.Drawing
{
@@ -131,19 +133,17 @@ namespace LongoMatch.Drawing
tk.End ();
}
- public static void RenderPlay (Color color, Image ss, bool selected, string desc,
+ 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;
-
selectPoint = new Point (backgroundArea.Start.X, backgroundArea.Start.Y);
- textPoint = new Point (selectPoint.X + StyleConf.ListSelectedWidth + 10,
selectPoint.Y);
- imagePoint = new Point (backgroundArea.Start.X + backgroundArea.Width -
StyleConf.ListImageWidth - 10,
- selectPoint.Y);
- textWidth = imagePoint.X - textPoint.X;
+ 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);
@@ -182,12 +182,26 @@ namespace LongoMatch.Drawing
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));
+ imagePoint.Y + backgroundArea.Height /
2 - EyeSurface.Height / 2));
}
if (ss != null) {
tk.DrawImage (imagePoint, StyleConf.ListImageWidth, cellArea.Height, ss,
true);
}
+ 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 ();
+ imagePoint.X += StyleConf.ListImageWidth + StyleConf.ListRowSeparator;
+ }
+ }
RenderSeparationLine (tk, context, backgroundArea);
tk.End ();
}
@@ -200,7 +214,7 @@ namespace LongoMatch.Drawing
context, backgroundArea, cellArea);
} else if (item is TimelineEvent) {
TimelineEvent p = item as TimelineEvent;
- RenderPlay (p.Color, p.Miniature, p.Selected, p.Description, count,
isExpanded, tk,
+ RenderPlay (p.Color, p.Miniature, p.Players, 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);
@@ -208,7 +222,7 @@ namespace LongoMatch.Drawing
RenderPlaylist (item as Playlist, count, isExpanded, tk, context,
backgroundArea, cellArea);
} else if (item is PlaylistPlayElement) {
PlaylistPlayElement p = item as PlaylistPlayElement;
- RenderPlay (p.Play.EventType.Color, p.Miniature, p.Selected, p.Description,
count, isExpanded, tk,
+ 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());
diff --git a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
index 2a29912..adbbf78 100644
--- a/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
+++ b/LongoMatch.GUI/Gui/TreeView/ListTreeViewBase.cs
@@ -189,12 +189,19 @@ namespace LongoMatch.Gui.Component
{
x_offset = 0;
y_offset = 0;
- width = StyleConf.ListSelectedWidth + StyleConf.ListTextWidth +
StyleConf.ListImageWidth;
+ width = StyleConf.ListSelectedWidth + StyleConf.ListRowSeparator +
StyleConf.ListTextWidth;
height = StyleConf.ListCategoryHeight;
+ if (Item is TimelineEvent) {
+ TimelineEvent evt = Item as TimelineEvent;
+ if (evt.Miniature != null) {
+ width += StyleConf.ListImageWidth + StyleConf.ListRowSeparator;
+ }
+ width += (StyleConf.ListImageWidth + StyleConf.ListRowSeparator) *
evt.Players.Count;
+ }
}
protected override void Render (Drawable window, Widget widget, Rectangle backgroundArea,
- Rectangle cellArea, Rectangle exposeArea, CellRendererState
flags)
+ Rectangle cellArea, Rectangle exposeArea, CellRendererState
flags)
{
CellState state = (CellState) flags;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]