2 Copyright (C) 2009 Paul Davis
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.
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.
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.
20 #ifndef __gtk_ardour_editor_summary_h__
21 #define __gtk_ardour_editor_summary_h__
23 #include "gtkmm2ext/cairo_widget.h"
24 #include "editor_component.h"
32 /** Class to provide a visual summary of the contents of an editor window; represents
33 * the whole session as a set of lines, one per region view.
35 class EditorSummary : public CairoWidget, public EditorComponent, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
38 EditorSummary (Editor *);
40 void set_session (ARDOUR::Session *);
41 void set_overlays_dirty ();
42 void set_background_dirty ();
43 void routes_added (std::list<RouteTimeAxisView*> const &);
46 void on_size_allocate (Gtk::Allocation& alloc);
63 void on_size_request (Gtk::Requisition *);
64 bool on_button_press_event (GdkEventButton *);
65 bool on_button_release_event (GdkEventButton *);
66 bool on_motion_notify_event (GdkEventMotion *);
67 bool on_scroll_event (GdkEventScroll *);
68 bool on_key_press_event (GdkEventKey*);
69 bool on_key_release_event (GdkEventKey*);
70 bool on_enter_notify_event (GdkEventCrossing*);
71 bool on_leave_notify_event (GdkEventCrossing*);
73 void centre_on_click (GdkEventButton *);
74 void render (cairo_t *, cairo_rectangle_t*);
75 void render_region (RegionView*, cairo_t*, double) const;
76 void get_editor (std::pair<double, double> *, std::pair<double, double> *) const;
77 void set_editor (double, double);
78 void set_editor (std::pair<double, double>, double);
79 void set_editor (std::pair<double, double>, std::pair<double, double>);
80 void set_editor_x (double);
81 void set_editor_x (std::pair<double, double>);
82 void set_editor_y (double);
83 void set_editor_y (std::pair<double, double>);
84 void playhead_position_changed (framepos_t);
85 double summary_y_to_editor (double) const;
86 double editor_y_to_summary (double) const;
87 Position get_position (double, double) const;
88 void set_cursor (Position);
89 void route_gui_changed (std::string);
90 bool suspending_editor_updates () const;
91 double playhead_frame_to_position (framepos_t) const;
92 framepos_t position_to_playhead_frame_to_position (double pos) const;
93 void set_overlays_dirty (int, int, int, int);
95 framepos_t _start; ///< start frame of the overview
96 framepos_t _end; ///< end frame of the overview
98 /** fraction of the session length by which the overview size should extend past the start and end markers */
99 double _overhang_fraction;
101 double _x_scale; ///< pixels per frame for the x axis of the pixmap
102 double _track_height;
103 double _last_playhead;
105 std::pair<double, double> _start_editor_x;
106 std::pair<double, double> _start_editor_y;
107 double _start_mouse_x;
108 double _start_mouse_y;
110 Position _start_position;
114 std::pair<double, double> _view_rectangle_x;
115 std::pair<double, double> _view_rectangle_y;
117 std::pair<double, double> _pending_editor_x;
118 std::pair<double, double> _pending_editor_y;
119 bool _pending_editor_changed;
122 Position _zoom_position;
124 bool _old_follow_playhead;
125 cairo_surface_t* _image;
126 void render_background_image ();
127 bool _background_dirty;
129 PBD::ScopedConnectionList position_connection;
130 PBD::ScopedConnection route_ctrl_id_connection;
131 PBD::ScopedConnectionList region_property_connection;