[longomatch/fakelive] Disable menu options for live projects.
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/fakelive] Disable menu options for live projects.
- Date: Sat, 6 Mar 2010 18:45:52 +0000 (UTC)
commit 77157b5f19c37e944146a98d177215005d179787
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sat Mar 6 19:09:07 2010 +0100
Disable menu options for live projects.
LongoMatch/Gui/Component/PlayersListTreeWidget.cs | 6 +++++
LongoMatch/Gui/Component/PlaysListTreeWidget.cs | 9 +++++--
LongoMatch/Gui/Component/TagsTreeWidget.cs | 6 +++++
LongoMatch/Gui/MainWindow.cs | 8 ++++++
LongoMatch/Gui/TreeView/PlayersTreeView.cs | 25 ++++++++++++++++----
LongoMatch/Gui/TreeView/PlaysTreeView.cs | 18 ++++++++++++--
LongoMatch/Gui/TreeView/TagsTreeView.cs | 19 ++++++++++++---
LongoMatch/Handlers/EventsManager.cs | 8 ++++--
8 files changed, 81 insertions(+), 18 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/PlayersListTreeWidget.cs b/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
index 59f3ded..99afa58 100644
--- a/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
@@ -49,6 +49,12 @@ namespace LongoMatch.Gui.Component
playerstreeview.Team = value;
}
}
+
+ public bool ProjectIsLive{
+ set{
+ playerstreeview.ProjectIsLive = value;
+ }
+ }
public void DeleteTimeNode(MediaTimeNode tNode, int player) {
if (template != null) {
diff --git a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
index f3d6c01..eebdd68 100644
--- a/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlaysListTreeWidget.cs
@@ -42,15 +42,13 @@ namespace LongoMatch.Gui.Component
public event PlayersTaggedHandler PlayersTagged;
public event TagPlayHandler TagPlay;
-
private Project project;
-
public PlaysListTreeWidget()
{
this.Build();
- }
+ }
public void DeletePlay(MediaTimeNode play, int section) {
if (project != null) {
@@ -95,6 +93,11 @@ namespace LongoMatch.Gui.Component
}
}
+ public bool ProjectIsLive{
+ set{
+ treeview.ProjectIsLive = value;
+ }
+ }
public Project Project {
set {
diff --git a/LongoMatch/Gui/Component/TagsTreeWidget.cs b/LongoMatch/Gui/Component/TagsTreeWidget.cs
index e7dc4cd..9354cfe 100644
--- a/LongoMatch/Gui/Component/TagsTreeWidget.cs
+++ b/LongoMatch/Gui/Component/TagsTreeWidget.cs
@@ -84,6 +84,12 @@ namespace LongoMatch.Gui.Component
model.AppendValues(play);
filter.Refilter();
}
+
+ public bool ProjectIsLive{
+ set{
+ treeview.ProjectIsLive = value;
+ }
+ }
public Project Project {
set {
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index 8363dc0..0427e22 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -140,6 +140,10 @@ namespace LongoMatch.Gui
if (project.File.HasVideo)
playerbin1.LogoMode = false;
timelinewidget1.Project = project;
+ treewidget1.ProjectIsLive = false;
+ localplayerslisttreewidget.ProjectIsLive = false;
+ visitorplayerslisttreewidget.ProjectIsLive = false;
+ tagstreewidget1.ProjectIsLive = false;
}
}else {
Title = "LongoMatch";
@@ -148,6 +152,10 @@ namespace LongoMatch.Gui
eManager.Capturer = capturerBin;
hbox2.Add(capturerBin);
(capturerBin).Show();
+ treewidget1.ProjectIsLive = true;
+ localplayerslisttreewidget.ProjectIsLive = true;
+ visitorplayerslisttreewidget.ProjectIsLive = true;
+ tagstreewidget1.ProjectIsLive = true;
}
playlistwidget2.Stop();
diff --git a/LongoMatch/Gui/TreeView/PlayersTreeView.cs b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
index f2cc273..a022f51 100644
--- a/LongoMatch/Gui/TreeView/PlayersTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
@@ -40,12 +40,14 @@ namespace LongoMatch.Gui.Component
private TreeIter selectedIter;
private Menu menu;
private MenuItem addPLN;
+ private MenuItem snapshot;
private Gtk.CellRendererText nameCell;
private TreePath path;
private Gtk.TreeViewColumn nameColumn;
//Using TimeNode as in the tree there are Media and Sections timenodes
private TimeNode selectedTimeNode;
private bool editing;
+ private bool projectIsLive;
private Team team;
@@ -56,6 +58,8 @@ namespace LongoMatch.Gui.Component
this.RowActivated += new RowActivatedHandler(OnTreeviewRowActivated);
SetMenu();
+ ProjectIsLive = false;
+ PlayListLoaded = false;
nameColumn = new Gtk.TreeViewColumn();
nameColumn.Title = "Name";
@@ -79,20 +83,30 @@ namespace LongoMatch.Gui.Component
return team ;
}
}
+
+ public bool ProjectIsLive{
+ set{
+ projectIsLive = value;
+ addPLN.Visible = !projectIsLive;
+ snapshot.Visible = !projectIsLive;
+ }
+ }
public bool PlayListLoaded {
set {
- addPLN.Sensitive=value;
+ addPLN.Sensitive = value;
}
}
private void SetMenu() {
+ MenuItem name;
+ MenuItem delete;
menu = new Menu();
- MenuItem name = new MenuItem(Catalog.GetString("Edit"));
- MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
- MenuItem snapshot = new MenuItem(Catalog.GetString("Export to PGN images"));
+ name = new MenuItem(Catalog.GetString("Edit"));
+ delete = new MenuItem(Catalog.GetString("Delete"));
+ snapshot = new MenuItem(Catalog.GetString("Export to PGN images"));
addPLN = new MenuItem(Catalog.GetString("Add to playlist"));
addPLN.Sensitive=false;
@@ -217,7 +231,8 @@ namespace LongoMatch.Gui.Component
this.Model.GetIter(out iter, args.Path);
item = this.Model.GetValue(iter, 0);
- if (item is MediaTimeNode && TimeNodeSelected != null)
+ if (item is MediaTimeNode && TimeNodeSelected != null
+ && !projectIsLive)
this.TimeNodeSelected(item as MediaTimeNode);
}
}
diff --git a/LongoMatch/Gui/TreeView/PlaysTreeView.cs b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
index 0664004..af85773 100644
--- a/LongoMatch/Gui/TreeView/PlaysTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlaysTreeView.cs
@@ -63,8 +63,9 @@ namespace LongoMatch.Gui.Component
private Gtk.TreeViewColumn nameColumn;
private Color[] colors;
private bool editing;
+ private bool projectIsLive;
-
+
public PlaysTreeView() {
Selection.Mode = SelectionMode.Multiple;
Selection.SelectFunction = SelectFunction;
@@ -72,6 +73,8 @@ namespace LongoMatch.Gui.Component
SetMenu();
SetCategoriesMenu();
+ ProjectIsLive = false;
+ PlayListLoaded = false;
colors = new Color[20];
@@ -103,6 +106,14 @@ namespace LongoMatch.Gui.Component
}
}
+ public bool ProjectIsLive{
+ set{
+ projectIsLive = value;
+ addPLN.Visible = !projectIsLive;
+ snapshot.Visible = !projectIsLive;
+ }
+ }
+
public Color[] Colors {
set {
this.colors = value;
@@ -111,7 +122,7 @@ namespace LongoMatch.Gui.Component
public bool PlayListLoaded {
set {
- addPLN.Sensitive=value;
+ addPLN.Sensitive = value;
}
}
@@ -357,7 +368,8 @@ namespace LongoMatch.Gui.Component
this.Model.GetIter(out iter, args.Path);
TimeNode tNode = (TimeNode)this.Model.GetValue(iter, 0);
- if (tNode is MediaTimeNode && TimeNodeSelected != null)
+ if (tNode is MediaTimeNode && TimeNodeSelected != null
+ && !projectIsLive)
this.TimeNodeSelected((MediaTimeNode)tNode);
}
diff --git a/LongoMatch/Gui/TreeView/TagsTreeView.cs b/LongoMatch/Gui/TreeView/TagsTreeView.cs
index d4f398c..3e1a28a 100644
--- a/LongoMatch/Gui/TreeView/TagsTreeView.cs
+++ b/LongoMatch/Gui/TreeView/TagsTreeView.cs
@@ -49,6 +49,7 @@ namespace LongoMatch.Gui.Component
private Gtk.CellRendererText nameCell;
private Gtk.TreeViewColumn nameColumn;
private bool editing;
+ private bool projectIsLive;
public TagsTreeView() {
@@ -56,6 +57,8 @@ namespace LongoMatch.Gui.Component
RowActivated += new RowActivatedHandler(OnTreeviewRowActivated);
SetMenu();
+ PlayListLoaded = false;
+ ProjectIsLive = false;
nameColumn = new Gtk.TreeViewColumn();
nameColumn.Title = "Tag";
@@ -73,9 +76,17 @@ namespace LongoMatch.Gui.Component
public bool PlayListLoaded {
set {
- addPLN.Sensitive=value;
+ addPLN.Sensitive = value;
}
- }
+ }
+
+ public bool ProjectIsLive{
+ set{
+ projectIsLive = value;
+ addPLN.Visible = !projectIsLive;
+ snapshot.Visible = !projectIsLive;
+ }
+ }
private void SetMenu() {
menu = new Menu();
@@ -96,7 +107,7 @@ namespace LongoMatch.Gui.Component
addPLN.Activated += new EventHandler(OnAdded);
snapshot.Activated += new EventHandler(OnSnapshot);
menu.ShowAll();
- }
+ }
private MediaTimeNode GetValueFromPath(TreePath path){
Gtk.TreeIter iter;
@@ -146,7 +157,7 @@ namespace LongoMatch.Gui.Component
Model.GetIter(out iter, args.Path);
MediaTimeNode tNode = Model.GetValue(iter, 0) as MediaTimeNode;
- if (TimeNodeSelected != null)
+ if (TimeNodeSelected != null && !projectIsLive)
TimeNodeSelected(tNode);
}
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index 96ad3c5..6a62ec0 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -266,9 +266,11 @@ namespace LongoMatch
foreach (int player in tNode.VisitorPlayers)
visitorPlayersList.DeleteTimeNode(tNode,player);
openedProject.DeleteTimeNode(tNode,section);
- this.player.CloseActualSegment();
- timeline.QueueDraw();
- MainClass.DB.UpdateProject(openedProject);
+ if (projectType == ProjectType.NewFileProject){
+ this.player.CloseActualSegment();
+ MainClass.DB.UpdateProject(openedProject);
+ }
+ timeline.QueueDraw();
}
protected virtual void OnPlayListNodeAdded(MediaTimeNode tNode)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]