summaryrefslogtreecommitdiff
path: root/libs/canvas/canvas/wave_view.h
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-04 00:32:52 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-04 00:32:52 -0400
commitaaea166135ace01709f7e0be64f40be80f4107ec (patch)
tree0e794ef7a723e4aaf909b841a6816e405b4ceca1 /libs/canvas/canvas/wave_view.h
parent1d8bac08c0c00d44e22c581768a275e1b21a99a7 (diff)
initial commit of hand merging, plus getting "ancient" waf script to work correctly
Diffstat (limited to 'libs/canvas/canvas/wave_view.h')
-rw-r--r--libs/canvas/canvas/wave_view.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/libs/canvas/canvas/wave_view.h b/libs/canvas/canvas/wave_view.h
new file mode 100644
index 0000000000..8ef0ce9868
--- /dev/null
+++ b/libs/canvas/canvas/wave_view.h
@@ -0,0 +1,119 @@
+#include <boost/shared_ptr.hpp>
+#include "pbd/properties.h"
+#include "ardour/types.h"
+#include "canvas/item.h"
+#include "canvas/fill.h"
+#include "canvas/outline.h"
+
+namespace ARDOUR {
+ class AudioRegion;
+}
+
+class WaveViewTest;
+
+namespace ArdourCanvas {
+
+class WaveView : virtual public Item, public Outline, public Fill
+{
+public:
+ WaveView (Group *, boost::shared_ptr<ARDOUR::AudioRegion>);
+
+ void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
+ void compute_bounding_box () const;
+
+ XMLNode* get_state () const;
+ void set_state (XMLNode const *);
+
+ void set_frames_per_pixel (double);
+ void set_height (Distance);
+ void set_channel (int);
+ void set_region_start (ARDOUR::frameoffset_t);
+
+ void region_resized ();
+
+ /* XXX */
+ void rebuild () {}
+
+#ifdef CANVAS_COMPATIBILITY
+ void*& property_gain_src () {
+ return _foo_void;
+ }
+ void*& property_gain_function () {
+ return _foo_void;
+ }
+ bool& property_rectified () {
+ return _foo_bool;
+ }
+ bool& property_logscaled () {
+ return _foo_bool;
+ }
+ double& property_amplitude_above_axis () {
+ return _foo_double;
+ }
+ Color& property_clip_color () {
+ return _foo_uint;
+ }
+ Color& property_zero_color () {
+ return _foo_uint;
+ }
+
+private:
+ void* _foo_void;
+ bool _foo_bool;
+ int _foo_int;
+ Color _foo_uint;
+ double _foo_double;
+#endif
+
+ class CacheEntry
+ {
+ public:
+ CacheEntry (WaveView const *, int, int);
+ ~CacheEntry ();
+
+ int start () const {
+ return _start;
+ }
+
+ int end () const {
+ return _end;
+ }
+
+ ARDOUR::PeakData* peaks () const {
+ return _peaks;
+ }
+
+ Glib::RefPtr<Gdk::Pixbuf> pixbuf ();
+ void clear_pixbuf ();
+
+ private:
+ Coord position (float) const;
+
+ WaveView const * _wave_view;
+ int _start;
+ int _end;
+ int _n_peaks;
+ ARDOUR::PeakData* _peaks;
+ Glib::RefPtr<Gdk::Pixbuf> _pixbuf;
+ };
+
+ friend class CacheEntry;
+ friend class ::WaveViewTest;
+
+ void invalidate_whole_cache ();
+ void invalidate_pixbuf_cache ();
+
+ boost::shared_ptr<ARDOUR::AudioRegion> _region;
+ int _channel;
+ double _frames_per_pixel;
+ Coord _height;
+ Color _wave_color;
+ /** The `start' value to use for the region; we can't use the region's
+ * value as the crossfade editor needs to alter it.
+ */
+ ARDOUR::frameoffset_t _region_start;
+
+ mutable std::list<CacheEntry*> _cache;
+};
+
+}