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>
31 #include <gtkmm2ext/selector.h>
34 #include <ardour/types.h>
36 #include "ardour_dialog.h"
39 #include "time_axis_view.h"
41 #include "level_meter.h"
59 class RegionSelection;
61 class AutomationTimeAxisView;
63 class ProcessorAutomationLine;
66 class RouteTimeAxisView : public RouteUI, public TimeAxisView
69 RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
70 virtual ~RouteTimeAxisView ();
72 void show_selection (TimeSelection&);
74 void set_samples_per_unit (double);
75 void set_height (TimeAxisView::TrackHeight);
76 void show_timestretch (nframes_t start, nframes_t end);
77 void hide_timestretch ();
78 void selection_click (GdkEventButton*);
79 void set_selected_points (PointSelection&);
80 void set_selected_regionviews (RegionSelection&);
81 void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable *>&);
82 void get_inverted_selectables (Selection&, list<Selectable*>&);
83 bool show_automation(ARDOUR::Parameter param);
84 void set_layer_display (LayerDisplay d);
86 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
87 nframes64_t find_next_region_boundary (nframes64_t pos, int32_t dir);
89 /* Editing operations */
90 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
91 bool paste (nframes_t, float times, Selection&, size_t nth);
93 TimeAxisView::Children get_child_list();
95 /* The editor calls these when mapping an operation across multiple tracks */
96 void use_new_playlist (bool prompt);
97 void use_copy_playlist (bool prompt);
98 void clear_playlist ();
100 void build_playlist_menu (Gtk::Menu *);
102 /* This is a bit nasty to expose :/ */
103 struct RouteAutomationNode {
104 ARDOUR::Parameter param;
105 Gtk::CheckMenuItem* menu_item;
106 boost::shared_ptr<AutomationTimeAxisView> track;
108 RouteAutomationNode (ARDOUR::Parameter par, Gtk::CheckMenuItem* mi, boost::shared_ptr<AutomationTimeAxisView> tr)
109 : param (par), menu_item (mi), track (tr) {}
112 virtual void create_automation_child (ARDOUR::Parameter param, bool show) = 0;
114 typedef map<ARDOUR::Parameter, RouteAutomationNode*> AutomationTracks;
115 AutomationTracks automation_tracks() { return _automation_tracks; }
117 boost::shared_ptr<AutomationTimeAxisView> automation_child(ARDOUR::Parameter param);
120 StreamView* view() const { return _view; }
121 ARDOUR::RouteGroup* edit_group() const;
122 boost::shared_ptr<ARDOUR::Playlist> playlist() const;
129 void io_changed (ARDOUR::IOChange, void *);
130 void meter_changed (void *);
133 friend class StreamView;
135 struct ProcessorAutomationNode {
136 ARDOUR::Parameter what;
137 Gtk::CheckMenuItem* menu_item;
138 boost::shared_ptr<AutomationTimeAxisView> view;
139 RouteTimeAxisView& parent;
141 ProcessorAutomationNode (ARDOUR::Parameter w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
142 : what (w), menu_item (mitem), parent (p) {}
144 ~ProcessorAutomationNode ();
147 struct ProcessorAutomationInfo {
148 boost::shared_ptr<ARDOUR::Processor> processor;
151 vector<ProcessorAutomationNode*> lines;
153 ProcessorAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i)
154 : processor (i), valid (true), menu (0) {}
156 ~ProcessorAutomationInfo ();
160 void diskstream_changed ();
161 void update_diskstream_display ();
163 gint edit_click (GdkEventButton *);
165 void processors_changed ();
167 void add_processor_to_subplugin_menu (boost::shared_ptr<ARDOUR::Processor>);
168 void remove_processor_automation_node (ProcessorAutomationNode* pan);
170 void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo*,
171 RouteTimeAxisView::ProcessorAutomationNode*);
173 void processor_automation_track_hidden (ProcessorAutomationNode*,
174 boost::shared_ptr<ARDOUR::Processor>);
176 void automation_track_hidden (ARDOUR::Parameter param);
178 RouteAutomationNode* automation_track(ARDOUR::Parameter param);
179 RouteAutomationNode* automation_track(ARDOUR::AutomationType type);
181 ProcessorAutomationNode*
182 find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::Parameter);
184 boost::shared_ptr<AutomationLine>
185 find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::Parameter);
187 void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, ARDOUR::Parameter);
188 void add_existing_processor_automation_curves (boost::shared_ptr<ARDOUR::Processor>);
190 void add_automation_child(ARDOUR::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
192 void reset_processor_automation_curves ();
194 void take_name_changed (void *src);
195 void route_name_changed ();
196 void name_entry_changed ();
198 void update_rec_display ();
200 virtual void label_view ();
202 void add_edit_group_menu_item (ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
203 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
205 void reset_samples_per_unit ();
207 void select_track_color();
209 virtual void build_automation_action_menu ();
210 virtual void append_extra_display_menu_items () {}
211 void build_display_menu ();
213 void align_style_changed ();
214 void set_align_style (ARDOUR::AlignStyle);
216 virtual void set_playlist (boost::shared_ptr<ARDOUR::Playlist>);
217 void playlist_click ();
218 void show_playlist_selector ();
219 void playlist_changed ();
220 void playlist_modified ();
222 void rename_current_playlist ();
224 void automation_click ();
225 void toggle_automation_track (ARDOUR::Parameter param);
226 virtual void show_all_automation ();
227 virtual void show_existing_automation ();
228 virtual void hide_all_automation ();
230 void timestretch (nframes_t start, nframes_t end);
232 void visual_click ();
235 void speed_changed ();
239 void color_handler ();
241 void region_view_added (RegionView*);
242 void add_ghost_to_processor (RegionView*, boost::shared_ptr<AutomationTimeAxisView>);
245 ArdourCanvas::Canvas& parent_canvas;
248 Gtk::HBox other_button_hbox;
249 Gtk::Table button_table;
250 Gtk::Button processor_button;
251 Gtk::Button edit_group_button;
252 Gtk::Button playlist_button;
253 Gtk::Button size_button;
254 Gtk::Button automation_button;
255 Gtk::Button hide_button;
256 Gtk::Button visual_button;
258 Gtk::Menu subplugin_menu;
259 Gtk::Menu* automation_action_menu;
260 Gtk::Menu edit_group_menu;
261 Gtk::RadioMenuItem* align_existing_item;
262 Gtk::RadioMenuItem* align_capture_item;
263 Gtk::RadioMenuItem* normal_track_mode_item;
264 Gtk::RadioMenuItem* destructive_track_mode_item;
265 Gtk::Menu* playlist_menu;
266 Gtk::Menu* playlist_action_menu;
267 Gtk::MenuItem* playlist_item;
268 Gtk::Menu* mode_menu;
270 virtual Gtk::Menu* build_mode_menu() { return NULL; }
272 void use_playlist (boost::weak_ptr<ARDOUR::Playlist>);
274 ArdourCanvas::SimpleRect* timestretch_rect;
276 void set_track_mode (ARDOUR::TrackMode);
277 void _set_track_mode (ARDOUR::Track* track, ARDOUR::TrackMode mode, Gtk::RadioMenuItem* reset_item);
278 void track_mode_changed ();
280 list<ProcessorAutomationInfo*> processor_automation;
282 typedef vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves;
283 ProcessorAutomationCurves processor_automation_curves;
285 // Set from XML so context menu automation buttons can be correctly initialized
286 set<ARDOUR::Parameter> _show_automation;
288 AutomationTracks _automation_tracks;
290 sigc::connection modified_connection;
292 void post_construct ();
294 void set_state (const XMLNode&);
296 XMLNode* get_automation_child_xml_node (ARDOUR::Parameter param);
301 #endif /* __ardour_route_time_axis_h__ */