[longomatch] Enable to load plays into the playlist form the Players treeviews



commit 7861f549b565f8196cf8e69fc24093eba819ee90
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Sep 20 20:23:40 2009 +0200

    Enable to load plays into the playlist form the Players treeviews

 LongoMatch/Gui/Component/PlayersListTreeWidget.cs  |   10 ++++
 LongoMatch/Gui/MainWindow.cs                       |    2 +
 LongoMatch/Gui/TreeView/PlayersTreeView.cs         |   17 ++++++-
 LongoMatch/Handlers/EventsManager.cs               |   52 ++++++++++---------
 ...ngoMatch.Gui.Component.PlayersListTreeWidget.cs |    1 +
 LongoMatch/gtk-gui/gui.stetic                      |    1 +
 LongoMatch/gtk-gui/objects.xml                     |    2 +
 7 files changed, 59 insertions(+), 26 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/PlayersListTreeWidget.cs b/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
index eb3007c..8fa8765 100644
--- a/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
+++ b/LongoMatch/Gui/Component/PlayersListTreeWidget.cs
@@ -34,6 +34,7 @@ namespace LongoMatch.Gui.Component
 		
 		public event TimeNodeSelectedHandler TimeNodeSelected;
 		public event TimeNodeChangedHandler TimeNodeChanged;
+		public event PlayListNodeAddedHandler PlayListNodeAdded;
 		public event SnapshotSeriesHandler SnapshotSeriesEvent;
 
 		private TeamTemplate template;
@@ -90,6 +91,9 @@ namespace LongoMatch.Gui.Component
 			playerstreeview.Model = model;
 		}
 		
+		public bool PlayListLoaded{
+			set{playerstreeview.PlayListLoaded=value;}
+		}
 		
 		protected virtual void OnTimeNodeSelected(MediaTimeNode tNode){
 			if (TimeNodeSelected != null)
@@ -108,5 +112,11 @@ namespace LongoMatch.Gui.Component
 				TimeNodeChanged (tNode, val);
 		}
 
+		protected virtual void OnPlayerstreeviewPlayListNodeAdded (LongoMatch.TimeNodes.MediaTimeNode tNode)
+		{
+			if (PlayListNodeAdded != null)
+				PlayListNodeAdded (tNode);
+		}
+
 	}
 }
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index ee7b1d4..12ccfd7 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -315,6 +315,8 @@ namespace LongoMatch.Gui
 			bool visible = ((Gtk.ToggleAction)sender).Active;
 			playlistwidget2.Visible=visible;
 			treewidget1.PlayListLoaded=visible;
+			localplayerslisttreewidget.PlayListLoaded=visible;
+			visitorplayerslisttreewidget.PlayListLoaded=visible;
 			
 			if (!visible && !noteswidget1.Visible){
 				rightvbox.Visible = false;
diff --git a/LongoMatch/Gui/TreeView/PlayersTreeView.cs b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
index 1fb3425..71f790a 100644
--- a/LongoMatch/Gui/TreeView/PlayersTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayersTreeView.cs
@@ -34,10 +34,12 @@ namespace LongoMatch.Gui.Component
 		
 		public event TimeNodeSelectedHandler TimeNodeSelected;
 		public event TimeNodeChangedHandler TimeNodeChanged;
+		public event PlayListNodeAddedHandler PlayListNodeAdded;
 		public event SnapshotSeriesHandler SnapshotSeriesEvent;
 
 		private TreeIter selectedIter;
 		private Menu menu;
+		private MenuItem addPLN; 
 		private Gtk.CellRendererText nameCell;
 		private TreePath path;
 		private Gtk.TreeViewColumn nameColumn;
@@ -89,7 +91,10 @@ namespace LongoMatch.Gui.Component
 			set {team = value;}
 			get {return team ;}
 		}
