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__
26 #include <gtkmm/table.h>
27 #include <gtkmm/button.h>
28 #include <gtkmm/box.h>
29 #include <gtkmm/menu.h>
30 #include <gtkmm/menuitem.h>
31 #include <gtkmm/radiomenuitem.h>
32 #include <gtkmm/checkmenuitem.h>
33 #include <gtkmm/adjustment.h>
35 #include <gtkmm2ext/selector.h>
36 #include <gtkmm2ext/slider_controller.h>
38 #include "ardour/playlist.h"
39 #include "ardour/types.h"
41 #include "ardour_button.h"
42 #include "ardour_dialog.h"
45 #include "time_axis_view.h"
46 #include "gain_meter.h"
58 namespace ArdourCanvas {
66 class RegionSelection;
68 class AutomationTimeAxisView;
70 class ProcessorAutomationLine;
74 class RouteTimeAxisView : public RouteUI, public TimeAxisView
77 RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
78 virtual ~RouteTimeAxisView ();
80 void set_route (boost::shared_ptr<ARDOUR::Route>);
82 void show_selection (TimeSelection&);
83 void set_button_names ();
85 void set_samples_per_pixel (double);
86 void set_height (uint32_t h);
87 void show_timestretch (framepos_t start, framepos_t end, int layers, int layer);
88 void hide_timestretch ();
89 void selection_click (GdkEventButton*);
90 void set_selected_points (PointSelection&);
91 void set_selected_regionviews (RegionSelection&);
92 void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&);
93 void get_inverted_selectables (Selection&, std::list<Selectable*>&);
94 void set_layer_display (LayerDisplay d, bool apply_to_selection = false);
95 LayerDisplay layer_display () const;
97 boost::shared_ptr<ARDOUR::Region> find_next_region (framepos_t pos, ARDOUR::RegionPoint, int32_t dir);
98 framepos_t find_next_region_boundary (framepos_t pos, int32_t dir);
100 /* Editing operations */
101 void cut_copy_clear (Selection&, Editing::CutCopyOp);
102 bool paste (ARDOUR::framepos_t, float times, Selection&, size_t nth);
103 RegionView* combine_regions ();
104 void uncombine_regions ();
105 void uncombine_region (RegionView*);
106 void toggle_automation_track (const Evoral::Parameter& param);
107 void fade_range (TimeSelection&);
109 /* The editor calls these when mapping an operation across multiple tracks */
110 void use_new_playlist (bool prompt, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
111 void use_copy_playlist (bool prompt, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
112 void clear_playlist ();
114 /* group playlist name resolving */
115 std::string resolve_new_group_playlist_name(std::string &, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
117 void build_playlist_menu ();
119 void add_underlay (StreamView*, bool update_xml = true);
120 void remove_underlay (StreamView*);
121 void build_underlay_menu(Gtk::Menu*);
123 int set_state (const XMLNode&, int version);
125 virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0;
127 typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
128 AutomationTracks automation_tracks() { return _automation_tracks; }
130 boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
131 virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
133 std::string name() const;
134 StreamView* view() const { return _view; }
135 ARDOUR::RouteGroup* route_group() const;
136 boost::shared_ptr<ARDOUR::Playlist> playlist() const;
143 void io_changed (ARDOUR::IOChange, void *);
144 void meter_changed ();
145 void effective_gain_display () { gm.effective_gain_display(); }
147 std::string state_id() const;
150 friend class StreamView;
152 struct ProcessorAutomationNode {
153 Evoral::Parameter what;
154 Gtk::CheckMenuItem* menu_item;
155 boost::shared_ptr<AutomationTimeAxisView> view;
156 RouteTimeAxisView& parent;
158 ProcessorAutomationNode (Evoral::Parameter w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
159 : what (w), menu_item (mitem), parent (p) {}
161 ~ProcessorAutomationNode ();
164 struct ProcessorAutomationInfo {
165 boost::shared_ptr<ARDOUR::Processor> processor;
168 std::vector<ProcessorAutomationNode*> lines;
170 ProcessorAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i)
171 : processor (i), valid (true), menu (0) {}
173 ~ProcessorAutomationInfo ();
177 void update_diskstream_display ();
179 gint route_group_click (GdkEventButton *);
181 void processors_changed (ARDOUR::RouteProcessorChange);
183 virtual void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
184 void remove_processor_automation_node (ProcessorAutomationNode* pan);
186 void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo*,
187 RouteTimeAxisView::ProcessorAutomationNode*);
189 void processor_automation_track_hidden (ProcessorAutomationNode*,
190 boost::shared_ptr<ARDOUR::Processor>);
192 void automation_track_hidden (Evoral::Parameter param);
194 ProcessorAutomationNode*
195 find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
197 boost::shared_ptr<AutomationLine>
198 find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
200 void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, Evoral::Parameter);
201 void add_existing_processor_automation_curves (boost::weak_ptr<ARDOUR::Processor>);
203 void add_automation_child(Evoral::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
205 void reset_processor_automation_curves ();
207 void take_name_changed (void *src);
208 void route_property_changed (const PBD::PropertyChange&);
209 void name_entry_changed ();
211 void blink_rec_display (bool onoff);
213 virtual void label_view ();
215 void reset_samples_per_pixel ();
217 virtual void build_automation_action_menu (bool);
218 virtual void append_extra_display_menu_items () {}
219 void build_display_menu ();
221 void set_align_choice (Gtk::RadioMenuItem*, ARDOUR::AlignChoice, bool apply_to_selection = false);
223 void playlist_click ();
224 void show_playlist_selector ();
225 void playlist_changed ();
227 void rename_current_playlist ();
229 void automation_click ();
231 virtual void show_all_automation (bool apply_to_selection = false);
232 virtual void show_existing_automation (bool apply_to_selection = false);
233 virtual void hide_all_automation (bool apply_to_selection = false);
235 void timestretch (framepos_t start, framepos_t end);
236 void speed_changed ();
238 void color_handler ();
239 void region_view_added (RegionView*);
240 void create_gain_automation_child (const Evoral::Parameter &, bool);
241 void create_mute_automation_child (const Evoral::Parameter &, bool);
242 void setup_processor_menu_and_curves ();
243 void route_color_changed ();
244 bool can_edit_name() const;
246 boost::shared_ptr<AutomationTimeAxisView> gain_track;
247 boost::shared_ptr<AutomationTimeAxisView> mute_track;
250 ArdourCanvas::Canvas& parent_canvas;
253 Gtk::HBox other_button_hbox;
254 Gtk::Table button_table;
255 ArdourButton route_group_button;
256 ArdourButton playlist_button;
257 ArdourButton automation_button;
258 ArdourButton number_label;
260 Gtk::Menu subplugin_menu;
261 Gtk::Menu* automation_action_menu;
262 Gtk::MenuItem* plugins_submenu_item;
263 RouteGroupMenu* route_group_menu;
264 Gtk::Menu* playlist_action_menu;
265 Gtk::MenuItem* playlist_item;
266 Gtk::Menu* mode_menu;
267 Gtk::Menu* color_mode_menu;
269 virtual Gtk::Menu* build_color_mode_menu() { return 0; }
271 void use_playlist (Gtk::RadioMenuItem *item, boost::weak_ptr<ARDOUR::Playlist> wpl);
273 ArdourCanvas::Rectangle* timestretch_rect;
275 void set_track_mode (ARDOUR::TrackMode, bool apply_to_selection = false);
277 /** Information about all automatable processor parameters that apply to
278 * this route. The Amp processor is not included in this list.
280 std::list<ProcessorAutomationInfo*> processor_automation;
282 typedef std::vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves;
283 ProcessorAutomationCurves processor_automation_curves;
285 AutomationTracks _automation_tracks;
286 typedef std::map<Evoral::Parameter, Gtk::CheckMenuItem*> ParameterMenuMap;
287 /** parameter -> menu item map for the main automation menu */
288 ParameterMenuMap _main_automation_menu_map;
289 /** parameter -> menu item map for the plugin automation menu */
290 ParameterMenuMap _subplugin_menu_map;
292 void post_construct ();
296 XMLNode* underlay_xml_node;
297 bool set_underlay_state();
299 typedef std::list<StreamView*> UnderlayList;
300 UnderlayList _underlay_streams;
301 typedef std::list<RouteTimeAxisView*> UnderlayMirrorList;
302 UnderlayMirrorList _underlay_mirrors;
304 bool _ignore_set_layer_display;
308 void remove_child (boost::shared_ptr<TimeAxisView>);
309 void update_playlist_tip ();
310 void parameter_changed (std::string const & p);
311 void update_track_number_visibility();
314 #endif /* __ardour_route_time_axis_h__ */