Ardour  9.7-336-gb784ad01ee
time_axis_view.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2008 Nick Mainsbridge <mainsbridge@gmail.com>
3  * Copyright (C) 2005-2019 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
5  * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
6  * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
7  * Copyright (C) 2007 Doug McLain <doug@nostar.net>
8  * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
9  * Copyright (C) 2014-2015 Ben Loftis <ben@harrisonconsoles.com>
10  * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  */
26 
27 #pragma once
28 
29 #include <vector>
30 #include <list>
31 
32 #include <ytkmm/box.h>
33 #include <ytkmm/fixed.h>
34 #include <ytkmm/frame.h>
35 #include <ytkmm/drawingarea.h>
36 #include <ytkmm/eventbox.h>
37 #include <ytkmm/table.h>
38 #include <ytkmm/entry.h>
39 #include <ytkmm/label.h>
40 #include <ytkmm/sizegroup.h>
41 
42 #include "pbd/stateful.h"
43 #include "pbd/signals.h"
44 
45 #include "evoral/Parameter.h"
46 
47 #include "ardour/types.h"
49 #include "ardour/region.h"
50 
51 #include "canvas/line.h"
52 
53 #include "widgets/focus_entry.h"
54 
55 #include "axis_view.h"
56 #include "enums.h"
57 #include "editing.h"
58 #include "selectable.h"
59 
60 namespace ARDOUR {
61  class Session;
62  class Region;
63  class Session;
64  class RouteGroup;
65  class Playlist;
66  class Stripable;
67 }
68 
69 namespace Gtk {
70  class Menu;
71  namespace Menu_Helpers {
72  class MenuList;
73  }
74 }
75 
76 namespace ArdourCanvas {
77  class Canvas;
78  class Container;
79  class Item;
80 }
81 
82 class PublicEditor;
83 class RegionSelection;
84 class TimeSelection;
85 class PointSelection;
86 class TimeAxisViewItem;
87 class Selection;
88 class RegionView;
89 class GhostRegion;
90 class StreamView;
91 class ArdourDialog;
92 class ItemCounts;
93 class PasteContext;
94 
100 class TimeAxisView : public virtual AxisView, public SelectableOwner
101 {
102 private:
105  NameEntryPacked = 0x2
106  };
107 
108 public:
110  virtual ~TimeAxisView ();
111 
112  std::string name () const { return name_label.get_text (); }
113 
115 
116  static void setup_sizes ();
117 
119  int order () const { return _order; }
120 
122  static int max_order () { return _max_order; }
123 
126 
129  uint32_t effective_height () const { return _effective_height; }
130 
132  int y_position () const { return _y_position; }
133 
135  PublicEditor& editor () const { return _editor; }
136 
137  uint32_t current_height() const { return height; }
138 
139  void idle_resize (int32_t);
140 
141  virtual guint32 show_at (int y, int& nth, Gtk::VBox *parent);
142  virtual void hide ();
143 
144  bool touched (double top, double bot);
145 
147  bool hidden () const { return _hidden; }
148 
149  void set_selected (bool);
150 
151  virtual bool selectable() const { return true; }
152 
157  virtual void entered () {}
158  virtual void exited () {}
159 
164  };
165 
166  virtual void set_height (uint32_t h, TrackHeightMode m = OnlySelf, bool from_idle = false);
167  void set_height_enum (Height, bool apply_to_selection = false);
168  void reset_height();
169 
170  virtual void reset_visual_state ();
171 
172  std::pair<TimeAxisView*, double> covers_y_position (double) const;
173  bool covered_by_y_range (double y0, double y1) const;
174 
175  virtual void step_height (bool);
176 
177  virtual std::shared_ptr<ARDOUR::RouteGroup> route_group() const { return nullptr; }
178  virtual std::shared_ptr<ARDOUR::Playlist> playlist() const { return nullptr; }
179 
180  virtual void set_samples_per_pixel (double);
181  virtual void show_selection (TimeSelection&);
182  virtual void hide_selection ();
184  virtual void show_timestretch (Temporal::timepos_t const & start, Temporal::timepos_t const & end, int layers, int layer);
185  virtual void hide_timestretch ();
186 
187  /* editing operations */
188 
190 
196  virtual bool paste (Temporal::timepos_t const & pos,
197  const Selection& selection,
198  PasteContext& ctx)
199  {
200  return false;
201  }
202 
203 
206 
207  virtual void fade_range (TimeSelection&) {}
208 
209  virtual std::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::timepos_t const & /*pos*/, ARDOUR::RegionPoint, int32_t /*dir*/) {
210  return std::shared_ptr<ARDOUR::Region> ();
211  }
212 
213  void order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top);
214 
215  void _get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable*>&, bool within);
216  void get_inverted_selectables (Selection&, std::list<Selectable *>& results);
218 
222 
225  virtual void first_idle () {}
226 
229 
230  virtual LayerDisplay layer_display () const { return Overlaid; }
231  virtual StreamView* view () const { return 0; }
232 
233  typedef std::vector<std::shared_ptr<TimeAxisView> > Children;
235 
236  static uint32_t preset_height (Height);
237 
239 
240 protected:
241  static Glib::RefPtr<Gtk::SizeGroup> controls_meters_size_group;
242  static Glib::RefPtr<Gtk::SizeGroup> midi_scroomer_size_group;
243  static unsigned int name_width_px;
244  /* The Standard LHS Controls */
246  Glib::RefPtr<Gtk::SizeGroup> controls_button_size_group;
255  uint32_t height; /* in canvas units */
258  Gtk::Menu* display_menu; /* The standard LHS Track control popup-menus */
262  std::list<GhostRegion*> ghosts;
263  std::list<SelectionRect*> free_selection_rects;
264  std::list<SelectionRect*> used_selection_rects;
265  bool _hidden;
272 
273  virtual bool can_edit_name() const;
274 
276  void end_name_edit (std::string, int);
277 
278  /* derived classes can override these */
279 
280  virtual bool name_entry_changed (std::string const&);
281 
291 
295  virtual void build_display_menu ();
296 
299  virtual bool handle_display_menu_map_event (GdkEventAny * /*ev*/) { return false; }
300 
303  virtual bool propagate_time_selection () const { return false; }
304 
305  virtual void remove_child (std::shared_ptr<TimeAxisView>);
306  void add_child (std::shared_ptr<TimeAxisView>);
307 
308  /* selection display */
309 
311 
312  void color_handler ();
313  void parameter_changed (std::string const &);
314 
316 
318 
319 private:
321  int _order;
328 
329  static uint32_t button_height;
330  static uint32_t extra_height;
331  static int const _max_order;
332 
334 
336  bool maybe_set_cursor (int y);
337  void popup_display_menu (int button, guint32 when);
338 
339 
340 }; /* class TimeAxisView */
341 
Gtk::Label name_label
Definition: axis_view.h:131
Glib::ustring get_text() const
Representation of the interface of the Editor class.
Lists of selected things.
virtual void set_samples_per_pixel(double)
Gtk::Menu * display_menu
static Glib::RefPtr< Gtk::SizeGroup > midi_scroomer_size_group
void order_selection_trims(ArdourCanvas::Item *item, bool put_start_on_top)
virtual bool controls_ebox_button_press(GdkEventButton *)
Gtk::HBox time_axis_hbox
virtual void reset_visual_state()
std::vector< std::shared_ptr< TimeAxisView > > Children
virtual void hide_timestretch()
Glib::RefPtr< Gtk::SizeGroup > controls_button_size_group
static void setup_sizes()
ArdourCanvas::Container * selection_group
Gtk::HBox top_hbox
virtual void show_timestretch(Temporal::timepos_t const &start, Temporal::timepos_t const &end, int layers, int layer)
std::string controls_base_unselected_name
virtual bool propagate_time_selection() const
Gtk::VBox controls_vbox
uint32_t current_height() const
virtual void add_scale_related_menu_items(Gtk::Menu_Helpers::MenuList &)
virtual void entered()
virtual bool can_edit_name() const
ArdourCanvas::Container * _ghost_group
uint32_t _effective_height
bool touched(double top, double bot)
void build_size_menu()
virtual bool controls_ebox_button_release(GdkEventButton *)
virtual bool selectable() const
virtual LayerDisplay layer_display() const
bool _ebox_release_can_act
virtual void fade_range(TimeSelection &)
TimeAxisView * parent
bool maybe_set_cursor(int y)
ArdourCanvas::Container * canvas_display()
virtual void exited()
ArdourCanvas::Container * _canvas_display
void color_handler()
virtual void build_display_menu()
static int const _max_order
PublicEditor & editor() const
void erase_ghost(GhostRegion *)
Children get_child_list() const
static uint32_t extra_height
virtual bool controls_ebox_leave(GdkEventCrossing *)
void parameter_changed(std::string const &)
static Glib::RefPtr< Gtk::SizeGroup > controls_meters_size_group
void set_parent(TimeAxisView &p)
virtual StreamView * view() const
int y_position() const
void get_inverted_selectables(Selection &, std::list< Selectable * > &results)
std::string controls_base_selected_name
bool covered_by_y_range(double y0, double y1) const
virtual void hide()
void _get_selectables(Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list< Selectable * > &, bool within)
virtual void selection_click(GdkEventButton *)
void set_height_enum(Height, bool apply_to_selection=false)
virtual void set_height(uint32_t h, TrackHeightMode m=OnlySelf, bool from_idle=false)
Children children
virtual void hide_selection()
virtual void reshow_selection(TimeSelection &)
std::string name() const
void set_selected(bool)
Gtk::Fixed scroomer_placeholder
SelectionRect * get_selection_rect(uint32_t id)
Gtk::VBox time_axis_vbox
virtual void step_height(bool)
Gtk::Frame time_axis_frame
void add_child(std::shared_ptr< TimeAxisView >)
static PBD::Signal< void(TimeAxisView *)> CatchDeletion
bool _have_preresize_cursor
virtual guint32 show_at(int y, int &nth, Gtk::VBox *parent)
double _resize_drag_start
Gtk::Menu * _size_menu
uint32_t height
Gtk::VBox * control_parent
void reset_height()
bool is_child(TimeAxisView *)
std::list< SelectionRect * > used_selection_rects
void idle_resize(int32_t)
virtual std::shared_ptr< ARDOUR::RouteGroup > route_group() const
virtual void set_selected_regionviews(RegionSelection &)
virtual bool handle_display_menu_map_event(GdkEventAny *)
std::list< SelectionRect * > free_selection_rects
Gtk::Table controls_table
void popup_display_menu(int button, guint32 when)
std::list< GhostRegion * > ghosts
bool hidden() const
TimeAxisView * get_parent()
virtual void set_selected_points(PointSelection &)
virtual bool controls_ebox_motion(GdkEventMotion *)
virtual void first_idle()
virtual ~TimeAxisView()
virtual bool controls_ebox_scroll(GdkEventScroll *)
TimeAxisView(ARDOUR::Session *sess, PublicEditor &ed, TimeAxisView *parent, ArdourCanvas::Canvas &canvas)
Gtk::EventBox controls_ebox
virtual void get_regionviews_at_or_after(Temporal::timepos_t const &, RegionSelection &)
virtual bool paste(Temporal::timepos_t const &pos, const Selection &selection, PasteContext &ctx)
void end_name_edit(std::string, int)
PublicEditor & _editor
void compute_heights()
static uint32_t preset_height(Height)
int order() const
void conditionally_add_to_selection()
static unsigned int name_width_px
GdkCursor * _preresize_cursor
virtual void cut_copy_clear(Selection &, Editing::CutCopyOp)
virtual std::shared_ptr< ARDOUR::Playlist > playlist() const
uint32_t effective_height() const
std::pair< TimeAxisView *, double > covers_y_position(double) const
void add_ghost(RegionView *)
virtual void remove_child(std::shared_ptr< TimeAxisView >)
static int max_order()
virtual std::shared_ptr< ARDOUR::Region > find_next_region(ARDOUR::timepos_t const &, ARDOUR::RegionPoint, int32_t)
ArdourCanvas::Line * _canvas_separator
static uint32_t button_height
ArdourCanvas::Container * ghost_group()
void remove_ghost(RegionView *)
void begin_name_edit()
virtual bool name_entry_changed(std::string const &)
virtual void show_selection(TimeSelection &)
LayerDisplay
@ Overlaid
PBD::PropertyDescriptor< timepos_t > start
PBD::PropertyDescriptor< layer_t > layer
CutCopyOp
Definition: editing.h:241
Definition: ardour_ui.h:182
link region and track selection