more show() stuff, and replaced strip->show_all(); untill its actually finished
[ardour.git] / gtk2_ardour / audio_region_view.h
index e9172dec972899b4b8e3cf5e6c6a444129f2fc25..c8734da59b7d8fecf9a65461297bfd2721481906 100644 (file)
@@ -24,7 +24,7 @@
 #include <libgnomecanvasmm.h>
 #include <libgnomecanvasmm/polygon.h>
 #include <sigc++/signal.h>
-#include <ardour/region.h>
+#include <ardour/audioregion.h>
 
 #include "region_view.h"
 #include "route_time_axis.h"
@@ -33,7 +33,6 @@
 #include "enums.h"
 #include "waveview.h"
 #include "canvas.h"
-#include "color.h"
 
 namespace ARDOUR {
        class AudioRegion;
@@ -51,52 +50,54 @@ class AudioRegionView : public RegionView
   public:
        AudioRegionView (ArdourCanvas::Group *, 
                         RouteTimeAxisView&,
-                        ARDOUR::AudioRegion&,
+                        boost::shared_ptr<ARDOUR::AudioRegion>,
                         double initial_samples_per_unit,
                         Gdk::Color& basic_color);
 
+        AudioRegionView (const AudioRegionView& other);
+
        ~AudioRegionView ();
        
        virtual void init (Gdk::Color& base_color, bool wait_for_data = false);
        
-       ARDOUR::AudioRegion& audio_region() const;
-    
-    void set_height (double);
-    void set_samples_per_unit (double);
-
-    void set_amplitude_above_axis (gdouble spp);
-
-    void temporarily_hide_envelope (); ///< Dangerous!
-    void unhide_envelope ();           ///< Dangerous!
-
-    void set_envelope_visible (bool);
-    void set_waveform_visible (bool yn);
-    void set_waveform_shape (WaveformShape);
-
-    bool waveform_rectified() const { return _flags & WaveformRectified; }
-    bool waveform_visible()   const { return _flags & WaveformVisible; }
-    bool envelope_visible()   const { return _flags & EnvelopeVisible; }
-    
-    void show_region_editor ();
-
-    void add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event);
-    void remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event);
-
-    AudioRegionGainLine* get_gain_line() const { return gain_line; }
-
-    void region_changed (ARDOUR::Change);
-    void envelope_active_changed ();
-
-    GhostRegion* add_ghost (AutomationTimeAxisView&);
-
-    void reset_fade_in_shape_width (jack_nframes_t);
-    void reset_fade_out_shape_width (jack_nframes_t);
-    void set_fade_in_active (bool);
-    void set_fade_out_active (bool);
-
-    virtual void entered ();
-    virtual void exited ();
+       boost::shared_ptr<ARDOUR::AudioRegion> audio_region() const;
+       
+       void set_y_position_and_height (double, double);
+       void set_samples_per_unit (double);
+       
+       void set_amplitude_above_axis (gdouble spp);
+       
+       void temporarily_hide_envelope (); ///< Dangerous!
+       void unhide_envelope ();           ///< Dangerous!
+       
+       void set_envelope_visible (bool);
+       void set_waveform_visible (bool yn);
+       void set_waveform_shape (WaveformShape);
+       void set_waveform_scale (WaveformScale);
+       
+       bool waveform_rectified() const { return _flags & WaveformRectified; }
+       bool waveform_logscaled() const { return _flags & WaveformLogScaled; }
+       bool waveform_visible()   const { return _flags & WaveformVisible; }
+       bool envelope_visible()   const { return _flags & EnvelopeVisible; }
+       
+       void show_region_editor ();
+       
+       void add_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event);
+       void remove_gain_point_event (ArdourCanvas::Item *item, GdkEvent *event);
+       
+       AudioRegionGainLine* get_gain_line() const { return gain_line; }
+       
+       void region_changed (ARDOUR::Change);
+       void envelope_active_changed ();
+       
+       GhostRegion* add_ghost (AutomationTimeAxisView&);
+       
+       void reset_fade_in_shape_width (nframes_t);
+       void reset_fade_out_shape_width (nframes_t);
 
+       virtual void entered ();
+       virtual void exited ();
+       
   protected:
 
     /* this constructor allows derived types
@@ -105,16 +106,17 @@ class AudioRegionView : public RegionView
     */
     
     AudioRegionView (ArdourCanvas::Group *, 
-                            RouteTimeAxisView&,
-                            ARDOUR::AudioRegion&,
-                            double      samples_per_unit,
-                            Gdk::Color& basic_color,
-                            TimeAxisViewItem::Visibility);
+                    RouteTimeAxisView&,
+                    boost::shared_ptr<ARDOUR::AudioRegion>,
+                    double      samples_per_unit,
+                    Gdk::Color& basic_color,
+                    TimeAxisViewItem::Visibility);
     
     enum Flags {
            EnvelopeVisible = 0x1,
            WaveformVisible = 0x4,
-           WaveformRectified = 0x8
+           WaveformRectified = 0x8,
+           WaveformLogScaled = 0x10,
     };
 
     vector<ArdourCanvas::WaveView *> waves;
@@ -129,6 +131,8 @@ class AudioRegionView : public RegionView
     AudioRegionGainLine * gain_line;
 
     double _amplitude_above_axis;
+    double _y_position;
+    double _height;
 
     uint32_t _flags;
     uint32_t fade_color;
@@ -142,7 +146,6 @@ class AudioRegionView : public RegionView
     void fade_out_active_changed ();
 
     void region_resized (ARDOUR::Change);
-    void region_moved (void *);
     void region_muted ();
     void region_scale_amplitude_changed ();
        void region_renamed ();
@@ -158,10 +161,14 @@ class AudioRegionView : public RegionView
     void compute_colors (Gdk::Color&);
     void reset_width_dependent_items (double pixel_width);
     void set_waveview_data_src();
+    
+    void color_handler ();
 
     vector<GnomeCanvasWaveViewCache*> wave_caches;
-    
-    void color_handler (ColorID, uint32_t);
+
+  private:
+
+    void setup_fade_handle_positions ();
 };
 
 #endif /* __gtk_ardour_audio_region_view_h__ */