[gnome-subtitles] Fix Bug#547984 - Quick subtitle timing during playback



commit 1a35222fd5e5ad4ec23799e9ea6fe73b4f61c1fd
Author: Valmir Sena <valmirse gmail com>
Date:   Thu May 27 10:20:55 2010 -0300

    Fix Bug#547984 - Quick subtitle timing during playback

 data/video-set-subtitle-start-end-30x.png   |  Bin 0 -> 484 bytes
 gnome-subtitles.mdp                         |    3 ++-
 src/Glade/MainWindow.glade                  |   21 +++++++++++++++++++++
 src/GnomeSubtitles/Core/EventHandlers.cs    |   12 ++++++++++++
 src/GnomeSubtitles/Ui/VideoPreview/Video.cs |    7 +++++++
 src/GnomeSubtitles/Ui/View/SubtitleView.cs  |    5 +++++
 src/GnomeSubtitles/Ui/WidgetNames.cs        |    2 ++
 src/Makefile.am                             |    3 ++-
 8 files changed, 51 insertions(+), 2 deletions(-)
---
diff --git a/data/video-set-subtitle-start-end-30x.png b/data/video-set-subtitle-start-end-30x.png
new file mode 100644
index 0000000..774e724
Binary files /dev/null and b/data/video-set-subtitle-start-end-30x.png differ
diff --git a/gnome-subtitles.mdp b/gnome-subtitles.mdp
index c502d07..01d141b 100644
--- a/gnome-subtitles.mdp
+++ b/gnome-subtitles.mdp
@@ -44,6 +44,7 @@
     <File name="src/GnomeSubtitles/Dialog/VideoOpenDialog.cs" subtype="Code" buildaction="Compile" />
     <File name="data/video-set-subtitle-start-16x.png" subtype="Code" buildaction="EmbedAsResource" />
     <File name="data/video-set-subtitle-end-16x.png" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="data/video-set-subtitle-start-end-30x.png" subtype="Code" buildaction="EmbedAsResource" />
     <File name="src/GnomeSubtitles/Dialog/PreferencesDialog.cs" subtype="Code" buildaction="Compile" />
     <File name="src/GnomeSubtitles/Dialog/EncodingsDialog.cs" subtype="Code" buildaction="Compile" />
     <File name="src/GnomeSubtitles/Execution/BugReporter.cs" subtype="Code" buildaction="Compile" />
@@ -260,4 +261,4 @@
   <LanguageParameters StartupObject="GnomeSubtitles.Execution.Executable" ApplicationIcon="." ctype="CSharpProjectParameters" />
   <Deployment.LinuxDeployData generateScript="False" />
   <DeploymentInformation strategy="File" />
-</Project>
\ No newline at end of file
+</Project>
diff --git a/src/Glade/MainWindow.glade b/src/Glade/MainWindow.glade
index 18045a8..529f07d 100644
--- a/src/Glade/MainWindow.glade
+++ b/src/Glade/MainWindow.glade
@@ -1376,6 +1376,27 @@
                             <property name="position">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="GtkButton" id="videoSetSubtitleStartEndButton">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="relief">none</property>
+                            <signal name="pressed" handler="OnVideoSetSubtitleStart"/>
+                            <signal name="released" handler="OnVideoSetSubtitleStartEnd"/>
+                            <child>
+                              <widget class="GtkImage" id="videoSetSubtitleStartEndButtonImage">
+                                <property name="visible">True</property>
+                                <property name="xpad">7</property>
+                                <property name="ypad">4</property>
+                                <property name="stock">gtk-missing-image</property>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
diff --git a/src/GnomeSubtitles/Core/EventHandlers.cs b/src/GnomeSubtitles/Core/EventHandlers.cs
index 81ae4ef..d6bd058 100644
--- a/src/GnomeSubtitles/Core/EventHandlers.cs
+++ b/src/GnomeSubtitles/Core/EventHandlers.cs
@@ -287,6 +287,18 @@ public class EventHandlers {
 		}
 	}
 
