X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Ftimeline.cc;h=7b9758febd16a4b3a27e300ab0f259745a3c5c42;hp=cac9318cca2eac486aee8ce30cb40c87f08a872f;hb=c04fec82d25127fafa73c3daff87bece9aa8c8e8;hpb=43b5ff1d2dc872f9029a7e59a85af59dbad8536f diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index cac9318cc..7b9758feb 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -56,6 +56,9 @@ using boost::dynamic_pointer_cast; using boost::bind; using boost::optional; using namespace dcpomatic; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif /* 3 hours in 640 pixels */ double const Timeline::_minimum_pixels_per_second = 640.0 / (60 * 60 * 3); @@ -82,6 +85,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 +120,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 +265,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 +423,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; } } @@ -478,7 +478,11 @@ Timeline::event_to_view (wxMouseEvent& ev) { /* Search backwards through views so that we find the uppermost one first */ TimelineViewList::reverse_iterator i = _views.rbegin(); - Position const p (ev.GetX(), ev.GetY()); + + int vsx, vsy; + _main_canvas->GetViewStart (&vsx, &vsy); + Position const p (ev.GetX() + vsx * _x_scroll_rate, ev.GetY() + vsy * _y_scroll_rate); + while (i != _views.rend() && !(*i)->bbox().contains (p)) { shared_ptr cv = dynamic_pointer_cast (*i); ++i;