Allow configurable start mode for player.
[dcpomatic.git] / src / wx / timeline_content_view.cc
index 88b50076af501cb6d567ebaf02e644c6624ba611..12691f661d34d163eff989173d62bb1254f63ab0 100644 (file)
@@ -33,7 +33,7 @@ TimelineContentView::TimelineContentView (Timeline& tl, shared_ptr<Content> 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<int>
@@ -141,15 +141,15 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list<dcpomatic::Rect<int>
        }
 
        /* 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->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 (name, time_x (position) + 12, y_pos (_track.get() + 1) - name_height - 4);
+       gc->DrawText (lab, time_x (position) + 12, y_pos (_track.get() + 1) - lab_height - 4);
        gc->ResetClip ();
 }
 
@@ -160,11 +160,21 @@ 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) {
                force_redraw ();
        }
 }
+
+wxString
+TimelineContentView::label () const
+{
+       return std_to_wx(content()->summary());
+}