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 __gtk_ardour_audio_region_view_h__
20 #define __gtk_ardour_audio_region_view_h__
24 #include <libgnomecanvasmm.h>
25 #include <libgnomecanvasmm/polygon.h>
26 #include <sigc++/signal.h>
27 #include <ardour/audioregion.h>
29 #include "region_view.h"
30 #include "route_time_axis.h"
31 #include "time_axis_view_item.h"
32 #include "automation_line.h"
42 class AudioTimeAxisView
;
43 class AudioRegionGainLine
;
44 class AudioRegionEditor
;
46 class AutomationTimeAxisView
;
48 class AudioRegionView
: public RegionView
51 AudioRegionView (ArdourCanvas::Group
*,
53 boost::shared_ptr
<ARDOUR::AudioRegion
>,
54 double initial_samples_per_unit
,
55 Gdk::Color
& basic_color
);
57 AudioRegionView (ArdourCanvas::Group
*,
59 boost::shared_ptr
<ARDOUR::AudioRegion
>,
60 double samples_per_unit
,
61 Gdk::Color
& basic_color
,
63 TimeAxisViewItem::Visibility
);
65 AudioRegionView (const AudioRegionView
& other
);
66 AudioRegionView (const AudioRegionView
& other
, boost::shared_ptr
<ARDOUR::AudioRegion
>);
70 virtual void init (Gdk::Color
& base_color
, bool wait_for_data
);
72 boost::shared_ptr
<ARDOUR::AudioRegion
> audio_region() const;
76 void set_height (double);
77 void set_samples_per_unit (double);
79 void set_amplitude_above_axis (gdouble spp
);
81 void temporarily_hide_envelope (); ///< Dangerous!
82 void unhide_envelope (); ///< Dangerous!
84 void set_envelope_visible (bool);
85 void set_waveform_visible (bool yn
);
86 void set_waveform_shape (Editing::WaveformShape
);
87 void set_waveform_scale (Editing::WaveformScale
);
89 bool waveform_rectified() const { return _flags
& WaveformRectified
; }
90 bool waveform_logscaled() const { return _flags
& WaveformLogScaled
; }
91 bool waveform_visible() const { return _flags
& WaveformVisible
; }
92 bool envelope_visible() const { return _flags
& EnvelopeVisible
; }
94 void show_region_editor ();
96 void add_gain_point_event (ArdourCanvas::Item
*item
, GdkEvent
*event
);
97 void remove_gain_point_event (ArdourCanvas::Item
*item
, GdkEvent
*event
);
99 AudioRegionGainLine
* get_gain_line() const { return gain_line
; }
101 void region_changed (ARDOUR::Change
);
102 void envelope_active_changed ();
104 GhostRegion
* add_ghost (AutomationTimeAxisView
&);
106 void reset_fade_in_shape_width (nframes_t
);
107 void reset_fade_out_shape_width (nframes_t
);
109 void set_fade_visibility (bool);
111 virtual void entered ();
112 virtual void exited ();
116 /* this constructor allows derived types
117 to specify their visibility requirements
118 to the TimeAxisViewItem parent class
122 EnvelopeVisible
= 0x1,
123 WaveformVisible
= 0x4,
124 WaveformRectified
= 0x8,
125 WaveformLogScaled
= 0x10,
128 void reset_fade_shapes ();
129 void reset_fade_in_shape ();
130 void reset_fade_out_shape ();
131 void fade_in_changed ();
132 void fade_out_changed ();
133 void fade_in_active_changed ();
134 void fade_out_active_changed ();
136 void region_resized (ARDOUR::Change
);
137 void region_moved (void *);
138 void region_muted ();
139 void region_scale_amplitude_changed ();
141 void create_one_wave (uint32_t, bool);
142 void manage_zero_line ();
143 void peaks_ready_handler (uint32_t);
144 void set_flags (XMLNode
*);
148 void compute_colors (Gdk::Color
&);
149 void reset_width_dependent_items (double pixel_width
);
150 void set_waveview_data_src();
151 void set_frame_color ();
153 void color_handler ();
155 vector
<GnomeCanvasWaveViewCache
*> wave_caches
;
156 vector
<ArdourCanvas::WaveView
*> waves
;
157 vector
<ArdourCanvas::WaveView
*> tmp_waves
; ///< see ::create_waves()
158 ArdourCanvas::Polygon
* sync_mark
; ///< polgyon for sync position
159 ArdourCanvas::SimpleLine
* zero_line
;
160 ArdourCanvas::Polygon
* fade_in_shape
;
161 ArdourCanvas::Polygon
* fade_out_shape
;
162 ArdourCanvas::SimpleRect
* fade_in_handle
;
163 ArdourCanvas::SimpleRect
* fade_out_handle
;
164 AudioRegionGainLine
* gain_line
;
166 double _amplitude_above_axis
;
172 #endif /* __gtk_ardour_audio_region_view_h__ */