+2018-01-08 Carl Hetherington <cth@carlh.net>
+
+ * When doing jump-to-selected, jump to the first subtitle
+ in any text subtitle content (#1160).
+
2018-01-07 Carl Hetherington <cth@carlh.net>
* Updated nl_NL translation from Rob van Nieuwkerk.
/*
- Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
using std::string;
using boost::shared_ptr;
using boost::scoped_array;
+using boost::optional;
using dcp::Data;
TextSubtitle::TextSubtitle (shared_ptr<const TextSubtitleContent> content)
delete reader;
}
+/** @return time of first subtitle, if there is one */
+optional<ContentTime>
+TextSubtitle::first () const
+{
+ if (_subtitles.empty()) {
+ return optional<ContentTime>();
+ }
+
+ return ContentTime::from_seconds(_subtitles[0].from.all_as_seconds());
+}
+
ContentTime
TextSubtitle::length () const
{
public:
TextSubtitle (boost::shared_ptr<const TextSubtitleContent>);
+ boost::optional<ContentTime> first () const;
ContentTime length () const;
protected:
/*
- 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.
#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>
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;
}
}