summaryrefslogtreecommitdiff
path: root/src/wx/subtitle_view.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-04-26 15:29:21 +0100
committerCarl Hetherington <cth@carlh.net>2017-04-27 10:55:07 +0100
commitba8a5a15cc27988e2bbc6acd470d8532f1d8e99f (patch)
tree375bd068bbd86760f85fcd1264c1d8d76f2f1240 /src/wx/subtitle_view.cc
parentf5a2789fcab274f2beda4a1e4ff59567158c9686 (diff)
Initial work on removing storage of subtitle times.
Diffstat (limited to 'src/wx/subtitle_view.cc')
-rw-r--r--src/wx/subtitle_view.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/wx/subtitle_view.cc b/src/wx/subtitle_view.cc
index 7c66f1db2..bb336d16b 100644
--- a/src/wx/subtitle_view.cc
+++ b/src/wx/subtitle_view.cc
@@ -78,22 +78,35 @@ SubtitleView::SubtitleView (wxWindow* parent, shared_ptr<Film> film, shared_ptr<
_subs = 0;
_frc = film->active_frame_rate_change (position);
- decoder->subtitle->TextData.connect (bind (&SubtitleView::data, this, _1));
+ decoder->subtitle->TextStart.connect (bind (&SubtitleView::data_start, this, _1));
+ decoder->subtitle->Stop.connect (bind (&SubtitleView::data_stop, this, _1));
while (!decoder->pass ()) {}
SetSizerAndFit (sizer);
}
void
-SubtitleView::data (ContentTextSubtitle cts)
+SubtitleView::data_start (ContentTextSubtitle cts)
{
- for (list<dcp::SubtitleString>::const_iterator i = cts.subs.begin(); i != cts.subs.end(); ++i) {
+ BOOST_FOREACH (dcp::SubtitleString const & i, cts.subs) {
wxListItem list_item;
list_item.SetId (_subs);
_list->InsertItem (list_item);
- ContentTimePeriod const p = cts.period ();
- _list->SetItem (_subs, 0, std_to_wx (p.from.timecode (_frc->source)));
- _list->SetItem (_subs, 1, std_to_wx (p.to.timecode (_frc->source)));
- _list->SetItem (_subs, 2, std_to_wx (i->text ()));
+ _list->SetItem (_subs, 0, std_to_wx (cts.from().timecode (_frc->source)));
+ _list->SetItem (_subs, 2, std_to_wx (i.text ()));
++_subs;
}
+
+ _last_count = cts.subs.size ();
+}
+
+void
+SubtitleView::data_stop (ContentTime time)
+{
+ if (!_last_count) {
+ return;
+ }
+
+ for (int i = _subs - *_last_count; i < _subs; ++i) {
+ _list->SetItem (i, 1, std_to_wx (time.timecode (_frc->source)));
+ }
}