gnome-subtitles r1053 - in trunk: . src src/Glade src/GnomeSubtitles/Core src/GnomeSubtitles/Dialog src/GnomeSubtitles/Ui
- From: pcastro svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-subtitles r1053 - in trunk: . src src/Glade src/GnomeSubtitles/Core src/GnomeSubtitles/Dialog src/GnomeSubtitles/Ui
- Date: Fri, 3 Oct 2008 22:59:31 +0000 (UTC)
Author: pcastro
Date: Fri Oct 3 22:59:31 2008
New Revision: 1053
URL: http://svn.gnome.org/viewvc/gnome-subtitles?rev=1053&view=rev
Log:
Added a dialog that allows to Seek to a specified time/frame instant (fixes #504560).
The dialog is initialized with the current video position, has a reset button, automatically selects the entered text and activates on Return. It changes according to the current timing mode (time or frames).
Added:
trunk/src/Glade/VideoSeekToDialog.glade
trunk/src/GnomeSubtitles/Dialog/VideoSeekToDialog.cs
Modified:
trunk/gnome-subtitles.mdp
trunk/src/GnomeSubtitles/Core/EventHandlers.cs
trunk/src/GnomeSubtitles/Ui/Menus.cs
trunk/src/GnomeSubtitles/Ui/WidgetNames.cs
trunk/src/Makefile.am
Modified: trunk/gnome-subtitles.mdp
==============================================================================
--- trunk/gnome-subtitles.mdp (original)
+++ trunk/gnome-subtitles.mdp Fri Oct 3 22:59:31 2008
@@ -132,6 +132,8 @@
<File name="src/GnomeSubtitles/Dialog/BaseDialog.cs" subtype="Code" buildaction="Compile" />
<File name="src/GnomeSubtitles/Dialog/WarningDialog.cs" subtype="Code" buildaction="Compile" />
<File name="src/GnomeSubtitles/Dialog/BasicErrorDialog.cs" subtype="Code" buildaction="Compile" />
+ <File name="src/GnomeSubtitles/Dialog/VideoSeekToDialog.cs" subtype="Code" buildaction="Compile" />
+ <File name="src/Glade/VideoSeekToDialog.glade" subtype="Code" buildaction="EmbedAsResource" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.8.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
Added: trunk/src/Glade/VideoSeekToDialog.glade
==============================================================================
--- (empty file)
+++ trunk/src/Glade/VideoSeekToDialog.glade Fri Oct 3 22:59:31 2008
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--Generated with glade3 3.4.5 on Fri Oct 3 23:01:20 2008 -->
+<glade-interface>
+ <widget class="GtkDialog" id="dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Seek To</property>
+ <property name="modal">True</property>
+ <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="has_separator">False</property>
+ <signal name="response" handler="OnResponse"/>
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialogVBox">
+ <property name="visible">True</property>
+ <property name="spacing">11</property>
+ <child>
+ <widget class="GtkHBox" id="dialogHBox">
+ <property name="visible">True</property>
+ <property name="border_width">4</property>
+ <property name="spacing">9</property>
+ <child>
+ <widget class="GtkLabel" id="positionLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Seek to _time:</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spinButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="is_focus">True</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">0 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="clearButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="OnClear"/>
+ <child>
+ <widget class="GtkImage" id="clearButtonImage">
+ <property name="visible">True</property>
+ <property name="stock">gtk-clear</property>
+ <property name="icon_size">1</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialogActionArea">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <widget class="GtkButton" id="buttonCancel">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="buttonSeek">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="response_id">-5</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <widget class="GtkHBox" id="hBox">
+ <property name="visible">True</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkImage" id="buttonImage">
+ <property name="visible">True</property>
+ <property name="stock">gtk-jump-to</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="buttonLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Seek</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
Modified: trunk/src/GnomeSubtitles/Core/EventHandlers.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Core/EventHandlers.cs (original)
+++ trunk/src/GnomeSubtitles/Core/EventHandlers.cs Fri Oct 3 22:59:31 2008
@@ -241,6 +241,10 @@
Base.Ui.Video.Forward();
}
+ public void OnVideoSeekTo (object o, EventArgs args) {
+ new VideoSeekToDialog().Show();
+ }
+
public void OnVideoSeekToSelection (object o, EventArgs args) {
Base.Ui.Video.SeekToSelection();
}
Added: trunk/src/GnomeSubtitles/Dialog/VideoSeekToDialog.cs
==============================================================================
--- (empty file)
+++ trunk/src/GnomeSubtitles/Dialog/VideoSeekToDialog.cs Fri Oct 3 22:59:31 2008
@@ -0,0 +1,94 @@
+/*
+ * This file is part of Gnome Subtitles.
+ * Copyright (C) 2008 Pedro Castro
+ *
+ * Gnome Subtitles is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Gnome Subtitles is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+using Glade;
+using GnomeSubtitles.Core;
+using Gtk;
+using Mono.Unix;
+using SubLib.Core;
+using SubLib.Core.Domain;
+using System;
+
+namespace GnomeSubtitles.Dialog {
+
+public class VideoSeekToDialog : GladeDialog {
+ private TimingMode timingMode = TimingMode.Frames;
+
+ /* Constant strings */
+ private const string gladeFilename = "VideoSeekToDialog.glade";
+
+ /* Widgets */
+ [WidgetAttribute] private SpinButton spinButton = null;
+ [WidgetAttribute] private Label positionLabel = null;
+
+ public VideoSeekToDialog () : base(gladeFilename, true, true){
+ this.timingMode = Base.TimingMode;
+
+ InitSpinButton();
+ }
+
+
+ /* Private methods */
+
+ private void InitSpinButton () {
+ spinButton.WidthRequest = Core.Util.SpinButtonTimeWidth(spinButton);
+ spinButton.Alignment = 0.5f;
+
+ if (timingMode == TimingMode.Times) {
+ Core.Util.SetSpinButtonTimingMode(spinButton, Base.TimingMode);
+ Core.Util.SetSpinButtonAdjustment(spinButton, Base.Ui.Video.Position.Length, false);
+ SetSpinButtonValue(Base.Ui.Video.Position.CurrentTime.TotalMilliseconds);
+ }
+ else {
+ Core.Util.SetSpinButtonTimingMode(spinButton, Base.TimingMode);
+ Core.Util.SetSpinButtonAdjustment(spinButton, Base.Ui.Video.Position.LengthInFrames, false);
+ SetSpinButtonValue(Base.Ui.Video.Position.CurrentFrames);
+
+ positionLabel.TextWithMnemonic = Catalog.GetString("Seek to _frame:");
+ }
+
+ spinButton.SelectRegion(0, spinButton.Text.Length);
+ }
+
+ private void SetSpinButtonValue (double newValue) {
+ spinButton.Value = newValue;
+ }
+
+ #pragma warning disable 169 //Disables warning about handlers not being used
+
+ private void OnClear (object o, EventArgs args) {
+ SetSpinButtonValue(0);
+ }
+
+ private void OnResponse (object o, ResponseArgs args) {
+ if (args.ResponseId == ResponseType.Ok) {
+ if (timingMode == TimingMode.Times) {
+ TimeSpan position = TimeSpan.FromMilliseconds(spinButton.Value); //TODO move to Util
+ Base.Ui.Video.Seek(position);
+ }
+ else {
+ Base.Ui.Video.Seek(Convert.ToInt32(spinButton.Value));
+ }
+ }
+ Close();
+ }
+
+}
+
+}
Modified: trunk/src/GnomeSubtitles/Ui/Menus.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/Menus.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/Menus.cs Fri Oct 3 22:59:31 2008
@@ -378,6 +378,7 @@
SetSensitivity(WidgetNames.VideoPlayPause, sensitivity);
SetSensitivity(WidgetNames.VideoRewind, sensitivity);
SetSensitivity(WidgetNames.VideoForward, sensitivity);
+ SetSensitivity(WidgetNames.VideoSeekTo, sensitivity);
/* Set video menu dependent sensitivity if there is 1 selected subtitle. */
if ((Core.Base.Ui.View.Selection.Count == 1) && sensitivity)
Modified: trunk/src/GnomeSubtitles/Ui/WidgetNames.cs
==============================================================================
--- trunk/src/GnomeSubtitles/Ui/WidgetNames.cs (original)
+++ trunk/src/GnomeSubtitles/Ui/WidgetNames.cs Fri Oct 3 22:59:31 2008
@@ -75,6 +75,7 @@
public const string VideoPlayPause = "videoPlayPause";
public const string VideoRewind = "videoRewind";
public const string VideoForward = "videoForward";
+ public const string VideoSeekTo = "videoSeekTo";
public const string VideoSeekToSelection = "videoSeekToSelection";
public const string VideoSetSubtitleStart = "videoSetSubtitleStart";
public const string VideoSetSubtitleEnd = "videoSetSubtitleEnd";
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Fri Oct 3 22:59:31 2008
@@ -33,6 +33,7 @@
$(srcdir)/Glade/TimingsAdjustDialog.glade \
$(srcdir)/Glade/TimingsShiftDialog.glade \
$(srcdir)/Glade/VideoOpenDialog.glade \
+ $(srcdir)/Glade/VideoSeekToDialog.glade \
$(GS_DATADIR)/gnome-subtitles.png \
$(GS_DATADIR)/gnome-subtitles-logo.png \
$(GS_DATADIR)/video-set-subtitle-end-16x.png \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]