diff --git a/gtk2_ardour/ui/editor_window.xml b/gtk2_ardour/ui/editor_window.xml
index 3594b705c2..3959957a05 100644
--- a/gtk2_ardour/ui/editor_window.xml
+++ b/gtk2_ardour/ui/editor_window.xml
@@ -22,7 +22,10 @@
maxvalue="10"
step="0.2"
pagesize="2.0"/>
+
+
+
diff --git a/gtk2_ardour/ui/tracks_preferences.xml b/gtk2_ardour/ui/tracks_preferences.xml
index c9988241bc..45fba3c7cd 100644
--- a/gtk2_ardour/ui/tracks_preferences.xml
+++ b/gtk2_ardour/ui/tracks_preferences.xml
@@ -2,46 +2,68 @@
diff --git a/gtk2_ardour/waves_button.cc b/gtk2_ardour/waves_button.cc
index 16d9476b05..d364b42af4 100644
--- a/gtk2_ardour/waves_button.cc
+++ b/gtk2_ardour/waves_button.cc
@@ -97,6 +97,10 @@ void
WavesButton::set_text (const std::string& str)
{
_text = str;
+ Gtk::Label* child = _find_label (this);
+ if (child) {
+ child->set_text (str);
+ }
_layout->set_text (str);
queue_resize ();
}
@@ -169,7 +173,10 @@ void
WavesButton::render_text (cairo_t* cr)
{
// text, if any
- if (!_text.empty()) {
+
+ if ((!_find_label (this)) &&
+ (!_text.empty ())) {
+
Glib::RefPtr style = get_style();
cairo_save (cr);
@@ -474,6 +481,16 @@ WavesButton::on_leave_notify_event (GdkEventCrossing* ev)
return CairoWidget::on_leave_notify_event (ev);
}
+void
+WavesButton::on_realize ()
+{
+ Gtk::EventBox::on_realize ();
+ Gtk::Label* child = _find_label (this);
+ if (child) {
+ child->set_text (get_text());
+ }
+}
+
void
WavesButton::action_sensitivity_changed ()
{
@@ -516,3 +533,22 @@ WavesButton::set_rounded_corner_mask (int mask)
_corner_mask = mask;
queue_draw ();
}
+
+Gtk::Label*
+WavesButton::_find_label (Gtk::Container *container)
+{
+ Gtk::Label* label = NULL;
+ if (container) {
+ std::list children = container->get_children ();
+ for (std::list::iterator i = children.begin(); i != children.end(); ++i) {
+ label = dynamic_cast(*i);
+ if (!label) {
+ label = _find_label (dynamic_cast(*i));
+ }
+ if (label) {
+ break;
+ }
+ }
+ }
+ return label;
+}
\ No newline at end of file
diff --git a/gtk2_ardour/waves_button.h b/gtk2_ardour/waves_button.h
index f2d8179b7f..291a9ec928 100644
--- a/gtk2_ardour/waves_button.h
+++ b/gtk2_ardour/waves_button.h
@@ -71,14 +71,15 @@ class WavesButton : public CairoWidget , public Gtkmm2ext::Activatable
RGBA() : red (0), green (0), blue (0), alpha (0) {}
};
- void render (cairo_t *, cairo_rectangle_t*);
- void render_text (cairo_t *);
+ void render (cairo_t *, cairo_rectangle_t*);
+ void render_text (cairo_t *);
void on_size_request (Gtk::Requisition* req);
void on_style_changed (const Glib::RefPtr&);
void on_name_changed ();
bool on_enter_notify_event (GdkEventCrossing*);
bool on_leave_notify_event (GdkEventCrossing*);
+ void on_realize ();
void controllable_changed ();
PBD::ScopedConnection watch_connection;
@@ -111,6 +112,7 @@ class WavesButton : public CairoWidget , public Gtkmm2ext::Activatable
private:
static void __prop_style_watcher(WavesButton *);
void _prop_style_watcher();
+ Gtk::Label* _find_label (Gtk::Container *child);
BindingProxy binding_proxy;
diff --git a/gtk2_ardour/waves_icon_button.cc b/gtk2_ardour/waves_icon_button.cc
index 2808c4c29f..911288210d 100644
--- a/gtk2_ardour/waves_icon_button.cc
+++ b/gtk2_ardour/waves_icon_button.cc
@@ -84,8 +84,6 @@ WavesIconButton::render (cairo_t* cr, cairo_rectangle_t*)
gdk_cairo_set_source_pixbuf (cr, pixbuf->gobj(), x, y);
cairo_fill (cr);
}
-
- render_text (cr);
}
void
diff --git a/gtk2_ardour/waves_ui.cc b/gtk2_ardour/waves_ui.cc
index a8ede3d049..9339647190 100644
--- a/gtk2_ardour/waves_ui.cc
+++ b/gtk2_ardour/waves_ui.cc
@@ -84,7 +84,7 @@ WavesUI::create_widget (const XMLNode& definition, const XMLNodeMap& styles)
} else if (widget_type == "DROPDOWN") {
child = manage (new WavesDropdown (text));
} else if (widget_type == "DROPDOWNITEM") {
- child = manage (new WavesDropdown (text));
+ } else if (widget_type == "DROPDOWNMENU") {
} else if (widget_type == "ICON") {
std::string image_path;
Searchpath spath(ARDOUR::ardour_data_search_path ());
@@ -444,18 +444,26 @@ WavesUI::add_dropdown_items (WavesDropdown &dropdown, const XMLNodeList& definit
}
std::string node_name = (**i).name ();
std::transform (node_name.begin (), node_name.end (), node_name.begin (), ::toupper);
- if (node_name != "DROPDOWNITEM") {
- continue;
- }
- std::string title = xml_property (**i, "title", styles, "");
- if (title.empty ()) {
- continue;
- }
- int itemdata = xml_property (**i, "data", styles, 0);
- Gtk::MenuItem& menuitem = dropdown.add_menu_item (title, (void*)itemdata);
- if (menuitem.get_child ()) {
- set_attributes (*menuitem.get_child (), **i, styles);
- }
+
+ if (node_name == "DROPDOWNMENU") {
+ set_attributes (dropdown.get_menu (), **i, styles);
+ const XMLNodeList& menuitems = (**i).children ();
+ for (XMLNodeList::const_iterator ii = menuitems.begin (); ii != menuitems.end (); ++ii) {
+ std::string node_name = (**ii).name ();
+ std::transform (node_name.begin (), node_name.end (), node_name.begin (), ::toupper);
+ if (node_name == "DROPDOWNITEM") {
+ std::string title = xml_property (**ii, "title", styles, "");
+ if (title.empty ()) {
+ continue;
+ }
+ int itemdata = xml_property (**ii, "data", styles, 0);
+ Gtk::MenuItem& menuitem = dropdown.add_menu_item (title, (void*)itemdata);
+ if (menuitem.get_child ()) {
+ set_attributes (*menuitem.get_child (), **ii, styles);
+ }
+ }
+ }
+ }
}
}
@@ -467,11 +475,10 @@ WavesUI::create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk
if (dropdown) {
add_dropdown_items (*dropdown, definition, styles);
- } else {
- for (XMLNodeList::const_iterator i = definition.begin (); i != definition.end (); ++i) {
- if (!(**i).is_content()) {
- WavesUI::add_widget (root, **i, styles);
- }
+ }
+ for (XMLNodeList::const_iterator i = definition.begin (); i != definition.end (); ++i) {
+ if (!(**i).is_content()) {
+ WavesUI::add_widget (root, **i, styles);
}
}
}
@@ -608,6 +615,27 @@ WavesUI::set_attributes (Gtk::Widget& widget, const XMLNode& definition, const X
widget.modify_fg(Gtk::STATE_PRELIGHT, Gdk::Color(property));
}
+ property = xml_property (definition, "state", styles, "");
+ if (!property.empty ()) {
+ Gtk::StateType state = Gtk::STATE_NORMAL;
+ if (property == "normal") {
+ state = Gtk::STATE_NORMAL;
+ } else if (property == "active") {
+ state = Gtk::STATE_ACTIVE;
+ } else if (property == "prelight") {
+ state = Gtk::STATE_PRELIGHT;
+ } else if (property == "selected") {
+ state = Gtk::STATE_SELECTED;
+ } else if (property == "insensitive") {
+ state = Gtk::STATE_INSENSITIVE;
+ } else if (property == "disabled") {
+ state = Gtk::STATE_INSENSITIVE;
+ } else {
+ dbg_msg ("Invalid state for Gtk::Widget !");
+ }
+ widget.set_state (state);
+ }
+
#if defined (PLATFORM_WINDOWS)
property = xml_property (definition, "winfont", styles, "");
#elif defined (__APPLE__)
@@ -742,11 +770,6 @@ WavesUI::set_attributes (Gtk::Widget& widget, const XMLNode& definition, const X
}
}
- WavesDropdown* dropdown = dynamic_cast (&widget);
- if (dropdown) {
- set_attributes (dropdown->get_menu (), definition, styles);
- }
-
Gtk::Table* table = dynamic_cast (&widget);
if (table) {
table->set_col_spacings (xml_property (definition, "columnspacing", styles, 0));