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 "ardour/location.h"
27 #include "simplerect.h"
44 ArdourCanvas::SimpleRect
* rectangle
;
50 class RouteTimeAxisView
;
52 class RegionSelection
;
56 class StreamView
: public sigc::trackable
59 virtual ~StreamView ();
61 RouteTimeAxisView
& trackview() { return _trackview
; }
62 const RouteTimeAxisView
& trackview() const { return _trackview
; }
68 int set_position (gdouble x
, gdouble y
);
69 virtual int set_height (double);
71 virtual int set_samples_per_unit (gdouble spp
);
72 gdouble
get_samples_per_unit () { return _samples_per_unit
; }
74 void set_layer_display (LayerDisplay
);
75 LayerDisplay
layer_display () const { return _layer_display
; }
77 ArdourCanvas::Group
* background_group() { return _background_group
; }
78 ArdourCanvas::Group
* canvas_item() { return canvas_group
; }
85 Gdk::Color
get_region_color () const { return region_color
; }
86 void apply_color (Gdk::Color
&, ColorTarget t
);
88 RegionView
* find_view (boost::shared_ptr
<const ARDOUR::Region
>);
89 void foreach_regionview (sigc::slot
<void,RegionView
*> slot
);
91 void set_selected_regionviews (RegionSelection
&);
92 void get_selectables (nframes_t
, nframes_t
, double, double, std::list
<Selectable
* >&);
93 void get_inverted_selectables (Selection
&, std::list
<Selectable
* >& results
);
95 virtual void update_contents_metrics(boost::shared_ptr
<ARDOUR::Region
>) {}
97 void add_region_view_weak (boost::weak_ptr
<ARDOUR::Region
> r
);
98 void add_region_view (boost::shared_ptr
<ARDOUR::Region
>);
100 void region_layered (RegionView
*);
101 virtual void update_contents_height ();
103 virtual void redisplay_diskstream () = 0;
104 double child_height () const;
105 ARDOUR::layer_t
layers () const { return _layers
; }
107 virtual RegionView
* create_region_view (boost::shared_ptr
<ARDOUR::Region
>, bool, bool) {
111 sigc::signal
<void,RegionView
*> RegionViewAdded
;
112 sigc::signal
<void> HeightChanged
;
115 StreamView (RouteTimeAxisView
&, ArdourCanvas::Group
* group
= NULL
);
117 void transport_changed();
118 void transport_looped();
119 void rec_enable_changed();
120 void sess_rec_enable_changed();
121 virtual void setup_rec_box () = 0;
122 void update_rec_box ();
124 virtual RegionView
* add_region_view_internal (boost::shared_ptr
<ARDOUR::Region
>,
125 bool wait_for_waves
, bool recording
= false) = 0;
126 virtual void remove_region_view (boost::weak_ptr
<ARDOUR::Region
> );
128 void display_diskstream (boost::shared_ptr
<ARDOUR::Diskstream
>);
129 virtual void undisplay_diskstream ();
130 void diskstream_changed ();
131 void layer_regions ();
133 virtual void playlist_changed_weak (boost::weak_ptr
<ARDOUR::Diskstream
>);
134 virtual void playlist_changed (boost::shared_ptr
<ARDOUR::Diskstream
>);
135 virtual void playlist_modified_weak (boost::weak_ptr
<ARDOUR::Diskstream
>);
136 virtual void playlist_modified (boost::shared_ptr
<ARDOUR::Diskstream
>);
138 virtual void color_handler () = 0;
140 RouteTimeAxisView
& _trackview
;
141 bool owns_canvas_group
;
142 ArdourCanvas::Group
* _background_group
;
143 ArdourCanvas::Group
* canvas_group
;
144 ArdourCanvas::SimpleRect
* canvas_rect
; /* frame around the whole thing */
146 typedef std::list
<RegionView
* > RegionViewList
;
147 RegionViewList region_views
;
149 double _samples_per_unit
;
151 sigc::connection screen_update_connection
;
152 std::vector
<RecBoxInfo
> rec_rects
;
153 std::list
< std::pair
<boost::shared_ptr
<ARDOUR::Region
>,RegionView
* > > rec_regions
;
156 bool use_rec_regions
;
158 Gdk::Color region_color
; ///< Contained region color
159 uint32_t stream_base_color
; ///< Background color
161 std::vector
<sigc::connection
> playlist_connections
;
162 sigc::connection playlist_change_connection
;
164 ARDOUR::layer_t _layers
;
165 LayerDisplay _layer_display
;
169 std::list
<sigc::connection
> rec_data_ready_connections
;
170 nframes_t last_rec_data_frame
;
173 void update_coverage_frames ();
176 #endif /* __ardour_streamview_h__ */