X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ftimeline.cc;h=c9a6dc9f172e056d5e29310a98ac87fe9857ec40;hb=47245166de02206389a0cb18aae7de35f8517c7d;hp=daeeb0a51280916c4bb5b594c59fe86f6627c201;hpb=c536ea4b470fffadcc491b2b9885e027efa2ec5c;p=dcpomatic.git diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index daeeb0a51..c9a6dc9f1 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -82,6 +82,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr film, w , _y_scroll_rate (16) , _pixels_per_track (48) , _first_resize (true) + , _timer (this) { #ifndef __WXOSX__ _labels_canvas->SetDoubleBuffered (true); @@ -116,16 +117,15 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr film, w _film_changed_connection = film->Change.connect (bind (&Timeline::film_change, this, _1, _2)); _film_content_change_connection = film->ContentChange.connect (bind (&Timeline::film_content_change, this, _1, _3, _4)); - shared_ptr vp = viewer.lock (); - DCPOMATIC_ASSERT (vp); - _viewer_position_change_connection = vp->PositionChanged.connect (bind(&Timeline::position_change, this)); + Bind (wxEVT_TIMER, boost::bind(&Timeline::update_playhead, this)); + _timer.Start (200, wxTIMER_CONTINUOUS); setup_scrollbars (); _labels_canvas->ShowScrollbars (wxSHOW_SB_NEVER, wxSHOW_SB_NEVER); } void -Timeline::position_change () +Timeline::update_playhead () { Refresh (); } @@ -262,8 +262,8 @@ Timeline::recreate_views () _views.push_back (shared_ptr (new TimelineTextContentView (*this, i, j))); } - if (dynamic_pointer_cast (i)) { - _views.push_back (shared_ptr (new TimelineAtmosContentView (*this, i))); + if (i->atmos) { + _views.push_back (shared_ptr(new TimelineAtmosContentView(*this, i))); } } @@ -420,12 +420,9 @@ Timeline::assign_tracks () bool have_atmos = false; BOOST_FOREACH (shared_ptr i, _views) { - shared_ptr cv = dynamic_pointer_cast (i); - if (!cv) { - continue; - } - if (dynamic_pointer_cast (i)) { - cv->set_track (_tracks - 1); + shared_ptr cv = dynamic_pointer_cast(i); + if (cv) { + cv->set_track (_tracks); have_atmos = true; } }