Ardour  8.12
streamview.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2005 Nick Mainsbridge <mainsbridge@gmail.com>
4  * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
5  * Copyright (C) 2006-2014 David Robillard <d@drobilla.net>
6  * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
7  * Copyright (C) 2007 Doug McLain <doug@nostar.net>
8  * Copyright (C) 2015-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 #ifndef __ardour_streamview_h__
26 #define __ardour_streamview_h__
27 
28 #include <list>
29 #include <cmath>
30 
31 #include "pbd/signals.h"
32 
33 #include "ardour/location.h"
34 #include "enums.h"
35 
36 namespace Gdk {
37  class Color;
38 }
39 
40 namespace ARDOUR {
41  class Crossfade;
42  class Region;
43  class Route;
44  class Source;
45  class Track;
46  struct PeakData;
47 }
48 
49 namespace ArdourCanvas {
50  class Rectangle;
51  class Container;
52 }
53 
54 struct RecBoxInfo {
58 };
59 
60 class Selectable;
61 class RouteTimeAxisView;
62 class RegionView;
63 class RegionSelection;
64 class CrossfadeView;
65 class Selection;
66 
67 class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
68 {
69 public:
70  virtual ~StreamView ();
71 
73  const RouteTimeAxisView& trackview() const { return _trackview; }
74 
75  void attach ();
76 
77  void set_zoom_all();
78 
79  int set_position (gdouble x, gdouble y);
80  virtual int set_height (double);
81 
82  virtual int set_samples_per_pixel (double);
83  gdouble get_samples_per_pixel () const { return _samples_per_pixel; }
84 
86  virtual bool can_change_layer_display() const { return true; }
88 
89  virtual ArdourCanvas::Container* region_canvas () const { return _canvas_group; }
90 
91  enum ColorTarget {
94  };
95 
96  uint32_t get_region_color () const { return region_color; }
97  void apply_color (uint32_t, ColorTarget t);
98  void apply_color (Gdk::Color const &, ColorTarget t);
99 
100  uint32_t num_selected_regionviews () const;
101 
102  RegionView* find_view (std::shared_ptr<const ARDOUR::Region>);
103  void foreach_regionview (sigc::slot<void,RegionView*> slot);
104  void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
105 
107  void get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable* >&, bool within = false);
108  void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
110 
111  virtual void update_contents_metrics(std::shared_ptr<ARDOUR::Region>) {}
112 
113  void add_region_view (std::weak_ptr<ARDOUR::Region>);
114 
116  virtual void update_contents_height ();
117 
118  virtual void redisplay_track () = 0;
119  double child_height () const;
120  ARDOUR::layer_t layers () const { return _layers; }
121 
122  virtual RegionView* create_region_view (std::shared_ptr<ARDOUR::Region>, bool, bool) {
123  return 0;
124  }
125 
126  void check_record_layers (std::shared_ptr<ARDOUR::Region>, ARDOUR::samplepos_t);
127 
128  virtual void playlist_layered (std::weak_ptr<ARDOUR::Track>);
130 
131  sigc::signal<void, RegionView*> RegionViewAdded;
132  sigc::signal<void> RegionViewRemoved;
134  sigc::signal<void> ContentsHeightChanged;
135 
136  virtual void parameter_changed (std::string const &);
137 
138 protected:
140 
145  void create_rec_box(samplepos_t sample_pos, double width);
147 
148  virtual void setup_rec_box () = 0;
149  virtual void update_rec_box ();
150 
151  virtual RegionView* add_region_view_internal (std::shared_ptr<ARDOUR::Region>,
152  bool wait_for_waves, bool recording = false) = 0;
153  virtual void remove_region_view (std::weak_ptr<ARDOUR::Region> );
154 
155  void display_track (std::shared_ptr<ARDOUR::Track>);
156  virtual void undisplay_track ();
157  void layer_regions ();
158 
159  void playlist_switched (std::weak_ptr<ARDOUR::Track>);
160 
161  virtual void color_handler () = 0;
162 
165  ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
166 
167  typedef std::list<RegionView* > RegionViewList;
169 
171 
172  sigc::connection screen_update_connection;
173  std::vector<RecBoxInfo> rec_rects;
174  std::list< std::pair<std::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
177 
178  uint32_t region_color;
179  uint32_t stream_base_color;
180 
183 
186 
187  double height;
188 
191 
192  /* When recording, the session time at which a new layer must be created for the region
193  being recorded, or max_samplepos if not applicable.
194  */
196  void setup_new_rec_layer_time (std::shared_ptr<ARDOUR::Region>);
197 };
198 
199 #endif /* __ardour_streamview_h__ */
200 
Lists of selected things.
virtual void setup_rec_box()=0
PBD::ScopedConnectionList playlist_connections
Definition: streamview.h:181
virtual bool can_change_layer_display() const
Definition: streamview.h:86
virtual void set_layer_display(LayerDisplay)
RegionView * find_view(std::shared_ptr< const ARDOUR::Region >)
void apply_color(Gdk::Color const &, ColorTarget t)
void layer_regions()
sigc::signal< void, RegionView * > RegionViewAdded
Definition: streamview.h:131
sigc::signal< void > ContentsHeightChanged
Definition: streamview.h:134
void check_record_layers(std::shared_ptr< ARDOUR::Region >, ARDOUR::samplepos_t)
ARDOUR::layer_t layers() const
Definition: streamview.h:120
void set_zoom_all()
StreamView(RouteTimeAxisView &, ArdourCanvas::Container *canvas_group=0)
virtual void update_rec_box()
RegionViewList region_views
Definition: streamview.h:168
bool rec_active
Definition: streamview.h:176
void get_regionviews_at_or_after(Temporal::timepos_t const &, RegionSelection &)
@ StreamBaseColor
Definition: streamview.h:93
samplepos_t last_rec_data_sample
Definition: streamview.h:190
virtual ArdourCanvas::Container * region_canvas() const
Definition: streamview.h:89
const RouteTimeAxisView & trackview() const
Definition: streamview.h:73
LayerDisplay layer_display() const
Definition: streamview.h:87
virtual RegionView * create_region_view(std::shared_ptr< ARDOUR::Region >, bool, bool)
Definition: streamview.h:122
ArdourCanvas::Container * _canvas_group
Definition: streamview.h:164
gdouble get_samples_per_pixel() const
Definition: streamview.h:83
uint32_t get_region_color() const
Definition: streamview.h:96
virtual int set_samples_per_pixel(double)
double height
Definition: streamview.h:187
double _samples_per_pixel
Definition: streamview.h:170
void foreach_regionview(sigc::slot< void, RegionView * > slot)
LayerDisplay _layer_display
Definition: streamview.h:185
uint32_t region_color
Contained region color.
Definition: streamview.h:178
virtual void parameter_changed(std::string const &)
void get_inverted_selectables(Selection &, std::list< Selectable * > &results)
virtual ~StreamView()
void create_rec_box(samplepos_t sample_pos, double width)
virtual void update_contents_metrics(std::shared_ptr< ARDOUR::Region >)
Definition: streamview.h:111
PBD::ScopedConnection playlist_switched_connection
Definition: streamview.h:182
virtual RegionView * add_region_view_internal(std::shared_ptr< ARDOUR::Region >, bool wait_for_waves, bool recording=false)=0
virtual void remove_region_view(std::weak_ptr< ARDOUR::Region >)
void apply_color(uint32_t, ColorTarget t)
uint32_t num_selected_regionviews() const
ArdourCanvas::Rectangle * canvas_rect
Definition: streamview.h:165
void get_selectables(Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list< Selectable * > &, bool within=false)
RouteTimeAxisView & trackview()
Definition: streamview.h:72
void update_coverage_frame()
ARDOUR::layer_t _layers
Definition: streamview.h:184
virtual void playlist_layered(std::weak_ptr< ARDOUR::Track >)
virtual void color_handler()=0
virtual void redisplay_track()=0
int set_position(gdouble x, gdouble y)
virtual int set_height(double)
void attach()
void sess_rec_enable_changed()
void rec_enable_changed()
void playlist_switched(std::weak_ptr< ARDOUR::Track >)
sigc::signal< void > RegionViewRemoved
Definition: streamview.h:132
void display_track(std::shared_ptr< ARDOUR::Track >)
void setup_new_rec_layer_time(std::shared_ptr< ARDOUR::Region >)
virtual void undisplay_track()
void set_selected_regionviews(RegionSelection &)
std::vector< RecBoxInfo > rec_rects
Definition: streamview.h:173
void foreach_selected_regionview(sigc::slot< void, RegionView * > slot)
void transport_changed()
PBD::ScopedConnectionList rec_data_ready_connections
Definition: streamview.h:189
bool rec_updating
Definition: streamview.h:175
double child_height() const
void add_region_view(std::weak_ptr< ARDOUR::Region >)
std::list< RegionView * > RegionViewList
Definition: streamview.h:167
void region_layered(RegionView *)
void transport_looped()
samplepos_t _new_rec_layer_time
Definition: streamview.h:195
virtual void update_contents_height()
uint32_t stream_base_color
Background color.
Definition: streamview.h:179
std::list< std::pair< std::shared_ptr< ARDOUR::Region >, RegionView * > > rec_regions
Definition: streamview.h:174
RouteTimeAxisView & _trackview
Definition: streamview.h:163
sigc::connection screen_update_connection
Definition: streamview.h:172
void cleanup_rec_box()
LayerDisplay
Temporal::samplecnt_t samplecnt_t
Temporal::samplepos_t samplepos_t
uint32_t layer_t
uint32_t Color
Definition: colors.h:33
samplepos_t start
Definition: streamview.h:56
ArdourCanvas::Rectangle * rectangle
Definition: streamview.h:55
ARDOUR::samplecnt_t length
Definition: streamview.h:57
gint width
Definition: xcursors.h:1