Ardour  9.0-pre0-582-g084a23a80d
route_time_axis.h
Go to the documentation of this file.
1 /*
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>
9  *
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.
14  *
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.
19  *
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.
23  */
24 
25 #pragma once
26 
27 #include <list>
28 #include <set>
29 
30 #include <gtkmm/table.h>
31 #include <gtkmm/button.h>
32 #include <gtkmm/box.h>
33 #include <gtkmm/menu.h>
34 #include <gtkmm/menuitem.h>
35 #include <gtkmm/radiomenuitem.h>
36 #include <gtkmm/checkmenuitem.h>
37 #include <gtkmm/adjustment.h>
38 
39 #include "widgets/ardour_button.h"
40 
41 #include "ardour/playlist.h"
42 #include "ardour/types.h"
43 
44 #include "ardour_dialog.h"
45 #include "route_ui.h"
46 #include "enums.h"
47 #include "stripable_time_axis.h"
48 #include "gain_meter.h"
49 
50 namespace ARDOUR {
51  class Session;
52  class Region;
53  class RouteGroup;
54  class IOProcessor;
55  class Processor;
56  class Location;
57  class Playlist;
58 }
59 
60 namespace ArdourCanvas {
61  class Rectangle;
62 }
63 
64 class PublicEditor;
65 class RegionView;
66 class StreamView;
67 class Selection;
68 class RegionSelection;
69 class Selectable;
72 class TimeSelection;
73 class RouteGroupMenu;
74 class ItemCounts;
75 
77 {
78 public:
80  virtual ~RouteTimeAxisView ();
81 
82  std::string name() const;
83  Gdk::Color color () const;
84  bool marked_for_display () const;
86 
87  std::shared_ptr<ARDOUR::Stripable> stripable() const { return RouteUI::stripable(); }
88 
89  void set_route (std::shared_ptr<ARDOUR::Route>);
90 
93 
94  void set_samples_per_pixel (double);
95  void set_height (uint32_t h, TrackHeightMode m = OnlySelf, bool from_idle = false);
96  void show_timestretch (Temporal::timepos_t const & start, Temporal::timepos_t const & end, int layers, int layer);
101  void _get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list<Selectable *>&, bool within);
102  void get_inverted_selectables (Selection&, std::list<Selectable*>&);
104 
105  virtual void set_layer_display (LayerDisplay d);
108 
109  std::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::timepos_t const & pos, ARDOUR::RegionPoint, int32_t dir);
111 
112  /* Editing operations */
114  bool paste (Temporal::timepos_t const &, const Selection&, PasteContext& ctx);
120 
121  int set_state (const XMLNode&, int version);
122 
124  virtual std::shared_ptr<AutomationTimeAxisView> automation_child(Evoral::Parameter param, PBD::ID ctrl_id = PBD::ID(0));
125 
126  StreamView* view() const { return _view; }
128  std::shared_ptr<ARDOUR::Playlist> playlist() const;
129 
130  void fast_update ();
131  void hide_meter ();
132  void show_meter ();
133  void reset_meter ();
134  void clear_meter ();
135  void io_changed (ARDOUR::IOChange, void *);
137  void meter_changed ();
139 
140  static sigc::signal<void, bool> signal_ctrl_touched;
141 
142  std::string state_id() const;
143 
144  void show_all_automation (bool apply_to_selection = false);
145  void show_existing_automation (bool apply_to_selection = false);
146  void hide_all_automation (bool apply_to_selection = false);
147 
148 protected:
149  friend class StreamView;
150 
154  std::shared_ptr<AutomationTimeAxisView> view;
156 
158  : what (w), menu_item (mitem), parent (p) {}
159 
161  };
162 
164  std::shared_ptr<ARDOUR::Processor> processor;
165  bool valid;
167  std::vector<ProcessorAutomationNode*> lines;
168 
169  ProcessorAutomationInfo (std::shared_ptr<ARDOUR::Processor> i)
170  : processor (i), valid (true), menu (0) {}
171 
173  };
174 
175 
177 
179 
181 
182  virtual void add_processor_to_subplugin_menu (std::weak_ptr<ARDOUR::Processor>);
184 
187 
189  std::shared_ptr<ARDOUR::Processor>);
190 
191 
193  find_processor_automation_node (std::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
194 
195  /* O(log(N)) lookup of menu-item by AC */
197  find_menu_item_by_ctrl (std::shared_ptr<ARDOUR::AutomationControl>);
198 
199  /* O(1) IFF route_owned_only == true, O(N) otherwise */
200  std::shared_ptr<AutomationTimeAxisView>
201  find_atav_by_ctrl (std::shared_ptr<ARDOUR::AutomationControl>, bool route_owned_only = true);
202 
203  std::shared_ptr<EditorAutomationLine>
204  find_processor_automation_curve (std::shared_ptr<ARDOUR::Processor> i, Evoral::Parameter);
205 
206  void add_processor_automation_curve (std::shared_ptr<ARDOUR::Processor> r, Evoral::Parameter);
207  void add_existing_processor_automation_curves (std::weak_ptr<ARDOUR::Processor>);
208 
209  std::shared_ptr<AutomationLine> automation_child_by_alist_id (PBD::ID);
210 
212 
213  void take_name_changed (void *src);
216  bool name_entry_changed (std::string const&);
217 
218  virtual void toggle_channel_selector () {}
219 
220  void blink_rec_display (bool onoff);
221 
222  virtual void label_view ();
223 
224  virtual void build_automation_action_menu (bool);
227 
228  void set_align_choice (Gtk::RadioMenuItem*, ARDOUR::AlignChoice, bool apply_to_selection = false);
229 
232 
234 
236  void speed_changed ();
237  void map_frozen ();
238  void color_handler ();
245  bool can_edit_name() const;
246 
248 
255 
262 
264 
268  std::list<ProcessorAutomationInfo*> processor_automation;
269 
270  std::map<std::shared_ptr<PBD::Controllable>, Gtk::CheckMenuItem*> ctrl_item_map;
271 
272  typedef std::vector<std::shared_ptr<EditorAutomationLine> > ProcessorAutomationCurves;
276 
277  void post_construct ();
278 
280 
283 
284 protected:
286 
291  void ensure_pan_views (bool show = true);
292 
293  std::list<std::shared_ptr<AutomationTimeAxisView> > pan_tracks;
295 
296 private:
297 
298  void remove_child (std::shared_ptr<TimeAxisView>);
300  void parameter_changed (std::string const & p);
302  void show_touched_automation (std::weak_ptr<PBD::Controllable>);
304 
306  void reread_midnam ();
308 
310  sigc::connection ctrl_autohide_connection;
311 };
312 
void effective_gain_display()
Definition: id.h:34
Representation of the interface of the Editor class.
void get_regionviews_at_or_after(Temporal::timepos_t const &, RegionSelection &)
Gtk::HBox other_button_hbox
bool name_entry_changed(std::string const &)
virtual void append_extra_display_menu_items()
Gdk::Color color() const
PBD::ScopedConnectionList midnam_connection
sigc::connection ctrl_autohide_connection
void add_processor_automation_curve(std::shared_ptr< ARDOUR::Processor > r, Evoral::Parameter)
void set_selected_regionviews(RegionSelection &)
void set_height(uint32_t h, TrackHeightMode m=OnlySelf, bool from_idle=false)
GainMeterBase gm
void layer_display_menu_change(Gtk::MenuItem *item)
void timestretch(samplepos_t start, samplepos_t end)
void parameter_changed(std::string const &p)
RegionView * combine_regions()
PBD::ScopedConnection ctrl_touched_connection
virtual std::shared_ptr< AutomationTimeAxisView > automation_child(Evoral::Parameter param, PBD::ID ctrl_id=PBD::ID(0))
Gtk::MenuItem * overlaid_menu_item
void drop_instrument_ref()
std::shared_ptr< ARDOUR::Region > find_next_region(ARDOUR::timepos_t const &pos, ARDOUR::RegionPoint, int32_t dir)
std::list< ProcessorAutomationInfo * > processor_automation
void _get_selectables(Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list< Selectable * > &, bool within)
bool set_marked_for_display(bool)
void build_display_menu()
bool playlist_click(GdkEventButton *)
void reset_processor_automation_curves()
void cut_copy_clear(Selection &, Editing::CutCopyOp)
virtual void build_automation_action_menu(bool)
virtual void set_layer_display(LayerDisplay d)
RouteTimeAxisView(PublicEditor &, ARDOUR::Session *, ArdourCanvas::Canvas &canvas)
void route_color_changed()
void set_align_choice(Gtk::RadioMenuItem *, ARDOUR::AlignChoice, bool apply_to_selection=false)
void show_touched_automation(std::weak_ptr< PBD::Controllable >)
void show_existing_automation(bool apply_to_selection=false)
void show_all_automation(bool apply_to_selection=false)
std::string name() const
StreamView * _view
virtual void processors_changed(ARDOUR::RouteProcessorChange)
std::string state_id() const
ArdourWidgets::ArdourButton number_label
void create_gain_automation_child(const Evoral::Parameter &, bool)
bool automation_click(GdkEventButton *)
void route_property_changed(const PBD::PropertyChange &)
void show_selection(TimeSelection &)
virtual void toggle_channel_selector()
void maybe_hide_automation(bool, ARDOUR::WeakAutomationControlList)
virtual void label_view()
bool paste(Temporal::timepos_t const &, const Selection &, PasteContext &ctx)
std::list< std::shared_ptr< AutomationTimeAxisView > > pan_tracks
void processor_automation_track_hidden(ProcessorAutomationNode *, std::shared_ptr< ARDOUR::Processor >)
Gtk::Menu subplugin_menu
Gtk::CheckMenuItem * find_menu_item_by_ctrl(std::shared_ptr< ARDOUR::AutomationControl >)
std::shared_ptr< ARDOUR::Playlist > playlist() const
static sigc::signal< void, bool > signal_ctrl_touched
void chan_count_changed()
void uncombine_region(RegionView *)
void get_inverted_selectables(Selection &, std::list< Selectable * > &)
virtual ~RouteTimeAxisView()
void remove_processor_automation_node(ProcessorAutomationNode *pan)
ArdourWidgets::ArdourButton automation_button
void processor_menu_item_toggled(RouteTimeAxisView::ProcessorAutomationInfo *, RouteTimeAxisView::ProcessorAutomationNode *)
Gtk::Menu * automation_action_menu
void create_trim_automation_child(const Evoral::Parameter &, bool)
void region_view_added(RegionView *)
ARDOUR::timepos_t find_next_region_boundary(ARDOUR::timepos_t const &pos, int32_t dir)
bool can_edit_name() const
void toggle_layer_display()
void set_samples_per_pixel(double)
void create_mute_automation_child(const Evoral::Parameter &, bool)
void set_route(std::shared_ptr< ARDOUR::Route >)
Gtk::MenuItem * plugins_submenu_item
std::shared_ptr< ARDOUR::Stripable > stripable() const
void take_name_changed(void *src)
std::vector< std::shared_ptr< EditorAutomationLine > > ProcessorAutomationCurves
void uncombine_regions()
StreamView * view() const
void route_active_changed()
ArdourWidgets::ArdourButton route_group_button
Gtk::CheckMenuItem * pan_automation_item
RouteGroupMenu * route_group_menu
ArdourWidgets::ArdourButton playlist_button
void show_timestretch(Temporal::timepos_t const &start, Temporal::timepos_t const &end, int layers, int layer)
void update_pan_track_visibility()
void io_changed(ARDOUR::IOChange, void *)
void update_playlist_tip()
void ensure_pan_views(bool show=true)
bool route_group_click(GdkEventButton *)
std::shared_ptr< EditorAutomationLine > find_processor_automation_curve(std::shared_ptr< ARDOUR::Processor > i, Evoral::Parameter)
ArdourCanvas::Rectangle * timestretch_rect
void set_selected_points(PointSelection &)
void update_diskstream_display()
void hide_all_automation(bool apply_to_selection=false)
bool marked_for_display() const
std::map< std::shared_ptr< PBD::Controllable >, Gtk::CheckMenuItem * > ctrl_item_map
Gtk::MenuItem * stacked_menu_item
virtual Gtk::CheckMenuItem * automation_child_menu_item(Evoral::Parameter)
Gtk::Table button_table
virtual void add_processor_to_subplugin_menu(std::weak_ptr< ARDOUR::Processor >)
ProcessorAutomationCurves processor_automation_curves
void selection_click(GdkEventButton *)
ARDOUR::RouteGroup * route_group() const
void blink_rec_display(bool onoff)
void remove_child(std::shared_ptr< TimeAxisView >)
ParameterMenuMap _subplugin_menu_map
void setup_processor_menu_and_curves()
int set_state(const XMLNode &, int version)
void update_track_number_visibility()
void add_existing_processor_automation_curves(std::weak_ptr< ARDOUR::Processor >)
void fade_range(TimeSelection &)
std::shared_ptr< AutomationLine > automation_child_by_alist_id(PBD::ID)
LayerDisplay layer_display() const
void toggle_automation_track(const Evoral::Parameter &param)
std::shared_ptr< AutomationTimeAxisView > find_atav_by_ctrl(std::shared_ptr< ARDOUR::AutomationControl >, bool route_owned_only=true)
ProcessorAutomationNode * find_processor_automation_node(std::shared_ptr< ARDOUR::Processor > i, Evoral::Parameter)
std::shared_ptr< ARDOUR::Stripable > stripable() const
Lists of selected things.
std::map< Evoral::Parameter, Gtk::CheckMenuItem * > ParameterMenuMap
Definition: xml++.h:114
LayerDisplay
PBD::PropertyDescriptor< timepos_t > start
PBD::PropertyDescriptor< layer_t > layer
std::list< std::weak_ptr< AutomationControl > > WeakAutomationControlList
Temporal::samplepos_t samplepos_t
CutCopyOp
Definition: editing.h:228
std::shared_ptr< ARDOUR::Processor > processor
std::vector< ProcessorAutomationNode * > lines
ProcessorAutomationInfo(std::shared_ptr< ARDOUR::Processor > i)
std::shared_ptr< AutomationTimeAxisView > view
ProcessorAutomationNode(Evoral::Parameter w, Gtk::CheckMenuItem *mitem, RouteTimeAxisView &p)