ardour
streamview.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2001, 2006 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 
19 #ifndef __ardour_streamview_h__
20 #define __ardour_streamview_h__
21 
22 #include <list>
23 #include <cmath>
24 
25 #include "pbd/signals.h"
26 
27 #include "ardour/location.h"
28 #include "enums.h"
29 
30 namespace Gdk {
31  class Color;
32 }
33 
34 namespace ARDOUR {
35  class Crossfade;
36  class Region;
37  class Route;
38  class Source;
39  class Track;
40  struct PeakData;
41 }
42 
43 namespace ArdourCanvas {
44  class Rectangle;
45  class Container;
46 }
47 
48 struct RecBoxInfo {
49  ArdourCanvas::Rectangle* rectangle;
52 };
53 
54 class Selectable;
55 class RouteTimeAxisView;
56 class RegionView;
57 class RegionSelection;
58 class CrossfadeView;
59 class Selection;
60 
61 class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
62 {
63 public:
64  virtual ~StreamView ();
65 
67  const RouteTimeAxisView& trackview() const { return _trackview; }
68 
69  void attach ();
70 
71  void set_zoom_all();
72 
73  int set_position (gdouble x, gdouble y);
74  virtual int set_height (double);
75 
76  virtual int set_samples_per_pixel (double);
77  gdouble get_samples_per_pixel () const { return _samples_per_pixel; }
78 
81 
82  ArdourCanvas::Container* canvas_item() { return _canvas_group; }
83 
84  enum ColorTarget {
87  };
88 
89  uint32_t get_region_color () const { return region_color; }
90  void apply_color (uint32_t, ColorTarget t);
91  void apply_color (Gdk::Color const &, ColorTarget t);
92 
93  uint32_t num_selected_regionviews () const;
94 
96  void foreach_regionview (sigc::slot<void,RegionView*> slot);
97  void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
98 
100  void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&, bool within = false);
101  void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
102 
104 
106 
107  void region_layered (RegionView*);
108  virtual void update_contents_height ();
109 
110  virtual void redisplay_track () = 0;
111  double child_height () const;
112  ARDOUR::layer_t layers () const { return _layers; }
113 
115  return 0;
116  }
117 
119 
121 
122  sigc::signal<void, RegionView*> RegionViewAdded;
123  sigc::signal<void> RegionViewRemoved;
125  sigc::signal<void> ContentsHeightChanged;
126 
127 protected:
128  StreamView (RouteTimeAxisView&, ArdourCanvas::Container* canvas_group = 0);
129 
130  void transport_changed();
131  void transport_looped();
132  void rec_enable_changed();
134  void create_rec_box(framepos_t frame_pos, double width);
135  virtual void setup_rec_box () = 0;
136  virtual void update_rec_box ();
137 
139  bool wait_for_waves, bool recording = false) = 0;
141 
143  virtual void undisplay_track ();
144  void diskstream_changed ();
145  void layer_regions ();
146 
148 
149  virtual void color_handler () = 0;
150 
152  ArdourCanvas::Container* _canvas_group;
153  ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
154 
155  typedef std::list<RegionView* > RegionViewList;
156  RegionViewList region_views;
157 
159 
160  sigc::connection screen_update_connection;
161  std::vector<RecBoxInfo> rec_rects;
162  std::list< std::pair<boost::shared_ptr<ARDOUR::Region>,RegionView* > > rec_regions;
165 
166  uint32_t region_color;
167  uint32_t stream_base_color;
168 
171 
174 
175  double height;
176 
179 
180  /* When recording, the session time at which a new layer must be created for the region
181  being recorded, or max_framepos if not applicable.
182  */
185 
186 private:
187  void update_coverage_frames ();
188 };
189 
190 #endif /* __ardour_streamview_h__ */
191 
virtual RegionView * create_region_view(boost::shared_ptr< ARDOUR::Region >, bool, bool)
Definition: streamview.h:114
PBD::ScopedConnectionList rec_data_ready_connections
Definition: streamview.h:177
RegionView * find_view(boost::shared_ptr< const ARDOUR::Region >)
Definition: streamview.cc:481
void transport_changed()
Definition: streamview.cc:395
std::list< std::pair< boost::shared_ptr< ARDOUR::Region >, RegionView * > > rec_regions
Definition: streamview.h:162
void transport_looped()
Definition: streamview.cc:401
virtual void color_handler()=0
int set_position(gdouble x, gdouble y)
Definition: streamview.cc:108
void diskstream_changed()
Definition: streamview.cc:336
virtual void update_contents_height()
Definition: streamview.cc:629
void rec_enable_changed()
Definition: streamview.cc:383
bool rec_updating
Definition: streamview.h:163
void layer_regions()
Definition: streamview.cc:224
void setup_new_rec_layer_time(boost::shared_ptr< ARDOUR::Region >)
Definition: streamview.cc:712
uint32_t num_selected_regionviews() const
Definition: streamview.cc:493
sigc::signal< void, RegionView * > RegionViewAdded
Definition: streamview.h:122
void set_layer_display(LayerDisplay)
Definition: streamview.cc:667
double _samples_per_pixel
Definition: streamview.h:158
virtual void redisplay_track()=0
PBD::ScopedConnectionList playlist_connections
Definition: streamview.h:169
void set_zoom_all()
ARDOUR::layer_t layers() const
Definition: streamview.h:112
ArdourCanvas::Container * _canvas_group
Definition: streamview.h:152
virtual RegionView * add_region_view_internal(boost::shared_ptr< ARDOUR::Region >, bool wait_for_waves, bool recording=false)=0
virtual int set_height(double)
Definition: streamview.cc:115
void sess_rec_enable_changed()
Definition: streamview.cc:389
virtual void undisplay_track()
Definition: streamview.cc:203
uint32_t get_region_color() const
Definition: streamview.h:89
Lists of selected things.
Definition: selection.h:66
void display_track(boost::shared_ptr< ARDOUR::Track >)
Definition: streamview.cc:216
framepos_t last_rec_data_frame
Definition: streamview.h:178
void get_selectables(ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list< Selectable * > &, bool within=false)
Definition: streamview.cc:551
RouteTimeAxisView & trackview()
Definition: streamview.h:66
framepos_t start
Definition: streamview.h:50
virtual void remove_region_view(boost::weak_ptr< ARDOUR::Region >)
Definition: streamview.cc:180
gdouble get_samples_per_pixel() const
Definition: streamview.h:77
std::vector< RecBoxInfo > rec_rects
Definition: streamview.h:161
void set_selected_regionviews(RegionSelection &)
Definition: streamview.cc:524
virtual void playlist_layered(boost::weak_ptr< ARDOUR::Track >)
Definition: streamview.cc:281
std::list< RegionView * > RegionViewList
Definition: streamview.h:155
framepos_t _new_rec_layer_time
Definition: streamview.h:183
PBD::ScopedConnection playlist_switched_connection
Definition: streamview.h:170
void foreach_selected_regionview(sigc::slot< void, RegionView * > slot)
Definition: streamview.cc:514
void foreach_regionview(sigc::slot< void, RegionView * > slot)
Definition: streamview.cc:506
int64_t framecnt_t
Definition: types.h:76
StreamView(RouteTimeAxisView &, ArdourCanvas::Container *canvas_group=0)
Definition: streamview.cc:57
void attach()
Definition: streamview.cc:100
virtual void update_rec_box()
Definition: streamview.cc:445
void check_record_layers(boost::shared_ptr< ARDOUR::Region >, ARDOUR::framepos_t)
Definition: streamview.cc:688
virtual void setup_rec_box()=0
Definition: amp.h:29
ArdourCanvas::Rectangle * rectangle
Definition: streamview.h:49
sigc::signal< void > ContentsHeightChanged
Definition: streamview.h:125
uint32_t layer_t
Definition: types.h:59
int64_t framepos_t
Definition: types.h:66
uint32_t stream_base_color
Background color.
Definition: streamview.h:167
RouteTimeAxisView & _trackview
Definition: streamview.h:151
virtual int set_samples_per_pixel(double)
Definition: streamview.cc:135
void create_rec_box(framepos_t frame_pos, double width)
Definition: streamview.cc:409
RegionViewList region_views
Definition: streamview.h:156
sigc::connection screen_update_connection
Definition: streamview.h:160
void get_inverted_selectables(Selection &, std::list< Selectable * > &results)
Definition: streamview.cc:602
ArdourCanvas::Rectangle * canvas_rect
Definition: streamview.h:153
virtual ~StreamView()
Definition: streamview.cc:92
bool rec_active
Definition: streamview.h:164
void update_coverage_frames()
Definition: streamview.cc:680
void playlist_switched(boost::weak_ptr< ARDOUR::Track >)
Definition: streamview.cc:304
double child_height() const
Definition: streamview.cc:613
virtual void update_contents_metrics(boost::shared_ptr< ARDOUR::Region >)
Definition: streamview.h:103
void add_region_view(boost::weak_ptr< ARDOUR::Region >)
Definition: streamview.cc:165
LayerDisplay layer_display() const
Definition: streamview.h:80
LayerDisplay
Definition: enums.h:34
ARDOUR::layer_t _layers
Definition: streamview.h:172
const RouteTimeAxisView & trackview() const
Definition: streamview.h:67
void apply_color(uint32_t, ColorTarget t)
Definition: streamview.cc:354
LayerDisplay _layer_display
Definition: streamview.h:173
int64_t framepos_t
uint32_t region_color
Contained region color.
Definition: streamview.h:166
void region_layered(RegionView *)
Definition: streamview.cc:374
ARDOUR::framecnt_t length
Definition: streamview.h:51
double height
Definition: streamview.h:175
ArdourCanvas::Container * canvas_item()
Definition: streamview.h:82
sigc::signal< void > RegionViewRemoved
Definition: streamview.h:123