[longomatch/redesign3: 12/156] Make use of the new API in the GUI classes
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/redesign3: 12/156] Make use of the new API in the GUI classes
- Date: Wed, 17 Aug 2011 22:17:12 +0000 (UTC)
commit c2157295a62695f9a089502e959825d94dd33185
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sun Nov 21 16:25:17 2010 +0100
Make use of the new API in the GUI classes
LongoMatch/Gui/Component/ButtonsWidget.cs | 25 +++--
LongoMatch/Gui/Component/CategoryProperties.cs | 7 +-
LongoMatch/Gui/Component/NotesWidget.cs | 4 +-
LongoMatch/Gui/Component/PlayListWidget.cs | 12 +-
LongoMatch/Gui/Component/PlayersListTreeWidget.cs | 23 ++--
LongoMatch/Gui/Component/PlaysListTreeWidget.cs | 64 ++++++------
LongoMatch/Gui/Component/ProjectDetailsWidget.cs | 99 ++++++++++-------
LongoMatch/Gui/Component/ProjectListWidget.cs | 6 +-
LongoMatch/Gui/Component/ProjectTemplateWidget.cs | 116 ++++++++++----------
LongoMatch/Gui/Component/TaggerWidget.cs | 14 ++-
LongoMatch/Gui/Component/TagsTreeWidget.cs | 39 +++----
LongoMatch/Gui/Component/TeamTemplateWidget.cs | 4 +-
LongoMatch/Gui/Component/TimeAdjustWidget.cs | 6 +-
LongoMatch/Gui/Component/TimeLineWidget.cs | 98 +++++++++-------
LongoMatch/Gui/Component/TimeReferenceWidget.cs | 2 +-
LongoMatch/Gui/Component/TimeScale.cs | 52 +++++----
LongoMatch/Gui/Dialog/DrawingTool.cs | 6 +-
LongoMatch/Gui/Dialog/EditCategoryDialog.cs | 16 ++--
LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs | 28 ++---
.../Gui/Dialog/ProjectTemplateEditorDialog.cs | 8 +-
LongoMatch/Gui/Dialog/ProjectsManager.cs | 15 ++-
LongoMatch/Gui/Dialog/TemplatesEditor.cs | 41 ++++----
LongoMatch/Gui/MainWindow.cs | 33 +++---
LongoMatch/Gui/TreeView/CategoriesTreeView.cs | 32 +++---
LongoMatch/Gui/TreeView/ListTreeViewBase.cs | 56 +++++-----
LongoMatch/Gui/TreeView/PlayListTreeView.cs | 12 +-
LongoMatch/Gui/TreeView/PlayersTreeView.cs | 4 +-
LongoMatch/Gui/TreeView/PlaysTreeView.cs | 18 ++--
LongoMatch/Gui/TreeView/TagsTreeView.cs | 2 +-
29 files changed, 445 insertions(+), 397 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/ButtonsWidget.cs b/LongoMatch/Gui/Component/ButtonsWidget.cs
index 57682e3..f6976a5 100644
--- a/LongoMatch/Gui/Component/ButtonsWidget.cs
+++ b/LongoMatch/Gui/Component/ButtonsWidget.cs
@@ -33,8 +33,9 @@ namespace LongoMatch.Gui.Component
public partial class ButtonsWidget : Gtk.Bin
{
- private Sections sections;
+ private Categories categories;
private TagMode tagMode;
+ private Dictionary<Widget, Category> buttonsDic;
public event NewMarkEventHandler NewMarkEvent;
public event NewMarkStartHandler NewMarkStartEvent;
@@ -45,6 +46,7 @@ namespace LongoMatch.Gui.Component
{
this.Build();
Mode = TagMode.Predifined;
+ buttonsDic = new Dictionary<Widget, Category>();
}
public TagMode Mode{
@@ -57,16 +59,17 @@ namespace LongoMatch.Gui.Component
}
}
- public Sections Sections {
+ public Categories Categories {
set {
foreach (Widget w in table1.AllChildren) {
table1.Remove(w);
w.Destroy();
}
- sections = value;
+ categories = value;
if (value == null)
return;
-
+
+ buttonsDic.Clear();
int sectionsCount = value.Count;
table1.NColumns =(uint) 10;
@@ -75,12 +78,14 @@ namespace LongoMatch.Gui.Component
for (int i=0;i<sectionsCount;i++) {
Button b = new Button();
Label l = new Label();
+ Category cat = value.CategoriesList[i];
+
uint row_top =(uint)(i/table1.NColumns);
uint row_bottom = (uint) row_top+1 ;
uint col_left = (uint) i%table1.NColumns;
uint col_right = (uint) col_left+1 ;
- l.Markup = sections.GetName(i);
+ l.Markup = cat.Name;
l.Justify = Justification.Center;
l.Ellipsize = Pango.EllipsizeMode.Middle;
l.CanFocus = false;
@@ -94,30 +99,32 @@ namespace LongoMatch.Gui.Component
b.Show();
table1.Attach(b,col_left,col_right,row_top,row_bottom);
+
+ buttonsDic.Add(b, cat);
}
}
}
protected virtual void OnButtonClicked(object sender, System.EventArgs e)
{
- if (sections == null)
+ if (categories == null)
return;
Widget w = (Button)sender;
if (tagMode == TagMode.Predifined){
if (NewMarkEvent != null)
- NewMarkEvent(int.Parse(w.Name));
+ NewMarkEvent(buttonsDic[w]);
} else {
starttagbutton.Visible = true;
table1.Visible = false;
cancelbutton.Visible = false;
if (NewMarkStopEvent != null)
- NewMarkStopEvent(int.Parse(w.Name));
+ NewMarkStopEvent(buttonsDic[w]);
}
}
protected virtual void OnStartTagClicked (object sender, System.EventArgs e)
{
- if (sections == null)
+ if (categories == null)
return;
starttagbutton.Visible = false;
diff --git a/LongoMatch/Gui/Component/CategoryProperties.cs b/LongoMatch/Gui/Component/CategoryProperties.cs
index 41354e3..ff3dba1 100644
--- a/LongoMatch/Gui/Component/CategoryProperties.cs
+++ b/LongoMatch/Gui/Component/CategoryProperties.cs
@@ -28,7 +28,7 @@ using LongoMatch.Gui.Dialog;
namespace LongoMatch.Gui.Component
{
- public delegate void HotKeyChangeHandler(HotKey prevHotKey, SectionsTimeNode newSection);
+ public delegate void HotKeyChangeHandler(HotKey prevHotKey, Category newSection);
[System.ComponentModel.Category("LongoMatch")]
[System.ComponentModel.ToolboxItem(true)]
@@ -37,15 +37,14 @@ namespace LongoMatch.Gui.Component
public event HotKeyChangeHandler HotKeyChanged;
- private SectionsTimeNode stn;
+ private Category stn;
public CategoryProperties()
{
this.Build();
}
- public SectionsTimeNode Section
- {
+ public Category Category{
set {
stn = value;
UpdateGui();
diff --git a/LongoMatch/Gui/Component/NotesWidget.cs b/LongoMatch/Gui/Component/NotesWidget.cs
index 459d336..e4fdbca 100644
--- a/LongoMatch/Gui/Component/NotesWidget.cs
+++ b/LongoMatch/Gui/Component/NotesWidget.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Gui.Component
{
public event TimeNodeChangedHandler TimeNodeChanged;
TextBuffer buf;
- MediaTimeNode play;
+ Play play;
public NotesWidget()
{
@@ -42,7 +42,7 @@ namespace LongoMatch.Gui.Component
}
- public MediaTimeNode Play {
+ public Play Play {
set {
play = value;
Notes = play.Notes;
diff --git a/LongoMatch/Gui/Component/PlayListWidget.cs b/LongoMatch/Gui/Component/PlayListWidget.cs
index e19927f..ca53494 100644
--- a/LongoMatch/Gui/Component/PlayListWidget.cs
+++ b/LongoMatch/Gui/Component/PlayListWidget.cs
@@ -47,7 +47,7 @@ namespace LongoMatch.Gui.Component
public event ProgressHandler Progress;
private PlayerBin player;
- private PlayListTimeNode plNode;
+ private PlayListPlay plNode;
private PlayList playList;
private uint timeout;
private object lock_node;
@@ -102,14 +102,14 @@ namespace LongoMatch.Gui.Component
}
}
- public void Add(PlayListTimeNode plNode) {
+ public void Add(PlayListPlay plNode) {
if (playList!=null) {
Model.AppendValues(plNode);
playList.Add(plNode);
}
}
- public PlayListTimeNode Next() {
+ public PlayListPlay Next() {
if (playList.HasNext()) {
plNode = playList.Next();
playlisttreeview1.Selection.SelectPath(new TreePath(playList.GetCurrentIndex().ToString()));
@@ -180,7 +180,7 @@ namespace LongoMatch.Gui.Component
return true;
}
}
- private PlayListTimeNode SelectPlayListNode(TreePath path) {
+ private PlayListPlay SelectPlayListNode(TreePath path) {
plNode = playList.Select(Int32.Parse(path.ToString()));
if (PlayListNodeSelected != null && plNode.Valid) {
@@ -275,7 +275,7 @@ namespace LongoMatch.Gui.Component
//FIXME:Create a new instance of the video editor until we fix the audio swith enable/disabled
LoadEditor();
//videoEditor.ClearList();
- foreach (PlayListTimeNode segment in playList) {
+ foreach (PlayListPlay segment in playList) {
if (segment.Valid)
videoEditor.AddSegment(segment.MediaFile.FilePath,
segment.Start.MSeconds,
@@ -322,7 +322,7 @@ namespace LongoMatch.Gui.Component
}
}
- protected virtual void OnApplyRate(PlayListTimeNode plNode) {
+ protected virtual void OnApplyRate(PlayListPlay plNode) {
if (ApplyCurrentRate != null)
ApplyCurrentRate(plNode);
}
diff --git a/LongoMatch/Gui/Component/PlayersListTreeWidget.cs b/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
index d535e82..11040e0 100644
--- a/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
@@ -61,8 +61,9 @@ namespace LongoMatch.Gui.Component
}
}
- public void DeleteTimeNode(MediaTimeNode tNode, int player) {
- if (template != null) {
+ public void RemovePlay(Play tNode, Player player) {
+ /*if (template != null) {
+
TreeIter iter;
TreeStore model = (TreeStore)playerstreeview.Model;
model.GetIterFromString(out iter, player.ToString());
@@ -70,7 +71,7 @@ namespace LongoMatch.Gui.Component
model.IterChildren(out child, iter);
// Searching the TimeNode to remove it
while (model.IterIsValid(child)) {
- MediaTimeNode mtn = (MediaTimeNode) model.GetValue(child,0);
+ Play mtn = (Play) model.GetValue(child,0);
if (mtn == tNode) {
model.Remove(ref child);
break;
@@ -80,19 +81,19 @@ namespace LongoMatch.Gui.Component
if (prev.Equals(child))
break;
}
- }
+ }*/
}
- public void AddTimeNode(MediaTimeNode tNode,int playerindex) {
- if (template != null) {
+ public void AddPlay(Play play, Player player) {
+ /*if (template != null) {
TreeIter iter;
TreeStore model = (TreeStore)playerstreeview.Model;
model.GetIterFromString(out iter, playerindex.ToString());
Player player = (Player)model.GetValue(iter,0);
if (template.GetPlayer(playerindex) == player)
model.AppendValues(iter,tNode);
- }
+ }*/
}
public void SetTeam(TeamTemplate template, TreeStore model) {
@@ -115,24 +116,24 @@ namespace LongoMatch.Gui.Component
template = null;
}
- protected virtual void OnTimeNodeSelected(MediaTimeNode tNode) {
+ protected virtual void OnTimeNodeSelected(Play tNode) {
if (TimeNodeSelected != null)
TimeNodeSelected(tNode);
}
- protected virtual void OnSnapshotSeriesEvent(LongoMatch.TimeNodes.MediaTimeNode tNode)
+ protected virtual void OnSnapshotSeriesEvent(Play tNode)
{
if (SnapshotSeriesEvent != null)
SnapshotSeriesEvent(tNode);
}
- protected virtual void OnTimeNodeChanged(LongoMatch.TimeNodes.TimeNode tNode, object val)
+ protected virtual void OnTimeNodeChanged(TimeNode tNode, object val)
{
if (TimeNodeChanged != null)
TimeNodeChanged(tNode, val);
}
- protected virtual void OnPlayListNodeAdded(LongoMatch.TimeNodes.MediaTimeNode tNode)
+ protected virtual void OnPlayListNodeAdded(Play tNode)
{
if (PlayListNodeAdded != null)
PlayListNodeAdded(tNode);
diff --git a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
index 0912017..e9f2dc6 100644
--- a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
@@ -55,18 +55,20 @@ namespace LongoMatch.Gui.Component
treeview.SnapshotSeriesEvent += OnSnapshotSeriesEvent;
treeview.PlayersTagged += OnPlayersTagged;
treeview.TagPlay += OnTagPlay;
- }
+ }
- public void DeletePlay(MediaTimeNode play, int section) {
+ public void RemovePlay(Play play) {
if (project != null) {
TreeIter iter;
- TreeStore model = (TreeStore)treeview.Model;
- model.GetIterFromString(out iter, section.ToString());
TreeIter child;
+
+ var category = play.Category;
+ var model = (TreeStore)treeview.Model;
+ model.GetIterFromString(out iter, CategoryPath(category));
model.IterChildren(out child, iter);
// Searching the TimeNode to remove it
while (model.IterIsValid(child)) {
- MediaTimeNode mtn = (MediaTimeNode) model.GetValue(child,0);
+ Play mtn = (Play) model.GetValue(child,0);
if (mtn == play) {
model.Remove(ref child);
break;
@@ -79,25 +81,20 @@ namespace LongoMatch.Gui.Component
}
}
- public void AddPlay(MediaTimeNode play,int section) {
- TreeIter sectionIter, playIter;
- TreePath playPath;
- TreeStore model;
- TimeNode stNode;
+ public void AddPlay(Play play) {
+ TreeIter categoryIter;
if (project == null)
return;
-
- model = (TreeStore)treeview.Model;
- model.GetIterFromString(out sectionIter, section.ToString());
- stNode = (TimeNode)model.GetValue(sectionIter,0);
- if (project.Sections.GetTimeNode(section) == stNode){
- playIter = model.AppendValues(sectionIter,play);
- playPath = model.GetPath(playIter);
- treeview.Selection.UnselectAll();
- treeview.ExpandToPath(playPath);
- treeview.Selection.SelectIter(playIter);
- }
+
+ var cat = play.Category;
+ var model = (TreeStore)treeview.Model;
+ model.GetIterFromString(out categoryIter, CategoryPath(cat));
+ var playIter = model.AppendValues(categoryIter,play);
+ var playPath = model.GetPath(playIter);
+ treeview.Selection.UnselectAll();
+ treeview.ExpandToPath(playPath);
+ treeview.Selection.SelectIter(playIter);
}
public bool ProjectIsLive{
@@ -111,13 +108,12 @@ namespace LongoMatch.Gui.Component
project = value;
if (project != null) {
treeview.Model = project.GetModel();
- treeview.Colors = project.Sections.GetColors();
- treeview.VisitorTeam = project.VisitorName;
- treeview.LocalTeam = project.LocalName;
+ treeview.Colors = true;
+ treeview.VisitorTeam = project.Description.VisitorName;
+ treeview.LocalTeam = project.Description.LocalName;
}
else {
treeview.Model = null;
- treeview.Colors = null;
}
}
}
@@ -127,41 +123,45 @@ namespace LongoMatch.Gui.Component
treeview.PlayListLoaded=value;
}
}
+
+ private string CategoryPath(Category cat){
+ return project.Categories.CategoriesList.IndexOf(cat).ToString();
+ }
protected virtual void OnTimeNodeChanged(TimeNode tNode,object val) {
if (TimeNodeChanged != null)
TimeNodeChanged(tNode,val);
}
- protected virtual void OnTimeNodeSelected(MediaTimeNode tNode) {
+ protected virtual void OnTimeNodeSelected(Play tNode) {
if (TimeNodeSelected != null)
TimeNodeSelected(tNode);
}
- protected virtual void OnTimeNodeDeleted(MediaTimeNode tNode, int section) {
+ protected virtual void OnTimeNodeDeleted(Play tNode){
if (TimeNodeDeleted != null)
- TimeNodeDeleted(tNode,section);
+ TimeNodeDeleted(tNode);
}
- protected virtual void OnPlayListNodeAdded(MediaTimeNode tNode)
+ protected virtual void OnPlayListNodeAdded(Play tNode)
{
if (PlayListNodeAdded != null)
PlayListNodeAdded(tNode);
}
- protected virtual void OnSnapshotSeriesEvent(LongoMatch.TimeNodes.MediaTimeNode tNode)
+ protected virtual void OnSnapshotSeriesEvent(LongoMatch.TimeNodes.Play tNode)
{
if (SnapshotSeriesEvent != null)
SnapshotSeriesEvent(tNode);
}
- protected virtual void OnPlayersTagged(LongoMatch.TimeNodes.MediaTimeNode tNode, Team team)
+ protected virtual void OnPlayersTagged(LongoMatch.TimeNodes.Play tNode, Team team)
{
if (PlayersTagged != null)
PlayersTagged(tNode,team);
}
- protected virtual void OnTagPlay (LongoMatch.TimeNodes.MediaTimeNode tNode)
+ protected virtual void OnTagPlay (LongoMatch.TimeNodes.Play tNode)
{
if (TagPlay != null)
TagPlay(tNode);
diff --git a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
index 507a603..b412665 100644
--- a/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectDetailsWidget.cs
@@ -49,7 +49,7 @@ namespace LongoMatch.Gui.Component
private DateTime date;
private CalendarPopup cp;
private Win32CalendarDialog win32CP;
- private Sections actualSection;
+ private Categories actualCategory;
private TeamTemplate actualVisitorTeam;
private TeamTemplate actualLocalTeam;
private ProjectType useType;
@@ -187,12 +187,12 @@ namespace LongoMatch.Gui.Component
}
}
- public Sections Sections {
+ public Categories Categories {
get {
- return actualSection;
+ return actualCategory;
}
set {
- actualSection = value;
+ actualCategory = value;
}
}
@@ -297,31 +297,33 @@ namespace LongoMatch.Gui.Component
public void SetProject(Project project) {
this.project = project;
- mFile = project.File;
+ var desc = project.Description;
+ mFile = desc.File;
Filename = mFile != null ? mFile.FilePath : "";
- LocalName = project.LocalName;
- VisitorName = project.VisitorName;
- LocalGoals = project.LocalGoals;
- VisitorGoals = project.VisitorGoals;
- Date = project.MatchDate;
- Season = project.Season;
- Competition = project.Competition;
- Sections = project.Sections;
+ LocalName = desc.LocalName;
+ VisitorName = desc.VisitorName;
+ LocalGoals = desc.LocalGoals;
+ VisitorGoals = desc.VisitorGoals;
+ Date = desc.MatchDate;
+ Season = desc.Season;
+ Competition = desc.Competition;
+ Categories = project.Categories;
LocalTeamTemplate = project.LocalTeamTemplate;
VisitorTeamTemplate = project.VisitorTeamTemplate;
Edited = false;
}
public void UpdateProject() {
- project.File= mFile;
- project.LocalName = localTeamEntry.Text;
- project.VisitorName = visitorTeamEntry.Text;
- project.LocalGoals = (int)localSpinButton.Value;
- project.VisitorGoals = (int)visitorSpinButton.Value;
- project.MatchDate = DateTime.Parse(dateEntry.Text);
- project.Competition = competitionentry.Text;
- project.Season = seasonentry.Text;
- project.Sections = Sections;
+ var desc = project.Description;
+ desc.File= mFile;
+ desc.LocalName = localTeamEntry.Text;
+ desc.VisitorName = visitorTeamEntry.Text;
+ desc.LocalGoals = (int)localSpinButton.Value;
+ desc.VisitorGoals = (int)visitorSpinButton.Value;
+ desc.MatchDate = DateTime.Parse(dateEntry.Text);
+ desc.Competition = competitionentry.Text;
+ desc.Season = seasonentry.Text;
+ project.Categories = Categories;
project.LocalTeamTemplate = LocalTeamTemplate;
project.VisitorTeamTemplate = VisitorTeamTemplate;
}
@@ -340,17 +342,21 @@ namespace LongoMatch.Gui.Component
mFile.FilePath = fileEntry.Text;
mFile.Fps = 25;
}
- return new Project(mFile,
- LocalName,
- VisitorName,
- Season,
- Competition,
- LocalGoals,
- VisitorGoals,
- Date,
- Sections,
- LocalTeamTemplate,
- VisitorTeamTemplate);
+ var desc = new ProjectDescription {
+ File = mFile,
+ LocalName = LocalName,
+ VisitorName = VisitorName,
+ Season = Season,
+ Competition = Competition,
+ LocalGoals = LocalGoals,
+ MatchDate = Date
+ };
+
+ return new Project{
+ Description = desc,
+ Categories = Categories,
+ LocalTeamTemplate = LocalTeamTemplate,
+ VisitorTeamTemplate = VisitorTeamTemplate};
}
}
else {
@@ -408,8 +414,9 @@ namespace LongoMatch.Gui.Component
i++;
}
tagscombobox.Active = index;
- SectionsReader reader = new SectionsReader(System.IO.Path.Combine(MainClass.TemplatesDir(),SectionsFile));
- Sections= reader.GetSections();
+ var reader = new CategoriesReader(System.IO.Path.Combine(MainClass.TemplatesDir(),SectionsFile));
+ Categories = reader.GetCategories();
+ Console.WriteLine (Categories.Count);
}
private void FillTeamsTemplate() {
@@ -430,8 +437,10 @@ namespace LongoMatch.Gui.Component
}
localcombobox.Active = index;
visitorcombobox.Active = index;
- LocalTeamTemplate = TeamTemplate.LoadFromFile(System.IO.Path.Combine(MainClass.TemplatesDir(),LocalTeamTemplateFile));
- VisitorTeamTemplate = TeamTemplate.LoadFromFile(System.IO.Path.Combine(MainClass.TemplatesDir(),VisitorTeamTemplateFile));
+ LocalTeamTemplate = TeamTemplate.LoadFromFile(System.IO.Path.Combine(MainClass.TemplatesDir(),
+ LocalTeamTemplateFile));
+ VisitorTeamTemplate = TeamTemplate.LoadFromFile(System.IO.Path.Combine(MainClass.TemplatesDir(),
+ VisitorTeamTemplateFile));
}
private void FillFormats(){
@@ -500,6 +509,7 @@ namespace LongoMatch.Gui.Component
md.Icon=Stetic.IconLoader.LoadIcon(this, "longomatch", Gtk.IconSize.Dialog);
md.Show();
mFile = LongoMatch.Video.Utils.PreviewMediaFile.GetMediaFile(filename);
+ Console.WriteLine (mFile.Length.ToString());
if (!mFile.HasVideo || mFile.VideoCodec == "")
throw new Exception(Catalog.GetString("This file doesn't contain a video stream."));
if (mFile.HasVideo && mFile.Length == 0)
@@ -538,30 +548,33 @@ namespace LongoMatch.Gui.Component
protected virtual void OnCombobox1Changed(object sender, System.EventArgs e)
{
- SectionsReader reader = new SectionsReader(System.IO.Path.Combine(MainClass.TemplatesDir(),SectionsFile));
- Sections= reader.GetSections();
+ var reader = new CategoriesReader(System.IO.Path.Combine(MainClass.TemplatesDir(),SectionsFile));
+ Categories = reader.GetCategories();
}
protected virtual void OnVisitorcomboboxChanged(object sender, System.EventArgs e)
{
- VisitorTeamTemplate = TeamTemplate.LoadFromFile(System.IO.Path.Combine(MainClass.TemplatesDir(), VisitorTeamTemplateFile));
+ VisitorTeamTemplate = TeamTemplate.LoadFromFile(System.IO.Path.Combine(MainClass.TemplatesDir(),
+ VisitorTeamTemplateFile));
}
protected virtual void OnLocalcomboboxChanged(object sender, System.EventArgs e)
{
- LocalTeamTemplate = TeamTemplate.LoadFromFile(System.IO.Path.Combine(MainClass.TemplatesDir(), LocalTeamTemplateFile));
+ LocalTeamTemplate = TeamTemplate.LoadFromFile(System.IO.Path.Combine(MainClass.TemplatesDir(),
+ LocalTeamTemplateFile));
}
protected virtual void OnEditbuttonClicked(object sender, System.EventArgs e)
{
ProjectTemplateEditorDialog ted = new ProjectTemplateEditorDialog();
ted.TransientFor = (Window)Toplevel;
- ted.Sections = Sections;
+ Console.WriteLine (Categories.Count);
+ ted.Categories = Categories;
ted.Project = project;
ted.CanExport = Use == ProjectType.EditProject;
if (ted.Run() == (int)ResponseType.Apply) {
- Sections = ted.Sections;
+ Categories = ted.Categories;
}
ted.Destroy();
OnEdited(this,null);
diff --git a/LongoMatch/Gui/Component/ProjectListWidget.cs b/LongoMatch/Gui/Component/ProjectListWidget.cs
index 75d08ad..0c2f30f 100644
--- a/LongoMatch/Gui/Component/ProjectListWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectListWidget.cs
@@ -91,8 +91,9 @@ namespace LongoMatch.Gui.Component
projectsList = projects;
projectsList.Sort();
projectsListStore.Clear();
- foreach (ProjectDescription project in projectsList)
+ foreach (ProjectDescription project in projectsList){
projectsListStore.AppendValues(project);
+ }
filter = new Gtk.TreeModelFilter(projectsListStore, null);
filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree);
treeview.Model = filter;
@@ -116,7 +117,8 @@ namespace LongoMatch.Gui.Component
string text;
ProjectDescription project = (ProjectDescription) model.GetValue(iter, 0);
- text = "\n"+"\n"+"\n"+"<b>"+Catalog.GetString("File length")+":</b> " + project.Length.ToSecondsString();
+ text = "\n"+"\n"+"\n"+"<b>"+Catalog.GetString("File length")+":</b> " +
+ (new Time {MSeconds = (int)project.File.Length}).ToSecondsString();
text = text +"\n"+"<b>"+Catalog.GetString("Video codec")+":</b> " + project.VideoCodec;
text = text +"\n"+"<b>"+Catalog.GetString("Audio codec")+":</b> " + project.AudioCodec;
text = text +"\n"+"<b>"+Catalog.GetString("Format")+":</b> " + project.Format;
diff --git a/LongoMatch/Gui/Component/ProjectTemplateWidget.cs b/LongoMatch/Gui/Component/ProjectTemplateWidget.cs
index 31f16ff..5165270 100644
--- a/LongoMatch/Gui/Component/ProjectTemplateWidget.cs
+++ b/LongoMatch/Gui/Component/ProjectTemplateWidget.cs
@@ -1,4 +1,4 @@
-// SectionsPropertiesWidget.cs
+// CategoriesPropertiesWidget.cs
// Copyright (C) 2007-2009 Andoni Morales Alastruey
//
// This program is free software; you can redistribute it and/or modify
@@ -38,9 +38,8 @@ namespace LongoMatch.Gui.Component
{
private List<HotKey> hkList;
private Project project;
- private Sections sections;
- private List<SectionsTimeNode> selectedSections;
- private bool edited = false;
+ private Categories categories;
+ private List<Category> selectedCategories;
public ProjectTemplateWidget()
{
@@ -48,28 +47,31 @@ namespace LongoMatch.Gui.Component
hkList = new List<HotKey>();
}
- public void SetProject(Project project) {
- this.project = project;
- if (project != null)
- Sections=project.Sections;
+ public Project Project {
+ set{
+ project = project;
+ if (project != null)
+ Categories = project.Categories;
+ }
}
- public Sections Sections {
+ public Categories Categories {
get {
- return sections;
+ return categories;
}
set {
- this.sections = value;
- edited = false;
- Gtk.TreeStore sectionsListStore = new Gtk.TreeStore(typeof(SectionsTimeNode));
+ categories = value;
+ Edited = false;
+ Gtk.TreeStore categoriesListStore = new Gtk.TreeStore(typeof(Category));
hkList.Clear();
- for (int i=0;i<sections.Count;i++) {
- sectionsListStore.AppendValues(sections.GetSection(i));
+
+ foreach (var cat in categories.CategoriesList){
+ categoriesListStore.AppendValues(cat);
try {
- hkList.Add(sections.GetSection(i).HotKey);
+ hkList.Add(cat.HotKey);
} catch {}; //Do not add duplicated hotkeys
}
- sectionstreeview1.Model = sectionsListStore;
+ categoriestreeview.Model = categoriesListStore;
ButtonsSensitive = false;
}
}
@@ -81,65 +83,68 @@ namespace LongoMatch.Gui.Component
}
}
public bool Edited {
- get {
- return edited;
- }
- set {
- edited=value;
- }
+ get;
+ set;
}
private void UpdateModel() {
- Sections = Sections;
+ Categories = Categories;
}
- private void AddSection(int index) {
- SectionsTimeNode tn;
+ private void AddCategory(int index) {
+ Category tn;
HotKey hkey = new HotKey();
- Time start = new Time(10*Time.SECONDS_TO_TIME);
- Time stop = new Time(10*Time.SECONDS_TO_TIME);
+ Time start = new Time {MSeconds = 10*Time.SECONDS_TO_TIME};
+ Time stop = new Time {MSeconds = 10*Time.SECONDS_TO_TIME};
- tn = new SectionsTimeNode("New Section",start,stop,hkey,new Color(Byte.MaxValue,Byte.MinValue,Byte.MinValue));
+ tn = new Category{
+ Name = "New Section",
+ Start = start,
+ Stop = stop,
+ HotKey = hkey,
+ Color = new Color(Byte.MaxValue,Byte.MinValue,Byte.MinValue)
+ };
if (project != null) {
- project.AddSectionAtPos(tn,index);
- }
- else {
- sections.AddSectionAtPos(tn,index);
+ /* Editing a project template */
+ project.Categories.AddCategoryAtPos(index,tn);
+ } else {
+ /* Editing a template in the templates editor */
+ categories.AddCategoryAtPos(index,tn);
}
UpdateModel();
- edited = true;
+ Edited = true;
}
- private void RemoveSelectedSections() {
+ private void RemoveSelectedCategories() {
if (project!= null) {
MessageDialog dialog = new MessageDialog((Gtk.Window)this.Toplevel,DialogFlags.Modal,MessageType.Question,
ButtonsType.YesNo,true,
Catalog.GetString("You are about to delete a category and all the plays added to this category. Do you want to proceed?"));
if (dialog.Run() == (int)ResponseType.Yes){
try {
- foreach (SectionsTimeNode tNode in selectedSections)
- project.DeleteSection(sections.SectionsTimeNodes.IndexOf(tNode));
+ foreach (Category cat in selectedCategories)
+ project.Categories.RemoveCategory(cat);
} catch {
MessagePopup.PopupMessage(this,MessageType.Warning,
Catalog.GetString("A template needs at least one category"));
}
}
dialog.Destroy();
- sections=project.Sections;
+ categories = project.Categories;
} else {
- foreach (SectionsTimeNode tNode in selectedSections){
- if (sections.Count == 1){
+ foreach (Category cat in selectedCategories){
+ if (categories.Count == 1){
MessagePopup.PopupMessage(this,MessageType.Warning,
Catalog.GetString("A template needs at least one category"));
} else
- sections.RemoveSection(sections.SectionsTimeNodes.IndexOf(tNode));
+ categories.RemoveCategory(cat);
}
}
UpdateModel();
- edited = true;
- selectedSections = null;
+ Edited = true;
+ selectedCategories = null;
ButtonsSensitive=false;
}
@@ -154,42 +159,42 @@ namespace LongoMatch.Gui.Component
private void EditSelectedSection() {
EditCategoryDialog dialog = new EditCategoryDialog();
- dialog.Section = selectedSections[0];
+ dialog.Category = selectedCategories[0];
dialog.HotKeysList = hkList;
dialog.TransientFor = (Gtk.Window) Toplevel;
dialog.Run();
dialog.Destroy();
- edited = true;
+ Edited = true;
}
private void SaveTemplate(string templateName){
- SectionsWriter.UpdateTemplate(templateName+".sct", Sections);
+ CategoriesWriter.UpdateTemplate(templateName+".sct", Categories);
}
protected virtual void OnNewAfter(object sender, EventArgs args) {
- AddSection(sections.SectionsTimeNodes.IndexOf(selectedSections[0])+1);
+ AddCategory(categories.CategoriesList.IndexOf(selectedCategories[0])+1);
}
protected virtual void OnNewBefore(object sender, EventArgs args) {
- AddSection(sections.SectionsTimeNodes.IndexOf(selectedSections[0]));
+ AddCategory(categories.CategoriesList.IndexOf(selectedCategories[0]));
}
protected virtual void OnRemove(object sender, EventArgs args) {
- RemoveSelectedSections();
+ RemoveSelectedCategories();
}
protected virtual void OnEdit(object sender, EventArgs args) {
EditSelectedSection();
}
- protected virtual void OnSectionstreeview1SectionClicked(LongoMatch.TimeNodes.SectionsTimeNode tNode)
+ protected virtual void OnCategoriestreeviewSectionClicked(LongoMatch.TimeNodes.Category tNode)
{
EditSelectedSection();
}
- protected virtual void OnSectionstreeview1SectionsSelected (List<SectionsTimeNode> tNodesList)
+ protected virtual void OnCategoriestreeviewCategoriesSelected (List<Category> tNodesList)
{
- selectedSections = tNodesList;
+ selectedCategories = tNodesList;
if (tNodesList.Count == 0)
ButtonsSensitive = false;
else if (tNodesList.Count == 1){
@@ -205,8 +210,8 @@ namespace LongoMatch.Gui.Component
protected virtual void OnKeyPressEvent(object o, Gtk.KeyPressEventArgs args)
{
- if (args.Event.Key == Gdk.Key.Delete && selectedSections != null)
- RemoveSelectedSections();
+ if (args.Event.Key == Gdk.Key.Delete && selectedCategories != null)
+ RemoveSelectedCategories();
}
protected virtual void OnExportbuttonClicked (object sender, System.EventArgs e)
@@ -225,7 +230,7 @@ namespace LongoMatch.Gui.Component
MessageType.Question,
Gtk.ButtonsType.YesNo,
Catalog.GetString("The template already exists. " +
- "Do you want to overwrite it ?")
+ "Do you want to overwrite it ?")
);
if (md.Run() == (int)ResponseType.Yes)
SaveTemplate(dialog.Text);
@@ -235,6 +240,5 @@ namespace LongoMatch.Gui.Component
}
dialog.Destroy();
}
-
}
}
diff --git a/LongoMatch/Gui/Component/TaggerWidget.cs b/LongoMatch/Gui/Component/TaggerWidget.cs
index e881d56..ae83837 100644
--- a/LongoMatch/Gui/Component/TaggerWidget.cs
+++ b/LongoMatch/Gui/Component/TaggerWidget.cs
@@ -77,16 +77,18 @@ namespace LongoMatch.Gui.Component
}
private void AddTag(string text, bool check){
- Tag tag = new Tag(text);
+ Tag tag = new Tag {
+ Value = text,
+ };
if (tagsDict.ContainsKey(tag))
return;
AddTagWidget(tag, check);
}
private void AddTagWidget(Tag tag, bool check){
- CheckButton button = new CheckButton(tag.Text);
- button.Name = tag.Text;
- AddElementToTable(button);
+ CheckButton button = new CheckButton(tag.Value);
+ button.Name = tag.Value;
+ AddElementToTable(button);
button.Active = check;
tagsDict.Add(tag, button);
}
@@ -118,7 +120,9 @@ namespace LongoMatch.Gui.Component
scrolledwindow1.Visible = true;
label1.Visible = false;
}
- tag = new Tag(entry1.Text);
+ tag = new Tag{
+ Value = entry1.Text,
+ };
if (tagsDict.TryGetValue(tag, out button))
button.Active = true;
else
diff --git a/LongoMatch/Gui/Component/TagsTreeWidget.cs b/LongoMatch/Gui/Component/TagsTreeWidget.cs
index a600e6e..4736cfb 100644
--- a/LongoMatch/Gui/Component/TagsTreeWidget.cs
+++ b/LongoMatch/Gui/Component/TagsTreeWidget.cs
@@ -57,7 +57,7 @@ namespace LongoMatch.Gui.Component
{
this.Build();
filterTags = new List<Tag>();
- model = new Gtk.ListStore(typeof(MediaTimeNode));
+ model = new Gtk.ListStore(typeof(Play));
filter = new Gtk.TreeModelFilter(model, null);
filter.VisibleFunc = new Gtk.TreeModelFilterVisibleFunc(FilterTree);
treeview.Model = filter;
@@ -78,12 +78,12 @@ namespace LongoMatch.Gui.Component
filter.Refilter();
}
- public void DeletePlay(MediaTimeNode play) {
+ public void DeletePlay(Play play) {
if (project != null) {
TreeIter iter;
model.GetIterFirst(out iter);
while (model.IterIsValid(iter)) {
- MediaTimeNode mtn = (MediaTimeNode) model.GetValue(iter,0);
+ Play mtn = (Play) model.GetValue(iter,0);
if (mtn == play) {
model.Remove(ref iter);
break;
@@ -96,7 +96,7 @@ namespace LongoMatch.Gui.Component
}
}
- public void AddPlay(MediaTimeNode play) {
+ public void AddPlay(Play play) {
model.AppendValues(play);
filter.Refilter();
}
@@ -112,13 +112,12 @@ namespace LongoMatch.Gui.Component
project = value;
if (project != null) {
model.Clear();
- foreach (List<MediaTimeNode> list in project.GetDataArray()){
- foreach (MediaTimeNode tNode in list)
- model.AppendValues(tNode);
- }
+ foreach (Play play in value.AllPlays())
+ model.AppendValues(play);
+
UpdateTagsList();
- treeview.LocalTeam = value.LocalName;
- treeview.VisitorTeam = value.VisitorName;
+ treeview.LocalTeam = project.Description.LocalName;
+ treeview.VisitorTeam = project.Description.VisitorName;
}
}
}
@@ -132,7 +131,7 @@ namespace LongoMatch.Gui.Component
public void UpdateTagsList(){
(tagscombobox.Model as ListStore).Clear();
foreach (Tag tag in project.Tags)
- tagscombobox.AppendText(tag.Text);
+ tagscombobox.AppendText(tag.Value);
}
private void AddFilterWidget(Tag tag){
@@ -141,11 +140,11 @@ namespace LongoMatch.Gui.Component
Label l;
box = new HBox();
- box.Name = tag.Text;
+ box.Name = tag.Value;
b = new Button();
b.Image = new Image(Stetic.IconLoader.LoadIcon(this, "gtk-delete", Gtk.IconSize.Menu));
b.Clicked += OnDeleteClicked;
- l = new Label(tag.Text);
+ l = new Label(tag.Value);
l.Justify = Justification.Left;
box.PackEnd(b,false, false, 0);
box.PackStart(l,true, true, 0);
@@ -156,7 +155,7 @@ namespace LongoMatch.Gui.Component
protected virtual void OnDeleteClicked (object o, System.EventArgs e){
Widget parent = (o as Widget).Parent;
tagscombobox.AppendText(parent.Name);
- filterTags.Remove(new Tag(parent.Name));
+ filterTags.Remove(new Tag{Value = parent.Name});
filter.Refilter();
tagsvbox.Remove(parent);
}
@@ -167,7 +166,7 @@ namespace LongoMatch.Gui.Component
if (text == null || text == "")
return;
- Tag tag = new Tag(text);
+ Tag tag = new Tag{ Value = text};
if (!filterTags.Contains(tag)){
filterTags.Add(tag);
tagscombobox.RemoveText(tagscombobox.Active);
@@ -187,12 +186,12 @@ namespace LongoMatch.Gui.Component
private bool FilterTree(Gtk.TreeModel model, Gtk.TreeIter iter)
{
- MediaTimeNode tNode;
+ Play tNode;
if (filterTags.Count == 0)
return true;
- tNode = model.GetValue(iter, 0) as MediaTimeNode;
+ tNode = model.GetValue(iter, 0) as Play;
if (tNode == null)
return true;
@@ -217,18 +216,18 @@ namespace LongoMatch.Gui.Component
TimeNodeChanged(tNode,val);
}
- protected virtual void OnTimeNodeSelected(MediaTimeNode tNode) {
+ protected virtual void OnTimeNodeSelected(Play tNode) {
if (TimeNodeSelected != null)
TimeNodeSelected(tNode);
}
- protected virtual void OnPlayListNodeAdded(MediaTimeNode tNode)
+ protected virtual void OnPlayListNodeAdded(Play tNode)
{
if (PlayListNodeAdded != null)
PlayListNodeAdded(tNode);
}
- protected virtual void OnSnapshotSeriesEvent(LongoMatch.TimeNodes.MediaTimeNode tNode)
+ protected virtual void OnSnapshotSeriesEvent(LongoMatch.TimeNodes.Play tNode)
{
if (SnapshotSeriesEvent != null)
SnapshotSeriesEvent(tNode);
diff --git a/LongoMatch/Gui/Component/TeamTemplateWidget.cs b/LongoMatch/Gui/Component/TeamTemplateWidget.cs
index d3af265..b48e566 100644
--- a/LongoMatch/Gui/Component/TeamTemplateWidget.cs
+++ b/LongoMatch/Gui/Component/TeamTemplateWidget.cs
@@ -47,8 +47,8 @@ namespace LongoMatch.Gui.Component
this.template= value;
edited = false;
Gtk.TreeStore playersListStore = new Gtk.TreeStore(typeof(Player));
- for (int i=0;i<template.PlayersCount;i++)
- playersListStore.AppendValues(template.GetPlayer(i));
+ foreach (Player player in template.PlayersList)
+ playersListStore.AppendValues(player);
playerpropertiestreeview1.Model=playersListStore;
}
}
diff --git a/LongoMatch/Gui/Component/TimeAdjustWidget.cs b/LongoMatch/Gui/Component/TimeAdjustWidget.cs
index 3884714..45d8312 100644
--- a/LongoMatch/Gui/Component/TimeAdjustWidget.cs
+++ b/LongoMatch/Gui/Component/TimeAdjustWidget.cs
@@ -38,17 +38,17 @@ namespace LongoMatch.Gui.Component
this.Build();
}
- public void SetTimeNode(SectionsTimeNode tNode) {
+ public void SetTimeNode(Category tNode) {
spinbutton1.Value=tNode.Start.Seconds;
spinbutton2.Value=tNode.Stop.Seconds;
}
public Time GetStartTime() {
- return new Time((int)(spinbutton1.Value)*Time.SECONDS_TO_TIME);
+ return new Time {Seconds = (int)(spinbutton1.Value)};
}
public Time GetStopTime() {
- return new Time((int)(spinbutton2.Value)*Time.SECONDS_TO_TIME);
+ return new Time {Seconds = (int)(spinbutton2.Value)};
}
protected virtual void OnSpinbutton1ValueChanged(object sender, System.EventArgs e)
diff --git a/LongoMatch/Gui/Component/TimeLineWidget.cs b/LongoMatch/Gui/Component/TimeLineWidget.cs
index 7979377..e4081cf 100644
--- a/LongoMatch/Gui/Component/TimeLineWidget.cs
+++ b/LongoMatch/Gui/Component/TimeLineWidget.cs
@@ -38,15 +38,15 @@ namespace LongoMatch.Gui.Component {
public event NewMarkAtFrameEventHandler NewMarkEvent;
//public event PlayListNodeAddedHandler PlayListNodeAdded;
- private TimeScale[] tsArray;
- private List<List<MediaTimeNode>> tnArray;
- private Sections sections;
+ private Dictionary<Category,TimeScale> tsList;
+ private Categories categories;
private TimeReferenceWidget tr;
CategoriesScale cs;
private uint frames;
private uint pixelRatio;
- private MediaTimeNode selected;
+ private Play selected;
private uint currentFrame;
+ private bool hasProject;
public TimeLineWidget()
@@ -71,17 +71,17 @@ namespace LongoMatch.Gui.Component {
toolsbox.HeightRequest = 50 - leftbox.Spacing;
}
- public MediaTimeNode SelectedTimeNode {
+ public Play SelectedTimeNode {
get {
return selected;
}
set {
+ if (!hasProject)
+ return;
+
selected = value;
- if (tsArray != null && tnArray != null) {
- foreach (TimeScale ts in tsArray) {
- ts.SelectedTimeNode = value;
- }
- }
+ foreach (TimeScale ts in tsList.Values)
+ ts.SelectedTimeNode = value;
if (selected != null) {
if (SelectedTimeNode.StartFrame/pixelRatio < GtkScrolledWindow.Hadjustment.Value ||
SelectedTimeNode.StartFrame/pixelRatio > GtkScrolledWindow.Hadjustment.Value +
@@ -97,14 +97,13 @@ namespace LongoMatch.Gui.Component {
return currentFrame;
}
set {
+ if (!hasProject)
+ return;
+
currentFrame = value;
-
- if (tsArray != null && tnArray != null) {
- foreach (TimeScale ts in tsArray) {
- ts.CurrentFrame = value;
- }
- tr.CurrentFrame = value;
- }
+ foreach (TimeScale ts in tsList.Values)
+ ts.CurrentFrame = value;
+ tr.CurrentFrame = value;
QueueDraw();
}
}
@@ -129,43 +128,44 @@ namespace LongoMatch.Gui.Component {
}
private void SetPixelRatio(uint pixelRatio) {
- if (tsArray != null && tnArray != null) {
- this.pixelRatio = pixelRatio;
- tr.PixelRatio = pixelRatio;
- foreach (TimeScale ts in tsArray) {
- ts.PixelRatio = pixelRatio;
- }
- zoomscale.Value=pixelRatio;
- }
+ if (!hasProject)
+ return;
+
+ this.pixelRatio = pixelRatio;
+ tr.PixelRatio = pixelRatio;
+ foreach (TimeScale ts in tsList.Values)
+ ts.PixelRatio = pixelRatio;
+ zoomscale.Value=pixelRatio;
}
-
public Project Project {
set {
ResetGui();
if (value == null) {
- sections = null;
- tnArray = null;
- tsArray=null;
+ categories = null;
+ tsList.Clear();
+ tsList=null;
+ hasProject = false;
return;
}
-
+ hasProject = true;
frames = value.File.GetFrames();
- sections = value.Sections;
- tnArray = value.GetDataArray();
- tsArray = new TimeScale[sections.Count];
+ categories = value.Categories;
+ tsList = new Dictionary<Category, TimeScale>();
+ frames = value.Description.File.GetFrames();
- cs.Categories = sections;
+ cs.Categories = categories;
cs.Show();
tr.Frames = frames;
- tr.FrameRate = value.File.Fps;
+ tr.FrameRate = value.Description.File.Fps;
tr.Show();
- for (int i=0; i<sections.Count; i++) {
- TimeScale ts = new TimeScale(i,tnArray[i],frames,sections.GetColor(i));
- tsArray[i]=ts;
+ foreach (Category cat in categories.CategoriesList) {
+ List<Play> playsList = value.PlaysInCategory(cat);
+ TimeScale ts = new TimeScale(cat, playsList,frames);
+ tsList[cat] = ts;
ts.TimeNodeChanged += new TimeNodeChangedHandler(OnTimeNodeChanged);
ts.TimeNodeSelected += new TimeNodeSelectedHandler(OnTimeNodeSelected);
ts.TimeNodeDeleted += new TimeNodeDeletedHandler(OnTimeNodeDeleted);
@@ -177,6 +177,18 @@ namespace LongoMatch.Gui.Component {
}
}
+ public void AddPlay(Play play){
+ TimeScale ts;
+ if (tsList.TryGetValue(play.Category, out ts))
+ ts.AddPlay(play);
+ }
+
+ public void RemovePlay (Play play){
+ TimeScale ts;
+ if (tsList.TryGetValue(play.Category, out ts))
+ ts.RemovePlay(play);
+
+ }
private void ResetGui() {
//Unrealize all children
foreach (Widget w in vbox1.AllChildren) {
@@ -185,9 +197,9 @@ namespace LongoMatch.Gui.Component {
}
}
- protected virtual void OnNewMark(int section, int frame) {
+ protected virtual void OnNewMark(Category category, int frame) {
if (NewMarkEvent != null)
- NewMarkEvent(section,frame);
+ NewMarkEvent(category,frame);
}
protected virtual void OnTimeNodeChanged(TimeNode tn, object val) {
@@ -195,13 +207,13 @@ namespace LongoMatch.Gui.Component {
TimeNodeChanged(tn,val);
}
- protected virtual void OnTimeNodeSelected(MediaTimeNode tn) {
+ protected virtual void OnTimeNodeSelected(Play tn) {
if (TimeNodeSelected != null)
TimeNodeSelected(tn);
}
- protected virtual void OnTimeNodeDeleted(MediaTimeNode tn, int section) {
+ protected virtual void OnTimeNodeDeleted(Play tn) {
if (TimeNodeDeleted != null)
- TimeNodeDeleted(tn,section);
+ TimeNodeDeleted(tn);
}
protected virtual void OnFitbuttonClicked(object sender, System.EventArgs e)
diff --git a/LongoMatch/Gui/Component/TimeReferenceWidget.cs b/LongoMatch/Gui/Component/TimeReferenceWidget.cs
index 0b5d270..6d9469e 100644
--- a/LongoMatch/Gui/Component/TimeReferenceWidget.cs
+++ b/LongoMatch/Gui/Component/TimeReferenceWidget.cs
@@ -1,4 +1,4 @@
-ï// TimeReferenceWidget.cs
+// TimeReferenceWidget.cs
//
// Copyright (C2007-2009 Andoni Morales Alastruey
//
diff --git a/LongoMatch/Gui/Component/TimeScale.cs b/LongoMatch/Gui/Component/TimeScale.cs
index c922c12..a49c43b 100644
--- a/LongoMatch/Gui/Component/TimeScale.cs
+++ b/LongoMatch/Gui/Component/TimeScale.cs
@@ -45,14 +45,14 @@ namespace LongoMatch.Gui.Component
private object locker;
- private int section;
+ private Category category;
private Cairo.Color color;
- private List<MediaTimeNode> list;
+ private List<Play> list;
- private MediaTimeNode candidateTN;
+ private Play candidateTN;
private bool candidateStart;
private bool movingLimit;
- private MediaTimeNode selected=null;
+ private Play selected=null;
private uint lastTime=0;
private uint currentFrame;
@@ -61,7 +61,7 @@ namespace LongoMatch.Gui.Component
private Menu menu;
private MenuItem delete;
private int cursorFrame;
- private Dictionary<MenuItem,MediaTimeNode> dic;
+ private Dictionary<MenuItem,Play> dic;
private Pango.Layout layout;
@@ -71,9 +71,9 @@ namespace LongoMatch.Gui.Component
public event TimeNodeDeletedHandler TimeNodeDeleted;
- public TimeScale(int section,List<MediaTimeNode> list, uint frames,Gdk.Color color)
+ public TimeScale(Category category, List<Play> list, uint frames)
{
- this.section = section;
+ this.category = category;
this.frames = frames;
this.list = list;
HeightRequest= SECTION_HEIGHT;
@@ -82,7 +82,7 @@ namespace LongoMatch.Gui.Component
this.color.A = ALPHA;
Events = EventMask.PointerMotionMask | EventMask.ButtonPressMask | EventMask.ButtonReleaseMask ;
- dic = new Dictionary<MenuItem,MediaTimeNode>();
+ dic = new Dictionary<MenuItem,Play>();
layout = new Pango.Layout(PangoContext);
layout.Wrap = Pango.WrapMode.Char;
@@ -113,7 +113,7 @@ namespace LongoMatch.Gui.Component
}
}
- public MediaTimeNode SelectedTimeNode {
+ public Play SelectedTimeNode {
get {
return selected;
}
@@ -122,6 +122,14 @@ namespace LongoMatch.Gui.Component
}
}
+ public void AddPlay(Play play) {
+ list.Add(play);
+ }
+
+ public void RemovePlay(Play play) {
+ list.Remove(play);
+ }
+
public void ReDraw() {
Gdk.Region region = GdkWindow.ClipRegion;
GdkWindow.InvalidateRegion(region,true);
@@ -130,16 +138,16 @@ namespace LongoMatch.Gui.Component
private void SetMenu() {
- MenuItem newMediaTimeNode;
+ MenuItem newPlay;
menu = new Menu();
delete = new MenuItem(Catalog.GetString("Delete Play"));
- newMediaTimeNode = new MenuItem(Catalog.GetString("Add New Play"));
+ newPlay = new MenuItem(Catalog.GetString("Add New Play"));
- menu.Append(newMediaTimeNode);
+ menu.Append(newPlay);
menu.Append(delete);
- newMediaTimeNode.Activated += new EventHandler(OnNewMediaTimeNode);
+ newPlay.Activated += new EventHandler(OnNewPlay);
menu.ShowAll();
}
@@ -157,7 +165,7 @@ namespace LongoMatch.Gui.Component
g.Operator = Operator.Over;
- foreach (MediaTimeNode tn in list) {
+ foreach (Play tn in list) {
if (tn != selected) {
Cairo.Color borderColor = new Cairo.Color(color.R+0.1, color.G+0.1,color.B+0.1, 1);
CairoUtils.DrawRoundedRectangle(g,tn.StartFrame/pixelRatio,3,
@@ -207,7 +215,7 @@ namespace LongoMatch.Gui.Component
private void DrawTimeNodesName() {
lock (locker) {
- foreach (MediaTimeNode tn in list) {
+ foreach (Play tn in list) {
layout.Width = Pango.Units.FromPixels((int)(tn.TotalFrames/pixelRatio));
layout.SetMarkup(tn.Name);
GdkWindow.DrawLayout(Style.TextGC(StateType.Normal),
@@ -222,7 +230,7 @@ namespace LongoMatch.Gui.Component
deleteMenu = new Menu();
delete.Submenu=deleteMenu;
dic.Clear();
- foreach (MediaTimeNode tn in list) {
+ foreach (Play tn in list) {
//We scan all the time Nodes looking for one matching the cursor selectcio
//And we add them to the delete menu
if (tn.HasFrame(cursorFrame)) {
@@ -239,7 +247,7 @@ namespace LongoMatch.Gui.Component
private void ProcessButton1(EventButton evnt) {
if (lastTime != evnt.Time) {
candidateTN = null;
- foreach (MediaTimeNode tn in list) {
+ foreach (Play tn in list) {
int pos = (int)(evnt.X*pixelRatio);
//Moving from the right side
if (Math.Abs(pos-tn.StopFrame) < 3*pixelRatio) {
@@ -265,7 +273,7 @@ namespace LongoMatch.Gui.Component
}
//On Double Click
else {
- foreach (MediaTimeNode tn in list) {
+ foreach (Play tn in list) {
int pos = (int)(evnt.X*pixelRatio);
if (TimeNodeSelected!= null && tn.HasFrame(pos)) {
TimeNodeSelected(tn);
@@ -275,16 +283,16 @@ namespace LongoMatch.Gui.Component
}
}
- protected void OnNewMediaTimeNode(object obj, EventArgs args) {
+ protected void OnNewPlay(object obj, EventArgs args) {
if (NewMarkAtFrameEvent != null)
- NewMarkAtFrameEvent(section,cursorFrame);
+ NewMarkAtFrameEvent(category,cursorFrame);
}
protected void OnDelete(object obj, EventArgs args) {
- MediaTimeNode tNode;
+ Play tNode;
dic.TryGetValue((MenuItem)obj, out tNode);
if (TimeNodeDeleted != null && tNode != null) {
- TimeNodeDeleted(tNode, section);
+ TimeNodeDeleted(tNode);
}
}
diff --git a/LongoMatch/Gui/Dialog/DrawingTool.cs b/LongoMatch/Gui/Dialog/DrawingTool.cs
index 51c1a76..1324f9e 100644
--- a/LongoMatch/Gui/Dialog/DrawingTool.cs
+++ b/LongoMatch/Gui/Dialog/DrawingTool.cs
@@ -29,7 +29,7 @@ namespace LongoMatch.Gui.Dialog
public partial class DrawingTool : Gtk.Dialog
{
- private MediaTimeNode play;
+ private Play play;
private int stopTime;
public DrawingTool()
@@ -51,7 +51,7 @@ namespace LongoMatch.Gui.Dialog
}
}
- public void SetPlay(MediaTimeNode play,int stopTime) {
+ public void SetPlay(Play play,int stopTime) {
this.play = play;
this.stopTime = stopTime;
savetoprojectbutton.Visible = true;
@@ -118,7 +118,7 @@ namespace LongoMatch.Gui.Dialog
string tempFile = System.IO.Path.GetTempFileName();
drawingwidget1.SaveDrawings(tempFile);
Pixbuf frame = new Pixbuf(tempFile);
- play.KeyFrameDrawing =new Drawing(frame,stopTime);
+ play.KeyFrameDrawing =new Drawing{ Pixbuf=frame, RenderTime = stopTime};
drawingwidget1.SaveAll(tempFile);
frame.Dispose();
play.Miniature = new Pixbuf(tempFile);
diff --git a/LongoMatch/Gui/Dialog/EditCategoryDialog.cs b/LongoMatch/Gui/Dialog/EditCategoryDialog.cs
index 7d8766a..631f3e8 100644
--- a/LongoMatch/Gui/Dialog/EditCategoryDialog.cs
+++ b/LongoMatch/Gui/Dialog/EditCategoryDialog.cs
@@ -39,9 +39,9 @@ namespace LongoMatch.Gui.Dialog
timenodeproperties2.HotKeyChanged += OnHotKeyChanged;
}
- public SectionsTimeNode Section {
+ public Category Category {
set {
- timenodeproperties2.Section = value;
+ timenodeproperties2.Category = value;
}
}
@@ -51,16 +51,16 @@ namespace LongoMatch.Gui.Dialog
}
}
- protected virtual void OnHotKeyChanged(HotKey prevHotKey,SectionsTimeNode section) {
- if (hkList.Contains(section.HotKey)) {
+ protected virtual void OnHotKeyChanged(HotKey prevHotKey, Category category) {
+ if (hkList.Contains(category.HotKey)) {
MessagePopup.PopupMessage(this,MessageType.Warning,
Catalog.GetString("This hotkey is already in use."));
- section.HotKey=prevHotKey;
- timenodeproperties2.Section=section; //Update Gui
+ category.HotKey=prevHotKey;
+ timenodeproperties2.Category = category; //Update Gui
}
- else if (section.HotKey.Defined){
+ else if (category.HotKey.Defined){
hkList.Remove(prevHotKey);
- hkList.Add(section.HotKey);
+ hkList.Add(category.HotKey);
}
}
}
diff --git a/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs b/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
index e3abc01..55ac260 100644
--- a/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
+++ b/LongoMatch/Gui/Dialog/PlayersSelectionDialog.cs
@@ -29,17 +29,16 @@ namespace LongoMatch.Gui.Dialog
public partial class PlayersSelectionDialog : Gtk.Dialog
{
TeamTemplate template;
- Dictionary<int, CheckButton> checkButtonsDict;
+ Dictionary<CheckButton, Player> checkButtonsDict;
public PlayersSelectionDialog()
{
this.Build();
- checkButtonsDict = new Dictionary<int, CheckButton>();
+ checkButtonsDict = new Dictionary<CheckButton, Player>();
}
public void SetPlayersInfo(TeamTemplate template) {
CheckButton button;
- Player player;
int playersCount=0;
if (this.template != null)
@@ -50,14 +49,13 @@ namespace LongoMatch.Gui.Dialog
table1.NColumns =(uint)(template.PlayersCount/10);
table1.NRows =(uint) 10;
- for (int i=0;i<template.PlayersCount;i++) {
- player = template.GetPlayer(i);
- if (player.Discarded)
+ foreach (Player player in template.PlayersList) {
+ if (player.Playing)
continue;
button = new CheckButton();
button.Label = player.Number + "-" + player.Name;
- button.Name = i.ToString();
+ button.Name = playersCount.ToString();
button.Show();
uint row_top =(uint)(playersCount%table1.NRows);
@@ -66,21 +64,21 @@ namespace LongoMatch.Gui.Dialog
uint col_right = (uint) col_left+1 ;
table1.Attach(button,col_left,col_right,row_top,row_bottom);
- checkButtonsDict.Add(i, button);
+ checkButtonsDict.Add(button, player);
playersCount++;
}
}
- public List<int> PlayersChecked {
+ public List<Player> PlayersChecked {
set {
- foreach (int player in checkButtonsDict.Keys)
- checkButtonsDict[player].Active = value.Contains(player);
+ foreach (var pair in checkButtonsDict)
+ pair.Key.Active = value.Contains(pair.Value);
}
get {
- List<int> playersList = new List<int>();
- foreach (int player in checkButtonsDict.Keys) {
- if (checkButtonsDict[player].Active)
- playersList.Add (player);
+ List<Player> playersList = new List<Player>();
+ foreach (var pair in checkButtonsDict){
+ if (pair.Key.Active)
+ playersList.Add(pair.Value);
}
return playersList;
}
diff --git a/LongoMatch/Gui/Dialog/ProjectTemplateEditorDialog.cs b/LongoMatch/Gui/Dialog/ProjectTemplateEditorDialog.cs
index 5e41084..f8c5d69 100644
--- a/LongoMatch/Gui/Dialog/ProjectTemplateEditorDialog.cs
+++ b/LongoMatch/Gui/Dialog/ProjectTemplateEditorDialog.cs
@@ -36,16 +36,16 @@ namespace LongoMatch.Gui.Dialog
public Project Project {
set {
- projecttemplatewidget.SetProject(value);
+ projecttemplatewidget.Project = value;
}
}
- public Sections Sections {
+ public Categories Categories {
set {
- projecttemplatewidget.Sections=value;
+ projecttemplatewidget.Categories =value;
}
get {
- return projecttemplatewidget.Sections;
+ return projecttemplatewidget.Categories;
}
}
diff --git a/LongoMatch/Gui/Dialog/ProjectsManager.cs b/LongoMatch/Gui/Dialog/ProjectsManager.cs
index 2c0ecbb..dd72244 100644
--- a/LongoMatch/Gui/Dialog/ProjectsManager.cs
+++ b/LongoMatch/Gui/Dialog/ProjectsManager.cs
@@ -25,6 +25,7 @@ using Mono.Unix;
using LongoMatch.Common;
using LongoMatch.DB;
using LongoMatch.Gui.Component;
+using LongoMatch.Video.Utils;
namespace LongoMatch.Gui.Dialog
{
@@ -81,7 +82,7 @@ namespace LongoMatch.Gui.Dialog
if (project == null)
return;
- if (project.File.FilePath == originalFilePath) {
+ if (project.Description.File.FilePath == originalFilePath) {
MainClass.DB.UpdateProject(project);
saveButton.Sensitive = false;
}
@@ -107,7 +108,8 @@ namespace LongoMatch.Gui.Dialog
return;
foreach (ProjectDescription selectedProject in selectedProjects) {
- if (openedProject != null && selectedProject.File == openedProject.File.FilePath) {
+ if (openedProject != null &&
+ selectedProject.File.FilePath == openedProject.Description.File.FilePath) {
MessagePopup.PopupMessage(this, MessageType.Warning,
Catalog.GetString("This Project is actually in use.")+"\n"+
Catalog.GetString("Close it first to allow its removal from the database"));
@@ -119,7 +121,7 @@ namespace LongoMatch.Gui.Dialog
Catalog.GetString("Do you really want to delete:")+
"\n"+selectedProject.Title);
if (md.Run()== (int)ResponseType.Yes) {
- MainClass.DB.RemoveProject(selectedProject.File);
+ MainClass.DB.RemoveProject(selectedProject.File.FilePath);
deletedProjects.Add (selectedProject);
}
md.Destroy();
@@ -171,15 +173,16 @@ namespace LongoMatch.Gui.Dialog
/* if only one project is selected try to load it in the editor */
project = projects[0];
- if (openedProject != null && project.File == openedProject.File.FilePath) {
+ if (openedProject != null &&
+ project.File.FilePath == openedProject.Description.File.FilePath) {
MessagePopup.PopupMessage(this, MessageType.Warning,
Catalog.GetString("The Project you are trying to load is actually in use.")+"\n" +Catalog.GetString("Close it first to edit it"));
Clear();
}
else {
projectdetails.Sensitive = true;
- projectdetails.SetProject(MainClass.DB.GetProject(project.File));
- originalFilePath = project.File;
+ projectdetails.SetProject(MainClass.DB.GetProject(project.File.FilePath));
+ originalFilePath = project.File.FilePath;
saveButton.Sensitive = false;
deleteButton.Sensitive = true;
exportbutton.Sensitive = true;
diff --git a/LongoMatch/Gui/Dialog/TemplatesEditor.cs b/LongoMatch/Gui/Dialog/TemplatesEditor.cs
index 3cbd481..63b6d71 100644
--- a/LongoMatch/Gui/Dialog/TemplatesEditor.cs
+++ b/LongoMatch/Gui/Dialog/TemplatesEditor.cs
@@ -37,12 +37,12 @@ namespace LongoMatch.Gui.Dialog
public enum UseType {
TeamTemplate,
- SectionsTemplate,
+ CategoriesTemplate,
}
private Gtk.ListStore dataFileListStore;
- private Sections selectedSectionsTemplate;
+ private Categories selectedCategoriesTemplate;
private TeamTemplate selectedTeamTemplate;
private UseType useType;
private string templateName;
@@ -95,10 +95,10 @@ namespace LongoMatch.Gui.Dialog
(cell as Gtk.CellRendererText).Text = System.IO.Path.GetFileNameWithoutExtension(_templateFilePath.ToString());
}
- public void SetSectionsTemplate(Sections sections) {
- if (useType != UseType.SectionsTemplate)
+ public void SetCategoriesTemplate(Categories sections) {
+ if (useType != UseType.CategoriesTemplate)
return;
- sectionspropertieswidget1.Sections=sections;
+ sectionspropertieswidget1.Categories=sections;
}
public void SetTeamTemplate(TeamTemplate template) {
@@ -107,10 +107,10 @@ namespace LongoMatch.Gui.Dialog
teamtemplatewidget1.TeamTemplate=template;
}
- private void UpdateSections() {
- SectionsReader sr = new SectionsReader(templateName);
- selectedSectionsTemplate = sr.GetSections();
- SetSectionsTemplate(sr.GetSections());
+ private void UpdateCategories() {
+ CategoriesReader sr = new CategoriesReader(templateName);
+ selectedCategoriesTemplate = sr.GetCategories();
+ SetCategoriesTemplate(sr.GetCategories());
SetSensitive(true);
}
@@ -120,7 +120,7 @@ namespace LongoMatch.Gui.Dialog
}
private void SetSensitive(bool sensitive) {
- if (useType == UseType.SectionsTemplate)
+ if (useType == UseType.CategoriesTemplate)
sectionspropertieswidget1.Sensitive = true;
else
teamtemplatewidget1.Sensitive = true;
@@ -147,9 +147,9 @@ namespace LongoMatch.Gui.Dialog
}
private void SaveTemplate() {
- if (useType == UseType.SectionsTemplate) {
- selectedSectionsTemplate = sectionspropertieswidget1.Sections;
- SectionsWriter.UpdateTemplate(templateName,selectedSectionsTemplate);
+ if (useType == UseType.CategoriesTemplate) {
+ selectedCategoriesTemplate = sectionspropertieswidget1.Categories;
+ CategoriesWriter.UpdateTemplate(templateName,selectedCategoriesTemplate);
}
else {
selectedTeamTemplate = teamtemplatewidget1.TeamTemplate;
@@ -215,12 +215,11 @@ namespace LongoMatch.Gui.Dialog
if (ed.SelectedTemplate != null)
System.IO.File.Copy(System.IO.Path.Combine(MainClass.TemplatesDir(),ed.SelectedTemplate),
System.IO.Path.Combine(MainClass.TemplatesDir(),name+fileExtension));
- else if (useType == UseType.SectionsTemplate){
- SectionsWriter.CreateNewTemplate(name+fileExtension);
+ else if (useType == UseType.CategoriesTemplate){
+ CategoriesWriter.CreateNewTemplate(name+fileExtension);
}
else {
- TeamTemplate tt = new TeamTemplate();
- tt.CreateDefaultTemplate(count);
+ TeamTemplate tt = TeamTemplate.DefautlTemplate(count);
tt.Save(System.IO.Path.Combine(MainClass.TemplatesDir(), name+fileExtension));
}
@@ -266,8 +265,8 @@ namespace LongoMatch.Gui.Dialog
treeview.Selection.GetSelected(out iter);
templateName = (string) this.dataFileListStore.GetValue(iter, 0);
- if (useType == UseType.SectionsTemplate)
- UpdateSections();
+ if (useType == UseType.CategoriesTemplate)
+ UpdateCategories();
else
UpdateTeamTemplate();
@@ -282,8 +281,8 @@ namespace LongoMatch.Gui.Dialog
protected virtual void OnTreeviewRowActivated(object o, Gtk.RowActivatedArgs args)
{
- if (useType == UseType.SectionsTemplate)
- UpdateSections();
+ if (useType == UseType.CategoriesTemplate)
+ UpdateCategories();
else
UpdateTeamTemplate();
}
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index ea6d4d6..d66c15d 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -124,28 +124,29 @@ namespace LongoMatch.Gui
/* Update tabs labels */
/* FIXME 1.0: Teams should have default names */
- if (project.VisitorName == "")
+ var desc = project.Description;
+ if (desc.VisitorName == "")
visitorteamlabel.Text = Catalog.GetString("Visitor Team");
else
- visitorteamlabel.Text = project.VisitorName;
- if (project.LocalName == "")
+ visitorteamlabel.Text = desc.VisitorName;
+ if (desc.LocalName == "")
localteamlabel.Text = Catalog.GetString("Local Team");
else
- localteamlabel.Text = project.LocalName;
+ localteamlabel.Text = desc.LocalName;
if (projectType == ProjectType.FileProject) {
// Check if the file associated to the project exists
- if (!File.Exists (project.File.FilePath)) {
+ if (!File.Exists (desc.File.FilePath)) {
MessagePopup.PopupMessage (this, MessageType.Warning,
Catalog.GetString ("The file associated to this project doesn't exist.") + "\n"
+ Catalog.GetString ("If the location of the file has changed try to edit it with the database manager."));
CloseOpenedProject (true);
return;
}
- Title = System.IO.Path.GetFileNameWithoutExtension (project.File.FilePath) +
+ Title = System.IO.Path.GetFileNameWithoutExtension (desc.File.FilePath) +
" - " + Constants.SOFTWARE_NAME;
try {
- playerbin1.Open (project.File.FilePath);
+ playerbin1.Open (desc.File.FilePath);
}
catch (GLib.GException ex) {
MessagePopup.PopupMessage (this, MessageType.Error,
@@ -185,8 +186,8 @@ namespace LongoMatch.Gui
localplayerslisttreewidget.SetTeam(project.LocalTeamTemplate,project.GetLocalTeamModel());
visitorplayerslisttreewidget.SetTeam(project.VisitorTeamTemplate,project.GetVisitorTeamModel());
tagstreewidget1.Project = project;
- buttonswidget1.Sections = project.Sections;
- hkManager.Sections=project.Sections;
+ buttonswidget1.Categories = project.Categories;
+ hkManager.Categories=project.Categories;
KeyPressEvent += hotkeysListener;
MakeActionsSensitive(true,projectType);
ShowWidgets();
@@ -195,7 +196,7 @@ namespace LongoMatch.Gui
private void SaveCaptureProject(){
PreviewMediaFile file;
Project newProject = openedProject;
- string filePath = openedProject.File.FilePath;
+ string filePath = openedProject.Description.File.FilePath;
MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None,
Catalog.GetString("Loading newly created project..."));
@@ -204,7 +205,7 @@ namespace LongoMatch.Gui
/* scan the new file to build a new PreviewMediaFile with all the metadata */
try{
file = PreviewMediaFile.GetMediaFile(filePath);
- openedProject.File = file;
+ openedProject.Description.File = file;
MainClass.DB.AddProject(openedProject);
} catch (Exception ex){
string projectFile = filePath + "-" + DateTime.Now;
@@ -268,7 +269,7 @@ namespace LongoMatch.Gui
noteswidget1.Visible = false;
selectedTimeNode = null;
MakeActionsSensitive(false, projectType);
- hkManager.Sections = null;
+ hkManager.Categories = null;
KeyPressEvent -= hotkeysListener;
}
@@ -299,7 +300,7 @@ namespace LongoMatch.Gui
}
private void ClearWidgets() {
- buttonswidget1.Sections = null;
+ buttonswidget1.Categories = null;
treewidget1.Project = null;
tagstreewidget1.Clear();
timelinewidget1.Project = null;
@@ -395,7 +396,7 @@ namespace LongoMatch.Gui
project = opd.SelectedProject;
opd.Destroy();
if (project != null)
- SetProject(MainClass.DB.GetProject(project.File), ProjectType.FileProject, new CapturePropertiesStruct());
+ SetProject(MainClass.DB.GetProject(project.File.FilePath), ProjectType.FileProject, new CapturePropertiesStruct());
}
protected virtual void OnSaveProjectActionActivated(object sender, System.EventArgs e)
@@ -428,7 +429,7 @@ namespace LongoMatch.Gui
protected virtual void OnSectionsTemplatesManagerActivated(object sender, System.EventArgs e)
{
- TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.SectionsTemplate);
+ TemplatesManager tManager = new TemplatesManager(TemplatesManager.UseType.CategoriesTemplate);
tManager.TransientFor = this;
tManager.Show();
}
@@ -585,7 +586,7 @@ namespace LongoMatch.Gui
return ret;
}
- protected virtual void OnTimeNodeSelected(LongoMatch.TimeNodes.MediaTimeNode tNode)
+ protected virtual void OnTimeNodeSelected(Play play)
{
rightvbox.Visible=true;
}
diff --git a/LongoMatch/Gui/TreeView/CategoriesTreeView.cs b/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
index 0f0f3aa..7b390ac 100644
--- a/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
+++ b/LongoMatch/Gui/TreeView/CategoriesTreeView.cs
@@ -34,8 +34,8 @@ namespace LongoMatch.Gui.Component
[System.ComponentModel.ToolboxItem(true)]
public class CategoriesTreeView : Gtk.TreeView
{
- public event SectionHandler SectionClicked;
- public event SectionsHandler SectionsSelected;
+ public event CategoryHandler CategoryClicked;
+ public event CategoriesHandler CategoriesSelected;
public CategoriesTreeView() {
@@ -91,7 +91,7 @@ namespace LongoMatch.Gui.Component
private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
- SectionsTimeNode tNode = (SectionsTimeNode) model.GetValue(iter, 0);
+ Category tNode = (Category) model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Text = tNode.Name;
}
@@ -99,63 +99,63 @@ namespace LongoMatch.Gui.Component
private void RenderStartTime(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
- SectionsTimeNode tNode = (SectionsTimeNode) model.GetValue(iter, 0);
+ Category tNode = (Category) model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Text =tNode.Start.Seconds.ToString();
}
private void RenderStopTime(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
- SectionsTimeNode tNode = (SectionsTimeNode) model.GetValue(iter, 0);
+ Category tNode = (Category) model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Text = tNode.Stop.Seconds.ToString();
}
private void RenderColor(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
- SectionsTimeNode tNode = (SectionsTimeNode) model.GetValue(iter, 0);
+ Category tNode = (Category) model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).CellBackgroundGdk = tNode.Color;
}
private void RenderHotKey(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
- SectionsTimeNode tNode = (SectionsTimeNode) Model.GetValue(iter, 0);
+ Category tNode = (Category) Model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Text = tNode.HotKey.ToString();
}
private void RenderSortMethod(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
- SectionsTimeNode tNode = (SectionsTimeNode) Model.GetValue(iter, 0);
+ Category tNode = (Category) Model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Text = tNode.SortMethodString;
}
protected virtual void OnSelectionChanged(object o, System.EventArgs e) {
TreeIter iter;
- List<SectionsTimeNode> list;
+ List<Category> list;
TreePath[] pathArray;
- list = new List<SectionsTimeNode>();
+ list = new List<Category>();
pathArray = Selection.GetSelectedRows();
for (int i=0; i< pathArray.Length; i++){
Model.GetIterFromString (out iter, pathArray[i].ToString());
- list.Add((SectionsTimeNode) Model.GetValue(iter, 0));
+ list.Add((Category) Model.GetValue(iter, 0));
}
- if (SectionsSelected != null)
- SectionsSelected(list);
+ if (CategoriesSelected != null)
+ CategoriesSelected(list);
}
protected virtual void OnTreeviewRowActivated(object o, Gtk.RowActivatedArgs args)
{
Gtk.TreeIter iter;
Model.GetIter(out iter, args.Path);
- SectionsTimeNode tNode = (SectionsTimeNode)Model.GetValue(iter, 0);
+ Category tNode = (Category)Model.GetValue(iter, 0);
- if (SectionClicked != null)
- SectionClicked(tNode);
+ if (CategoryClicked != null)
+ CategoryClicked(tNode);
}
}
}
\ No newline at end of file
diff --git a/LongoMatch/Gui/TreeView/ListTreeViewBase.cs b/LongoMatch/Gui/TreeView/ListTreeViewBase.cs
index b8fdb3d..e9c23c9 100644
--- a/LongoMatch/Gui/TreeView/ListTreeViewBase.cs
+++ b/LongoMatch/Gui/TreeView/ListTreeViewBase.cs
@@ -49,7 +49,6 @@ namespace LongoMatch.Gui.Component
protected Gtk.CellRendererText nameCell;
protected Gtk.TreeViewColumn nameColumn;
- protected Color[] colors;
protected String[] teams_name;
protected bool editing;
protected bool projectIsLive;
@@ -75,7 +74,6 @@ namespace LongoMatch.Gui.Component
SetMenu();
ProjectIsLive = false;
PlayListLoaded = false;
- colors = null;
teams_name = new String[3];
teams_name[(int)Team.NONE] = Catalog.GetString(Catalog.GetString("None"));
@@ -98,11 +96,6 @@ namespace LongoMatch.Gui.Component
}
- public Color[] Colors {
- set {
- this.colors = value;
- }
- }
public bool ProjectIsLive{
set{
projectIsLive = value;
@@ -111,6 +104,11 @@ namespace LongoMatch.Gui.Component
}
}
+ public bool Colors{
+ get;
+ set;
+ }
+
public String LocalTeam {
set{
Label l1 = (local.Children[0] as Label);
@@ -225,10 +223,10 @@ namespace LongoMatch.Gui.Component
var item = model.GetValue(iter, 0);
var c = cell as CellRendererPixbuf;
- if (item is MediaTimeNode){
- c.Pixbuf = (item as MediaTimeNode).Miniature;
- if (colors !=null) {
- c.CellBackgroundGdk = colors[GetSectionFromIter(iter)];
+ if (item is Play){
+ c.Pixbuf = (item as Play).Miniature;
+ if (Colors) {
+ c.CellBackgroundGdk = (item as Play).Category.Color;
} else{
c.CellBackground = "white";
}
@@ -258,11 +256,10 @@ namespace LongoMatch.Gui.Component
return;
}
- if (o is MediaTimeNode){
- var mtn = o as MediaTimeNode;
- /* FIXME: the colors array is set externally and might not match the model!!! */
- if (colors !=null) {
- Color col = colors[GetSectionFromIter(iter)];
+ if (o is Play){
+ var mtn = o as Play;
+ if (Colors) {
+ Color col = mtn.Category.Color;
c.CellBackgroundGdk = col;
c.BackgroundGdk = col;
} else{
@@ -274,7 +271,7 @@ namespace LongoMatch.Gui.Component
c.Background = "white";
c.CellBackground = "white";
c.Markup = String.Format("{0} ({1})", (o as Player).Name, Model.IterNChildren(iter));
- }else if (o is SectionsTimeNode) {
+ }else if (o is Category) {
c.Background = "white";
c.CellBackground = "white";
c.Markup = String.Format("{0} ({1})", (o as TimeNode).Name, Model.IterNChildren(iter));
@@ -306,26 +303,27 @@ namespace LongoMatch.Gui.Component
this.Model.GetIter(out iter, args.Path);
object item = this.Model.GetValue(iter, 0);
- if (!(item is MediaTimeNode))
+ if (!(item is Play))
return;
if (TimeNodeSelected != null && !projectIsLive)
- this.TimeNodeSelected(item as MediaTimeNode);
+ this.TimeNodeSelected(item as Play);
}
protected void OnDeleted(object obj, EventArgs args) {
if (TimeNodeDeleted == null)
return;
- List<MediaTimeNode> list = new List<MediaTimeNode>();
+ List<Play> list = new List<Play>();
TreePath[] paths = Selection.GetSelectedRows();
for (int i=0; i<paths.Length; i++){
- list.Add((MediaTimeNode)GetValueFromPath(paths[i]));
+ list.Add((Play)GetValueFromPath(paths[i]));
}
// When a TimeNode is deleted from the tree the path changes.
// We need first to retrieve all the TimeNodes to delete using the
// current path of each one and then send the TimeNodeDeleted event
for (int i=0; i<paths.Length; i++){
- TimeNodeDeleted(list[i], int.Parse(paths[i].ToString().Split(':')[0]));
+ /*FIXME*/
+ //TimeNodeDeleted(list[i], int.Parse(paths[i].ToString().Split(':')[0]));
}
}
@@ -340,7 +338,7 @@ namespace LongoMatch.Gui.Component
if (md.Run() == (int)ResponseType.Yes){
TreePath[] paths = Selection.GetSelectedRows();
for (int i=0; i<paths.Length; i++){
- MediaTimeNode tNode = (MediaTimeNode)GetValueFromPath(paths[i]);
+ Play tNode = (Play)GetValueFromPath(paths[i]);
tNode.KeyFrameDrawing = null;
}
// Refresh the thumbnails
@@ -369,7 +367,7 @@ namespace LongoMatch.Gui.Component
TreePath[] paths = Selection.GetSelectedRows();
for (int i=0; i<paths.Length; i++){
- MediaTimeNode tNode = (MediaTimeNode)GetValueFromPath(paths[i]);
+ Play tNode = (Play)GetValueFromPath(paths[i]);
tNode.Team = team;
}
}
@@ -378,7 +376,7 @@ namespace LongoMatch.Gui.Component
if (PlayListNodeAdded != null){
TreePath[] paths = Selection.GetSelectedRows();
for (int i=0; i<paths.Length; i++){
- MediaTimeNode tNode = (MediaTimeNode)GetValueFromPath(paths[i]);
+ Play tNode = (Play)GetValueFromPath(paths[i]);
PlayListNodeAdded(tNode);
}
}
@@ -386,22 +384,22 @@ namespace LongoMatch.Gui.Component
protected void OnTag (object obj, EventArgs args){
if (TagPlay != null)
- TagPlay((MediaTimeNode)GetValueFromPath(Selection.GetSelectedRows()[0]));
+ TagPlay((Play)GetValueFromPath(Selection.GetSelectedRows()[0]));
}
protected void OnSnapshot(object obj, EventArgs args) {
if (SnapshotSeriesEvent != null)
- SnapshotSeriesEvent((MediaTimeNode)GetValueFromPath(Selection.GetSelectedRows()[0]));
+ SnapshotSeriesEvent((Play)GetValueFromPath(Selection.GetSelectedRows()[0]));
}
protected virtual void OnLocalPlayers(object o, EventArgs args) {
if (PlayersTagged != null)
- PlayersTagged((MediaTimeNode)GetValueFromPath(Selection.GetSelectedRows()[0]), Team.LOCAL);
+ PlayersTagged((Play)GetValueFromPath(Selection.GetSelectedRows()[0]), Team.LOCAL);
}
protected virtual void OnVisitorPlayers(object o, EventArgs args) {
if (PlayersTagged != null)
- PlayersTagged((MediaTimeNode)GetValueFromPath(Selection.GetSelectedRows()[0]), Team.VISITOR);
+ PlayersTagged((Play)GetValueFromPath(Selection.GetSelectedRows()[0]), Team.VISITOR);
}
protected abstract bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected);
diff --git a/LongoMatch/Gui/TreeView/PlayListTreeView.cs b/LongoMatch/Gui/TreeView/PlayListTreeView.cs
index 824d248..8cdcb25 100644
--- a/LongoMatch/Gui/TreeView/PlayListTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayListTreeView.cs
@@ -38,8 +38,8 @@ namespace LongoMatch.Gui.Component
private MenuItem setRate;
private ListStore ls;
private PlayList playlist;
- private PlayListTimeNode loadedTimeNode = null; //The play currently loaded in the player
- private PlayListTimeNode selectedTimeNode = null; //The play selected in the tree
+ private PlayListPlay loadedTimeNode = null; //The play currently loaded in the player
+ private PlayListPlay selectedTimeNode = null; //The play selected in the tree
private TreeIter selectedIter;
public event ApplyCurrentRateHandler ApplyCurrentRate;
@@ -49,7 +49,7 @@ namespace LongoMatch.Gui.Component
this.HeadersVisible = false;
- ls = new ListStore(typeof(PlayListTimeNode));
+ ls = new ListStore(typeof(PlayListPlay));
this.Model = ls;
menu = new Menu();
@@ -81,7 +81,7 @@ namespace LongoMatch.Gui.Component
}
}
- public PlayListTimeNode LoadedPlay {
+ public PlayListPlay LoadedPlay {
set {
loadedTimeNode = value;
this.QueueDraw();
@@ -102,7 +102,7 @@ namespace LongoMatch.Gui.Component
if (path!=null) {
ListStore list = ((ListStore)Model);
Model.GetIter(out selectedIter,path);
- selectedTimeNode = (PlayListTimeNode)(list.GetValue(selectedIter,0));
+ selectedTimeNode = (PlayListPlay)(list.GetValue(selectedIter,0));
setRate.Sensitive = selectedTimeNode == loadedTimeNode;
menu.Popup();
}
@@ -134,7 +134,7 @@ namespace LongoMatch.Gui.Component
private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
- PlayListTimeNode tNode = (PlayListTimeNode) model.GetValue(iter, 0);
+ PlayListPlay tNode = (PlayListPlay) model.GetValue(iter, 0);
(cell as Gtk.CellRendererText).Text = Catalog.GetString("Title")+": "+tNode.Name +"\n"+
Catalog.GetString("Start")+": "+tNode.Start.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
Catalog.GetString("Duration")+": "+tNode.Duration.ToMSecondsString()+Catalog.GetString(" sec")+"\n"+
diff --git a/LongoMatch/Gui/TreeView/PlayersTreeView.cs b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
index 93a050c..0a36674 100644
--- a/LongoMatch/Gui/TreeView/PlayersTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
@@ -128,8 +128,8 @@ namespace LongoMatch.Gui.Component
if (paths.Length == 1) {
TimeNode selectedTimeNode = GetValueFromPath(paths[0]) as TimeNode;
- if (selectedTimeNode is MediaTimeNode) {
- deleteKeyFrame.Sensitive = (selectedTimeNode as MediaTimeNode).KeyFrameDrawing != null;
+ if (selectedTimeNode is Play) {
+ deleteKeyFrame.Sensitive = (selectedTimeNode as Play).KeyFrameDrawing != null;
MultiSelectMenu(false);
menu.Popup();
} else {
diff --git a/LongoMatch/Gui/TreeView/PlaysTreeView.cs b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
index 6983943..c54f909 100644
--- a/LongoMatch/Gui/TreeView/PlaysTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
@@ -128,7 +128,7 @@ namespace LongoMatch.Gui.Component
TimeNode tna, tnb;
TreeIter parent;
int depth;
- SectionsTimeNode category;
+ Category category;
if (model == null)
return 0;
@@ -152,7 +152,7 @@ namespace LongoMatch.Gui.Component
return int.Parse(model.GetPath(a).ToString())
- int.Parse(model.GetPath(b).ToString());
- category = model.GetValue(parent,0) as SectionsTimeNode;
+ category = model.GetValue(parent,0) as Category;
tna = model.GetValue (a, 0)as TimeNode;
tnb = model.GetValue (b, 0) as TimeNode;
@@ -171,11 +171,11 @@ namespace LongoMatch.Gui.Component
}
private void OnSortActivated (object o, EventArgs args){
- SectionsTimeNode category;
+ Category category;
RadioAction sender;
sender = o as RadioAction;
- category = GetValueFromPath(Selection.GetSelectedRows()[0]) as SectionsTimeNode;
+ category = GetValueFromPath(Selection.GetSelectedRows()[0]) as Category;
if (sender == sortByName)
category.SortMethod = SortMethodType.SortByName;
@@ -193,9 +193,9 @@ namespace LongoMatch.Gui.Component
// Don't allow multiselect for categories
if (!selected && selection.GetSelectedRows().Length > 0){
if (selection.GetSelectedRows().Length == 1 &&
- GetValueFromPath(selection.GetSelectedRows()[0]) is SectionsTimeNode)
+ GetValueFromPath(selection.GetSelectedRows()[0]) is Category)
return false;
- return !(GetValueFromPath(path) is SectionsTimeNode);
+ return !(GetValueFromPath(path) is Category);
}
// Always unselect
else
@@ -224,13 +224,13 @@ namespace LongoMatch.Gui.Component
if (paths.Length == 1) {
TimeNode selectedTimeNode = GetValueFromPath(paths[0]) as TimeNode;
- if (selectedTimeNode is MediaTimeNode) {
- deleteKeyFrame.Sensitive = (selectedTimeNode as MediaTimeNode).KeyFrameDrawing != null;
+ if (selectedTimeNode is Play) {
+ deleteKeyFrame.Sensitive = (selectedTimeNode as Play).KeyFrameDrawing != null;
MultiSelectMenu(false);
menu.Popup();
}
else{
- SetupSortMenu((selectedTimeNode as SectionsTimeNode).SortMethod);
+ SetupSortMenu((selectedTimeNode as Category).SortMethod);
categoriesMenu.Popup();
}
}
diff --git a/LongoMatch/Gui/TreeView/TagsTreeView.cs b/LongoMatch/Gui/TreeView/TagsTreeView.cs
index bbc67f7..8ae6195 100644
--- a/LongoMatch/Gui/TreeView/TagsTreeView.cs
+++ b/LongoMatch/Gui/TreeView/TagsTreeView.cs
@@ -52,7 +52,7 @@ namespace LongoMatch.Gui.Component
}
if (paths.Length == 1) {
- MediaTimeNode selectedTimeNode = GetValueFromPath(paths[0]) as MediaTimeNode;
+ Play selectedTimeNode = GetValueFromPath(paths[0]) as Play;
deleteKeyFrame.Sensitive = selectedTimeNode.KeyFrameDrawing != null;
MultiSelectMenu(false);
menu.Popup();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]