Allow dragging of the horizontal extents of the summary view box using PrimaryModifie...
[ardour.git] / gtk2_ardour / editor_summary.h
1 #ifndef __gtk_ardour_editor_summary_h__
2 #define __gtk_ardour_editor_summary_h__
3
4 #include <gtkmm/eventbox.h>
5
6 namespace ARDOUR {
7         class Session;
8 }
9
10 class Editor;
11
12 /** Class to provide a visual summary of the contents of an editor window; represents
13  *  the whole session as a set of lines, one per region view.
14  */
15 class EditorSummary : public Gtk::EventBox
16 {
17 public:
18         EditorSummary (Editor *);
19         ~EditorSummary ();
20
21         void set_session (ARDOUR::Session *);
22         void set_dirty ();
23         void set_bounds_dirty ();
24
25 private:
26         void centre_on_click (GdkEventButton *);
27         bool on_expose_event (GdkEventExpose *);
28         void on_size_request (Gtk::Requisition *);
29         void on_size_allocate (Gtk::Allocation &);
30         bool on_button_press_event (GdkEventButton *);
31         bool on_button_release_event (GdkEventButton *);
32         bool on_motion_notify_event (GdkEventMotion *);
33
34         void render (cairo_t *);
35         GdkPixmap* get_pixmap (GdkDrawable *);
36         void render_region (RegionView*, cairo_t*, nframes_t, double) const;
37         void editor_view (std::pair<double, double> *, std::pair<double, double> *) const;
38
39         Editor* _editor; ///< our editor
40         ARDOUR::Session* _session; ///< our session
41         GdkPixmap* _pixmap; ///< pixmap containing a rendering of the region views, or 0
42         bool _regions_dirty; ///< true if _pixmap requires re-rendering, otherwise false
43         int _width; ///< pixmap width
44         int _height; ///< pixmap height
45         double _pixels_per_frame; ///< pixels per frame for the x axis of the pixmap
46         double _vertical_scale;
47
48         bool _move_dragging;
49         double _x_offset;
50         double _y_offset;
51         bool _moved;
52
53         bool _zoom_dragging;
54         double _mouse_x_start;
55         double _width_start;
56         double _zoom_start;
57         nframes64_t _frames_start;
58
59         enum ZoomPosition {
60                 LEFT,
61                 RIGHT,
62                 NONE
63         };
64
65         ZoomPosition _zoom_position;
66 };
67
68 #endif