2 * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
3 * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
4 * Copyright (C) 2012-2017 Robin Gareus <robin@gareus.org>
5 * Copyright (C) 2017-2019 Ben Loftis <ben@harrisonconsoles.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #ifndef __gtk_ardour_editor_summary_h__
23 #define __gtk_ardour_editor_summary_h__
25 #include "gtkmm2ext/cairo_widget.h"
26 #include "editor_component.h"
34 /** Class to provide a visual summary of the contents of an editor window; represents
35 * the whole session as a set of lines, one per region view.
37 class EditorSummary : public CairoWidget, public EditorComponent, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList
40 EditorSummary (Editor *);
43 void set_session (ARDOUR::Session *);
44 void set_overlays_dirty ();
45 void set_background_dirty ();
46 void routes_added (std::list<RouteTimeAxisView*> const &);
49 void parameter_changed (std::string);
50 void on_size_allocate (Gtk::Allocation& alloc);
60 void on_size_request (Gtk::Requisition *);
61 bool on_button_press_event (GdkEventButton *);
62 bool on_button_release_event (GdkEventButton *);
63 bool on_motion_notify_event (GdkEventMotion *);
64 bool on_scroll_event (GdkEventScroll *);
65 bool on_key_press_event (GdkEventKey*);
66 bool on_key_release_event (GdkEventKey*);
67 bool on_enter_notify_event (GdkEventCrossing*);
68 bool on_leave_notify_event (GdkEventCrossing*);
70 void reset_to_extents ();
72 void centre_on_click (GdkEventButton *);
73 void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
74 void render_region (RegionView*, cairo_t*, double) const;
75 void get_editor (std::pair<double, double>* x, std::pair<double, double>* y = NULL) const;
76 void set_editor (double);
77 void set_editor (std::pair<double, double>);
78 void set_editor_x (double);
79 void set_editor_x (std::pair<double, double>);
80 void playhead_position_changed (samplepos_t);
81 double editor_y_to_summary (double) const;
82 Position get_position (double, double) const;
83 void set_cursor (Position);
84 void route_gui_changed (PBD::PropertyChange const&);
85 bool suspending_editor_updates () const;
86 double playhead_sample_to_position (samplepos_t) const;
87 samplepos_t position_to_playhead_sample_to_position (double pos) const;
88 void set_overlays_dirty_rect (int, int, int, int);
90 void summary_zoom_step ( int steps );
92 samplepos_t _start; ///< start sample of the overview
93 samplepos_t _end; ///< end sample of the overview
95 samplepos_t _leftmost; ///< the earliest sample we ever viewed
96 samplepos_t _rightmost; ///< the latest sample we ever viewed
98 double _x_scale; ///< pixels per sample for the x axis of the pixmap
100 double _last_playhead;
102 std::pair<double, double> _start_editor_x;
103 double _start_mouse_x;
104 double _start_mouse_y;
106 Position _start_position;
111 uint32_t _phead_color;
120 std::pair<double, double> _view_rectangle_x;
121 std::pair<double, double> _view_rectangle_y;
123 std::pair<double, double> _pending_editor_x;
124 std::pair<double, double> _pending_editor_y;
125 bool _pending_editor_changed;
127 bool _zoom_trim_dragging;
128 Position _zoom_trim_position;
130 bool _old_follow_playhead;
131 cairo_surface_t* _image;
132 void render_background_image ();
133 bool _background_dirty;
135 PBD::ScopedConnectionList position_connection;
136 PBD::ScopedConnection route_ctrl_id_connection;
137 PBD::ScopedConnectionList region_property_connection;