[gnome-subtitles] Bug#547984 - Quick subtitle timing during playback Add shortcuts keys on this bug, was setted tempor



commit 5f5fd2637426d657f09244f90a2943f8840a27dd
Author: Valmir Sena <valmirse gmail com>
Date:   Tue Jun 22 17:33:19 2010 -0300

    Bug#547984 - Quick subtitle timing during playback Add shortcuts keys on this bug, was setted temporaly the keys ctrl-alt-x

 src/Glade/MainWindow.glade               |    3 ++
 src/GnomeSubtitles/Core/EventHandlers.cs |   31 ++++++++++++++++++++++++++---
 2 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/src/Glade/MainWindow.glade b/src/Glade/MainWindow.glade
index c1bfe53..4fe5c35 100644
--- a/src/Glade/MainWindow.glade
+++ b/src/Glade/MainWindow.glade
@@ -1399,7 +1399,10 @@
                             <property name="receives_default">False</property>
                             <property name="relief">none</property>
                             <signal name="pressed" handler="OnVideoSetSubtitleStart"/>
+                            <signal name="grab_focus" handler="OnVideoSetSubtitleStartEndByKey"/>
                             <signal name="released" handler="OnVideoSetSubtitleStartEnd"/>
+                            <signal name="key_release_event" handler="OnVideoSetSubtitleStartEnd"/>
+                            <accelerator key="x" signal="grab-focus" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK"/>
                             <child>
                               <widget class="GtkImage" id="videoSetSubtitleStartEndButtonImage">
                                 <property name="visible">True</property>
diff --git a/src/GnomeSubtitles/Core/EventHandlers.cs b/src/GnomeSubtitles/Core/EventHandlers.cs
index 6181ded..e7cf215 100644
--- a/src/GnomeSubtitles/Core/EventHandlers.cs
+++ b/src/GnomeSubtitles/Core/EventHandlers.cs
@@ -31,7 +31,7 @@ namespace GnomeSubtitles.Core {
 
 public class EventHandlers {
 
-
+	private bool PressStartEndKey = false;
 	/* File Menu */
 	
 	public void OnFileNew (object o, EventArgs args) {
@@ -282,9 +282,9 @@ public class EventHandlers {
 		else {
 			int frames = Base.Ui.Video.Position.CurrentFrames;
 			Base.CommandManager.Execute(new VideoSetSubtitleStartCommand(frames));
-		}
+		}			
 	}
-	
+		
 	public void OnVideoSetSubtitleEnd (object o, EventArgs args) {
 		if (Base.TimingMode == TimingMode.Times) {
 			TimeSpan time = Base.Ui.Video.Position.CurrentTime;
@@ -307,7 +307,30 @@ public class EventHandlers {
 			Base.CommandManager.Execute(new VideoSetSubtitleEndCommand(frames));
 			Base.Ui.View.SelectNextSubtitle();
 		}
-	}		
+	}
+	//todo change the function name	here and on glade to better name
+	public void OnVideoSetSubtitleStartEndByKey (object o, EventArgs args) {			
+		if( PressStartEndKey == false ){
+			OnVideoSetSubtitleStart(o, args);
+			PressStartEndKey = true;
+		}
+	}
+	//todo change the function name	here and on glade to a better name
+	public void OnVideoSetSubtitleStartEnd (object o, KeyReleaseEventArgs args) {			
+		if( PressStartEndKey == true ){
+			if (Base.TimingMode == TimingMode.Times) {
+				TimeSpan time = Base.Ui.Video.Position.CurrentTime;
+				Base.CommandManager.Execute(new VideoSetSubtitleEndCommand(time));
+				Base.Ui.View.SelectNextSubtitle();
+			}
+			else {
+				int frames = Base.Ui.Video.Position.CurrentFrames;
+				Base.CommandManager.Execute(new VideoSetSubtitleEndCommand(frames));
+				Base.Ui.View.SelectNextSubtitle();
+			}
+				PressStartEndKey = false;
+		}
+	}
 
 	/* Tools Menu */
 		



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