-	
+		
+		public bool PlayListLoaded{
+			set{addPLN.Sensitive=value;}
+		}	
 		
 		private void SetMenu(){
 		
@@ -98,12 +103,17 @@ namespace LongoMatch.Gui.Component
 			MenuItem name = new MenuItem(Catalog.GetString("Edit"));
 			MenuItem delete = new MenuItem(Catalog.GetString("Delete"));
 			MenuItem snapshot = new MenuItem(Catalog.GetString("Export to PGN images"));
+			addPLN = new MenuItem(Catalog.GetString("Add to playlist"));
+			addPLN.Sensitive=false;
+			
 			menu.Append(name);
 			menu.Append(delete);
+			menu.Append(addPLN);
 			menu.Append(snapshot);
 			 
 			delete.Activated += new EventHandler(OnDeleted);
 			name.Activated += new EventHandler(OnEdit);
+			addPLN.Activated += new EventHandler(OnAdded);
 			snapshot.Activated += new EventHandler(OnSnapshot);
 			menu.ShowAll();		
 		}
@@ -199,6 +209,11 @@ namespace LongoMatch.Gui.Component
 			this.SetCursor(path,  nameColumn, true);
 		}
 		
+		protected void OnAdded(object obj, EventArgs args){
+			if (PlayListNodeAdded != null)	
+				PlayListNodeAdded((MediaTimeNode)selectedTimeNode);
+		}
+		
 		private void OnNameCellEdited (object o, Gtk.EditedArgs args)
 		{
 			Gtk.TreeIter iter;
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index eb5d31a..7e3652c 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -82,40 +82,42 @@ namespace LongoMatch
 		private void ConnectSignals(){
 			//Adding Handlers for each event		
 			
-			buttonswidget.NewMarkEvent += new Handlers.NewMarkEventHandler(OnNewMark);
+			buttonswidget.NewMarkEvent += OnNewMark;
 			
-			treewidget.TimeNodeChanged += new Handlers.TimeNodeChangedHandler(OnTimeNodeChanged);
-			localPlayersList.TimeNodeChanged += new Handlers.TimeNodeChangedHandler(OnTimeNodeChanged);
-			visitorPlayersList.TimeNodeChanged += new Handlers.TimeNodeChangedHandler(OnTimeNodeChanged);
-			timeline.TimeNodeChanged += new Handlers.TimeNodeChangedHandler(OnTimeNodeChanged);
-			notes.TimeNodeChanged += new TimeNodeChangedHandler(OnTimeNodeChanged);
+			treewidget.TimeNodeChanged += OnTimeNodeChanged;
+			localPlayersList.TimeNodeChanged += OnTimeNodeChanged;
+			visitorPlayersList.TimeNodeChanged += OnTimeNodeChanged;
+			timeline.TimeNodeChanged += OnTimeNodeChanged;
+			notes.TimeNodeChanged += OnTimeNodeChanged;
 			
-			treewidget.TimeNodeDeleted += new Handlers.TimeNodeDeletedHandler(OnTimeNodeDeleted);
-			timeline.TimeNodeDeleted += new Handlers.TimeNodeDeletedHandler(OnTimeNodeDeleted);
+			treewidget.TimeNodeDeleted += OnTimeNodeDeleted;
+			timeline.TimeNodeDeleted += OnTimeNodeDeleted;
 			
-			treewidget.TimeNodeSelected += new Handlers.TimeNodeSelectedHandler(OnTimeNodeSelected);			
-			localPlayersList.TimeNodeSelected += new Handlers.TimeNodeSelectedHandler(OnTimeNodeSelected);
-			visitorPlayersList.TimeNodeSelected += new Handlers.TimeNodeSelectedHandler(OnTimeNodeSelected);
-			timeline.TimeNodeSelected += new Handlers.TimeNodeSelectedHandler(OnTimeNodeSelected);
+			treewidget.TimeNodeSelected += OnTimeNodeSelected;			
+			localPlayersList.TimeNodeSelected += OnTimeNodeSelected;
+			visitorPlayersList.TimeNodeSelected += OnTimeNodeSelected;
+			timeline.TimeNodeSelected += OnTimeNodeSelected;
 			
-			playlist.PlayListNodeSelected += new Handlers.PlayListNodeSelectedHandler(OnPlayListNodeSelected);
-			playlist.Progress += new LongoMatch.Video.Handlers.ProgressHandler(OnProgress);
-			playlist.ApplyCurrentRate += new ApplyCurrentRateHandler(OnApplyRate);
+			playlist.PlayListNodeSelected += OnPlayListNodeSelected;
+			playlist.Progress += OnProgress;
+			playlist.ApplyCurrentRate += OnApplyRate;
 			
-			treewidget.PlayListNodeAdded += new Handlers.PlayListNodeAddedHandler(OnPlayListNodeAdded);
+			treewidget.PlayListNodeAdded += OnPlayListNodeAdded;
+			localPlayersList.PlayListNodeAdded += OnPlayListNodeAdded;
+			visitorPlayersList.PlayListNodeAdded += OnPlayListNodeAdded;
 			
-			treewidget.PlayersTagged += new PlayersTaggedHandler(OnPlayersTagged);
+			treewidget.PlayersTagged += OnPlayersTagged;
 			
-			treewidget.SnapshotSeriesEvent += new Handlers.SnapshotSeriesHandler(OnSnapshotSeries);
-			localPlayersList.SnapshotSeriesEvent += new Handlers.SnapshotSeriesHandler(OnSnapshotSeries);
-			visitorPlayersList.SnapshotSeriesEvent += new Handlers.SnapshotSeriesHandler(OnSnapshotSeries);
+			treewidget.SnapshotSeriesEvent += OnSnapshotSeries;
+			localPlayersList.SnapshotSeriesEvent += OnSnapshotSeries;
+			visitorPlayersList.SnapshotSeriesEvent += OnSnapshotSeries;
 
-			timeline.NewMarkEvent += new NewMarkAtFrameEventHandler(OnNewMarkAtFrame);
+			timeline.NewMarkEvent += OnNewMarkAtFrame;
 			
-			player.Prev += new PrevButtonClickedHandler(OnPrev);
-			player.Next += new NextButtonClickedHandler(OnNext);
-			player.Tick += new TickHandler(OnTick);
-			player.SegmentClosedEvent += new SegmentClosedHandler(OnSegmentClosedEvent);
+			player.Prev += OnPrev;
+			player.Next += OnNext;
+			player.Tick += OnTick;
+			player.SegmentClosedEvent += OnSegmentClosedEvent;
 		}
 		
 		private void ProcessNewMarkEvent(int section,Time pos){
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.PlayersListTreeWidget.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.PlayersListTreeWidget.cs
index ae602ce..346af47 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Component.PlayersListTreeWidget.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Component.PlayersListTreeWidget.cs
@@ -40,6 +40,7 @@ namespace LongoMatch.Gui.Component {
             this.playerstreeview.TimeNodeSelected += new LongoMatch.Handlers.TimeNodeSelectedHandler(this.OnTimeNodeSelected);
             this.playerstreeview.SnapshotSeriesEvent += new LongoMatch.Handlers.SnapshotSeriesHandler(this.OnSnapshotSeriesEvent);
             this.playerstreeview.TimeNodeChanged += new LongoMatch.Handlers.TimeNodeChangedHandler(this.OnTimeNodeChanged);
+            this.playerstreeview.PlayListNodeAdded += new LongoMatch.Handlers.PlayListNodeAddedHandler(this.OnPlayerstreeviewPlayListNodeAdded);
         }
     }
 }
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index 432e313..ae18218 100644
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -3664,6 +3664,7 @@ You can download it using this direct link:</property>
             <signal name="TimeNodeSelected" handler="OnTimeNodeSelected" />
             <signal name="SnapshotSeriesEvent" handler="OnSnapshotSeriesEvent" />
             <signal name="TimeNodeChanged" handler="OnTimeNodeChanged" />
+            <signal name="PlayListNodeAdded" handler="OnPlayerstreeviewPlayListNodeAdded" />
           </widget>
         </child>
       </widget>
diff --git a/LongoMatch/gtk-gui/objects.xml b/LongoMatch/gtk-gui/objects.xml
index a3cacea..d26c959 100644
--- a/LongoMatch/gtk-gui/objects.xml
+++ b/LongoMatch/gtk-gui/objects.xml
@@ -60,6 +60,7 @@
         <signal name="TimeNodeSelected" />
         <signal name="TimeNodeChanged" />
         <signal name="SnapshotSeriesEvent" />
+        <signal name="PlayListNodeAdded" />
       </itemgroup>
     </signals>
   </object>
@@ -100,6 +101,7 @@
         <signal name="TimeNodeSelected" />
         <signal name="TimeNodeChanged" />
         <signal name="SnapshotSeriesEvent" />
+        <signal name="PlayListNodeAdded" />
       </itemgroup>
     </signals>
   </object>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]