[longomatch] Improve plays details by displaying a bigger frame and using a unique Cell for all the details (name
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [longomatch] Improve plays details by displaying a bigger frame and using a unique Cell for all the details (name
- Date: Thu, 15 Oct 2009 08:55:06 +0000 (UTC)
commit 5117631b29b2f4dc9b6c80d5c45c99940a5b9323
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Oct 14 14:46:28 2009 +0200
Improve plays details by displaying a bigger frame and using a unique Cell for all the details (name, start time,...)
CesarPlayer/Gui/PlayerBin.cs | 4 +-
LongoMatch/Gui/TreeView/PlayersTreeView.cs | 58 ++++-----------
LongoMatch/Gui/TreeView/PlaysTreeView.cs | 111 ++++++----------------------
LongoMatch/Time/PixbufTimeNode.cs | 4 +-
4 files changed, 43 insertions(+), 134 deletions(-)
---
diff --git a/CesarPlayer/Gui/PlayerBin.cs b/CesarPlayer/Gui/PlayerBin.cs
index 512427a..8f66d69 100644
--- a/CesarPlayer/Gui/PlayerBin.cs
+++ b/CesarPlayer/Gui/PlayerBin.cs
@@ -44,7 +44,7 @@ namespace LongoMatch.Gui
public event DrawFrameHandler DrawFrame;
public event SeekEventHandler SeekEvent;
- private const int THUMBNAIL_WIDTH = 50;
+ private const int THUMBNAIL_MAX_WIDTH = 100;
private TickHandler tickHandler;
private IPlayer player;
private long length=0;
@@ -111,7 +111,7 @@ namespace LongoMatch.Gui
public Pixbuf CurrentMiniatureFrame{
get{
- Pixbuf pixbuf = player.GetCurrentFrame(50,50);
+ Pixbuf pixbuf = player.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_WIDTH);
return pixbuf;
}
}
diff --git a/LongoMatch/Gui/TreeView/PlayersTreeView.cs b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
index 6216521..9d3b548 100644
--- a/LongoMatch/Gui/TreeView/PlayersTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
@@ -45,6 +45,7 @@ namespace LongoMatch.Gui.Component
private Gtk.TreeViewColumn nameColumn;
//Using TimeNode as in the tree there are Media and Sections timenodes
private TimeNode selectedTimeNode;
+ private bool editing;
private Team team;
@@ -62,29 +63,12 @@ namespace LongoMatch.Gui.Component
nameCell.Edited += OnNameCellEdited;
Gtk.CellRendererPixbuf miniatureCell = new Gtk.CellRendererPixbuf ();
nameColumn.PackStart (miniatureCell, true);
- nameColumn.PackEnd (nameCell, true);
-
-
- Gtk.TreeViewColumn startTimeColumn = new Gtk.TreeViewColumn ();
- startTimeColumn.Title = "Start";
- Gtk.CellRendererText startTimeCell = new Gtk.CellRendererText ();
- startTimeColumn.PackStart (startTimeCell, true);
-
- Gtk.TreeViewColumn stopTimeColumn = new Gtk.TreeViewColumn ();
- stopTimeColumn.Title = "Stop";
- Gtk.CellRendererText stopTimeCell = new Gtk.CellRendererText ();
- stopTimeColumn.PackStart (stopTimeCell, true);
+ nameColumn.PackEnd (nameCell, true);
nameColumn.SetCellDataFunc (miniatureCell, new Gtk.TreeCellDataFunc(RenderMiniature));
nameColumn.SetCellDataFunc (nameCell, new Gtk.TreeCellDataFunc (RenderName));
- startTimeColumn.SetCellDataFunc (startTimeCell, new Gtk.TreeCellDataFunc (RenderStartTime));
- stopTimeColumn.SetCellDataFunc (stopTimeCell, new Gtk.TreeCellDataFunc (RenderStopTime));
-
- this.AppendColumn (nameColumn);
- this.AppendColumn (startTimeColumn);
- this.AppendColumn (stopTimeColumn);
-
+ AppendColumn (nameColumn);
}
public Team Team{
@@ -176,35 +160,22 @@ namespace LongoMatch.Gui.Component
{
object item = model.GetValue (iter, 0);
- if (item is MediaTimeNode)
- (cell as Gtk.CellRendererText).Text = (item as MediaTimeNode).Name;
+ if (item is MediaTimeNode){
+ MediaTimeNode tNode = item as MediaTimeNode;
+ if (editing && selectedIter.Equals(iter))
+ (cell as Gtk.CellRendererText).Markup = tNode.Name;
+ else
+ (cell as Gtk.CellRendererText).Markup = Catalog.GetString("<b>Name: </b>")+tNode.Name+"\n"+
+ Catalog.GetString("<b>Start: </b>")+tNode.Start.ToMSecondsString()+"\n"+
+ Catalog.GetString("<b>Stop: </b>")+tNode.Stop.ToMSecondsString();
+ }
else if (item is Player)
(cell as Gtk.CellRendererText).Text = (item as Player).Name;
- }
-
-
- private void RenderStartTime (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
- {
- object item = model.GetValue (iter, 0);
-
- if (item is MediaTimeNode)
- (cell as Gtk.CellRendererText).Text = (item as MediaTimeNode).Start.ToMSecondsString();
- else if (item is Player)
- (cell as Gtk.CellRendererText).Text = "";
- }
-
- private void RenderStopTime (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
- {
- object item = model.GetValue (iter, 0);
-
- if (item is MediaTimeNode)
- (cell as Gtk.CellRendererText).Text = (item as MediaTimeNode).Stop.ToMSecondsString();
- else if (item is Player)
- (cell as Gtk.CellRendererText).Text = "";
- }
+ }
protected virtual void OnEdit(object obj, EventArgs args){
+ editing = true;
nameCell.Editable = true;
this.SetCursor(path, nameColumn, true);
}
@@ -230,6 +201,7 @@ namespace LongoMatch.Gui.Component
player.Name = args.NewText;
nameCell.Editable=false;
}
+ editing = false;
}
diff --git a/LongoMatch/Gui/TreeView/PlaysTreeView.cs b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
index 5b910dd..05da2e4 100644
--- a/LongoMatch/Gui/TreeView/PlaysTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
@@ -54,6 +54,7 @@ namespace LongoMatch.Gui.Component
//Using TimeNode as in the tree there are Media and Sections timenodes
private TimeNode selectedTimeNode;
private Color[] colors;
+ private bool editing;
@@ -74,34 +75,11 @@ namespace LongoMatch.Gui.Component
Gtk.CellRendererPixbuf miniatureCell = new Gtk.CellRendererPixbuf ();
nameColumn.PackStart (miniatureCell, true);
nameColumn.PackEnd (nameCell, true);
-
- Gtk.TreeViewColumn teamColumn = new Gtk.TreeViewColumn ();
- teamColumn.Title = "Team";
- Gtk.CellRendererText teamCell = new Gtk.CellRendererText ();
- teamColumn.PackStart (teamCell, true);
-
- Gtk.TreeViewColumn startTimeColumn = new Gtk.TreeViewColumn ();
- startTimeColumn.Title = "Start";
- Gtk.CellRendererText startTimeCell = new Gtk.CellRendererText ();
- startTimeColumn.PackStart (startTimeCell, true);
-
- Gtk.TreeViewColumn stopTimeColumn = new Gtk.TreeViewColumn ();
- stopTimeColumn.Title = "Stop";
- Gtk.CellRendererText stopTimeCell = new Gtk.CellRendererText ();
- stopTimeColumn.PackStart (stopTimeCell, true);
-
+
nameColumn.SetCellDataFunc (miniatureCell, new Gtk.TreeCellDataFunc(RenderMiniature));
nameColumn.SetCellDataFunc (nameCell, new Gtk.TreeCellDataFunc (RenderName));
- teamColumn.SetCellDataFunc(teamCell, new Gtk.TreeCellDataFunc(RenderTeam));
- startTimeColumn.SetCellDataFunc (startTimeCell, new Gtk.TreeCellDataFunc (RenderStartTime));
- stopTimeColumn.SetCellDataFunc (stopTimeCell, new Gtk.TreeCellDataFunc (RenderStopTime));
-
-
+
this.AppendColumn (nameColumn);
- this.AppendColumn(teamColumn);
- this.AppendColumn (startTimeColumn);
- this.AppendColumn (stopTimeColumn);
-
}
public Color[] Colors{
@@ -112,9 +90,7 @@ namespace LongoMatch.Gui.Component
set{addPLN.Sensitive=value;}
}
- private void SetMenu(){
-
-
+ private void SetMenu(){
Menu teamMenu = new Menu();
local = new MenuItem(Catalog.GetString("Local Team"));
visitor = new MenuItem(Catalog.GetString("Visitor Team"));
@@ -180,74 +156,32 @@ namespace LongoMatch.Gui.Component
(cell as Gtk.CellRendererPixbuf).Pixbuf = null;
(cell as Gtk.CellRendererPixbuf).CellBackground = "white";
}
- }
-
- private void RenderTeam (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
- {
- TimeNode tNode = (TimeNode) model.GetValue (iter, 0);
-
- (cell as Gtk.CellRendererText).Text = tNode.Name;
-
- if (tNode is MediaTimeNode){
- (cell as Gtk.CellRendererText).Text =((MediaTimeNode)tNode).Team.ToString().ToLowerInvariant();
- (cell as Gtk.CellRendererText).BackgroundGdk = colors[GetSectionFromIter(iter)];
- (cell as Gtk.CellRendererText).CellBackgroundGdk = colors[GetSectionFromIter(iter)];
- }
- else {
- (cell as Gtk.CellRendererText).Text = "";
- (cell as Gtk.CellRendererText).Background = "white";
- (cell as Gtk.CellRendererText).CellBackground = "white";
- }
- }
-
+ }
+
private void RenderName (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
+ string text = "";
TimeNode tNode = (TimeNode) model.GetValue (iter, 0);
-
- (cell as Gtk.CellRendererText).Text = tNode.Name;
- if (tNode is MediaTimeNode){
- (cell as Gtk.CellRendererText).BackgroundGdk = colors[GetSectionFromIter(iter)];
- (cell as Gtk.CellRendererText).CellBackgroundGdk = colors[GetSectionFromIter(iter)];
- }
- else{
- (cell as Gtk.CellRendererText).Background = "white";
- (cell as Gtk.CellRendererText).CellBackground = "white";
- }
- }
-
+ //Handle special case in which we replace the test in the cell by the name of the TimeNode
+ //We need to check if we are editing and only change it for the path that's currently beeing edited
- private void RenderStartTime (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
- {
- TimeNode tNode = (TimeNode) model.GetValue (iter, 0);
-
- if (tNode is MediaTimeNode){
- (cell as Gtk.CellRendererText).Text =tNode.Start.ToMSecondsString();
+ if (editing && selectedIter.Equals(iter))
+ (cell as Gtk.CellRendererText).Markup = tNode.Name;
+ else if (tNode is MediaTimeNode){
(cell as Gtk.CellRendererText).BackgroundGdk = colors[GetSectionFromIter(iter)];
(cell as Gtk.CellRendererText).CellBackgroundGdk = colors[GetSectionFromIter(iter)];
-
+ (cell as Gtk.CellRendererText).Markup = Catalog.GetString("<b>Name: </b>")+tNode.Name+"\n"+
+ Catalog.GetString("<b>Team: </b>")+(tNode as MediaTimeNode).Team.ToString().ToLower()+"\n"+
+ Catalog.GetString("<b>Start: </b>")+tNode.Start.ToMSecondsString()+"\n"+
+ Catalog.GetString("<b>Stop: </b>")+tNode.Stop.ToMSecondsString();
}
- else {
- (cell as Gtk.CellRendererText).Text = "";
- (cell as Gtk.CellRendererText).Background = "white";
- (cell as Gtk.CellRendererText).CellBackground = "white";
- }
- }
-
- private void RenderStopTime (Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
- {
- TimeNode tNode = (TimeNode) model.GetValue (iter, 0);
- if (tNode is MediaTimeNode){
- (cell as Gtk.CellRendererText).Text = tNode.Stop.ToMSecondsString();
- (cell as Gtk.CellRendererText).BackgroundGdk = colors[GetSectionFromIter(iter)];
- (cell as Gtk.CellRendererText).CellBackgroundGdk = colors[GetSectionFromIter(iter)];
- }
- else {
- (cell as Gtk.CellRendererText).Text = "";
+ else{
(cell as Gtk.CellRendererText).Background = "white";
(cell as Gtk.CellRendererText).CellBackground = "white";
- }
- }
+ (cell as Gtk.CellRendererText).Markup =tNode.Name;
+ }
+ }
private void OnNameCellEdited (object o, Gtk.EditedArgs args)
{
@@ -255,6 +189,7 @@ namespace LongoMatch.Gui.Component
this.Model.GetIter (out iter, new Gtk.TreePath (args.Path));
TimeNode tNode = (TimeNode)this.Model.GetValue (iter,0);
tNode.Name = args.NewText;
+ editing = false;
nameCell.Editable=false;
if (TimeNodeChanged != null)
TimeNodeChanged(tNode,args.NewText);
@@ -317,8 +252,10 @@ namespace LongoMatch.Gui.Component
}
protected virtual void OnEdit(object obj, EventArgs args){
+ editing = true;
nameCell.Editable = true;
- this.SetCursor(path, nameColumn, true);
+ nameCell.Markup = selectedTimeNode.Name;
+ SetCursor(path, nameColumn, true);
}
protected void OnTeamSelection(object obj, EventArgs args){
diff --git a/LongoMatch/Time/PixbufTimeNode.cs b/LongoMatch/Time/PixbufTimeNode.cs
index aea8fad..4acc84f 100644
--- a/LongoMatch/Time/PixbufTimeNode.cs
+++ b/LongoMatch/Time/PixbufTimeNode.cs
@@ -28,8 +28,8 @@ namespace LongoMatch.TimeNodes
public class PixbufTimeNode : TimeNode
{
private byte[] thumbnailBuf;
- private const int MAX_WIDTH=50;
- private const int MAX_HEIGHT=50;
+ private const int MAX_WIDTH=100;
+ private const int MAX_HEIGHT=75;
#region Contructors
public PixbufTimeNode(){
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]