Split out TimelineView from ContentTimelineView.
[dcpomatic.git] / src / wx / content_timeline_view.h
index 0f6eeae518116cdd04b1e5ea6200df63770a950e..450d19df461dce16620d67598c49b7d629d24cff 100644 (file)
@@ -23,6 +23,7 @@
 #define DCPOMATIC_CONTENT_TIMELINE_VIEW_H
 
 
+#include "timeline_view.h"
 #include "lib/rect.h"
 #include "lib/dcpomatic_time.h"
 
@@ -34,30 +35,22 @@ class ContentTimeline;
 /** @class ContentTimelineView
  *  @brief Parent class for components of the content timeline (e.g. a piece of content or an axis).
  */
-class ContentTimelineView
+class ContentTimelineView : public TimelineView<ContentTimeline>
 {
 public:
        explicit ContentTimelineView(ContentTimeline& t);
        virtual ~ContentTimelineView () = default;
 
-       ContentTimelineView(ContentTimelineView const&) = delete;
-       ContentTimelineView& operator=(ContentTimelineView const&) = delete;
-
-       void paint (wxGraphicsContext* g, std::list<dcpomatic::Rect<int>> overlaps);
-       void force_redraw ();
-
-       virtual dcpomatic::Rect<int> bbox () const = 0;
+       void paint(wxGraphicsContext* gc, std::list<dcpomatic::Rect<int>> overlaps)
+       {
+               _last_paint_bbox = bbox();
+               do_paint(gc, overlaps);
+       }
 
 protected:
-       virtual void do_paint (wxGraphicsContext *, std::list<dcpomatic::Rect<int>> overlaps) = 0;
+       virtual void do_paint(wxGraphicsContext *, std::list<dcpomatic::Rect<int>> overlaps) = 0;
 
-       int time_x (dcpomatic::DCPTime t) const;
        int y_pos(int t) const;
-
-       ContentTimeline& _timeline;
-
-private:
-       dcpomatic::Rect<int> _last_paint_bbox;
 };