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