Add a playhead marker to the summary.
[ardour.git] / gtk2_ardour / editor_summary.h
1 /*
2     Copyright (C) 2009 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __gtk_ardour_editor_summary_h__
21 #define __gtk_ardour_editor_summary_h__
22
23 #include <gtkmm/eventbox.h>
24
25 namespace ARDOUR {
26         class Session;
27 }
28
29 class Editor;
30
31 /** Class to provide a visual summary of the contents of an editor window; represents
32  *  the whole session as a set of lines, one per region view.
33  */
34 class EditorSummary : public Gtk::EventBox
35 {
36 public:
37         EditorSummary (Editor *);
38         ~EditorSummary ();
39
40         void set_session (ARDOUR::Session *);
41         void set_dirty ();
42         void set_overlays_dirty ();
43
44 private:
45         void centre_on_click (GdkEventButton *);
46         bool on_expose_event (GdkEventExpose *);
47         void on_size_request (Gtk::Requisition *);
48         void on_size_allocate (Gtk::Allocation &);
49         bool on_button_press_event (GdkEventButton *);
50         bool on_button_release_event (GdkEventButton *);
51         bool on_motion_notify_event (GdkEventMotion *);
52         bool on_scroll_event (GdkEventScroll *);
53
54         void render (cairo_t *);
55         GdkPixmap* get_pixmap (GdkDrawable *);
56         void render_region (RegionView*, cairo_t*, nframes_t, double) const;
57         void get_editor (std::pair<double, double> *, std::pair<double, double> *) const;
58         void set_editor (std::pair<double, double> const &, std::pair<double, double> const &);
59         void playhead_position_changed (nframes64_t);
60
61         Editor* _editor; ///< our editor
62         ARDOUR::Session* _session; ///< our session
63         GdkPixmap* _pixmap; ///< pixmap containing a rendering of the region views, or 0
64         bool _regions_dirty; ///< true if _pixmap requires re-rendering, otherwise false
65         int _width; ///< pixmap width
66         int _height; ///< pixmap height
67         double _x_scale; ///< pixels per frame for the x axis of the pixmap
68         double _y_scale;
69         double _last_playhead;
70
71         std::pair<double, double> _start_editor_x;
72         std::pair<double, double> _start_editor_y;
73         double _start_mouse_x;
74         double _start_mouse_y;
75
76         bool _move_dragging;
77         double _x_offset;
78         double _y_offset;
79         bool _moved;
80
81         bool _zoom_dragging;
82         bool _zoom_left;
83 };
84
85 #endif