X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fcrossfade_edit.h;h=f18b26ae8ad30262de231af77c94a0f469d30d05;hb=0883f02de92478800ad232f10d388219e2817ed7;hp=715aa1a3607da3f6fe3765d9dd0aa66c4d4af110;hpb=666e0870554705f4fb466fc6b188fe9b4000ca49;p=ardour.git diff --git a/gtk2_ardour/crossfade_edit.h b/gtk2_ardour/crossfade_edit.h index 715aa1a360..f18b26ae8a 100644 --- a/gtk2_ardour/crossfade_edit.h +++ b/gtk2_ardour/crossfade_edit.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2007 Paul Davis + Copyright (C) 2000-2007 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,103 +26,118 @@ #include #include -#include +#include "canvas/canvas.h" + +#include "evoral/Curve.hpp" +#include "ardour/session_handle.h" + #include "ardour_dialog.h" -#include "canvas.h" namespace ARDOUR { class Session; - class Curve; + class AutomationList; class Crossfade; } +namespace ArdourCanvas { + class Rectangle; + class Line; + class Polygon; +} + +namespace ArdourWaveview { + class WaveView; +} + class CrossfadeEditor : public ArdourDialog { - public: - CrossfadeEditor (ARDOUR::Session&, boost::shared_ptr, double miny, double maxy); +public: + CrossfadeEditor (ARDOUR::Session*, boost::shared_ptr, double miny, double maxy); ~CrossfadeEditor (); - + void apply (); - + 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; - - PresetPoint (double a, double b) - : x (a), y (b) {} + double x; + double y; + + PresetPoint (double a, double b) + : x (a), y (b) {} }; - - struct Preset : public list { - const char* image_name; - - Preset (const char* x) : image_name (x) {} + + struct Preset : public std::list { + const char* name; + const char* image_name; + + Preset (const char* n, const char* x) : name (n), image_name (x) {} }; - - typedef list Presets; - + + typedef std::list Presets; + static Presets* fade_in_presets; static Presets* fade_out_presets; - - private: + +protected: + bool on_key_press_event (GdkEventKey*); + bool on_key_release_event (GdkEventKey*); + +private: boost::shared_ptr xfade; - ARDOUR::Session& session; - + Gtk::VBox vpacker; - + struct Point { - ~Point(); - - ArdourCanvas::SimpleRect* box; - ArdourCanvas::Line* curve; - double x; - double y; - - static const int32_t size; - - void move_to (double x, double y, double xfract, double yfract); + ~Point(); + + ArdourCanvas::Rectangle* box; + ArdourCanvas::PolyLine* curve; + double x; + double y; + + static const int32_t size; + + 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; - } + + struct PointSorter { + 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; - list points; - ARDOUR::Curve normative_curve; /* 0 - 1.0, linear */ - ARDOUR::Curve gain_curve; /* 0 - 2.0, gain mapping */ - vector waves; - - Half(); + ArdourCanvas::PolyLine* line; + ArdourCanvas::Polygon* shading; + std::list points; + ARDOUR::AutomationList normative_curve; /* 0 - 1.0, linear */ + ARDOUR::AutomationList gain_curve; /* 0 - 2.0, gain mapping */ + std::vector waves; + + Half(); }; - + enum WhichFade { In = 0, Out = 1 }; - + Half fade[2]; WhichFade current; - + bool point_grabbed; - vector fade_out_buttons; - vector fade_in_buttons; + std::vector fade_out_buttons; + std::vector fade_in_buttons; Gtk::VBox vpacker2; @@ -150,7 +165,7 @@ class CrossfadeEditor : public ArdourDialog void add_control_point (double x, double y); Point* make_point (); void redraw (); - + double effective_width () const { return canvas->get_allocation().get_width() - (2.0 * canvas_border); } double effective_height () const { return canvas->get_allocation().get_height() - (2.0 * canvas_border); } @@ -165,7 +180,7 @@ class CrossfadeEditor : public ArdourDialog void build_presets (); void apply_preset (Preset*); - + Gtk::RadioButton select_in_button; Gtk::RadioButton select_out_button; Gtk::HBox curve_button_box; @@ -175,32 +190,40 @@ class CrossfadeEditor : public ArdourDialog double x_coordinate (double& xfract) const; double y_coordinate (double& yfract) const; - - void set (const ARDOUR::Curve& alist, WhichFade); - sigc::connection peaks_ready_connection; + void set (const ARDOUR::AutomationList& alist, WhichFade); + + PBD::ScopedConnection* _peaks_ready_connection; + PBD::ScopedConnection state_connection; void make_waves (boost::shared_ptr, WhichFade); - void peaks_ready (boost::shared_ptr r, WhichFade); - + void peaks_ready (boost::weak_ptr r, WhichFade); + void _apply_to (boost::shared_ptr xf); void setup (boost::shared_ptr); void cancel_audition (); void audition_state_changed (bool); + enum Audition { + Both, + Left, + Right + }; + void audition_toggled (); void audition_right_toggled (); void audition_right_dry_toggled (); void audition_left_toggled (); void audition_left_dry_toggled (); + void audition (Audition); void audition_both (); void audition_left_dry (); void audition_left (); void audition_right_dry (); void audition_right (); - void xfade_changed (ARDOUR::Change); + void xfade_changed (const PBD::PropertyChange&); void dump (); };