[gnome-subtitles] Activate subtitle when activating sync point (fixes #585064)
- From: Pedro Daniel da Rocha Melo e Castro <pcastro src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-subtitles] Activate subtitle when activating sync point (fixes #585064)
- Date: Sun, 3 Jan 2010 20:13:41 +0000 (UTC)
commit d8ff08c24f957e5ce419b6220a862ea6438cf569
Author: Pedro Castro <mail>
Date: Sun Jan 3 20:12:43 2010 +0000
Activate subtitle when activating sync point (fixes #585064)
Activate a subtitle (including seeking the video to its start time) when activating
a sync point in the Synchronize dialog.
src/Glade/TimingsSynchronizeDialog.glade | 6 +++++-
src/GnomeSubtitles/Core/EventHandlers.cs | 4 ++--
.../Dialog/TimingsSynchronizeDialog.cs | 10 +++++++++-
src/GnomeSubtitles/Ui/VideoPreview/Video.cs | 11 +++++++++--
src/GnomeSubtitles/Ui/View/SubtitleSelection.cs | 9 +++++++--
5 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/src/Glade/TimingsSynchronizeDialog.glade b/src/Glade/TimingsSynchronizeDialog.glade
index 780531f..96e0cfe 100644
--- a/src/Glade/TimingsSynchronizeDialog.glade
+++ b/src/Glade/TimingsSynchronizeDialog.glade
@@ -11,6 +11,7 @@
<child internal-child="vbox">
<widget class="GtkVBox" id="dialogVBox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<widget class="GtkFrame" id="syncPointsFrame">
@@ -25,6 +26,7 @@
<child>
<widget class="GtkVBox" id="syncPointsFrameVBox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<widget class="GtkScrolledWindow" id="syncPointsScrolledWindow">
@@ -38,6 +40,7 @@
<widget class="GtkTreeView" id="syncPointsTree">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <signal name="row_activated" handler="OnRowActivated"/>
</widget>
</child>
</widget>
@@ -52,7 +55,7 @@
<property name="visible">True</property>
<child>
<widget class="GtkButton" id="buttonAdd">
- <property name="label" translatable="yes">gtk-add</property>
+ <property name="label">gtk-add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -123,6 +126,7 @@
<child>
<widget class="GtkVBox" id="optionsFrameVBox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<child>
<widget class="GtkCheckButton" id="syncAllSubtitlesCheckButton">
<property name="label" translatable="yes">Synchroni_ze all subtitles</property>
diff --git a/src/GnomeSubtitles/Core/EventHandlers.cs b/src/GnomeSubtitles/Core/EventHandlers.cs
index 8b67468..cf19198 100644
--- a/src/GnomeSubtitles/Core/EventHandlers.cs
+++ b/src/GnomeSubtitles/Core/EventHandlers.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2009 Pedro Castro
+ * Copyright (C) 2006-2010 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
@@ -351,7 +351,7 @@ public class EventHandlers {
/* Subtitle View */
public void OnRowActivated (object o, RowActivatedArgs args) {
- Base.Ui.Video.SeekToSelection();
+ Base.Ui.Video.SeekToPath(args.Path);
}
public void OnSubtitleViewKeyPressed (object o, KeyPressEventArgs args) {
diff --git a/src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs b/src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs
index f7381bd..b159da8 100644
--- a/src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs
+++ b/src/GnomeSubtitles/Dialog/TimingsSynchronizeDialog.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2008-2009 Pedro Castro
+ * Copyright (C) 2008-2010 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
@@ -203,6 +203,14 @@ public class TimingsSynchronizeDialog : GladeDialog {
TreeSelection selection = (o as TreeSelection);
buttonRemove.Sensitive = (selection.CountSelectedRows() > 0);
}
+
+ private void OnRowActivated (object o, RowActivatedArgs args) {
+ SyncPoint syncPoint = syncPoints[args.Path];
+ int subtitleNumber = syncPoint.SubtitleNumber;
+ if (subtitleNumber < Base.Document.Subtitles.Count) {
+ Base.Ui.View.Selection.Activate(Core.Util.IntToPath(syncPoint.SubtitleNumber), true, false);
+ }
+ }
private void OnAdd (object o, EventArgs args) {
/* Check if document and video are loaded */
diff --git a/src/GnomeSubtitles/Ui/VideoPreview/Video.cs b/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
index 0f085ca..b1d12d7 100644
--- a/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
+++ b/src/GnomeSubtitles/Ui/VideoPreview/Video.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2009 Pedro Castro
+ * Copyright (C) 2006-2010 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
@@ -154,8 +154,15 @@ public class Video {
TimeSpan time = TimingUtil.FramesToTime(frames, this.FrameRate);
Seek(time);
}
+
+ public void SeekToPath (TreePath path) {
+ Subtitle subtitle = Base.Document.Subtitles[path];
+ if (subtitle != null) {
+ Seek(subtitle.Times.Start);
+ }
+ }
- public void SeekToSelection () { //TODO check out
+ public void SeekToSelection () {
Subtitle subtitle = Core.Base.Ui.View.Selection.FirstSubtitle;
TimeSpan time = subtitle.Times.Start;
Seek(time);
diff --git a/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs b/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs
index a3a3924..aa531c5 100644
--- a/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs
+++ b/src/GnomeSubtitles/Ui/View/SubtitleSelection.cs
@@ -1,6 +1,6 @@
/*
* This file is part of Gnome Subtitles.
- * Copyright (C) 2006-2009 Pedro Castro
+ * Copyright (C) 2006-2010 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
@@ -221,7 +221,7 @@ public class SubtitleSelection {
}
if ((!reselect) && (Count == 1) && (selection.PathIsSelected(path))) //No reselection is required and path is already the only selected path
return;
-
+
SetFocus(path, align);
}
@@ -371,6 +371,11 @@ public class SubtitleSelection {
else
ScrollToCell(path, align);
}
+
+ public void Activate (TreePath path, bool align, bool reselect) {
+ Select(path, align, reselect);
+ tree.ActivateRow(path, null);
+ }
/* Event members */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]