X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Ftimeline_content_view.cc;h=69f1723cee28b6ea055ab647a1833882fa7a0e67;hp=eacfbfd4a0143a493803d8f9a578e6446edac1b8;hb=254b3044d72de6b033d7c584f5abd2b9aa70aad5;hpb=220518a7bf41bfd9e9da852b4d5ac1461fdd0e1a diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index eacfbfd4a..69f1723ce 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -33,7 +33,7 @@ TimelineContentView::TimelineContentView (Timeline& tl, shared_ptr c) , _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,8 +50,8 @@ 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), - _timeline.track_height() + content->length_after_trim(film).seconds() * _timeline.pixels_per_second().get_value_or(0), + _timeline.pixels_per_track() ); } @@ -104,7 +104,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); @@ -117,11 +117,11 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list /* Outline */ wxGraphicsPath path = gc->CreatePath (); - path.MoveToPoint (time_x (position) + 1, y_pos (_track.get()) + 4); + path.MoveToPoint (time_x (position) + 2, y_pos (_track.get()) + 4); path.AddLineToPoint (time_x (position + len) - 1, y_pos (_track.get()) + 4); path.AddLineToPoint (time_x (position + len) - 1, y_pos (_track.get() + 1) - 4); - path.AddLineToPoint (time_x (position) + 1, y_pos (_track.get() + 1) - 4); - path.AddLineToPoint (time_x (position) + 1, y_pos (_track.get()) + 4); + path.AddLineToPoint (time_x (position) + 2, y_pos (_track.get() + 1) - 4); + path.AddLineToPoint (time_x (position) + 2, y_pos (_track.get()) + 4); gc->StrokePath (path); gc->FillPath (path); @@ -141,30 +141,40 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list } /* Label text */ - wxString name = std_to_wx (cont->summary()); - wxDouble name_width; - wxDouble name_height; - wxDouble name_descent; - wxDouble name_leading; + wxString lab = label (); + wxDouble lab_width; + wxDouble lab_height; + wxDouble lab_descent; + wxDouble lab_leading; gc->SetFont (gc->CreateFont (*wxNORMAL_FONT, foreground_colour ())); - gc->GetTextExtent (name, &name_width, &name_height, &name_descent, &name_leading); - gc->Clip (wxRegion (time_x (position), y_pos (_track.get()), len.seconds() * _timeline.pixels_per_second().get_value_or(0), _timeline.track_height())); - gc->DrawText (name, time_x (position) + 12, y_pos (_track.get() + 1) - name_height - 4); + gc->GetTextExtent (lab, &lab_width, &lab_height, &lab_descent, &lab_leading); + 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 (); } int TimelineContentView::y_pos (int t) const { - return t * _timeline.track_height(); + return t * _timeline.pixels_per_track() + _timeline.tracks_y_offset(); } 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) { force_redraw (); } } + +wxString +TimelineContentView::label () const +{ + return std_to_wx(content()->summary()); +}