Ardour  9.0-pre0-582-g084a23a80d
automation_time_axis.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
4  * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
5  * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
6  * Copyright (C) 2006 Sampo Savolainen <v2@iki.fi>
7  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
8  * Copyright (C) 2014-2015 Ben Loftis <ben@harrisonconsoles.com>
9  * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  */
25 
26 #pragma once
27 
28 #include <list>
29 #include <memory>
30 #include <string>
31 #include <utility>
32 
33 #include "ardour/types.h"
34 #include "ardour/automatable.h"
35 #include "ardour/automation_list.h"
36 
37 #include "canvas/rectangle.h"
38 
39 #include "widgets/ardour_button.h"
41 
42 #include "line_merger.h"
43 #include "time_axis_view.h"
44 #include "automation_controller.h"
45 
46 namespace ARDOUR {
47  class Session;
48  class Stripable;
49  class AutomationControl;
50 }
51 
52 class PublicEditor;
53 class TimeSelection;
54 class RegionSelection;
55 class PointSelection;
56 class AutomationLine;
58 class Selection;
59 class Selectable;
62 class ItemCounts;
63 
65 {
66 public:
68  std::shared_ptr<ARDOUR::Stripable>,
69  std::shared_ptr<ARDOUR::Automatable>,
70  std::shared_ptr<ARDOUR::AutomationControl>,
72  PublicEditor&,
74  bool show_regions,
75  ArdourCanvas::Canvas& canvas,
76  const std::string & name = "", /* translatable */
77  const std::string & plug_name = "");
78 
80 
81  virtual void set_height (uint32_t, TrackHeightMode m = OnlySelf, bool from_idle = false);
82  void set_samples_per_pixel (double);
83  std::string name() const { return _name; }
84  Gdk::Color color () const;
86 
87  std::shared_ptr<ARDOUR::Stripable> stripable() const;
89 
90  void add_automation_event (GdkEvent *, Temporal::timepos_t const &, double, bool with_guard_points);
91 
92  void clear_lines ();
93 
95  std::shared_ptr<EditorAutomationLine> line() { return _line; }
96 
98  std::list<std::shared_ptr<AutomationLine> > lines () const;
99 
101 
103  void _get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list<Selectable *>&, bool within);
104  void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
105 
106  void show_timestretch (Temporal::timepos_t const &/*start*/, Temporal::timepos_t const & /*end*/, int /*layers*/, int /*layer*/) {}
107  void hide_timestretch () {}
108 
109  /* editing operations */
110 
113 
114  int set_state (const XMLNode&, int version);
115 
116  std::string state_id() const;
117  static bool parse_state_id (std::string const &, PBD::ID &, bool &, Evoral::Parameter &);
118 
119  std::shared_ptr<ARDOUR::AutomationControl> control() const { return _control; }
120  std::shared_ptr<AutomationController> controller() const { return _controller; }
122  return _parameter;
123  }
124 
126  return *_base_rect;
127  }
128 
129  bool has_automation () const;
130 
131  std::shared_ptr<ARDOUR::Stripable> parent_stripable () {
132  return _stripable;
133  }
134 
135  bool show_regions () const {
136  return _show_regions;
137  }
138 
140 
144  };
145 
147  void set_velocity_mode (VelocityMode, bool force = false);
148 
150 
152 
153 protected:
154  /* Note that for MIDI controller "automation" (in regions), all of these
155  * may be set. In this case, _automatable is likely _route so the
156  * controller will send immediate events out the route's MIDI port. */
157 
159  std::shared_ptr<ARDOUR::Stripable> _stripable;
161  std::shared_ptr<ARDOUR::AutomationControl> _control;
163  std::shared_ptr<ARDOUR::Automatable> _automatable;
165  std::shared_ptr<AutomationController> _controller;
167 
169  std::shared_ptr<EditorAutomationLine> _line;
170 
171  std::string _name;
172 
175 
177 
182 
188 
193 
195 
196  void add_line (std::shared_ptr<EditorAutomationLine>);
197 
198  void clear_clicked ();
199  void hide_clicked ();
200 
201  virtual bool can_edit_name() const {return false;}
202 
204 
206  bool paste_one (Temporal::timepos_t const &, unsigned, float times, const Selection&, ItemCounts& counts, bool greedy=false);
208 
211 
213 
215 
217 
219 
222 
223  void entered ();
224  void exited ();
225 
226  //void set_colors ();
227  void color_handler ();
228 
229  static Pango::FontDescription name_font;
230  static bool have_name_font;
231 
232  std::string automation_state_off_string () const;
233 
234  virtual void add_contents (bool show_regions);
235 
237 
239 
240 private:
241  int set_state_2X (const XMLNode &, int);
242 };
243 
void show_timestretch(Temporal::timepos_t const &, Temporal::timepos_t const &, int, int)
static Pango::FontDescription name_font
virtual void set_height(uint32_t, TrackHeightMode m=OnlySelf, bool from_idle=false)
std::list< std::shared_ptr< AutomationLine > > lines() const
Gtk::CheckMenuItem * auto_off_item
Gtk::CheckMenuItem * mode_log_item
void cut_copy_clear(Selection &, Editing::CutCopyOp)
bool show_automation_controls() const
void set_interpolation(ARDOUR::AutomationList::InterpolationStyle)
Evoral::Parameter _parameter
std::shared_ptr< ARDOUR::Automatable > _automatable
void get_inverted_selectables(Selection &, std::list< Selectable * > &results)
Gtk::CheckMenuItem * mode_discrete_item
void add_automation_event(GdkEvent *, Temporal::timepos_t const &, double, bool with_guard_points)
std::shared_ptr< AutomationController > controller() const
std::string state_id() const
ArdourWidgets::ArdourButton hide_button
std::shared_ptr< ARDOUR::Stripable > _stripable
virtual void add_contents(bool show_regions)
Gtk::CheckMenuItem * mode_exp_item
std::shared_ptr< AutomationController > _controller
Gtk::CheckMenuItem * auto_play_item
void set_samples_per_pixel(double)
Evoral::Parameter parameter() const
std::string automation_state_off_string() const
virtual bool can_edit_name() const
PBD::ScopedConnectionList _stripable_connections
Gtk::CheckMenuItem * mode_line_item
std::shared_ptr< ARDOUR::Stripable > stripable() const
std::shared_ptr< ARDOUR::AutomationControl > control() const
void set_selected_regionviews(RegionSelection &)
bool paste(Temporal::timepos_t const &, const Selection &, PasteContext &)
void interpolation_changed(ARDOUR::AutomationList::InterpolationStyle)
std::shared_ptr< ARDOUR::AutomationControl > _control
ArdourCanvas::Rectangle * _base_rect
static bool parse_state_id(std::string const &, PBD::ID &, bool &, Evoral::Parameter &)
void _get_selectables(Temporal::timepos_t const &, Temporal::timepos_t const &, double top, double bot, std::list< Selectable * > &, bool within)
std::shared_ptr< EditorAutomationLine > _line
int set_state(const XMLNode &, int version)
void add_line(std::shared_ptr< EditorAutomationLine >)
ARDOUR::PresentationInfo const & presentation_info() const
void set_automation_state(ARDOUR::AutoState)
std::shared_ptr< ARDOUR::Stripable > parent_stripable()
bool propagate_time_selection() const
PBD::ScopedConnectionList _list_connections
std::shared_ptr< EditorAutomationLine > line()
ArdourWidgets::ArdourDropdown auto_dropdown
AutomationTimeAxisView(ARDOUR::Session *, std::shared_ptr< ARDOUR::Stripable >, std::shared_ptr< ARDOUR::Automatable >, std::shared_ptr< ARDOUR::AutomationControl >, Evoral::Parameter, PublicEditor &, TimeAxisView &parent, bool show_regions, ArdourCanvas::Canvas &canvas, const std::string &name="", const std::string &plug_name="")
AutomationStreamView * automation_view() const
void set_velocity_mode(VelocityMode, bool force=false)
Gdk::Color color() const
void set_selected_points(PointSelection &)
int set_state_2X(const XMLNode &, int)
MergeableLine * make_merger()
Gtk::CheckMenuItem * auto_write_item
bool has_automation() const
AutomationStreamView * _view
ArdourCanvas::Rectangle & base_item() const
void cut_copy_clear_one(AutomationLine &, Selection &, Editing::CutCopyOp)
VelocityMode velocity_mode() const
bool paste_one(Temporal::timepos_t const &, unsigned, float times, const Selection &, ItemCounts &counts, bool greedy=false)
Gtk::CheckMenuItem * auto_latch_item
std::string name() const
Gtk::CheckMenuItem * auto_touch_item
Definition: id.h:34
Representation of the interface of the Editor class.
Lists of selected things.
TimeAxisView * parent
Definition: xml++.h:114
CutCopyOp
Definition: editing.h:228