[gnome-subtitles] Made necessary changes to Valmir's patch for bug #547984



commit 55402379efee41b4658188e47c05bde890114ed5
Author: Pedro Castro <mail pedrocastro org>
Date:   Sun Jun 27 21:45:32 2010 +0100

    Made necessary changes to Valmir's patch for bug #547984

 src/Glade/MainWindow.glade               |   24 +++++++++++-----------
 src/GnomeSubtitles/Core/EventHandlers.cs |   31 ++++++++++-------------------
 2 files changed, 23 insertions(+), 32 deletions(-)
---
diff --git a/src/Glade/MainWindow.glade b/src/Glade/MainWindow.glade
index 4fe5c35..9569584 100644
--- a/src/Glade/MainWindow.glade
+++ b/src/Glade/MainWindow.glade
@@ -248,8 +248,8 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
                         <signal name="activate" handler="OnEditRedo"/>
-                        <accelerator key="Z" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
                         <accelerator key="Y" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                        <accelerator key="Z" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
                       </widget>
                     </child>
                     <child>
@@ -532,8 +532,8 @@
                         <property name="label" translatable="yes">Find Ne_xt</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="OnSearchFindNext"/>
-                        <accelerator key="g" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <accelerator key="F3" signal="activate"/>
+                        <accelerator key="g" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                       </widget>
                     </child>
                     <child>
@@ -543,8 +543,8 @@
                         <property name="label" translatable="yes">Find Pre_vious</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="OnSearchFindPrevious"/>
-                        <accelerator key="g" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
                         <accelerator key="F3" signal="activate" modifiers="GDK_SHIFT_MASK"/>
+                        <accelerator key="g" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
                       </widget>
                     </child>
                     <child>
@@ -803,8 +803,8 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">False</property>
                         <signal name="activate" handler="OnVideoPlayPause"/>
-                        <accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <accelerator key="F5" signal="activate"/>
+                        <accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <child internal-child="image">
                           <widget class="GtkImage" id="videoPlayPauseImage">
                             <property name="visible">True</property>
@@ -822,8 +822,8 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">False</property>
                         <signal name="activate" handler="OnVideoRewind"/>
-                        <accelerator key="k" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <accelerator key="F6" signal="activate"/>
+                        <accelerator key="k" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <child internal-child="image">
                           <widget class="GtkImage" id="videoRewindImage">
                             <property name="visible">True</property>
@@ -841,8 +841,8 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">False</property>
                         <signal name="activate" handler="OnVideoForward"/>
-                        <accelerator key="l" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <accelerator key="F7" signal="activate"/>
+                        <accelerator key="l" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <child internal-child="image">
                           <widget class="GtkImage" id="videoForwardImage">
                             <property name="visible">True</property>
@@ -882,8 +882,8 @@
                         <property name="label" translatable="yes">Seek _to Selection</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="OnVideoSeekToSelection"/>
-                        <accelerator key="r" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
                         <accelerator key="F4" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
+                        <accelerator key="r" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
                       </widget>
                     </child>
                     <child>
@@ -893,8 +893,8 @@
                         <property name="label" translatable="yes">Select Nearest Subtitle</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="OnVideoSelectNearestSubtitle"/>
-                        <accelerator key="F4" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <accelerator key="r" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                        <accelerator key="F4" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                       </widget>
                     </child>
                     <child>
@@ -903,8 +903,8 @@
                         <property name="label" translatable="yes">Auto Select Subtitles</property>
                         <property name="use_underline">True</property>
                         <signal name="toggled" handler="OnVideoAutoSelectSubtitles"/>
-                        <accelerator key="F3" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                         <accelerator key="j" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+                        <accelerator key="F3" signal="activate" modifiers="GDK_CONTROL_MASK"/>
                       </widget>
                     </child>
                     <child>
@@ -1399,10 +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="grab_focus" handler="OnVideoSetSubtitleStartEndGrabFocus"/>
                             <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"/>
+                            <signal name="key_release_event" handler="OnVideoSetSubtitleStartEndKeyRelease"/>
+                            <accelerator key="F9" signal="grab-focus" modifiers="GDK_CONTROL_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 e7cf215..bc57d9c 100644
--- a/src/GnomeSubtitles/Core/EventHandlers.cs
+++ b/src/GnomeSubtitles/Core/EventHandlers.cs
@@ -30,8 +30,8 @@ using System.Text;
 namespace GnomeSubtitles.Core {
 
 public class EventHandlers {
-
-	private bool PressStartEndKey = false;
+	private bool buttonStartEndKeyPressed = false;
+	
 	/* File Menu */
 	
 	public void OnFileNew (object o, EventArgs args) {
@@ -308,27 +308,18 @@ public class EventHandlers {
 			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 ){
+
+	public void OnVideoSetSubtitleStartEndGrabFocus (object o, EventArgs args) {			
+		if (!buttonStartEndKeyPressed) {
 			OnVideoSetSubtitleStart(o, args);
-			PressStartEndKey = true;
+			buttonStartEndKeyPressed = 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;
+
+	public void OnVideoSetSubtitleStartEndKeyRelease (object o, KeyReleaseEventArgs args) {			
+		if (buttonStartEndKeyPressed){
+			OnVideoSetSubtitleStartEnd(o, args);
+			buttonStartEndKeyPressed = false;
 		}
 	}
 



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