2 Copyright (C) 2006 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 __ardour_route_time_axis_h__
21 #define __ardour_route_time_axis_h__
23 #include <gtkmm/table.h>
24 #include <gtkmm/button.h>
25 #include <gtkmm/box.h>
26 #include <gtkmm/menu.h>
27 #include <gtkmm/menuitem.h>
28 #include <gtkmm/radiomenuitem.h>
29 #include <gtkmm/checkmenuitem.h>
30 #include <gtkmm/adjustment.h>
32 #include <gtkmm2ext/selector.h>
33 #include <gtkmm2ext/slider_controller.h>
36 #include <ardour/types.h>
38 #include "ardour_dialog.h"
41 #include "time_axis_view.h"
43 #include "level_meter.h"
61 class RegionSelection;
63 class AutomationTimeAxisView;
65 class ProcessorAutomationLine;
68 class RouteTimeAxisView : public RouteUI, public TimeAxisView
71 RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
72 virtual ~RouteTimeAxisView ();
74 void show_selection (TimeSelection&);
76 void set_samples_per_unit (double);
77 void set_height (TimeAxisView::TrackHeight);
78 void show_timestretch (nframes_t start, nframes_t end);
79 void hide_timestretch ();
80 void selection_click (GdkEventButton*);
81 void set_selected_points (PointSelection&);
82 void set_selected_regionviews (RegionSelection&);
83 void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable *>&);
84 void get_inverted_selectables (Selection&, list<Selectable*>&);
85 bool show_automation(ARDOUR::Parameter param);
86 void set_layer_display (LayerDisplay d);
88 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
89 nframes64_t find_next_region_boundary (nframes64_t pos, int32_t dir);
91 /* Editing operations */
92 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
93 bool paste (nframes_t, float times, Selection&, size_t nth);
95 TimeAxisView::Children get_child_list();
97 /* The editor calls these when mapping an operation across multiple tracks */
98 void use_new_playlist (bool prompt);
99 void use_copy_playlist (bool prompt);
100 void clear_playlist ();
102 void build_playlist_menu (Gtk::Menu *);
104 void add_underlay (StreamView*, bool update_xml = true);
105 void remove_underlay (StreamView*);
106 void build_underlay_menu(Gtk::Menu*);
108 /* This is a bit nasty to expose :/ */
109 struct RouteAutomationNode {
110 ARDOUR::Parameter param;
111 Gtk::CheckMenuItem* menu_item;
112 boost::shared_ptr<AutomationTimeAxisView> track;
114 RouteAutomationNode (ARDOUR::Parameter par, Gtk::CheckMenuItem* mi, boost::shared_ptr<AutomationTimeAxisView> tr)
115 : param (par), menu_item (mi), track (tr) {}
118 virtual void create_automation_child (ARDOUR::Parameter param, bool show) = 0;
120 typedef map<ARDOUR::Parameter, RouteAutomationNode*> AutomationTracks;
121 AutomationTracks automation_tracks() { return _automation_tracks; }
123 boost::shared_ptr<AutomationTimeAxisView> automation_child(ARDOUR::Parameter param);
126 StreamView* view() const { return _view; }
127 ARDOUR::RouteGroup* edit_group() const;
128 boost::shared_ptr<ARDOUR::Playlist> playlist() const;
135 void io_changed (ARDOUR::IOChange, void *);
136 void meter_changed (void *);
137 void effective_gain_display ();
140 friend class StreamView;
142 struct ProcessorAutomationNode {
143 ARDOUR::Parameter what;
144 Gtk::CheckMenuItem* menu_item;
145 boost::shared_ptr<AutomationTimeAxisView> view;
146 RouteTimeAxisView& parent;
148 ProcessorAutomationNode (ARDOUR::Parameter w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
149 : what (w), menu_item (mitem), parent (p) {}
151 ~ProcessorAutomationNode ();
154 struct ProcessorAutomationInfo {
155 boost::shared_ptr<ARDOUR::Processor> processor;
158 vector<ProcessorAutomationNode*> lines;
160 ProcessorAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i)
161 : processor (i), valid (true), menu (0) {}
163 ~ProcessorAutomationInfo ();
167 void diskstream_changed ();
168 void update_diskstream_display ();
170 gint edit_click (GdkEventButton *);
172 void processors_changed ();
174 void add_processor_to_subplugin_menu (boost::shared_ptr<ARDOUR::Processor>);
175 void remove_processor_automation_node (ProcessorAutomationNode* pan);
177 void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo*,
178 RouteTimeAxisView::ProcessorAutomationNode*);
180 void processor_automation_track_hidden (ProcessorAutomationNode*,
181 boost::shared_ptr<ARDOUR::Processor>);
183 void automation_track_hidden (ARDOUR::Parameter param);
185 RouteAutomationNode* automation_track(ARDOUR::Parameter param);
186 RouteAutomationNode* automation_track(ARDOUR::AutomationType type);
188 ProcessorAutomationNode*
189 find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::Parameter);
191 boost::shared_ptr<AutomationLine>
192 find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::Parameter);
194 void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, ARDOUR::Parameter);
195 void add_existing_processor_automation_curves (boost::shared_ptr<ARDOUR::Processor>);
197 void add_automation_child(ARDOUR::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
199 void reset_processor_automation_curves ();
201 void take_name_changed (void *src);
202 void route_name_changed ();
203 void name_entry_changed ();
205 void update_rec_display ();
207 virtual void label_view ();
209 void add_edit_group_menu_item (ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
210 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
212 void reset_samples_per_unit ();
214 void select_track_color();
216 virtual void build_automation_action_menu ();
217 virtual void append_extra_display_menu_items () {}
218 void build_display_menu ();
220 void align_style_changed ();
221 void set_align_style (ARDOUR::AlignStyle);
223 virtual void set_playlist (boost::shared_ptr<ARDOUR::Playlist>);
224 void playlist_click ();
225 void show_playlist_selector ();
226 void playlist_changed ();
227 void playlist_modified ();
229 void rename_current_playlist ();
231 void automation_click ();
232 void toggle_automation_track (ARDOUR::Parameter param);
233 virtual void show_all_automation ();
234 virtual void show_existing_automation ();
235 virtual void hide_all_automation ();
237 void timestretch (nframes_t start, nframes_t end);
239 void visual_click ();
242 void speed_changed ();
246 void color_handler ();
248 void region_view_added (RegionView*);
251 ArdourCanvas::Canvas& parent_canvas;
254 Gtk::HBox other_button_hbox;
255 Gtk::Table button_table;
256 Gtk::Button processor_button;
257 Gtk::Button edit_group_button;
258 Gtk::Button playlist_button;
259 Gtk::Button size_button;
260 Gtk::Button automation_button;
261 Gtk::Button hide_button;
262 Gtk::Button visual_button;
264 Gtk::Menu subplugin_menu;
265 Gtk::Menu* automation_action_menu;
266 Gtk::Menu edit_group_menu;
267 Gtk::RadioMenuItem* align_existing_item;
268 Gtk::RadioMenuItem* align_capture_item;
269 Gtk::RadioMenuItem* normal_track_mode_item;
270 Gtk::RadioMenuItem* destructive_track_mode_item;
271 Gtk::Menu* playlist_menu;
272 Gtk::Menu* playlist_action_menu;
273 Gtk::MenuItem* playlist_item;
274 Gtk::Menu* mode_menu;
276 virtual Gtk::Menu* build_mode_menu() { return NULL; }
278 void use_playlist (boost::weak_ptr<ARDOUR::Playlist>);
280 ArdourCanvas::SimpleRect* timestretch_rect;
282 void set_track_mode (ARDOUR::TrackMode);
283 void _set_track_mode (ARDOUR::Track* track, ARDOUR::TrackMode mode, Gtk::RadioMenuItem* reset_item);
284 void track_mode_changed ();
286 list<ProcessorAutomationInfo*> processor_automation;
288 typedef vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves;
289 ProcessorAutomationCurves processor_automation_curves;
291 // Set from XML so context menu automation buttons can be correctly initialized
292 set<ARDOUR::Parameter> _show_automation;
294 AutomationTracks _automation_tracks;
296 sigc::connection modified_connection;
298 void post_construct ();
300 void set_state (const XMLNode&);
302 XMLNode* get_automation_child_xml_node (ARDOUR::Parameter param);
306 XMLNode* underlay_xml_node;
307 bool set_underlay_state();
309 typedef list<StreamView*> UnderlayList;
310 UnderlayList _underlay_streams;
311 typedef list<RouteTimeAxisView*> UnderlayMirrorList;
312 UnderlayMirrorList _underlay_mirrors;
314 Gtkmm2ext::HSliderController *gain_slider;
315 Gtk::Adjustment gain_adjustment;
316 static Glib::RefPtr<Gdk::Pixbuf> slider;
317 static int setup_slider_pix ();
318 void gain_adjusted();
320 gint start_gain_touch (GdkEventButton*);
321 gint end_gain_touch (GdkEventButton*);
322 void gain_changed ();
325 #endif /* __ardour_route_time_axis_h__ */