diff options
author | David Robillard <d@drobilla.net> | 2010-01-28 06:02:14 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-01-28 06:02:14 +0000 |
commit | cf099732084c20dfe45ae78b2d64816f2bf03ab6 (patch) | |
tree | 16e2042c653ea07acff74bc26515d24a0d193c76 /src | |
parent | 2b7f487f515929099744c69afe22f85c332b2f20 (diff) | |
download | ingen-cf099732084c20dfe45ae78b2d64816f2bf03ab6.tar.gz ingen-cf099732084c20dfe45ae78b2d64816f2bf03ab6.tar.bz2 ingen-cf099732084c20dfe45ae78b2d64816f2bf03ab6.zip |
Shrink code (generic Control::enable and Control::disable by iterating over box).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2389 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/Controls.cpp | 68 | ||||
-rw-r--r-- | src/gui/Controls.hpp | 15 |
2 files changed, 20 insertions, 63 deletions
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp index 6e2fd6be..8564fbed 100644 --- a/src/gui/Controls.cpp +++ b/src/gui/Controls.cpp @@ -76,6 +76,24 @@ Control::init(ControlPanel* panel, SharedPtr<PortModel> pm) void +Control::enable() +{ + for (Gtk::Box_Helpers::BoxList::const_iterator i = children().begin(); + i != children().end(); ++i) + i->get_widget()->set_sensitive(true); +} + + +void +Control::disable() +{ + for (Gtk::Box_Helpers::BoxList::const_iterator i = children().begin(); + i != children().end(); ++i) + i->get_widget()->set_sensitive(false); +} + + +void Control::set_name(const string& name) { const string name_markup = string("<span weight=\"bold\">") + name + "</span>"; @@ -223,24 +241,6 @@ SliderControl::set_range(float min, float max) void -SliderControl::enable() -{ - _slider->property_sensitive() = true; - _value_spinner->property_sensitive() = true; - _name_label->property_sensitive() = true; -} - - -void -SliderControl::disable() -{ - _slider->property_sensitive() = false; - _value_spinner->property_sensitive() = false; - _name_label->property_sensitive() = false; -} - - -void SliderControl::update_value_from_slider() { if (_enable_signal) { @@ -353,22 +353,6 @@ ToggleControl::set_value(const Atom& val) void -ToggleControl::enable() -{ - _checkbutton->property_sensitive() = true; - _name_label->property_sensitive() = true; -} - - -void -ToggleControl::disable() -{ - _checkbutton->property_sensitive() = false; - _name_label->property_sensitive() = false; -} - - -void ToggleControl::toggled() { if (_enable_signal) { @@ -422,22 +406,6 @@ StringControl::set_value(const Atom& val) void -StringControl::enable() -{ - _entry->property_sensitive() = true; - _name_label->property_sensitive() = true; -} - - -void -StringControl::disable() -{ - _entry->property_sensitive() = false; - _name_label->property_sensitive() = false; -} - - -void StringControl::activated() { if (_enable_signal) diff --git a/src/gui/Controls.hpp b/src/gui/Controls.hpp index 91b737ed..1a5ee46d 100644 --- a/src/gui/Controls.hpp +++ b/src/gui/Controls.hpp @@ -45,8 +45,8 @@ public: virtual void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); - virtual void enable() = 0; - virtual void disable() = 0; + void enable(); + void disable(); inline const SharedPtr<Client::PortModel> port_model() const { return _port_model; } @@ -78,9 +78,6 @@ public: SliderControl(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& glade_xml); void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); - void enable(); - void disable(); - void set_min(float val); void set_max(float val); @@ -115,12 +112,8 @@ public: void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); - void enable(); - void disable(); - private: void set_value(const Raul::Atom& value); - void toggled(); Gtk::CheckButton* _checkbutton; @@ -138,12 +131,8 @@ public: void init(ControlPanel* panel, SharedPtr<Client::PortModel> pm); - void enable(); - void disable(); - private: void set_value(const Raul::Atom& value); - void activated(); Gtk::Entry* _entry; |