X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Fsubtitle_view.cc;h=bb336d16b19f79b8f83b5faf7ecc6a533e52b780;hp=7c66f1db2d15cf073137c59be8cedbac1582ff86;hb=ba8a5a15cc27988e2bbc6acd470d8532f1d8e99f;hpb=f5a2789fcab274f2beda4a1e4ff59567158c9686 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, 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::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))); + } }