X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Ftimeline.cc;h=2a8555e7ce0b3fd8abcedd14dc369e2c7e43712d;hp=645cb3de3a5e876055177e8126894721e2b1e142;hb=b9f949d688b6e9563f6350286bbbc3f169b1b9fe;hpb=313319ba2d8544bc25524e02e634804a503b54f1 diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 645cb3de3..2a8555e7c 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -38,7 +38,10 @@ #include "lib/text_content.h" #include "lib/timer.h" #include "lib/video_content.h" +#include +LIBDCP_DISABLE_WARNINGS #include +LIBDCP_ENABLE_WARNINGS #include #include @@ -64,7 +67,7 @@ double const Timeline::_minimum_pixels_per_second = 640.0 / (60 * 60 * 3); int const Timeline::_minimum_pixels_per_track = 16; -Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr film, weak_ptr viewer) +Timeline::Timeline(wxWindow* parent, ContentPanel* cp, shared_ptr film, FilmViewer& viewer) : wxPanel (parent, wxID_ANY) , _labels_canvas (new wxScrolledCanvas (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)) , _main_canvas (new wxScrolledCanvas (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE)) @@ -78,7 +81,7 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr film, w , _left_down (false) , _down_view_position (0) , _first_move (false) - , _menu (this) + , _menu (this, viewer) , _snap (true) , _tool (SELECT) , _x_scroll_rate (16) @@ -156,7 +159,7 @@ Timeline::paint_labels () _labels_canvas->GetViewStart (&vsx, &vsy); gc->Translate (-vsx * _x_scroll_rate, -vsy * _y_scroll_rate + tracks_y_offset()); - _labels_view->paint (gc, list >()); + _labels_view->paint (gc, {}); delete gc; } @@ -204,7 +207,7 @@ Timeline::paint_main () if (_zoom_point) { /* Translate back as _down_point and _zoom_point do not take scroll into account */ gc->Translate (vsx * _x_scroll_rate, vsy * _y_scroll_rate); - gc->SetPen (*wxBLACK_PEN); + gc->SetPen(gui_is_dark() ? *wxWHITE_PEN : *wxBLACK_PEN); gc->SetBrush (*wxTRANSPARENT_BRUSH); gc->DrawRectangle ( min (_down_point.x, _zoom_point->x), @@ -216,12 +219,9 @@ Timeline::paint_main () /* Playhead */ - auto vp = _viewer.lock (); - DCPOMATIC_ASSERT (vp); - gc->SetPen (*wxRED_PEN); auto path = gc->CreatePath (); - double const ph = vp->position().seconds() * pixels_per_second().get_value_or(0); + double const ph = _viewer.position().seconds() * pixels_per_second().get_value_or(0); path.MoveToPoint (ph, 0); path.AddLineToPoint (ph, pixels_per_track() * _tracks + 32); gc->StrokePath (path); @@ -476,7 +476,6 @@ Timeline::event_to_view (wxMouseEvent& ev) Position const p (ev.GetX() + vsx * _x_scroll_rate, ev.GetY() + vsy * _y_scroll_rate); while (i != _views.rend() && !(*i)->bbox().contains (p)) { - auto cv = dynamic_pointer_cast(*i); ++i; } @@ -521,6 +520,12 @@ Timeline::left_down_select (wxMouseEvent& ev) _down_view_position = content_view->content()->position (); } + if (dynamic_pointer_cast(view)) { + int vsx, vsy; + _main_canvas->GetViewStart(&vsx, &vsy); + _viewer.seek(DCPTime::from_seconds((ev.GetPosition().x + vsx * _x_scroll_rate) / _pixels_per_second.get_value_or(1)), true); + } + for (auto i: _views) { auto cv = dynamic_pointer_cast(i); if (!cv) {