Ardour  9.0-pre0-1320-gf48fe3f740
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 #pragma once
26 
27 #include <list>
28 #include <cmath>
29 
30 #include "pbd/signals.h"
31 
32 #include "ardour/location.h"
33 
34 #include "enums.h"
35 #include "selectable.h"
36 #include "time_axis_view_item.h"
37 #include "view_background.h"
38 
39 namespace Gdk {
40  class Color;
41 }
42 
43 namespace ARDOUR {
44  class Crossfade;
45  class Region;
46  class Route;
47  class Source;
48  class Track;
49  struct PeakData;
50 }
51 
52 namespace ArdourCanvas {
53  class Rectangle;
54  class Container;
55 }
56 
57 struct RecBoxInfo {
61 };
62 
63 class RouteTimeAxisView;
64 class RegionView;
65 class RegionSelection;
66 class CrossfadeView;
67 class Selection;
68 
70 {
71 public:
72  virtual ~StreamView ();
73 
75  const RouteTimeAxisView& trackview() const { return _trackview; }
76 
77  void attach ();
78 
79  void set_zoom_all();
80 
81  int height() const;
82  int width() const;
83  int contents_height() const {
85  }
86  int y_position () const;
87 
88  int set_position (gdouble x, gdouble y);
89  virtual int set_height (double);
90 
91  virtual int set_samples_per_pixel (double);
92  gdouble get_samples_per_pixel () const { return _samples_per_pixel; }
93 
95  virtual bool can_change_layer_display() const { return true; }
97 
98  virtual ArdourCanvas::Container* region_canvas () const { return _canvas_group; }
99 
100  enum ColorTarget {
103  };
104 
105  uint32_t get_region_color () const { return region_color; }
106  void apply_color (uint32_t, ColorTarget t);
107  void apply_color (Gdk::Color const &, ColorTarget t);
108 
109  uint32_t num_selected_regionviews () const;
110 
111  RegionView* find_view (std::shared_ptr<const ARDOUR::Region>);
112  void foreach_regionview (sigc::slot<void,RegionView*> slot);
113  void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
114 
116  void _get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable* >&, bool within);
117  void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
119 
120  virtual void update_contents_metrics(std::shared_ptr<ARDOUR::Region>) {}
121 
122  void add_region_view (std::weak_ptr<ARDOUR::Region>);
123 
125  virtual void update_contents_height ();
126 
127  virtual void redisplay_track () = 0;
128  double child_height () const;
129  ARDOUR::layer_t layers () const { return _layers; }
130 
131  virtual RegionView* create_region_view (std::shared_ptr<ARDOUR::Region>, bool, bool) {
132  return 0;
133  }
134 
135  void check_record_layers (std::shared_ptr<ARDOUR::Region>, ARDOUR::samplepos_t);
136 
137  virtual void playlist_layered (std::weak_ptr<ARDOUR::Track>);
139 
140  sigc::signal<void, RegionView*> RegionViewAdded;
141  sigc::signal<void> RegionViewRemoved;
143  sigc::signal<void> ContentsHeightChanged;
144 
145  virtual void parameter_changed (std::string const &);
146 
147 protected:
149 
154  void create_rec_box(samplepos_t sample_pos, double width);
156 
157  virtual void setup_rec_box () = 0;
158  virtual void update_rec_box ();
159 
160  virtual RegionView* add_region_view_internal (std::shared_ptr<ARDOUR::Region>,
161  bool wait_for_waves, bool recording = false) = 0;
162  virtual void remove_region_view (std::weak_ptr<ARDOUR::Region> );
163 
164  void display_track (std::shared_ptr<ARDOUR::Track>);
165  virtual void undisplay_track ();
166  void layer_regions ();
167 
168  void playlist_switched (std::weak_ptr<ARDOUR::Track>);
169 
170  virtual void color_handler () = 0;
171 
174  ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
175 
176  typedef std::list<RegionView* > RegionViewList;
178 
180 
181  sigc::connection screen_update_connection;
182  std::vector<RecBoxInfo> rec_rects;
183  std::list< std::pair<std::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
186 
187  uint32_t region_color;
188  uint32_t stream_base_color;
189 
192 
195 
196  double _height;
197 
200 
201  /* When recording, the session time at which a new layer must be created for the region
202  being recorded, or max_samplepos if not applicable.
203  */
205  void setup_new_rec_layer_time (std::shared_ptr<ARDOUR::Region>);
206 };
207 
208 
Lists of selected things.
virtual void setup_rec_box()=0
PBD::ScopedConnectionList playlist_connections
Definition: streamview.h:190
virtual bool can_change_layer_display() const
Definition: streamview.h:95
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:140
sigc::signal< void > ContentsHeightChanged
Definition: streamview.h:143
void check_record_layers(std::shared_ptr< ARDOUR::Region >, ARDOUR::samplepos_t)
ARDOUR::layer_t layers() const
Definition: streamview.h:129
void set_zoom_all()
StreamView(RouteTimeAxisView &, ArdourCanvas::Container *canvas_group=0)
virtual void update_rec_box()
RegionViewList region_views
Definition: streamview.h:177
bool rec_active
Definition: streamview.h:185
void get_regionviews_at_or_after(Temporal::timepos_t const &, RegionSelection &)
@ StreamBaseColor
Definition: streamview.h:102
samplepos_t last_rec_data_sample
Definition: streamview.h:199
virtual ArdourCanvas::Container * region_canvas() const
Definition: streamview.h:98
const RouteTimeAxisView & trackview() const
Definition: streamview.h:75
LayerDisplay layer_display() const
Definition: streamview.h:96
virtual RegionView * create_region_view(std::shared_ptr< ARDOUR::Region >, bool, bool)
Definition: streamview.h:131
ArdourCanvas::Container * _canvas_group
Definition: streamview.h:173
gdouble get_samples_per_pixel() const
Definition: streamview.h:92
uint32_t get_region_color() const
Definition: streamview.h:105
int width() const
virtual int set_samples_per_pixel(double)
double _samples_per_pixel
Definition: streamview.h:179
void foreach_regionview(sigc::slot< void, RegionView * > slot)
LayerDisplay _layer_display
Definition: streamview.h:194
uint32_t region_color
Contained region color.
Definition: streamview.h:187
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:120
PBD::ScopedConnection playlist_switched_connection
Definition: streamview.h:191
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:174
RouteTimeAxisView & trackview()
Definition: streamview.h:74
void update_coverage_frame()
ARDOUR::layer_t _layers
Definition: streamview.h:193
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)
int height() const
double _height
Definition: streamview.h:196
int contents_height() const
Definition: streamview.h:83
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:141
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:182
void foreach_selected_regionview(sigc::slot< void, RegionView * > slot)
void transport_changed()
int y_position() const
PBD::ScopedConnectionList rec_data_ready_connections
Definition: streamview.h:198
bool rec_updating
Definition: streamview.h:184
double child_height() const
void add_region_view(std::weak_ptr< ARDOUR::Region >)
std::list< RegionView * > RegionViewList
Definition: streamview.h:176
void region_layered(RegionView *)
void _get_selectables(Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list< Selectable * > &, bool within)
void transport_looped()
samplepos_t _new_rec_layer_time
Definition: streamview.h:204
virtual void update_contents_height()
uint32_t stream_base_color
Background color.
Definition: streamview.h:188
std::list< std::pair< std::shared_ptr< ARDOUR::Region >, RegionView * > > rec_regions
Definition: streamview.h:183
RouteTimeAxisView & _trackview
Definition: streamview.h:172
sigc::connection screen_update_connection
Definition: streamview.h:181
void cleanup_rec_box()
static double NAME_HIGHLIGHT_SIZE
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:59
ArdourCanvas::Rectangle * rectangle
Definition: streamview.h:58
ARDOUR::samplecnt_t length
Definition: streamview.h:60