2 * Copyright (C) 2006-2008 Sampo Savolainen <v2@iki.fi>
3 * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
4 * Copyright (C) 2006-2017 Paul Davis <paul@linuxaudiosystems.com>
5 * Copyright (C) 2007 Doug McLain <doug@nostar.net>
6 * Copyright (C) 2008-2012 Carl Hetherington <carl@carlh.net>
7 * Copyright (C) 2014-2015 Ben Loftis <ben@harrisonconsoles.com>
8 * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef __ardour_route_time_axis_h__
26 #define __ardour_route_time_axis_h__
31 #include <gtkmm/table.h>
32 #include <gtkmm/button.h>
33 #include <gtkmm/box.h>
34 #include <gtkmm/menu.h>
35 #include <gtkmm/menuitem.h>
36 #include <gtkmm/radiomenuitem.h>
37 #include <gtkmm/checkmenuitem.h>
38 #include <gtkmm/adjustment.h>
40 #include "widgets/ardour_button.h"
42 #include "ardour/playlist.h"
43 #include "ardour/types.h"
45 #include "ardour_dialog.h"
48 #include "stripable_time_axis.h"
49 #include "gain_meter.h"
61 namespace ArdourCanvas {
69 class RegionSelection;
71 class AutomationTimeAxisView;
73 class ProcessorAutomationLine;
78 class RouteTimeAxisView : public RouteUI, public StripableTimeAxisView
81 RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
82 virtual ~RouteTimeAxisView ();
84 std::string name() const;
85 Gdk::Color color () const;
86 bool marked_for_display () const;
87 bool set_marked_for_display (bool);
89 boost::shared_ptr<ARDOUR::Stripable> stripable() const { return RouteUI::stripable(); }
91 void set_route (boost::shared_ptr<ARDOUR::Route>);
93 void show_selection (TimeSelection&);
94 void set_button_names ();
96 void set_samples_per_pixel (double);
97 void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
98 void show_timestretch (samplepos_t start, samplepos_t end, int layers, int layer);
99 void hide_timestretch ();
100 void selection_click (GdkEventButton*);
101 void set_selected_points (PointSelection&);
102 void set_selected_regionviews (RegionSelection&);
103 void get_selectables (ARDOUR::samplepos_t start, ARDOUR::samplepos_t end, double top, double bot, std::list<Selectable *>&, bool within = false);
104 void get_inverted_selectables (Selection&, std::list<Selectable*>&);
105 void set_layer_display (LayerDisplay d, bool apply_to_selection = false);
106 LayerDisplay layer_display () const;
108 boost::shared_ptr<ARDOUR::Region> find_next_region (samplepos_t pos, ARDOUR::RegionPoint, int32_t dir);
109 samplepos_t find_next_region_boundary (samplepos_t pos, int32_t dir);
111 /* Editing operations */
112 void cut_copy_clear (Selection&, Editing::CutCopyOp);
113 bool paste (ARDOUR::samplepos_t, const Selection&, PasteContext& ctx, const int32_t sub_num);
114 RegionView* combine_regions ();
115 void uncombine_regions ();
116 void uncombine_region (RegionView*);
117 void toggle_automation_track (const Evoral::Parameter& param);
118 void fade_range (TimeSelection&);
120 /* The editor calls these when mapping an operation across multiple tracks */
121 void use_new_playlist (bool prompt, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &, bool copy);
122 void clear_playlist ();
124 /* group playlist name resolving */
125 std::string resolve_new_group_playlist_name(std::string &, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
127 void build_playlist_menu ();
129 void add_underlay (StreamView*, bool update_xml = true);
130 void remove_underlay (StreamView*);
131 void build_underlay_menu(Gtk::Menu*);
133 int set_state (const XMLNode&, int version);
135 virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
137 StreamView* view() const { return _view; }
138 ARDOUR::RouteGroup* route_group() const;
139 boost::shared_ptr<ARDOUR::Playlist> playlist() const;
146 void io_changed (ARDOUR::IOChange, void *);
147 void meter_changed ();
148 void effective_gain_display () { gm.effective_gain_display(); }
150 std::string state_id() const;
153 friend class StreamView;
155 struct ProcessorAutomationNode {
156 Evoral::Parameter what;
157 Gtk::CheckMenuItem* menu_item;
158 boost::shared_ptr<AutomationTimeAxisView> view;
159 RouteTimeAxisView& parent;
161 ProcessorAutomationNode (Evoral::Parameter w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
162 : what (w), menu_item (mitem), parent (p) {}
164 ~ProcessorAutomationNode ();
167 struct ProcessorAutomationInfo {
168 boost::shared_ptr<ARDOUR::Processor> processor;
171 std::vector<ProcessorAutomationNode*> lines;
173 ProcessorAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i)
174 : processor (i), valid (true), menu (0) {}
176 ~ProcessorAutomationInfo ();
180 void update_diskstream_display ();
182 bool route_group_click (GdkEventButton *);
184 virtual void processors_changed (ARDOUR::RouteProcessorChange);
186 virtual void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
187 void remove_processor_automation_node (ProcessorAutomationNode* pan);
189 void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo*,
190 RouteTimeAxisView::ProcessorAutomationNode*);
192 void processor_automation_track_hidden (ProcessorAutomationNode*,
193 boost::shared_ptr<ARDOUR::Processor>);
196 ProcessorAutomationNode*
197 find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
199 boost::shared_ptr<AutomationLine>
200 find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
202 void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, Evoral::Parameter);
203 void add_existing_processor_automation_curves (boost::weak_ptr<ARDOUR::Processor>);
206 void reset_processor_automation_curves ();
208 void take_name_changed (void *src);
209 void route_property_changed (const PBD::PropertyChange&);
210 bool name_entry_changed (std::string const&);
212 virtual void toggle_channel_selector () {}
214 void blink_rec_display (bool onoff);
216 virtual void label_view ();
218 virtual void build_automation_action_menu (bool);
219 virtual void append_extra_display_menu_items () {}
220 void build_display_menu ();
222 void set_align_choice (Gtk::RadioMenuItem*, ARDOUR::AlignChoice, bool apply_to_selection = false);
224 bool playlist_click (GdkEventButton *);
225 void show_playlist_selector ();
226 void playlist_changed ();
228 void rename_current_playlist ();
230 bool automation_click (GdkEventButton *);
232 virtual void show_all_automation (bool apply_to_selection = false);
233 virtual void show_existing_automation (bool apply_to_selection = false);
234 virtual void hide_all_automation (bool apply_to_selection = false);
236 void timestretch (samplepos_t start, samplepos_t end);
237 void speed_changed ();
239 void color_handler ();
240 void region_view_added (RegionView*);
241 void create_gain_automation_child (const Evoral::Parameter &, bool);
242 void create_trim_automation_child (const Evoral::Parameter &, bool);
243 void create_mute_automation_child (const Evoral::Parameter &, bool);
244 void setup_processor_menu_and_curves ();
245 void route_color_changed ();
246 bool can_edit_name() const;
250 Gtk::HBox other_button_hbox;
251 Gtk::Table button_table;
252 ArdourWidgets::ArdourButton route_group_button;
253 ArdourWidgets::ArdourButton playlist_button;
254 ArdourWidgets::ArdourButton automation_button;
255 ArdourWidgets::ArdourButton number_label;
257 Gtk::Menu subplugin_menu;
258 Gtk::Menu* automation_action_menu;
259 Gtk::MenuItem* plugins_submenu_item;
260 RouteGroupMenu* route_group_menu;
261 Gtk::Menu* playlist_action_menu;
262 Gtk::MenuItem* playlist_item;
264 void use_playlist (Gtk::RadioMenuItem *item, boost::weak_ptr<ARDOUR::Playlist> wpl);
266 ArdourCanvas::Rectangle* timestretch_rect;
268 /** Information about all automatable processor parameters that apply to
269 * this route. The Amp processor is not included in this list.
271 std::list<ProcessorAutomationInfo*> processor_automation;
273 typedef std::vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves;
274 ProcessorAutomationCurves processor_automation_curves;
275 /** parameter -> menu item map for the plugin automation menu */
276 ParameterMenuMap _subplugin_menu_map;
278 void post_construct ();
282 XMLNode* underlay_xml_node;
283 bool set_underlay_state();
285 typedef std::list<StreamView*> UnderlayList;
286 UnderlayList _underlay_streams;
287 typedef std::list<RouteTimeAxisView*> UnderlayMirrorList;
288 UnderlayMirrorList _underlay_mirrors;
290 bool _ignore_set_layer_display;
293 void update_pan_track_visibility ();
295 /** Ensure that we have the appropriate automation lanes for panners.
297 * @param show true to show any new views that we create, otherwise false.
299 void ensure_pan_views (bool show = true);
301 std::list<boost::shared_ptr<AutomationTimeAxisView> > pan_tracks;
302 Gtk::CheckMenuItem* pan_automation_item;
306 void remove_child (boost::shared_ptr<TimeAxisView>);
307 void update_playlist_tip ();
308 void parameter_changed (std::string const & p);
309 void update_track_number_visibility();
311 void drop_instrument_ref ();
312 void reread_midnam ();
313 PBD::ScopedConnectionList midnam_connection;
316 #endif /* __ardour_route_time_axis_h__ */