summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-11-12 07:02:33 +0000
committerDavid Robillard <d@drobilla.net>2009-11-12 07:02:33 +0000
commitcfec427867f42d7aa7bea6dfbb0736b5ce99e9e2 (patch)
treecc41e4172bcaecc0eaa74ca55c4753cacef948c7
parent64bd557e75113743f179086b365ea7d97b72ee3e (diff)
downloadingen-cfec427867f42d7aa7bea6dfbb0736b5ce99e9e2.tar.gz
ingen-cfec427867f42d7aa7bea6dfbb0736b5ce99e9e2.tar.bz2
ingen-cfec427867f42d7aa7bea6dfbb0736b5ce99e9e2.zip
Factor out common Control code.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2256 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/gui/Controls.cpp36
-rw-r--r--src/gui/Controls.hpp10
2 files changed, 11 insertions, 35 deletions
diff --git a/src/gui/Controls.cpp b/src/gui/Controls.cpp
index 39c18a88..6ab9081a 100644
--- a/src/gui/Controls.cpp
+++ b/src/gui/Controls.cpp
@@ -42,6 +42,7 @@ Control::Control(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>&
: Gtk::VBox(cobject)
, _control_panel(NULL)
, _enable_signal(false)
+ , _name_label(NULL)
{
Glib::RefPtr<Gnome::Glade::Xml> menu_xml = GladeFactory::new_glade_reference("port_control_menu");
menu_xml->get_widget("port_control_menu", _menu);
@@ -74,6 +75,14 @@ Control::init(ControlPanel* panel, SharedPtr<PortModel> pm)
void
+Control::set_name(const string& name)
+{
+ const string name_markup = string("<span weight=\"bold\">") + name + "</span>";
+ _name_label->set_markup(name_markup);
+}
+
+
+void
Control::menu_properties()
{
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference();
@@ -213,15 +222,6 @@ SliderControl::set_range(float min, float max)
void
-SliderControl::set_name(const string& name)
-{
- string name_label = "<span weight=\"bold\">";
- name_label += name + "</span>";
- _name_label->set_markup(name_label);
-}
-
-
-void
SliderControl::enable()
{
_slider->property_sensitive() = true;
@@ -410,15 +410,6 @@ ToggleControl::init(ControlPanel* panel, SharedPtr<PortModel> pm)
void
-ToggleControl::set_name(const string& name)
-{
- string name_label = "<span weight=\"bold\">";
- name_label += name + "</span>";
- _name_label->set_markup(name_label);
-}
-
-
-void
ToggleControl::set_value(const Atom& val)
{
bool enable = false;
@@ -500,15 +491,6 @@ StringControl::init(ControlPanel* panel, SharedPtr<PortModel> pm)
void
-StringControl::set_name(const string& name)
-{
- string name_label = "<span weight=\"bold\">";
- name_label += name + "</span>";
- _name_label->set_markup(name_label);
-}
-
-
-void
StringControl::set_value(const Atom& val)
{
_enable_signal = false;
diff --git a/src/gui/Controls.hpp b/src/gui/Controls.hpp
index 0f0dbd79..844e6738 100644
--- a/src/gui/Controls.hpp
+++ b/src/gui/Controls.hpp
@@ -54,6 +54,7 @@ protected:
virtual void set_value(const Raul::Atom& value) = 0;
virtual void set_range(float min, float max) {}
+ void set_name(const std::string& name);
void menu_properties();
ControlPanel* _control_panel;
@@ -63,6 +64,7 @@ protected:
Gtk::Menu* _menu;
Gtk::MenuItem* _menu_properties;
+ Gtk::Label* _name_label;
};
@@ -83,7 +85,6 @@ public:
void set_max(float val);
private:
- void set_name(const std::string& name);
void set_value(const Raul::Atom& value);
void set_range(float min, float max);
@@ -98,7 +99,6 @@ private:
bool _enabled;
- Gtk::Label* _name_label;
Gtk::SpinButton* _value_spinner;
Gtk::HScale* _slider;
};
@@ -119,14 +119,12 @@ public:
void disable();
private:
- void set_name(const string& name);
void set_value(float val);
void update_value();
bool _enable_signal;
Gtk::Alignment _alignment;
- Gtk::Label _name_label;
Gtk::SpinButton _spinner;
};
#endif
@@ -147,12 +145,10 @@ public:
void disable();
private:
- void set_name(const std::string& name);
void set_value(const Raul::Atom& value);
void toggled();
- Gtk::Label* _name_label;
Gtk::CheckButton* _checkbutton;
};
@@ -172,12 +168,10 @@ public:
void disable();
private:
- void set_name(const std::string& name);
void set_value(const Raul::Atom& value);
void activated();
- Gtk::Label* _name_label;
Gtk::Entry* _entry;
};