ardour
route_time_axis.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 Paul Davis
3 
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.
8 
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.
13 
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.
17 
18 */
19 
20 #ifndef __ardour_route_time_axis_h__
21 #define __ardour_route_time_axis_h__
22 
23 #include <list>
24 #include <set>
25 
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>
34 
35 #include <gtkmm2ext/selector.h>
37 
38 #include "ardour/playlist.h"
39 #include "ardour/types.h"
40 
41 #include "ardour_button.h"
42 #include "ardour_dialog.h"
43 #include "route_ui.h"
44 #include "enums.h"
45 #include "time_axis_view.h"
46 #include "gain_meter.h"
47 
48 namespace ARDOUR {
49  class Session;
50  class Region;
51  class RouteGroup;
52  class IOProcessor;
53  class Processor;
54  class Location;
55  class Playlist;
56 }
57 
58 namespace ArdourCanvas {
59  class Rectangle;
60 }
61 
62 class PublicEditor;
63 class RegionView;
64 class StreamView;
65 class Selection;
66 class RegionSelection;
67 class Selectable;
69 class AutomationLine;
70 class ProcessorAutomationLine;
71 class TimeSelection;
72 class RouteGroupMenu;
73 class ItemCounts;
74 
75 class RouteTimeAxisView : public RouteUI, public TimeAxisView
76 {
77 public:
78  RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas);
79  virtual ~RouteTimeAxisView ();
80 
82 
84  void set_button_names ();
85 
86  void set_samples_per_pixel (double);
87  void set_height (uint32_t h, TrackHeightMode m = OnlySelf);
88  void show_timestretch (framepos_t start, framepos_t end, int layers, int layer);
89  void hide_timestretch ();
90  void selection_click (GdkEventButton*);
93  void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&, bool within = false);
94  void get_inverted_selectables (Selection&, std::list<Selectable*>&);
95  void set_layer_display (LayerDisplay d, bool apply_to_selection = false);
96  LayerDisplay layer_display () const;
97 
100 
101  /* Editing operations */
103  bool paste (ARDOUR::framepos_t, const Selection&, PasteContext& ctx);
105  void uncombine_regions ();
107  void toggle_automation_track (const Evoral::Parameter& param);
108  void fade_range (TimeSelection&);
109 
110  /* The editor calls these when mapping an operation across multiple tracks */
111  void use_new_playlist (bool prompt, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
112  void use_copy_playlist (bool prompt, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
113  void clear_playlist ();
114 
115  /* group playlist name resolving */
116  std::string resolve_new_group_playlist_name(std::string &, std::vector<boost::shared_ptr<ARDOUR::Playlist> > const &);
117 
118  void build_playlist_menu ();
119 
120  void add_underlay (StreamView*, bool update_xml = true);
121  void remove_underlay (StreamView*);
122  void build_underlay_menu(Gtk::Menu*);
123 
124  int set_state (const XMLNode&, int version);
125 
126  virtual void create_automation_child (const Evoral::Parameter& param, bool show) = 0;
127 
128  typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
129  const AutomationTracks& automation_tracks() const { return _automation_tracks; }
130 
132  virtual Gtk::CheckMenuItem* automation_child_menu_item (Evoral::Parameter);
133 
134  std::string name() const;
135  StreamView* view() const { return _view; }
138 
139  void fast_update ();
140  void hide_meter ();
141  void show_meter ();
142  void reset_meter ();
143  void clear_meter ();
144  void io_changed (ARDOUR::IOChange, void *);
145  void meter_changed ();
147 
148  std::string state_id() const;
149 
150 protected:
151  friend class StreamView;
152 
155  Gtk::CheckMenuItem* menu_item;
158 
160  : what (w), menu_item (mitem), parent (p) {}
161 
163  };
164 
167  bool valid;
168  Gtk::Menu* menu;
169  std::vector<ProcessorAutomationNode*> lines;
170 
172  : processor (i), valid (true), menu (0) {}
173 
175  };
176 
177 
179 
180  gint route_group_click (GdkEventButton *);
181 
183 
185  void remove_processor_automation_node (ProcessorAutomationNode* pan);
186 
189 
190  void processor_automation_track_hidden (ProcessorAutomationNode*,
192 
194 
195  ProcessorAutomationNode*
197 
200 
203 
205 
207 
208  void take_name_changed (void *src);
210  void name_entry_changed ();
211 
212  void blink_rec_display (bool onoff);
213 
214  virtual void label_view ();
215 
216  void reset_samples_per_pixel ();
217 
218  virtual void build_automation_action_menu (bool);
220  void build_display_menu ();
221 
222  void set_align_choice (Gtk::RadioMenuItem*, ARDOUR::AlignChoice, bool apply_to_selection = false);
223 
224  void playlist_click ();
225  void show_playlist_selector ();
226  void playlist_changed ();
227 
228  void rename_current_playlist ();
229 
230  void automation_click ();
231 
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);
235 
236  void timestretch (framepos_t start, framepos_t end);
237  void speed_changed ();
238  void map_frozen ();
239  void color_handler ();
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);
245  void route_color_changed ();
246  bool can_edit_name() const;
247 
251 
253  ArdourCanvas::Canvas& parent_canvas;
254  bool no_redraw;
255 
256  Gtk::HBox other_button_hbox;
257  Gtk::Table button_table;
262 
263  Gtk::Menu subplugin_menu;
265  Gtk::MenuItem* plugins_submenu_item;
268  Gtk::MenuItem* playlist_item;
269  Gtk::Menu* mode_menu;
270  Gtk::Menu* color_mode_menu;
271 
272  virtual Gtk::Menu* build_color_mode_menu() { return 0; }
273 
274  void use_playlist (Gtk::RadioMenuItem *item, boost::weak_ptr<ARDOUR::Playlist> wpl);
275 
276  ArdourCanvas::Rectangle* timestretch_rect;
277 
278  void set_track_mode (ARDOUR::TrackMode, bool apply_to_selection = false);
279 
283  std::list<ProcessorAutomationInfo*> processor_automation;
284 
285  typedef std::vector<boost::shared_ptr<AutomationLine> > ProcessorAutomationCurves;
286  ProcessorAutomationCurves processor_automation_curves;
287 
288  AutomationTracks _automation_tracks;
289  typedef std::map<Evoral::Parameter, Gtk::CheckMenuItem*> ParameterMenuMap;
291  ParameterMenuMap _main_automation_menu_map;
293  ParameterMenuMap _subplugin_menu_map;
294 
295  void post_construct ();
296 
298 
300  bool set_underlay_state();
301 
302  typedef std::list<StreamView*> UnderlayList;
303  UnderlayList _underlay_streams;
304  typedef std::list<RouteTimeAxisView*> UnderlayMirrorList;
305  UnderlayMirrorList _underlay_mirrors;
306 
308 
309 protected:
314 
319  void ensure_pan_views (bool show = true);
320 
321  Gtk::CheckMenuItem* gain_automation_item;
322  Gtk::CheckMenuItem* trim_automation_item;
323  Gtk::CheckMenuItem* mute_automation_item;
324  std::list<boost::shared_ptr<AutomationTimeAxisView> > pan_tracks;
325  Gtk::CheckMenuItem* pan_automation_item;
326 
327 private:
328 
330  void update_playlist_tip ();
331  void parameter_changed (std::string const & p);
333 };
334 
335 #endif /* __ardour_route_time_axis_h__ */
336 
LayerDisplay layer_display() const
void blink_rec_display(bool onoff)
boost::shared_ptr< ARDOUR::Processor > processor
std::list< ProcessorAutomationInfo * > processor_automation
void automation_track_hidden(Evoral::Parameter param)
void remove_child(boost::shared_ptr< TimeAxisView >)
void create_trim_automation_child(const Evoral::Parameter &, bool)
boost::shared_ptr< ARDOUR::Playlist > playlist() const
UnderlayList _underlay_streams
Gtk::MenuItem * plugins_submenu_item
void set_route(boost::shared_ptr< ARDOUR::Route >)
Gtk::Table button_table
virtual Gtk::CheckMenuItem * automation_child_menu_item(Evoral::Parameter)
void use_new_playlist(bool prompt, std::vector< boost::shared_ptr< ARDOUR::Playlist > > const &)
XMLNode * underlay_xml_node
void take_name_changed(void *src)
ARDOUR::RouteGroup * route_group() const
LIBARDOUR_API PBD::PropertyDescriptor< layer_t > layer
Definition: region.cc:67
std::string name() const
Gtk::Menu subplugin_menu
void update_pan_track_visibility()
Gtk::CheckMenuItem * trim_automation_item
StreamView * _view
ArdourButton playlist_button
virtual ~RouteTimeAxisView()
void cut_copy_clear(Selection &, Editing::CutCopyOp)
std::string resolve_new_group_playlist_name(std::string &, std::vector< boost::shared_ptr< ARDOUR::Playlist > > const &)
Lists of selected things.
Definition: selection.h:66
boost::shared_ptr< ARDOUR::Region > find_next_region(framepos_t pos, ARDOUR::RegionPoint, int32_t dir)
void add_underlay(StreamView *, bool update_xml=true)
void uncombine_region(RegionView *)
void add_processor_automation_curve(boost::shared_ptr< ARDOUR::Processor > r, Evoral::Parameter)
int set_state(const XMLNode &, int version)
Representation of the interface of the Editor class.
void build_underlay_menu(Gtk::Menu *)
void set_layer_display(LayerDisplay d, bool apply_to_selection=false)
ArdourCanvas::Canvas & parent_canvas
RouteGroupMenu * route_group_menu
virtual Gtk::Menu * build_color_mode_menu()
const AutomationTracks & automation_tracks() const
void add_existing_processor_automation_curves(boost::weak_ptr< ARDOUR::Processor >)
Gtk::Menu * color_mode_menu
StreamView * view() const
Gtk::MenuItem * playlist_item
LIBARDOUR_API PBD::PropertyDescriptor< framepos_t > start
Definition: region.cc:63
void set_samples_per_pixel(double)
std::vector< boost::shared_ptr< AutomationLine > > ProcessorAutomationCurves
void use_playlist(Gtk::RadioMenuItem *item, boost::weak_ptr< ARDOUR::Playlist > wpl)
std::list< RouteTimeAxisView * > UnderlayMirrorList
void set_track_mode(ARDOUR::TrackMode, bool apply_to_selection=false)
std::vector< ProcessorAutomationNode * > lines
void update_trim_track_visibility()
virtual void add_processor_to_subplugin_menu(boost::weak_ptr< ARDOUR::Processor >)
virtual void show_existing_automation(bool apply_to_selection=false)
ProcessorAutomationInfo(boost::shared_ptr< ARDOUR::Processor > i)
void route_property_changed(const PBD::PropertyChange &)
void show_timestretch(framepos_t start, framepos_t end, int layers, int layer)
ProcessorAutomationNode * find_processor_automation_node(boost::shared_ptr< ARDOUR::Processor > i, Evoral::Parameter)
GainMeterBase gm
void set_height(uint32_t h, TrackHeightMode m=OnlySelf)
void processor_automation_track_hidden(ProcessorAutomationNode *, boost::shared_ptr< ARDOUR::Processor >)
void effective_gain_display()
Definition: gain_meter.cc:545
void create_gain_automation_child(const Evoral::Parameter &, bool)
RouteTimeAxisView(PublicEditor &, ARDOUR::Session *, ArdourCanvas::Canvas &canvas)
ArdourButton automation_button
TrackMode
Definition: types.h:198
RegionView * combine_regions()
virtual void label_view()
void get_inverted_selectables(Selection &, std::list< Selectable * > &)
virtual void append_extra_display_menu_items()
void remove_underlay(StreamView *)
bool can_edit_name() const
void setup_processor_menu_and_curves()
ProcessorAutomationCurves processor_automation_curves
void set_selected_regionviews(RegionSelection &)
void set_align_choice(Gtk::RadioMenuItem *, ARDOUR::AlignChoice, bool apply_to_selection=false)
virtual void show_all_automation(bool apply_to_selection=false)
Definition: amp.h:29
boost::shared_ptr< AutomationTimeAxisView > mute_track
boost::shared_ptr< ARDOUR::Track > track() const
Definition: route_ui.cc:1738
void show_selection(TimeSelection &)
void selection_click(GdkEventButton *)
void region_view_added(RegionView *)
virtual void create_automation_child(const Evoral::Parameter &param, bool show)=0
void fade_range(TimeSelection &)
int64_t framepos_t
Definition: types.h:66
void add_automation_child(Evoral::Parameter param, boost::shared_ptr< AutomationTimeAxisView > track, bool show=true)
Gtk::HBox other_button_hbox
void set_selected_points(PointSelection &)
void ensure_pan_views(bool show=true)
std::list< StreamView * > UnderlayList
AutomationTracks _automation_tracks
Gtk::Menu * automation_action_menu
Gtk::Menu * mode_menu
CutCopyOp
Definition: editing.h:198
boost::shared_ptr< AutomationTimeAxisView > gain_track
Gtk::CheckMenuItem * gain_automation_item
ParameterMenuMap _subplugin_menu_map
void processors_changed(ARDOUR::RouteProcessorChange)
virtual void build_automation_action_menu(bool)
void create_mute_automation_child(const Evoral::Parameter &, bool)
ArdourButton route_group_button
void reset_processor_automation_curves()
Definition: xml++.h:95
void update_track_number_visibility()
Gtk::CheckMenuItem * pan_automation_item
boost::shared_ptr< AutomationTimeAxisView > automation_child(Evoral::Parameter param)
void parameter_changed(std::string const &p)
boost::shared_ptr< AutomationLine > find_processor_automation_curve(boost::shared_ptr< ARDOUR::Processor > i, Evoral::Parameter)
ProcessorAutomationNode(Evoral::Parameter w, Gtk::CheckMenuItem *mitem, RouteTimeAxisView &p)
UnderlayMirrorList _underlay_mirrors
void timestretch(framepos_t start, framepos_t end)
LayerDisplay
Definition: enums.h:34
Gtk::Menu * playlist_action_menu
std::map< Evoral::Parameter, boost::shared_ptr< AutomationTimeAxisView > > AutomationTracks
std::string state_id() const
void update_gain_track_visibility()
std::list< boost::shared_ptr< AutomationTimeAxisView > > pan_tracks
bool paste(ARDOUR::framepos_t, const Selection &, PasteContext &ctx)
void update_mute_track_visibility()
void io_changed(ARDOUR::IOChange, void *)
void processor_menu_item_toggled(RouteTimeAxisView::ProcessorAutomationInfo *, RouteTimeAxisView::ProcessorAutomationNode *)
AlignChoice
Definition: types.h:168
gint route_group_click(GdkEventButton *)
RegionPoint
Definition: types.h:369
Gtk::CheckMenuItem * mute_automation_item
int64_t framepos_t
boost::shared_ptr< AutomationTimeAxisView > view
void use_copy_playlist(bool prompt, std::vector< boost::shared_ptr< ARDOUR::Playlist > > const &)
ArdourButton number_label
void get_selectables(ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list< Selectable * > &, bool within=false)
void remove_processor_automation_node(ProcessorAutomationNode *pan)
framepos_t find_next_region_boundary(framepos_t pos, int32_t dir)
ArdourCanvas::Rectangle * timestretch_rect
std::map< Evoral::Parameter, Gtk::CheckMenuItem * > ParameterMenuMap
virtual void hide_all_automation(bool apply_to_selection=false)
boost::shared_ptr< AutomationTimeAxisView > trim_track
ParameterMenuMap _main_automation_menu_map
void toggle_automation_track(const Evoral::Parameter &param)