X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Ftimeline_content_view.cc;h=8258a81f97a5bfd6dd37e8485a3a5b2cef29ba71;hb=a5d004b0773f633401528392fc28e66d70e13ac8;hp=bf22e0156d7d739f4ecc0f6d47f24685ac042f53;hpb=a44d87088c380e2e282b1df65d6bd55795091c72;p=dcpomatic.git diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index bf22e0156..8258a81f9 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -23,17 +23,20 @@ #include "wx_util.h" #include "lib/content.h" #include -#include using std::list; -using boost::shared_ptr; +using std::shared_ptr; +using namespace dcpomatic; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif TimelineContentView::TimelineContentView (Timeline& tl, shared_ptr c) : TimelineView (tl) , _content (c) , _selected (false) { - _content_connection = c->Changed.connect (bind (&TimelineContentView::content_changed, this, _2)); + _content_connection = c->Change.connect (bind (&TimelineContentView::content_change, this, _1, _3)); } dcpomatic::Rect @@ -50,7 +53,7 @@ TimelineContentView::bbox () const return dcpomatic::Rect ( time_x (content->position ()), y_pos (_track.get()), - content->length_after_trim().seconds() * _timeline.pixels_per_second().get_value_or(0), + content->length_after_trim(film).seconds() * _timeline.pixels_per_second().get_value_or(0), _timeline.pixels_per_track() ); } @@ -104,7 +107,7 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list } DCPTime const position = cont->position (); - DCPTime const len = cont->length_after_trim (); + DCPTime const len = cont->length_after_trim (film); wxColour selected (background_colour().Red() / 2, background_colour().Green() / 2, background_colour().Blue() / 2); @@ -127,7 +130,7 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list /* Reel split points */ gc->SetPen (*wxThePenList->FindOrCreatePen (foreground_colour(), 1, wxPENSTYLE_DOT)); - BOOST_FOREACH (DCPTime i, cont->reel_split_points ()) { + for (auto i: cont->reel_split_points(film)) { path = gc->CreatePath (); path.MoveToPoint (time_x (i), y_pos (_track.get()) + 4); path.AddLineToPoint (time_x (i), y_pos (_track.get() + 1) - 4); @@ -148,9 +151,10 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list wxDouble lab_leading; gc->SetFont (gc->CreateFont (*wxNORMAL_FONT, foreground_colour ())); gc->GetTextExtent (lab, &lab_width, &lab_height, &lab_descent, &lab_leading); + gc->PushState (); gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len.seconds() * _timeline.pixels_per_second().get_value_or(0), _timeline.pixels_per_track())); gc->DrawText (lab, time_x (position) + 12, y_pos (_track.get() + 1) - lab_height - 4); - gc->ResetClip (); + gc->PopState (); } int @@ -160,8 +164,12 @@ TimelineContentView::y_pos (int t) const } void -TimelineContentView::content_changed (int p) +TimelineContentView::content_change (ChangeType type, int p) { + if (type != CHANGE_TYPE_DONE) { + return; + } + ensure_ui_thread (); if (p == ContentProperty::POSITION || p == ContentProperty::LENGTH) {