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_dialog.h"
44 #include "time_axis_view.h"
46 #include "gain_meter.h"
62 class RegionSelection;
64 class AutomationTimeAxisView;
66 class ProcessorAutomationLine;
70 class RouteTimeAxisView : public RouteUI, public TimeAxisView
73 RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>, ArdourCanvas::Canvas& canvas);
74 virtual ~RouteTimeAxisView ();
76 void show_selection (TimeSelection&);
77 void set_button_names ();
79 void set_samples_per_unit (double);
80 void set_height (uint32_t h);
81 void show_timestretch (nframes_t start, nframes_t end);
82 void hide_timestretch ();
83 void selection_click (GdkEventButton*);
84 void set_selected_points (PointSelection&);
85 void set_selected_regionviews (RegionSelection&);
86 void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&);
87 void get_inverted_selectables (Selection&, std::list<Selectable*>&);
88 void set_layer_display (LayerDisplay d);
89 LayerDisplay layer_display () const;
91 boost::shared_ptr<ARDOUR::Region> find_next_region (nframes_t pos, ARDOUR::RegionPoint, int32_t dir);
92 nframes64_t find_next_region_boundary (nframes64_t pos, int32_t dir);
94 /* Editing operations */
95 void cut_copy_clear (Selection&, Editing::CutCopyOp);
96 bool paste (ARDOUR::framepos_t, float times, Selection&, size_t nth);
98 void toggle_automation_track (const Evoral::Parameter& param);
100 /* The editor calls these when mapping an operation across multiple tracks */
101 void use_new_playlist (bool prompt, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
102 void use_copy_playlist (bool prompt, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
103 void clear_playlist ();
105 /* group playlist name resolving */
106 std::string resolve_new_group_playlist_name(std::string &, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
109 void build_playlist_menu (Gtk::Menu *);
111 void add_underlay (StreamView*, bool update_xml = true);
112 void remove_underlay (StreamView*);
113 void build_underlay_menu(Gtk::Menu*);
115 int set_state (const XMLNode&, int version);
117 virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0;
119 /* make sure we get the right version of this */
121 XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return RouteUI::get_automation_child_xml_node (param); }
123 typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
124 AutomationTracks automation_tracks() { return _automation_tracks; }
126 boost::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param);
127 virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
129 std::string name() const;
130 StreamView* view() const { return _view; }
131 ARDOUR::RouteGroup* route_group() const;
132 boost::shared_ptr<ARDOUR::Playlist> playlist() const;
139 void io_changed (ARDOUR::IOChange, void *);
140 void meter_changed ();
141 void effective_gain_display () { gm.effective_gain_display(); }
143 static void setup_slider_pix ();
146 friend class StreamView;
148 struct ProcessorAutomationNode {
149 Evoral::Parameter what;
150 Gtk::CheckMenuItem* menu_item;
151 boost::shared_ptr<AutomationTimeAxisView> view;
152 RouteTimeAxisView& parent;
154 ProcessorAutomationNode (Evoral::Parameter w, Gtk::CheckMenuItem* mitem, RouteTimeAxisView& p)
155 : what (w), menu_item (mitem), parent (p) {}
157 ~ProcessorAutomationNode ();
160 struct ProcessorAutomationInfo {
161 boost::shared_ptr<ARDOUR::Processor> processor;
164 std::vector<ProcessorAutomationNode*> lines;
166 ProcessorAutomationInfo (boost::shared_ptr<ARDOUR::Processor> i)
167 : processor (i), valid (true), menu (0) {}
169 ~ProcessorAutomationInfo ();
173 void update_diskstream_display ();
175 gint edit_click (GdkEventButton *);
177 void processors_changed (ARDOUR::RouteProcessorChange);
179 virtual void add_processor_to_subplugin_menu (boost::weak_ptr<ARDOUR::Processor>);
180 void remove_processor_automation_node (ProcessorAutomationNode* pan);
182 void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo*,
183 RouteTimeAxisView::ProcessorAutomationNode*);
185 void processor_automation_track_hidden (ProcessorAutomationNode*,
186 boost::shared_ptr<ARDOUR::Processor>);
188 void automation_track_hidden (Evoral::Parameter param);
190 ProcessorAutomationNode*
191 find_processor_automation_node (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
193 boost::shared_ptr<AutomationLine>
194 find_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
196 void add_processor_automation_curve (boost::shared_ptr<ARDOUR::Processor> r, Evoral::Parameter);
197 void add_existing_processor_automation_curves (boost::weak_ptr<ARDOUR::Processor>);
199 void add_automation_child(Evoral::Parameter param, boost::shared_ptr<AutomationTimeAxisView> track, bool show=true);
201 void reset_processor_automation_curves ();
203 void take_name_changed (void *src);
204 void route_property_changed (const PBD::PropertyChange&);
205 void name_entry_changed ();
207 void update_rec_display ();
209 virtual void label_view ();
211 void set_route_group_from_menu (ARDOUR::RouteGroup *);
213 void reset_samples_per_unit ();
215 void select_track_color();
217 virtual void build_automation_action_menu ();
218 virtual void append_extra_display_menu_items () {}
219 void build_display_menu ();
221 void align_style_changed ();
222 void set_align_style (ARDOUR::AlignStyle);
224 void playlist_click ();
225 void show_playlist_selector ();
226 void playlist_changed ();
228 void rename_current_playlist ();
230 void automation_click ();
231 virtual void show_all_automation ();
232 virtual void show_existing_automation ();
233 virtual void hide_all_automation ();
235 void timestretch (nframes_t start, nframes_t end);
237 void speed_changed ();
241 void color_handler ();
243 void region_view_added (RegionView*);
246 ArdourCanvas::Canvas& parent_canvas;
249 Gtk::HBox other_button_hbox;
250 Gtk::Table button_table;
251 Gtk::Button processor_button;
252 Gtk::Button route_group_button;
253 Gtk::Button playlist_button;
254 Gtk::Button automation_button;
256 Gtk::Menu subplugin_menu;
257 Gtk::Menu* automation_action_menu;
258 Gtk::MenuItem* plugins_submenu_item;
259 RouteGroupMenu* route_group_menu;
260 Gtk::RadioMenuItem* align_existing_item;
261 Gtk::RadioMenuItem* align_capture_item;
262 Gtk::RadioMenuItem* normal_track_mode_item;
263 Gtk::RadioMenuItem* non_layered_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;
269 Gtk::Menu* color_mode_menu;
271 virtual Gtk::Menu* build_color_mode_menu() { return 0; }
273 void use_playlist (Gtk::RadioMenuItem *item, boost::weak_ptr<ARDOUR::Playlist> wpl);
275 ArdourCanvas::SimpleRect* timestretch_rect;
277 void set_track_mode (ARDOUR::TrackMode);
278 void _set_track_mode (ARDOUR::Track* track, ARDOUR::TrackMode mode, Gtk::RadioMenuItem* reset_item, Gtk::RadioMenuItem* reset_item_2);
279 void track_mode_changed ();
281 std::list<ProcessorAutomationInfo*> processor_automation;
283 typedef std::vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves;
284 ProcessorAutomationCurves processor_automation_curves;
286 AutomationTracks _automation_tracks;
287 typedef std::map<Evoral::Parameter, Gtk::CheckMenuItem*> ParameterMenuMap;
288 /** parameter -> menu item map for the main automation menu */
289 ParameterMenuMap _main_automation_menu_map;
290 /** parameter -> menu item map for the plugin automation menu */
291 ParameterMenuMap _subplugin_menu_map;
293 void post_construct ();
297 static Glib::RefPtr<Gdk::Pixbuf> slider;
299 XMLNode* underlay_xml_node;
300 bool set_underlay_state();
302 typedef std::list<StreamView*> UnderlayList;
303 UnderlayList _underlay_streams;
304 typedef std::list<RouteTimeAxisView*> UnderlayMirrorList;
305 UnderlayMirrorList _underlay_mirrors;
307 bool _ignore_track_mode_change; ///< true to ignore track mode change signals
310 #endif /* __ardour_route_time_axis_h__ */