replace ::cast_dynamic() with relevant ActionManager::get_*_action() calls
[ardour.git] / gtk2_ardour / crossfade_edit.h
index 7334002abd8a677b7ad3681676e28d414bfd9088..f18b26ae8ad30262de231af77c94a0f469d30d05 100644 (file)
 #include <gtkmm/button.h>
 #include <gtkmm/radiobutton.h>
 
+#include "canvas/canvas.h"
+
 #include "evoral/Curve.hpp"
 #include "ardour/session_handle.h"
 
 #include "ardour_dialog.h"
-#include "canvas.h"
 
 namespace ARDOUR
 {
@@ -39,9 +40,19 @@ namespace ARDOUR
        class Crossfade;
 }
 
+namespace ArdourCanvas {
+       class Rectangle;
+       class Line;
+       class Polygon;
+}
+
+namespace ArdourWaveview {
+       class WaveView;
+}
+
 class CrossfadeEditor : public ArdourDialog
 {
-  public:
+public:
        CrossfadeEditor (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Crossfade>, double miny, double maxy);
        ~CrossfadeEditor ();
 
@@ -49,25 +60,24 @@ class CrossfadeEditor : public ArdourDialog
 
        static const double canvas_border;
 
-       /* these are public so that a caller/subclass can make them do the right thing.
-        */
+       /* these are public so that a caller/subclass can make them do the right thing. */
 
        Gtk::Button* cancel_button;
        Gtk::Button* ok_button;
 
        struct PresetPoint {
-           double x;
-           double y;
+               double x;
+               double y;
 
-           PresetPoint (double a, double b)
-                   : x (a), y (b) {}
+               PresetPoint (double a, double b)
+                       : x (a), y (b) {}
        };
 
        struct Preset : public std::list<PresetPoint> {
-           const char* name;
-           const char* image_name;
+               const char* name;
+               const char* image_name;
 
-           Preset (const char* n, const char* x) : name (n), image_name (x) {}
+               Preset (const char* n, const char* x) : name (n), image_name (x) {}
        };
 
        typedef std::list<Preset*> Presets;
@@ -75,46 +85,46 @@ class CrossfadeEditor : public ArdourDialog
        static Presets* fade_in_presets;
        static Presets* fade_out_presets;
 
-  protected:
+protected:
        bool on_key_press_event (GdkEventKey*);
        bool on_key_release_event (GdkEventKey*);
 
-  private:
+private:
        boost::shared_ptr<ARDOUR::Crossfade> xfade;
 
        Gtk::VBox vpacker;
 
        struct Point {
-           ~Point();
+               ~Point();
 
-           ArdourCanvas::SimpleRect* box;
-           ArdourCanvas::Line* curve;
-           double x;
-           double y;
+               ArdourCanvas::Rectangle* box;
+               ArdourCanvas::PolyLine* curve;
+               double x;
+               double y;
 
-           static const int32_t size;
+               static const int32_t size;
 
-           void move_to (double x, double y, double xfract, double yfract);
+               void move_to (double x, double y, double xfract, double yfract);
        };
 
        struct PointSorter {
-           bool operator() (const CrossfadeEditor::Point* a, const CrossfadeEditor::Point *b) {
-                   return a->x < b->x;
-           }
+               bool operator() (const CrossfadeEditor::Point* a, const CrossfadeEditor::Point *b) {
+                       return a->x < b->x;
+               }
        };
 
-       ArdourCanvas::SimpleRect*   toplevel;
-       ArdourCanvas::Canvas* canvas;
+       ArdourCanvas::Rectangle*   toplevel;
+       ArdourCanvas::GtkCanvas* canvas;
 
        struct Half {
-           ArdourCanvas::Line*     line;
-           ArdourCanvas::Polygon*  shading;
-           std::list<Point*>       points;
-           ARDOUR::AutomationList  normative_curve; /* 0 - 1.0, linear */
-           ARDOUR::AutomationList  gain_curve;      /* 0 - 2.0, gain mapping */
-           std::vector<ArdourCanvas::WaveView*>  waves;
-
-           Half();
+               ArdourCanvas::PolyLine* line;
+               ArdourCanvas::Polygon*  shading;
+               std::list<Point*>       points;
+               ARDOUR::AutomationList  normative_curve; /* 0 - 1.0, linear */
+               ARDOUR::AutomationList  gain_curve;      /* 0 - 2.0, gain mapping */
+               std::vector<ArdourWaveView::WaveView*>  waves;
+
+               Half();
        };
 
        enum WhichFade {
@@ -183,7 +193,8 @@ class CrossfadeEditor : public ArdourDialog
 
        void set (const ARDOUR::AutomationList& alist, WhichFade);
 
-       boost::signals2::scoped_connection peaks_ready_connection;
+       PBD::ScopedConnection* _peaks_ready_connection;
+       PBD::ScopedConnection state_connection;
 
        void make_waves (boost::shared_ptr<ARDOUR::AudioRegion>, WhichFade);
        void peaks_ready (boost::weak_ptr<ARDOUR::AudioRegion> r, WhichFade);
@@ -212,7 +223,7 @@ class CrossfadeEditor : public ArdourDialog
        void audition_right_dry ();
        void audition_right ();
 
-       void xfade_changed (ARDOUR::Change);
+       void xfade_changed (const PBD::PropertyChange&);
 
        void dump ();
 };