[longomatch/fakelive] Retrieve the current time on a new marl using the apropiate device



commit 59f547fffafff6358e0dd7b3458a5c43120b70b6
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Thu Mar 4 23:24:08 2010 +0100

    Retrieve the current time on a new marl using the apropiate device

 LongoMatch/Gui/MainWindow.cs         |    4 ++-
 LongoMatch/Handlers/EventsManager.cs |   45 +++++++++++++++++++++++++--------
 2 files changed, 37 insertions(+), 12 deletions(-)
---
diff --git a/LongoMatch/Gui/MainWindow.cs b/LongoMatch/Gui/MainWindow.cs
index fe5f091..f1c05e4 100644
--- a/LongoMatch/Gui/MainWindow.cs
+++ b/LongoMatch/Gui/MainWindow.cs
@@ -143,8 +143,9 @@ namespace LongoMatch.Gui
 					} 
 				}else {
 					Title = "LongoMatch";
-					playerbin1.Visible = false;
+					playerbin1.Visible = false;					
 					capturerBin = new CapturerBin();
+					eManager.Capturer = capturerBin;
 					hbox2.Add(capturerBin);
 					(capturerBin).Show();	
 				}
@@ -177,6 +178,7 @@ namespace LongoMatch.Gui
 			}
 			if (projectType != ProjectType.NewFileProject){
 				playerbin1.Visible = true;
+				eManager.Capturer = null;
 				if (capturerBin != null)
 					capturerBin.Destroy();			
 			}
diff --git a/LongoMatch/Handlers/EventsManager.cs b/LongoMatch/Handlers/EventsManager.cs
index 66fd87c..96ad3c5 100644
--- a/LongoMatch/Handlers/EventsManager.cs
+++ b/LongoMatch/Handlers/EventsManager.cs
@@ -48,6 +48,7 @@ namespace LongoMatch
 		private ButtonsWidget buttonswidget;
 		private PlayListWidget playlist;
 		private PlayerBin player;
+		private CapturerBin capturer;
 		private TimeLineWidget timeline;
 		private ProgressBar videoprogressbar;
 		private NotesWidget notes;
@@ -88,10 +89,16 @@ namespace LongoMatch
 		}
 		
 		public ProjectType OpenedProjectType{
-			set{
+			set {
 				projectType = value;
 			}
 		}
+		
+		public CapturerBin Capturer{
+			set {
+				capturer = value;
+			}
+		}
 
 		private void ConnectSignals() {
 			//Adding Handlers for each event
@@ -142,22 +149,32 @@ namespace LongoMatch
 
 		private void ProcessNewMarkEvent(int section,Time pos) {
 			if (player != null && openedProject != null) {
-				//Getting defualt star and stop gap for the section
+				Time fStop;
+				Pixbuf miniature;
+				MediaTimeNode tn;
+				Time length;
+				
+				//Get the default lead and lag time for the section
 				Time startTime = openedProject.Sections.GetStartTime(section);
 				Time stopTime = openedProject.Sections.GetStopTime(section);
 				// Calculating borders of the segment depnding
 				Time start = pos - startTime;
 				Time stop = pos + stopTime;
 				Time fStart = (start < new Time(0)) ? new Time(0) : start;
-				//La longitud tiene que ser en ms
-				Time length;
-
-				length = new Time((int)player.StreamLength);
-
-				Time fStop = (stop > length) ? length: stop;
-				Pixbuf miniature = projectType == ProjectType.NewFakeCaptureProject ?
+				
+				if (projectType == ProjectType.NewFakeCaptureProject || 
+				    projectType == ProjectType.NewCaptureProject){
+					fStop = stop;					
+				}
+				else {
+					length = new Time((int)player.StreamLength);
+					fStop = (stop > length) ? length: stop;
+				}
+				
+				miniature = projectType == ProjectType.NewFakeCaptureProject ?
 						null : player.CurrentMiniatureFrame;
-				MediaTimeNode tn = openedProject.AddTimeNode(section,fStart, fStop,miniature);
+				
+				tn = openedProject.AddTimeNode(section,fStart, fStop,miniature);
 				treewidget.AddPlay(tn,section);
 				tagsTreeWidget.AddPlay(tn);
 				timeline.QueueDraw();
@@ -200,7 +217,13 @@ namespace LongoMatch
 		}
 
 		public virtual void OnNewMark(int i) {
-			Time pos = new Time((int)player.CurrentTime);
+			Time pos;
+			
+			if (projectType == ProjectType.NewFakeCaptureProject || 
+			    projectType == ProjectType.NewCaptureProject)
+				pos =  new Time((int)capturer.CurrentTime);
+			else 
+				pos = new Time((int)player.CurrentTime);
 			ProcessNewMarkEvent(i,pos);
 		}
 



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