X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Foption_editor.h;h=9ab8132d2c116ea485a5c8bc0892553c0c6ccda2;hb=fb3d1a6f244525d02f16cb851b925e07a43b1648;hp=47afa77868f6186be211db07894235c8992619e0;hpb=b9185d2c07c77eccf3679ac99f6b69f8fdd79c48;p=ardour.git diff --git a/gtk2_ardour/option_editor.h b/gtk2_ardour/option_editor.h index 47afa77868..9ab8132d2c 100644 --- a/gtk2_ardour/option_editor.h +++ b/gtk2_ardour/option_editor.h @@ -46,7 +46,7 @@ * options dialog. */ -namespace ARDOUR { +namespace PBD { class Configuration; } @@ -169,11 +169,11 @@ public: _button->set_sensitive (yn); } - Gtk::Widget& tip_widget() { return *_button; } + Gtk::Widget& tip_widget() { return *_button; } -private: +protected: - void toggled (); + virtual void toggled (); sigc::slot _get; ///< slot to get the configuration variable's value sigc::slot _set; ///< slot to set the configuration variable's value @@ -181,6 +181,31 @@ private: Gtk::Label* _label; ///< label for button, so we can use markup }; +class RouteDisplayBoolOption : public BoolOption +{ +public: + RouteDisplayBoolOption (std::string const &, std::string const &, sigc::slot, sigc::slot); +protected: + virtual void toggled (); +}; + +/** Component which allows to add any GTK Widget - intended for single buttons and custom stateless objects */ +class FooOption : public OptionEditorComponent +{ +public: + FooOption (Gtk::Widget *w) : _w (w) {} + + void add_to_page (OptionEditorPage* p) { + add_widget_to_page (p, _w); + } + + Gtk::Widget& tip_widget() { return *_w; } + void set_state_from_config () {} + void parameter_changed (std::string const &) {} +private: + Gtk::Widget *_w; +}; + /** Component which provides the UI to handle a string option using a GTK Entry */ class EntryOption : public Option { @@ -189,17 +214,22 @@ public: EntryOption (std::string const &, std::string const &, sigc::slot, sigc::slot); void set_state_from_config (); void add_to_page (OptionEditorPage*); + void set_sensitive (bool); + void set_invalid_chars (std::string i) { _invalid = i; } - Gtk::Widget& tip_widget() { return *_entry; } + Gtk::Widget& tip_widget() { return *_entry; } private: void activated (); + bool focus_out (GdkEventFocus*); + void filter_text (const Glib::ustring&, int*); sigc::slot _get; ///< slot to get the configuration variable's value sigc::slot _set; ///< slot to set the configuration variable's value Gtk::Label* _label; ///< UI label Gtk::Entry* _entry; ///< UI entry + std::string _invalid; }; @@ -347,6 +377,7 @@ public: } Gtk::Widget& tip_widget() { return *_hscale; } + Gtk::HScale& scale() { return *_hscale; } private: sigc::slot _get; @@ -475,6 +506,7 @@ public: * @param page Page step for the spin button. * @param unit Unit name. * @param scale Scaling factor (such that for a value x in the spinbutton, x * scale is written to the config) + * @param digits Number of decimal digits to show. */ SpinOption ( std::string const & i, @@ -486,7 +518,8 @@ public: T step, T page, std::string const & unit = "", - float scale = 1 + float scale = 1, + unsigned digits = 0 ) : Option (i, n), _get (g), @@ -499,6 +532,7 @@ public: _spin = Gtk::manage (new Gtk::SpinButton); _spin->set_range (min, max); _spin->set_increments (step, page); + _spin->set_digits(digits); _box = Gtk::manage (new Gtk::HBox); _box->pack_start (*_spin, true, true); @@ -590,7 +624,7 @@ public: Gtk::Widget& tip_widget() { return _file_chooser; } private: - void file_set (); + void selection_changed (); void current_folder_set (); sigc::slot _get; ///< slot to get the configuration variable's value @@ -616,18 +650,19 @@ public: class OptionEditor : public ArdourWindow { public: - OptionEditor (ARDOUR::Configuration *, std::string const &); + OptionEditor (PBD::Configuration *, std::string const &); ~OptionEditor (); void add_option (std::string const &, OptionEditorComponent *); - + void add_page (std::string const &, Gtk::Widget& page_widget); + void set_current_page (std::string const &); protected: virtual void parameter_changed (std::string const &); - - ARDOUR::Configuration* _config; + + PBD::Configuration* _config; private: