diff --git a/gtk2_ardour/waves_dropdown.cc b/gtk2_ardour/waves_dropdown.cc index d9c3f4983f..24f9e0f99e 100644 --- a/gtk2_ardour/waves_dropdown.cc +++ b/gtk2_ardour/waves_dropdown.cc @@ -41,14 +41,18 @@ WavesDropdown::add_menu_item (const std::string& item, void* cookie) { Gtk::Menu_Helpers::MenuList& items = _menu.items (); - items.push_back (Gtk::Menu_Helpers::MenuElem (item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), cookie))); + items.push_back (Gtk::Menu_Helpers::MenuElem (item, sigc::bind (sigc::mem_fun(*this, &WavesDropdown::_on_menu_item), items.size (), cookie))); return _menu.items ().back (); } void -WavesDropdown::_on_menu_item (void* cookie) +WavesDropdown::_on_menu_item (size_t item_number, void* cookie) { + Gtk::Menu_Helpers::MenuList& items = _menu.items (); + Gtk::Menu_Helpers::MenuList::iterator i = items.begin(); + std::advance (i, item_number); + set_text ((*i).get_label()); signal_menu_item_clicked (this, cookie); } @@ -71,18 +75,4 @@ WavesDropdown::_on_popup_menu_position (int& x, int& y, bool& push_in) x += xo; y += yo; } - - /* - if (get_window ()) { - Gtk::Allocation a = get_allocation (); - - int xo; - int yo; - - get_window ()->get_origin (xo, yo); - - x = xo; - y = yo + a.get_height (); - } - */ } diff --git a/gtk2_ardour/waves_dropdown.h b/gtk2_ardour/waves_dropdown.h index db9d362d94..1a48f7b3bd 100644 --- a/gtk2_ardour/waves_dropdown.h +++ b/gtk2_ardour/waves_dropdown.h @@ -40,7 +40,7 @@ class WavesDropdown : public WavesIconButton private: Gtk::Menu _menu; - void _on_menu_item (void* cookie); + void _on_menu_item (size_t item_number, void* cookie); void _on_popup_menu_position (int& x, int& y, bool& push_in); }; diff --git a/gtk2_ardour/waves_ui.cc b/gtk2_ardour/waves_ui.cc index 5cfcb06346..be4bbf233c 100644 --- a/gtk2_ardour/waves_ui.cc +++ b/gtk2_ardour/waves_ui.cc @@ -463,7 +463,6 @@ WavesUI::create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk WavesDropdown* dropdown = dynamic_cast (&root); if (dropdown) { - dbg_msg ("launching dropdown->create_menu ()"); add_dropdown_items (*dropdown, definition, styles); } else { for (XMLNodeList::const_iterator i = definition.begin (); i != definition.end (); ++i) {