summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-03 23:31:11 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-03 23:31:11 +0100
commit5a9373e48aa575c70bd32b4b48eb6b9b8634a4fc (patch)
tree9f82092695f26b5d823ff1103e3f62bdc73dea91
parentc9152723208a20542b147e8a879117d6a5a76a45 (diff)
Fix hidden reels view and time axis not moving under zoom.
-rw-r--r--src/wx/timeline.cc10
-rw-r--r--src/wx/timeline.h2
-rw-r--r--src/wx/timeline_content_view.cc2
-rw-r--r--src/wx/timeline_time_axis_view.cc13
-rw-r--r--src/wx/timeline_time_axis_view.h3
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<dcpomatic::Rect<int> >());
@@ -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<dcpomatic::Rect<int>
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<int> (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<dcpomatic::Rect<int>
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<dcpomatic::Rect<int>
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<dcpomatic::Rect<int>
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<dcpomatic::Rect<int> > overlaps);
- int _y;
+ int _y; ///< y position in tracks (not pixels)
};
-