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
*, ArdourCanvas::Canvas
& canvas
);
74 virtual ~RouteTimeAxisView ();
76 void set_route (boost::shared_ptr
<ARDOUR::Route
>);
78 void show_selection (TimeSelection
&);
79 void set_button_names ();
81 void set_samples_per_unit (double);
82 void set_height (uint32_t h
);
83 void show_timestretch (framepos_t start
, framepos_t end
);
84 void hide_timestretch ();
85 void selection_click (GdkEventButton
*);
86 void set_selected_points (PointSelection
&);
87 void set_selected_regionviews (RegionSelection
&);
88 void get_selectables (ARDOUR::framepos_t start
, ARDOUR::framepos_t end
, double top
, double bot
, std::list
<Selectable
*>&);
89 void get_inverted_selectables (Selection
&, std::list
<Selectable
*>&);
90 void set_layer_display (LayerDisplay d
, bool apply_to_selection
= false);
91 LayerDisplay
layer_display () const;
93 boost::shared_ptr
<ARDOUR::Region
> find_next_region (framepos_t pos
, ARDOUR::RegionPoint
, int32_t dir
);
94 framepos_t
find_next_region_boundary (framepos_t pos
, int32_t dir
);
96 /* Editing operations */
97 void cut_copy_clear (Selection
&, Editing::CutCopyOp
);
98 bool paste (ARDOUR::framepos_t
, float times
, Selection
&, size_t nth
);
99 RegionView
* combine_regions ();
100 void uncombine_regions ();
101 void uncombine_region (RegionView
*);
102 void toggle_automation_track (const Evoral::Parameter
& param
);
104 /* The editor calls these when mapping an operation across multiple tracks */
105 void use_new_playlist (bool prompt
, std::vector
<boost::shared_ptr
<ARDOUR::Playlist
> > const &);
106 void use_copy_playlist (bool prompt
, std::vector
<boost::shared_ptr
<ARDOUR::Playlist
> > const &);
107 void clear_playlist ();
109 /* group playlist name resolving */
110 std::string
resolve_new_group_playlist_name(std::string
&, std::vector
<boost::shared_ptr
<ARDOUR::Playlist
> > const &);
112 void build_playlist_menu ();
114 void add_underlay (StreamView
*, bool update_xml
= true);
115 void remove_underlay (StreamView
*);
116 void build_underlay_menu(Gtk::Menu
*);
118 int set_state (const XMLNode
&, int version
);
120 virtual void create_automation_child (const Evoral::Parameter
& param
, bool show
) = 0;
122 typedef std::map
<Evoral::Parameter
, boost::shared_ptr
<AutomationTimeAxisView
> > AutomationTracks
;
123 AutomationTracks
automation_tracks() { return _automation_tracks
; }
125 boost::shared_ptr
<AutomationTimeAxisView
> automation_child(Evoral::Parameter param
);
126 virtual Gtk::CheckMenuItem
* automation_child_menu_item (Evoral::Parameter
);
128 std::string
name() const;
129 StreamView
* view() const { return _view
; }
130 ARDOUR::RouteGroup
* route_group() const;
131 boost::shared_ptr
<ARDOUR::Playlist
> playlist() const;
138 void io_changed (ARDOUR::IOChange
, void *);
139 void meter_changed ();
140 void effective_gain_display () { gm
.effective_gain_display(); }
142 std::string
state_id() const;
144 static void setup_slider_pix ();
147 friend class StreamView
;
149 struct ProcessorAutomationNode
{
150 Evoral::Parameter what
;
151 Gtk::CheckMenuItem
* menu_item
;
152 boost::shared_ptr
<AutomationTimeAxisView
> view
;
153 RouteTimeAxisView
& parent
;
155 ProcessorAutomationNode (Evoral::Parameter w
, Gtk::CheckMenuItem
* mitem
, RouteTimeAxisView
& p
)
156 : what (w
), menu_item (mitem
), parent (p
) {}
158 ~ProcessorAutomationNode ();
161 struct ProcessorAutomationInfo
{
162 boost::shared_ptr
<ARDOUR::Processor
> processor
;
165 std::vector
<ProcessorAutomationNode
*> lines
;
167 ProcessorAutomationInfo (boost::shared_ptr
<ARDOUR::Processor
> i
)
168 : processor (i
), valid (true), menu (0) {}
170 ~ProcessorAutomationInfo ();
174 void update_diskstream_display ();
176 gint
route_group_click (GdkEventButton
*);
178 void processors_changed (ARDOUR::RouteProcessorChange
);
180 virtual void add_processor_to_subplugin_menu (boost::weak_ptr
<ARDOUR::Processor
>);
181 void remove_processor_automation_node (ProcessorAutomationNode
* pan
);
183 void processor_menu_item_toggled (RouteTimeAxisView::ProcessorAutomationInfo
*,
184 RouteTimeAxisView::ProcessorAutomationNode
*);
186 void processor_automation_track_hidden (ProcessorAutomationNode
*,
187 boost::shared_ptr
<ARDOUR::Processor
>);
189 void automation_track_hidden (Evoral::Parameter param
);
191 ProcessorAutomationNode
*
192 find_processor_automation_node (boost::shared_ptr
<ARDOUR::Processor
> i
, Evoral::Parameter
);
194 boost::shared_ptr
<AutomationLine
>
195 find_processor_automation_curve (boost::shared_ptr
<ARDOUR::Processor
> i
, Evoral::Parameter
);
197 void add_processor_automation_curve (boost::shared_ptr
<ARDOUR::Processor
> r
, Evoral::Parameter
);
198 void add_existing_processor_automation_curves (boost::weak_ptr
<ARDOUR::Processor
>);
200 void add_automation_child(Evoral::Parameter param
, boost::shared_ptr
<AutomationTimeAxisView
> track
, bool show
=true);
202 void reset_processor_automation_curves ();
204 void take_name_changed (void *src
);
205 void route_property_changed (const PBD::PropertyChange
&);
206 void name_entry_changed ();
208 void update_rec_display ();
210 virtual void label_view ();
212 void reset_samples_per_unit ();
213 void horizontal_position_changed ();
215 void set_color (Gdk::Color
const &);
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
);
237 void speed_changed ();
241 void color_handler ();
243 void region_view_added (RegionView
*);
245 void create_gain_automation_child (const Evoral::Parameter
&, bool);
247 void setup_processor_menu_and_curves ();
249 boost::shared_ptr
<AutomationTimeAxisView
> gain_track
;
252 ArdourCanvas::Canvas
& parent_canvas
;
255 Gtk::HBox other_button_hbox
;
256 Gtk::Table button_table
;
257 Gtk::Button processor_button
;
258 Gtk::Button route_group_button
;
259 Gtk::Button playlist_button
;
260 Gtk::Button automation_button
;
262 Gtk::Menu subplugin_menu
;
263 Gtk::Menu
* automation_action_menu
;
264 Gtk::MenuItem
* plugins_submenu_item
;
265 RouteGroupMenu
* route_group_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
, bool apply_to_selection
= false);
279 /** Information about all automatable processor parameters that apply to
280 * this route. The Amp processor is not included in this list.
282 std::list
<ProcessorAutomationInfo
*> processor_automation
;
284 typedef std::vector
<boost::shared_ptr
<AutomationLine
> > ProcessorAutomationCurves
;
285 ProcessorAutomationCurves processor_automation_curves
;
287 AutomationTracks _automation_tracks
;
288 typedef std::map
<Evoral::Parameter
, Gtk::CheckMenuItem
*> ParameterMenuMap
;
289 /** parameter -> menu item map for the main automation menu */
290 ParameterMenuMap _main_automation_menu_map
;
291 /** parameter -> menu item map for the plugin automation menu */
292 ParameterMenuMap _subplugin_menu_map
;
294 void post_construct ();
298 static Glib::RefPtr
<Gdk::Pixbuf
> slider
;
300 XMLNode
* underlay_xml_node
;
301 bool set_underlay_state();
303 typedef std::list
<StreamView
*> UnderlayList
;
304 UnderlayList _underlay_streams
;
305 typedef std::list
<RouteTimeAxisView
*> UnderlayMirrorList
;
306 UnderlayMirrorList _underlay_mirrors
;
308 bool _ignore_track_mode_change
; ///< true to ignore track mode change signals
311 #endif /* __ardour_route_time_axis_h__ */