Fix a couple of minor typos.
[ardour2.git] / gtk2_ardour / streamview.h
blob6e0c39ebc8c073873206e9c9a960858859ad5d27
1 /*
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__
22 #include <list>
23 #include <cmath>
25 #include "pbd/signals.h"
27 #include "ardour/location.h"
28 #include "enums.h"
29 #include "simplerect.h"
30 #include "canvas.h"
32 namespace Gdk {
33 class Color;
36 namespace ARDOUR {
37 class Route;
38 class Crossfade;
39 class PeakData;
40 class Region;
41 class Source;
42 class Track;
45 struct RecBoxInfo {
46 ArdourCanvas::SimpleRect* rectangle;
47 framepos_t start;
48 ARDOUR::framecnt_t length;
51 class Selectable;
52 class RouteTimeAxisView;
53 class RegionView;
54 class RegionSelection;
55 class CrossfadeView;
56 class Selection;
58 class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
60 public:
61 virtual ~StreamView ();
63 RouteTimeAxisView& trackview() { return _trackview; }
64 const RouteTimeAxisView& trackview() const { return _trackview; }
66 void attach ();
68 void set_zoom_all();
70 int set_position (gdouble x, gdouble y);
71 virtual int set_height (double);
73 virtual int set_samples_per_unit (gdouble spp);
74 gdouble get_samples_per_unit () { return _samples_per_unit; }
75 virtual void horizontal_position_changed () {}
77 virtual void enter_internal_edit_mode ();
78 virtual void leave_internal_edit_mode ();
80 void set_layer_display (LayerDisplay);
81 LayerDisplay layer_display () const { return _layer_display; }
83 ArdourCanvas::Group* background_group() { return _background_group; }
84 ArdourCanvas::Group* canvas_item() { return _canvas_group; }
86 enum ColorTarget {
87 RegionColor,
88 StreamBaseColor
91 Gdk::Color get_region_color () const { return region_color; }
92 void apply_color (Gdk::Color&, ColorTarget t);
94 uint32_t num_selected_regionviews () const;
96 RegionView* find_view (boost::shared_ptr<const ARDOUR::Region>);
97 void foreach_regionview (sigc::slot<void,RegionView*> slot);
98 void foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
100 void set_selected_regionviews (RegionSelection&);
101 void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&);
102 void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
104 virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}
106 void add_region_view (boost::weak_ptr<ARDOUR::Region>);
108 void region_layered (RegionView*);
109 virtual void update_contents_height ();
111 virtual void redisplay_track () = 0;
112 double child_height () const;
113 ARDOUR::layer_t layers () const { return _layers; }
115 virtual RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool) {
116 return 0;
119 void check_record_layers (boost::shared_ptr<ARDOUR::Region>, ARDOUR::framepos_t);
121 sigc::signal<void, RegionView*> RegionViewAdded;
122 sigc::signal<void> RegionViewRemoved;
124 protected:
125 StreamView (RouteTimeAxisView&, ArdourCanvas::Group* background_group = 0, ArdourCanvas::Group* canvas_group = 0);
127 void transport_changed();
128 void transport_looped();
129 void rec_enable_changed();
130 void sess_rec_enable_changed();
131 virtual void setup_rec_box () = 0;
132 virtual void update_rec_box ();
134 virtual RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>,
135 bool wait_for_waves, bool recording = false) = 0;
136 virtual void remove_region_view (boost::weak_ptr<ARDOUR::Region> );
138 void display_track (boost::shared_ptr<ARDOUR::Track>);
139 virtual void undisplay_track ();
140 void diskstream_changed ();
141 void layer_regions ();
143 virtual void playlist_switched (boost::weak_ptr<ARDOUR::Track>);
144 virtual void playlist_layered (boost::weak_ptr<ARDOUR::Track>);
146 virtual void color_handler () = 0;
148 RouteTimeAxisView& _trackview;
149 bool owns_background_group;
150 bool owns_canvas_group;
151 ArdourCanvas::Group* _background_group;
152 ArdourCanvas::Group* _canvas_group;
153 ArdourCanvas::SimpleRect* canvas_rect; /* frame around the whole thing */
155 typedef std::list<RegionView* > RegionViewList;
156 RegionViewList region_views;
158 double _samples_per_unit;
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;
163 bool rec_updating;
164 bool rec_active;
166 Gdk::Color 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;
175 double height;
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>);
186 private:
187 void update_coverage_frames ();
190 #endif /* __ardour_streamview_h__ */