Ardour  8.12
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 #ifndef __ardour_gtk_time_axis_h__
28 #define __ardour_gtk_time_axis_h__
29 
30 #include <vector>
31 #include <list>
32 
33 #include <gtkmm/box.h>
34 #include <gtkmm/fixed.h>
35 #include <gtkmm/frame.h>
36 #include <gtkmm/drawingarea.h>
37 #include <gtkmm/eventbox.h>
38 #include <gtkmm/table.h>
39 #include <gtkmm/entry.h>
40 #include <gtkmm/label.h>
41 #include <gtkmm/sizegroup.h>
42 
43 #include "pbd/stateful.h"
44 #include "pbd/signals.h"
45 
46 #include "evoral/Parameter.h"
47 
48 #include "ardour/types.h"
50 #include "ardour/region.h"
51 
52 #include "canvas/line.h"
53 
54 #include "widgets/focus_entry.h"
55 
56 #include "axis_view.h"
57 #include "enums.h"
58 #include "editing.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 }
72 
73 namespace ArdourCanvas {
74  class Canvas;
75  class Container;
76  class Item;
77 }
78 
79 class PublicEditor;
80 class RegionSelection;
81 class TimeSelection;
82 class PointSelection;
83 class TimeAxisViewItem;
84 class Selection;
85 class Selectable;
86 class RegionView;
87 class GhostRegion;
88 class StreamView;
89 class ArdourDialog;
90 class ItemCounts;
91 class PasteContext;
92 
98 class TimeAxisView : public virtual AxisView
99 {
100 private:
103  NameEntryPacked = 0x2
104  };
105 
106 public:
108  virtual ~TimeAxisView ();
109 
110  static PBD::Signal1<void,TimeAxisView*> CatchDeletion;
111 
112  static void setup_sizes ();
113 
115  int order () const { return _order; }
116 
118  static int max_order () { return _max_order; }
119 
122 
125  uint32_t effective_height () const { return _effective_height; }
126 
128  double y_position () const { return _y_position; }
129 
131  PublicEditor& editor () const { return _editor; }
132 
133  uint32_t current_height() const { return height; }
134 
135  void idle_resize (int32_t);
136 
137  virtual guint32 show_at (double y, int& nth, Gtk::VBox *parent);
138  virtual void hide ();
139 
140  bool touched (double top, double bot);
141 
143  bool hidden () const { return _hidden; }
144 
145  void set_selected (bool);
146 
147  virtual bool selectable() const { return true; }
148 
153  virtual void entered () {}
154  virtual void exited () {}
155 
160  };
161 
162  virtual void set_height (uint32_t h, TrackHeightMode m = OnlySelf, bool from_idle = false);
163  void set_height_enum (Height, bool apply_to_selection = false);
164  void reset_height();
165 
166  virtual void reset_visual_state ();
167 
168  std::pair<TimeAxisView*, double> covers_y_position (double) const;
169  bool covered_by_y_range (double y0, double y1) const;
170 
171  virtual void step_height (bool);
172 
173  virtual ARDOUR::RouteGroup* route_group() const { return 0; }
174  virtual std::shared_ptr<ARDOUR::Playlist> playlist() const { return std::shared_ptr<ARDOUR::Playlist> (); }
175 
176  virtual void set_samples_per_pixel (double);
177  virtual void show_selection (TimeSelection&);
178  virtual void hide_selection ();
180  virtual void show_timestretch (Temporal::timepos_t const & start, Temporal::timepos_t const & end, int layers, int layer);
181  virtual void hide_timestretch ();
182 
183  /* editing operations */
184 
186 
192  virtual bool paste (Temporal::timepos_t const & pos,
193  const Selection& selection,
194  PasteContext& ctx)
195  {
196  return false;
197  }
198 
199 
202 
203  virtual void fade_range (TimeSelection&) {}
204 
205  virtual std::shared_ptr<ARDOUR::Region> find_next_region (ARDOUR::timepos_t const & /*pos*/, ARDOUR::RegionPoint, int32_t /*dir*/) {
206  return std::shared_ptr<ARDOUR::Region> ();
207  }
208 
209  void order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top);
210 
211  virtual void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable*>&, bool within = false);
212  virtual void get_inverted_selectables (Selection&, std::list<Selectable *>& results);
214 
218 
221  virtual void first_idle () {}
222 
225 
226  virtual LayerDisplay layer_display () const { return Overlaid; }
227  virtual StreamView* view () const { return 0; }
228 
229  typedef std::vector<std::shared_ptr<TimeAxisView> > Children;
231 
232  static uint32_t preset_height (Height);
233 
234 protected:
235  static Glib::RefPtr<Gtk::SizeGroup> controls_meters_size_group;
236  static Glib::RefPtr<Gtk::SizeGroup> midi_scroomer_size_group;
237  static unsigned int name_width_px;
238  /* The Standard LHS Controls */
240  Glib::RefPtr<Gtk::SizeGroup> controls_button_size_group;
249  uint32_t height; /* in canvas units */
252  Gtk::Menu* display_menu; /* The standard LHS Track control popup-menus */
256  std::list<GhostRegion*> ghosts;
257  std::list<SelectionRect*> free_selection_rects;
258  std::list<SelectionRect*> used_selection_rects;
259  bool _hidden;
264  double _y_position;
266 
267  virtual bool can_edit_name() const;
268 
270  void end_name_edit (std::string, int);
271  virtual std::string name () const { return name_label.get_text (); }
272 
273  /* derived classes can override these */
274 
275  virtual bool name_entry_changed (std::string const&);
276 
286 
290  virtual void build_display_menu ();
291 
294  virtual bool handle_display_menu_map_event (GdkEventAny * /*ev*/) { return false; }
295 
298  virtual bool propagate_time_selection () const { return false; }
299 
300  virtual void remove_child (std::shared_ptr<TimeAxisView>);
301  void add_child (std::shared_ptr<TimeAxisView>);
302 
303  /* selection display */
304 
306 
307  void color_handler ();
308  void parameter_changed (std::string const &);
309 
311 
313 
314 private:
316  int _order;
323 
324  static uint32_t button_height;
325  static uint32_t extra_height;
326  static int const _max_order;
327 
329 
331  bool maybe_set_cursor (int y);
332  void popup_display_menu (int button, guint32 when);
333 
334 
335 }; /* class TimeAxisView */
336 
337 #endif /* __ardour_gtk_time_axis_h__ */
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.
double y_position() const
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()
double _y_position
virtual std::string name() const
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 entered()
virtual void get_selectables(Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list< Selectable * > &, bool within=false)
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 guint32 show_at(double y, int &nth, Gtk::VBox *parent)
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
static PBD::Signal1< void, TimeAxisView * > CatchDeletion
std::string controls_base_selected_name
bool covered_by_y_range(double y0, double y1) const
virtual ARDOUR::RouteGroup * route_group() const
virtual void hide()
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 get_inverted_selectables(Selection &, std::list< Selectable * > &results)
virtual void reshow_selection(TimeSelection &)
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 >)
bool _have_preresize_cursor
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 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:229
Definition: ardour_ui.h:188
link region and track selection