+	public void OnVideoSetSubtitleStartEnd (object o, EventArgs args) {
+		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();
+		}
+	}		
 
 	/* Tools Menu */
 		
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/Video.cs b/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
index b1d12d7..8236160 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
@@ -43,6 +43,7 @@ public class Video {
 	/* Constant strings */
 	private const string videoSetSubtitleStartIconFilename = "video-set-subtitle-start-16x.png";
 	private const string videoSetSubtitleEndIconFilename = "video-set-subtitle-end-16x.png";
+	private const string videoSetSubtitleStartEndIconFilename = "video-set-subtitle-start-end-30x.png";
 
 	public Video () {
 		videoArea = Base.GetWidget(WidgetNames.VideoAreaHBox) as HBox;
@@ -188,6 +189,11 @@ public class Video {
 		pixbuf = new Gdk.Pixbuf(null, videoSetSubtitleEndIconFilename);
 		image = Base.GetWidget(WidgetNames.VideoSetSubtitleEndButtonImage) as Image;
 		image.Pixbuf = pixbuf;
+			
+		/* Set the icon for the SetSubtitleStartEnd button */
+		pixbuf = new Gdk.Pixbuf(null, videoSetSubtitleStartEndIconFilename);
+		image = Base.GetWidget(WidgetNames.VideoSetSubtitleStartEndButtonImage) as Image;
+		image.Pixbuf = pixbuf;
 	}
 	
 	private void InitializeVideoFrame () {
@@ -229,6 +235,7 @@ public class Video {
 	private void SetSelectionDependentControlsSensitivity (bool sensitivity) {
 		Base.GetWidget(WidgetNames.VideoSetSubtitleStartButton).Sensitive = sensitivity;
 		Base.GetWidget(WidgetNames.VideoSetSubtitleEndButton).Sensitive = sensitivity;
+		Base.GetWidget(WidgetNames.VideoSetSubtitleStartEndButton).Sensitive = sensitivity;
 	}
 	
 	private void SilentDisablePlayPauseButton () {
diff --git a/src/GnomeSubtitles/Ui/View/SubtitleView.cs b/src/GnomeSubtitles/Ui/View/SubtitleView.cs
index e10b19d..5286059 100644
--- a/src/GnomeSubtitles/Ui/View/SubtitleView.cs
+++ b/src/GnomeSubtitles/Ui/View/SubtitleView.cs
@@ -192,6 +192,11 @@ public class SubtitleView {
 		return true;
 	}
 
+	/// <summary>Selects the subtitle below of current selected</summary>	
+	public bool SelectNextSubtitle () {
+		selection.SelectNext();
+		return true;
+	}		
     
     /* Private members */
     
diff --git a/src/GnomeSubtitles/Ui/WidgetNames.cs b/src/GnomeSubtitles/Ui/WidgetNames.cs
index e9f23de..6043140 100644
--- a/src/GnomeSubtitles/Ui/WidgetNames.cs
+++ b/src/GnomeSubtitles/Ui/WidgetNames.cs
@@ -114,6 +114,8 @@ public class WidgetNames {
 	public const string VideoSetSubtitleStartButtonImage = "videoSetSubtitleStartButtonImage";
 	public const string VideoSetSubtitleEndButton = "videoSetSubtitleEndButton";
 	public const string VideoSetSubtitleEndButtonImage = "videoSetSubtitleEndButtonImage";
+	public const string VideoSetSubtitleStartEndButton = "videoSetSubtitleStartEndButton";
+	public const string VideoSetSubtitleStartEndButtonImage = "videoSetSubtitleStartEndButtonImage";
 	public const string VideoFrame = "videoFrame";
 	public const string VideoPlaybackHBox = "videoPlaybackHBox";
 	public const string VideoSlider = "videoSlider";
diff --git a/src/Makefile.am b/src/Makefile.am
index 3e5f84c..3522ea9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,7 +56,8 @@ GS_RESOURCES = \
 	$(GS_DATADIR)/gnome-subtitles.png \
 	$(GS_DATADIR)/gnome-subtitles-logo.png \
 	$(GS_DATADIR)/video-set-subtitle-end-16x.png \
-	$(GS_DATADIR)/video-set-subtitle-start-16x.png
+	$(GS_DATADIR)/video-set-subtitle-start-16x.png\
+	$(GS_DATADIR)/video-set-subtitle-start-end-30x.png
 
 GS_SYSTEM_REFERENCES = \
 	Mono.Posix.dll



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