[longomatch: 42/51] Toggle pause/rec buttons visibility



commit 50332bf6a57ffeba319a9ea2fb85e1447606d217
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun May 9 18:19:09 2010 +0200

    Toggle pause/rec buttons visibility

 CesarPlayer/Gui/CapturerBin.cs |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/CesarPlayer/Gui/CapturerBin.cs b/CesarPlayer/Gui/CapturerBin.cs
index 2b9de9d..98e9b9d 100644
--- a/CesarPlayer/Gui/CapturerBin.cs
+++ b/CesarPlayer/Gui/CapturerBin.cs
@@ -48,6 +48,7 @@ namespace LongoMatch.Gui
 		private AudioEncoderType audioEncoder;
 		private VideoMuxerType videoMuxer;
 		private string outputFile;
+		private bool captureStarted;
 		private bool capturing;
 		private const int THUMBNAIL_MAX_WIDTH = 100;		
 		
@@ -88,6 +89,7 @@ namespace LongoMatch.Gui
 					logodrawingarea.Visible = true;
 					capturerhbox.Visible = false;
 				}
+				captureStarted = false;
 				capturing = false;
 				SetProperties();
 				pausebutton.Visible = false;
@@ -167,6 +169,7 @@ namespace LongoMatch.Gui
 		
 		public void Start(){
 			capturing = true;
+			captureStarted = true;
 			recbutton.Visible = false;
 			pausebutton.Visible = true;
 			stopbutton.Visible = true;
@@ -175,6 +178,8 @@ namespace LongoMatch.Gui
 		
 		public void TogglePause(){
 			capturing = !capturing;
+			recbutton.Visible = !capturing;
+			pausebutton.Visible = capturing;
 			capturer.TogglePause();
 		}
 		
@@ -248,12 +253,19 @@ namespace LongoMatch.Gui
 
 		protected virtual void OnRecbuttonClicked (object sender, System.EventArgs e)
 		{
-			Start();	
+			if (captureStarted == true){
+				if (capturing)
+					return;
+				TogglePause();
+			}
+			else
+				Start();	
 		}
 
 		protected virtual void OnPausebuttonClicked (object sender, System.EventArgs e)
 		{
-			TogglePause();						
+			if (capturing)
+				TogglePause();						
 		}
 
 		protected virtual void OnStopbuttonClicked (object sender, System.EventArgs e)



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