From 5a9373e48aa575c70bd32b4b48eb6b9b8634a4fc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 3 Jul 2018 23:31:11 +0100 Subject: [PATCH] Fix hidden reels view and time axis not moving under zoom. --- src/wx/timeline.cc | 10 ++++++++-- src/wx/timeline.h | 2 ++ src/wx/timeline_content_view.cc | 2 +- src/wx/timeline_time_axis_view.cc | 13 ++++++++----- src/wx/timeline_time_axis_view.h | 3 +-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 667bf5f87..480f6d690 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -117,7 +117,7 @@ Timeline::paint_labels () int vsx, vsy; _labels_canvas->GetViewStart (&vsx, &vsy); - gc->Translate (-vsx * _x_scroll_rate, -vsy * _y_scroll_rate); + gc->Translate (-vsx * _x_scroll_rate, -vsy * _y_scroll_rate + tracks_y_offset()); _labels_view->paint (gc, list >()); @@ -365,7 +365,7 @@ Timeline::assign_tracks () _labels_view->set_subtitle_tracks (subtitle_tracks); _labels_view->set_atmos (have_atmos); - _time_axis_view->set_y (tracks() * track_height() + 64); + _time_axis_view->set_y (tracks()); _reels_view->set_y (8); } @@ -745,3 +745,9 @@ Timeline::set_selection (ContentList selection) } } } + +int +Timeline::tracks_y_offset () const +{ + return _reels_view->bbox().height + 4; +} diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 1b75f7ab2..503025f3c 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -77,6 +77,8 @@ public: _tool = t; } + int tracks_y_offset () const; + private: void paint_labels (); void paint_main (); diff --git a/src/wx/timeline_content_view.cc b/src/wx/timeline_content_view.cc index abb671b77..1d0c1668f 100644 --- a/src/wx/timeline_content_view.cc +++ b/src/wx/timeline_content_view.cc @@ -156,7 +156,7 @@ TimelineContentView::do_paint (wxGraphicsContext* gc, list int TimelineContentView::y_pos (int t) const { - return t * _timeline.track_height(); + return t * _timeline.track_height() + _timeline.tracks_y_offset(); } void diff --git a/src/wx/timeline_time_axis_view.cc b/src/wx/timeline_time_axis_view.cc index c8808a62f..1d7aefb73 100644 --- a/src/wx/timeline_time_axis_view.cc +++ b/src/wx/timeline_time_axis_view.cc @@ -39,6 +39,7 @@ TimelineTimeAxisView::bbox () const return dcpomatic::Rect (0, _y - 4, _timeline.width(), 24); } +/** @param y y position in tracks (not pixels) */ void TimelineTimeAxisView::set_y (int y) { @@ -59,9 +60,11 @@ TimelineTimeAxisView::do_paint (wxGraphicsContext* gc, list double const mark_interval = calculate_mark_interval (rint (128 / pps)); + int y = _y * _timeline.track_height() + 32; + wxGraphicsPath path = gc->CreatePath (); - path.MoveToPoint (0, _y); - path.AddLineToPoint (_timeline.width(), _y); + path.MoveToPoint (0, y); + path.AddLineToPoint (_timeline.width(), y); gc->StrokePath (path); gc->SetFont (gc->CreateFont (*wxNORMAL_FONT)); @@ -70,8 +73,8 @@ TimelineTimeAxisView::do_paint (wxGraphicsContext* gc, list DCPTime t; while ((t.seconds() * pps) < _timeline.width()) { wxGraphicsPath path = gc->CreatePath (); - path.MoveToPoint (time_x (t), _y - 4); - path.AddLineToPoint (time_x (t), _y + 4); + path.MoveToPoint (time_x (t), y - 4); + path.AddLineToPoint (time_x (t), y + 4); gc->StrokePath (path); double tc = t.seconds (); @@ -90,7 +93,7 @@ TimelineTimeAxisView::do_paint (wxGraphicsContext* gc, list int const tx = t.seconds() * pps; if ((tx + str_width) < _timeline.width()) { - gc->DrawText (str, time_x (t), _y + 16); + gc->DrawText (str, time_x (t), y + 16); } t += DCPTime::from_seconds (mark_interval); diff --git a/src/wx/timeline_time_axis_view.h b/src/wx/timeline_time_axis_view.h index 5eecb8232..5477e61f1 100644 --- a/src/wx/timeline_time_axis_view.h +++ b/src/wx/timeline_time_axis_view.h @@ -31,6 +31,5 @@ public: private: void do_paint (wxGraphicsContext* gc, std::list > overlaps); - int _y; + int _y; ///< y position in tracks (not pixels) }; - -- 2.30.2