+ _labels_view->paint (gc, list<dcpomatic::Rect<int> >());
+
+ delete gc;
+}
+
+void
+Timeline::paint_main ()
+{
+ wxPaintDC dc (this);
+ _main_canvas->DoPrepareDC (dc);
+
+ wxGraphicsContext* gc = wxGraphicsContext::Create (dc);
+ if (!gc) {
+ return;
+ }
+
+ int vsx, vsy;
+ _main_canvas->GetViewStart (&vsx, &vsy);
+ gc->Translate (-vsx * _x_scroll_rate, -vsy * _y_scroll_rate);
+
+ gc->SetAntialiasMode (wxANTIALIAS_DEFAULT);
+
+ BOOST_FOREACH (shared_ptr<TimelineView> i, _views) {
+
+ shared_ptr<TimelineContentView> ic = dynamic_pointer_cast<TimelineContentView> (i);
+
+ /* Find areas of overlap with other content views, so that we can plot them */
+ list<dcpomatic::Rect<int> > overlaps;
+ BOOST_FOREACH (shared_ptr<TimelineView> j, _views) {
+ shared_ptr<TimelineContentView> jc = dynamic_pointer_cast<TimelineContentView> (j);
+ /* No overlap with non-content views, views no different tracks, audio views or non-active views */
+ if (!ic || !jc || i == j || ic->track() != jc->track() || ic->track().get_value_or(2) >= 2 || !ic->active() || !jc->active()) {
+ continue;
+ }
+
+ optional<dcpomatic::Rect<int> > r = j->bbox().intersection (i->bbox());
+ if (r) {
+ overlaps.push_back (r.get ());
+ }
+ }
+
+ i->paint (gc, overlaps);
+ }
+
+ 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->SetBrush (*wxTRANSPARENT_BRUSH);
+ gc->DrawRectangle (
+ min (_down_point.x, _zoom_point->x),
+ min (_down_point.y, _zoom_point->y),
+ fabs (_down_point.x - _zoom_point->x),
+ fabs (_down_point.y - _zoom_point->y)
+ );