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 *);
41 void set_session (ARDOUR::Session *);
42 void set_overlays_dirty ();
43 void set_background_dirty ();
44 void routes_added (std::list<RouteTimeAxisView*> const &);
47 void parameter_changed (std::string);
48 void on_size_allocate (Gtk::Allocation& alloc);
58 void on_size_request (Gtk::Requisition *);
59 bool on_button_press_event (GdkEventButton *);
60 bool on_button_release_event (GdkEventButton *);
61 bool on_motion_notify_event (GdkEventMotion *);
62 bool on_scroll_event (GdkEventScroll *);
63 bool on_key_press_event (GdkEventKey*);
64 bool on_key_release_event (GdkEventKey*);
65 bool on_enter_notify_event (GdkEventCrossing*);
66 bool on_leave_notify_event (GdkEventCrossing*);
68 void reset_to_extents ();
70 void centre_on_click (GdkEventButton *);
71 void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
72 void render_region (RegionView*, cairo_t*, double) const;
73 void get_editor (std::pair<double, double>* x, std::pair<double, double>* y = NULL) const;
74 void set_editor (double);
75 void set_editor (std::pair<double, double>);
76 void set_editor_x (double);
77 void set_editor_x (std::pair<double, double>);
78 void playhead_position_changed (samplepos_t);
79 double editor_y_to_summary (double) const;
80 Position get_position (double, double) const;
81 void set_cursor (Position);
82 void route_gui_changed (PBD::PropertyChange const&);
83 bool suspending_editor_updates () const;
84 double playhead_sample_to_position (samplepos_t) const;
85 samplepos_t position_to_playhead_sample_to_position (double pos) const;
86 void set_overlays_dirty_rect (int, int, int, int);
88 void summary_zoom_step ( int steps );
90 samplepos_t _start; ///< start sample of the overview
91 samplepos_t _end; ///< end sample of the overview
93 samplepos_t _leftmost; ///< the earliest sample we ever viewed
94 samplepos_t _rightmost; ///< the latest sample we ever viewed
96 double _x_scale; ///< pixels per sample for the x axis of the pixmap
98 double _last_playhead;
100 std::pair<double, double> _start_editor_x;
101 double _start_mouse_x;
102 double _start_mouse_y;
104 Position _start_position;
115 std::pair<double, double> _view_rectangle_x;
116 std::pair<double, double> _view_rectangle_y;
118 std::pair<double, double> _pending_editor_x;
119 std::pair<double, double> _pending_editor_y;
120 bool _pending_editor_changed;
122 bool _zoom_trim_dragging;
123 Position _zoom_trim_position;
125 bool _old_follow_playhead;
126 cairo_surface_t* _image;
127 void render_background_image ();
128 bool _background_dirty;
130 PBD::ScopedConnectionList position_connection;
131 PBD::ScopedConnection route_ctrl_id_connection;
132 PBD::ScopedConnectionList region_property_connection;