2 Copyright (C) 2001, 2006 Paul Davis
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.
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.
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.
19 #ifndef __ardour_streamview_h__
20 #define __ardour_streamview_h__
25 #include "pbd/signals.h"
27 #include "ardour/location.h"
43 namespace ArdourCanvas {
49 ArdourCanvas::Rectangle* rectangle;
51 ARDOUR::framecnt_t length;
55 class RouteTimeAxisView;
57 class RegionSelection;
61 class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
64 virtual ~StreamView ();
66 RouteTimeAxisView& trackview() { return _trackview; }
67 const RouteTimeAxisView& trackview() const { return _trackview; }
73 int set_position (gdouble x, gdouble y);
74 virtual int set_height (double);
76 virtual int set_samples_per_pixel (double);
77 gdouble get_samples_per_pixel () const { return _samples_per_pixel; }
79 void set_layer_display (LayerDisplay);
80 LayerDisplay layer_display () const { return _layer_display; }
82 ArdourCanvas::Container* canvas_item() { return _canvas_group; }
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);
93 uint32_t num_selected_regionviews () const;
95 RegionView* find_view (boost::shared_ptr<const ARDOUR::Region>);
96 void foreach_regionview (sigc::slot<void,RegionView*> slot);
97 void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
99 void set_selected_regionviews (RegionSelection&);
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);
103 virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}
105 void add_region_view (boost::weak_ptr<ARDOUR::Region>);
107 void region_layered (RegionView*);
108 virtual void update_contents_height ();
110 virtual void redisplay_track () = 0;
111 double child_height () const;
112 ARDOUR::layer_t layers () const { return _layers; }
114 virtual RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool) {
118 void check_record_layers (boost::shared_ptr<ARDOUR::Region>, ARDOUR::framepos_t);
120 virtual void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
122 sigc::signal<void, RegionView*> RegionViewAdded;
123 sigc::signal<void> RegionViewRemoved;
124 /** Emitted when the height of regions has changed */
125 sigc::signal<void> ContentsHeightChanged;
128 StreamView (RouteTimeAxisView&, ArdourCanvas::Container* canvas_group = 0);
130 void transport_changed();
131 void transport_looped();
132 void rec_enable_changed();
133 void sess_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 ();
138 virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>,
139 bool wait_for_waves, bool recording = false) = 0;
140 virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> );
142 void display_track (boost::shared_ptr<ARDOUR::Track>);
143 virtual void undisplay_track ();
144 void diskstream_changed ();
145 void layer_regions ();
147 void playlist_switched (boost::weak_ptr<ARDOUR::Track>);
149 virtual void color_handler () = 0;
151 RouteTimeAxisView& _trackview;
152 ArdourCanvas::Container* _canvas_group;
153 ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */
155 typedef std::list<RegionView* > RegionViewList;
156 RegionViewList region_views;
158 double _samples_per_pixel;
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;
166 uint32_t region_color; ///< Contained region color
167 uint32_t stream_base_color; ///< Background color
169 PBD::ScopedConnectionList playlist_connections;
170 PBD::ScopedConnection playlist_switched_connection;
172 ARDOUR::layer_t _layers;
173 LayerDisplay _layer_display;
177 PBD::ScopedConnectionList rec_data_ready_connections;
178 framepos_t last_rec_data_frame;
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.
183 framepos_t _new_rec_layer_time;
184 void setup_new_rec_layer_time (boost::shared_ptr<ARDOUR::Region>);
187 void update_coverage_frames ();
190 #endif /* __ardour_streamview_h__ */