Ardour  9.0-rc2-173-g21533227e7
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  void apply_color (uint32_t, ColorTarget t);
106  void apply_color (Gdk::Color const &, ColorTarget t);
107 
108  uint32_t num_selected_regionviews () const;
109 
110  RegionView* find_view (std::shared_ptr<const ARDOUR::Region>);
111  void foreach_regionview (sigc::slot<void,RegionView*> slot);
112  void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
113 
115  void _get_selectables (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, std::list<Selectable* >&, bool within);
116  void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
118 
119  virtual void update_contents_metrics(std::shared_ptr<ARDOUR::Region>) {}
120 
121  void add_region_view (std::weak_ptr<ARDOUR::Region>);
122 
124  virtual void update_contents_height ();
125 
126  virtual void redisplay_track () = 0;
127  double child_height () const;
128  ARDOUR::layer_t layers () const { return _layers; }
129 
130  virtual RegionView* create_region_view (std::shared_ptr<ARDOUR::Region>, bool, bool) {
131  return 0;
132  }
133 
134  void check_record_layers (std::shared_ptr<ARDOUR::Region>, ARDOUR::samplepos_t);
135 
136  virtual void playlist_layered (std::weak_ptr<ARDOUR::Track>);
138 
139  sigc::signal<void, RegionView*> RegionViewAdded;
140  sigc::signal<void> RegionViewRemoved;
142  sigc::signal<void> ContentsHeightChanged;
143 
144  virtual void parameter_changed (std::string const &);
145 
146 protected:
148 
153  void create_rec_box(samplepos_t sample_pos, double width);
155 
156  virtual void setup_rec_box () = 0;
157  virtual void update_rec_box ();
158 
159  virtual RegionView* add_region_view_internal (std::shared_ptr<ARDOUR::Region>,
160  bool wait_for_waves, bool recording = false) = 0;
161  virtual void remove_region_view (std::weak_ptr<ARDOUR::Region> );
162 
163  void display_track (std::shared_ptr<ARDOUR::Track>);
164  virtual void undisplay_track ();
165  void layer_regions ();
166 
167  void playlist_switched (std::weak_ptr<ARDOUR::Track>);
168 
169  virtual void color_handler () = 0;
170 
173  ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
174 
175  typedef std::list<RegionView* > RegionViewList;
177 
179 
180  sigc::connection screen_update_connection;
181  std::vector<RecBoxInfo> rec_rects;
182  std::list< std::pair<std::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
185 
186  uint32_t stream_base_color;
187 
190 
193 
194  double _height;
195 
198 
199  /* When recording, the session time at which a new layer must be created for the region
200  being recorded, or max_samplepos if not applicable.
201  */
203  void setup_new_rec_layer_time (std::shared_ptr<ARDOUR::Region>);
204 };
205 
206 
Lists of selected things.
virtual void setup_rec_box()=0
PBD::ScopedConnectionList playlist_connections
Definition: streamview.h:188
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:139
sigc::signal< void > ContentsHeightChanged
Definition: streamview.h:142
void check_record_layers(std::shared_ptr< ARDOUR::Region >, ARDOUR::samplepos_t)
ARDOUR::layer_t layers() const
Definition: streamview.h:128
void set_zoom_all()
StreamView(RouteTimeAxisView &, ArdourCanvas::Container *canvas_group=0)
virtual void update_rec_box()
RegionViewList region_views
Definition: streamview.h:176
bool rec_active
Definition: streamview.h:184
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:197
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:130
ArdourCanvas::Container * _canvas_group
Definition: streamview.h:172
gdouble get_samples_per_pixel() const
Definition: streamview.h:92
int width() const
virtual int set_samples_per_pixel(double)
double _samples_per_pixel
Definition: streamview.h:178
void foreach_regionview(sigc::slot< void, RegionView * > slot)
LayerDisplay _layer_display
Definition: streamview.h:192
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:119
PBD::ScopedConnection playlist_switched_connection
Definition: streamview.h:189
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:173
RouteTimeAxisView & trackview()
Definition: streamview.h:74
void update_coverage_frame()
ARDOUR::layer_t _layers
Definition: streamview.h:191
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:194
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:140
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:181
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:196
bool rec_updating
Definition: streamview.h:183
double child_height() const
void add_region_view(std::weak_ptr< ARDOUR::Region >)
std::list< RegionView * > RegionViewList
Definition: streamview.h:175
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:202
virtual void update_contents_height()
uint32_t stream_base_color
Background color.
Definition: streamview.h:186
std::list< std::pair< std::shared_ptr< ARDOUR::Region >, RegionView * > > rec_regions
Definition: streamview.h:182
RouteTimeAxisView & _trackview
Definition: streamview.h:171
sigc::connection screen_update_connection
Definition: streamview.h:180
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