summaryrefslogtreecommitdiff
path: root/src/wx/content_panel.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-01-08 23:54:10 +0000
committerCarl Hetherington <cth@carlh.net>2018-01-08 23:54:10 +0000
commit81c317f71b4150f9ba6299190d5272837c548ef1 (patch)
treed13502dcb65bdc534fa0124aaae3e866a5234de5 /src/wx/content_panel.cc
parent160a401d16e3962b10f3105e00992936a8188424 (diff)
When doing jump-to-selected jump to the first subtitle in TextSubtitleContent (#1160).
Diffstat (limited to 'src/wx/content_panel.cc')
-rw-r--r--src/wx/content_panel.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc
index 8620fa3e0..fa3754dd6 100644
--- a/src/wx/content_panel.cc
+++ b/src/wx/content_panel.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -39,6 +39,8 @@
#include "lib/config.h"
#include "lib/log.h"
#include "lib/compose.hpp"
+#include "lib/text_subtitle_content.h"
+#include "lib/text_subtitle.h"
#include <wx/wx.h>
#include <wx/notebook.h>
#include <wx/listctrl.h>
@@ -254,8 +256,19 @@ ContentPanel::selection_changed ()
optional<DCPTime> go_to;
BOOST_FOREACH (shared_ptr<Content> i, selected ()) {
- if (!go_to || i->position() < go_to.get()) {
- go_to = i->position ();
+ DCPTime p;
+ p = i->position();
+ if (dynamic_pointer_cast<TextSubtitleContent>(i)) {
+ /* Rather special case; if we select a text subtitle file jump to its
+ first subtitle.
+ */
+ TextSubtitle ts (dynamic_pointer_cast<TextSubtitleContent>(i));
+ if (ts.first()) {
+ p += DCPTime(ts.first().get(), _film->active_frame_rate_change(i->position()));
+ }
+ }
+ if (!go_to || p < go_to.get()) {
+ go_to = p;
}
}