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"
57 class RegionSelection;
59 class AutomationTimeAxisView;
61 class ProcessorAutomationLine;
64 class RouteTimeAxisView : public RouteUI, public TimeAxisView
67 RouteTimeAxisView (PublicEditor&, ARDOUR::Session&, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
68 virtual ~RouteTimeAxisView ();
70 void show_selection (TimeSelection&);
72 void set_samples_per_unit (double);
73 void set_height (TimeAxisView::TrackHeight);
74 void show_timestretch (nframes_t start, nframes_t end);
75 void hide_timestretch ();
76 void selection_click (GdkEventButton*);
77 void set_selected_points (PointSelection&);
78 void set_selected_regionviews (RegionSelection&);
79 void get_selectables (nframes_t start, nframes_t end, double top, double bot, list<Selectable *>&);
80 void get_inverted_selectables (Selection&, list<Selectable*>&);
81 bool show_automation(ARDOUR::Parameter param);
82 void set_layer_display (LayerDisplay d);
84 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
86 /* Editing operations */
87 bool cut_copy_clear (Selection&, Editing::CutCopyOp);
88 bool paste (nframes_t, float times, Selection&, size_t nth);
90 TimeAxisView::Children get_child_list();
92 /* The editor calls these when mapping an operation across multiple tracks */
93 void use_new_playlist (bool prompt);
94 void use_copy_playlist (bool prompt);
95 void clear_playlist ();
97 void build_playlist_menu (Gtk::Menu *);
99 virtual void create_automation_child (ARDOUR::Parameter param, bool show) = 0;
102 StreamView* view() const { return _view; }
103 ARDOUR::RouteGroup* edit_group() const;
104 boost::shared_ptr<ARDOUR::Playlist> playlist() const;
107 friend class StreamView;
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 struct ProcessorAutomationNode {
119 ARDOUR::Parameter what;
120 Gtk::CheckMenuItem* menu_item;
121 boost::shared_ptr<AutomationTimeAxisView> view;
122 RouteTimeAxisView& parent;
124 ProcessorAutomationNode (ARDOUR::Parameter w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
125 : what (w), menu_item (mitem), parent (p) {}
127 ~ProcessorAutomationNode ();
130 struct ProcessorAutomationInfo {
131 boost::shared_ptr<ARDOUR::Processor> processor;
134 vector<ProcessorAutomationNode*> lines;
136 ProcessorAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i)
137 : processor (i), valid (true), menu (0) {}
139 ~ProcessorAutomationInfo ();
143 void diskstream_changed ();
144 void update_diskstream_display ();
146 gint edit_click (GdkEventButton *);
148 void processors_changed ();
150 void add_processor_to_subplugin_menu (boost::shared_ptr<ARDOUR::Processor>);
151 void remove_processor_automation_node (ProcessorAutomationNode* pan);
153 void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo*,
154 RouteTimeAxisView::ProcessorAutomationNode*);
156 void processor_automation_track_hidden (ProcessorAutomationNode*,
157 boost::shared_ptr<ARDOUR::Processor>);
159 void automation_track_hidden (ARDOUR::Parameter param);
161 RouteAutomationNode* automation_track(ARDOUR::Parameter param);
162 RouteAutomationNode* automation_track(ARDOUR::AutomationType type);
164 ProcessorAutomationNode*
165 find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::Parameter);
167 boost::shared_ptr<AutomationLine>
168 find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, ARDOUR::Parameter);
170 void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, ARDOUR::Parameter);
171 void add_existing_processor_automation_curves (boost::shared_ptr<ARDOUR::Processor>);
173 void add_automation_child(ARDOUR::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
175 void reset_processor_automation_curves ();
177 void take_name_changed (void *src);
178 void route_name_changed ();
179 void name_entry_changed ();
181 void update_rec_display ();
183 virtual void label_view ();
185 void add_edit_group_menu_item (ARDOUR::RouteGroup *, Gtk::RadioMenuItem::Group*);
186 void set_edit_group_from_menu (ARDOUR::RouteGroup *);
188 void reset_samples_per_unit ();
190 void select_track_color();
192 virtual void build_automation_action_menu ();
193 virtual void append_extra_display_menu_items () {}
194 void build_display_menu ();
196 void align_style_changed ();
197 void set_align_style (ARDOUR::AlignStyle);
199 virtual void set_playlist (boost::shared_ptr<ARDOUR::Playlist>);
200 void playlist_click ();
201 void show_playlist_selector ();
202 void playlist_changed ();
203 void playlist_modified ();
205 void rename_current_playlist ();
207 void automation_click ();
208 void toggle_automation_track (ARDOUR::Parameter param);
209 virtual void show_all_automation ();
210 virtual void show_existing_automation ();
211 virtual void hide_all_automation ();
213 void timestretch (nframes_t start, nframes_t end);
215 void visual_click ();
218 void speed_changed ();
222 void color_handler ();
224 void region_view_added (RegionView*);
225 void add_ghost_to_processor (RegionView*, boost::shared_ptr<AutomationTimeAxisView>);
228 ArdourCanvas::Canvas& parent_canvas;
231 Gtk::HBox other_button_hbox;
232 Gtk::Table button_table;
233 Gtk::Button processor_button;
234 Gtk::Button edit_group_button;
235 Gtk::Button playlist_button;
236 Gtk::Button size_button;
237 Gtk::Button automation_button;
238 Gtk::Button hide_button;
239 Gtk::Button visual_button;
241 Gtk::Menu subplugin_menu;
242 Gtk::Menu* automation_action_menu;
243 Gtk::Menu edit_group_menu;
244 Gtk::RadioMenuItem* align_existing_item;
245 Gtk::RadioMenuItem* align_capture_item;
246 Gtk::RadioMenuItem* normal_track_mode_item;
247 Gtk::RadioMenuItem* destructive_track_mode_item;
248 Gtk::Menu* playlist_menu;
249 Gtk::Menu* playlist_action_menu;
250 Gtk::MenuItem* playlist_item;
251 Gtk::Menu* mode_menu;
253 virtual Gtk::Menu* build_mode_menu() { return NULL; }
255 void use_playlist (boost::weak_ptr<ARDOUR::Playlist>);
257 ArdourCanvas::SimpleRect* timestretch_rect;
259 void set_track_mode (ARDOUR::TrackMode);
260 void _set_track_mode (ARDOUR::Track* track, ARDOUR::TrackMode mode, Gtk::RadioMenuItem* reset_item);
261 void track_mode_changed ();
263 list<ProcessorAutomationInfo*> processor_automation;
265 typedef vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves;
266 ProcessorAutomationCurves processor_automation_curves;
268 // Set from XML so context menu automation buttons can be correctly initialized
269 set<ARDOUR::Parameter> _show_automation;
271 typedef map<ARDOUR::Parameter, RouteAutomationNode*> AutomationTracks;
272 AutomationTracks _automation_tracks;
274 sigc::connection modified_connection;
276 void post_construct ();
278 void set_state (const XMLNode&);
280 XMLNode* get_automation_child_xml_node (ARDOUR::Parameter param);
283 #endif /* __ardour_route_time_axis_h__ */