-void
-ARDOUR_UI::build_control_surface_menu ()
-{
- list<ControlProtocolInfo*>::iterator i;
- bool with_feedback;
-
- /* !!! this has to match the top level entry from ardour.menus */
-
- string ui = "<menubar name='Main' action='MainMenu'>\n"
- "<menu name='Options' action='Options'>\n"
- "<menu action='ControlSurfaces'><separator/>\n";
-
- for (i = ControlProtocolManager::instance().control_protocol_info.begin();
- i != ControlProtocolManager::instance().control_protocol_info.end(); ++i) {
-
- if (!(*i)->mandatory) {
-
- // Enable surface
-
- string action_name = "Toggle";
- action_name += legalize_for_path ((*i)->name);
- action_name += "Surface";
-
- string action_label = (*i)->name;
-
- Glib::RefPtr<Action> act = ActionManager::register_toggle_action (
- editor->editor_actions, action_name.c_str(), action_label.c_str(), (bind (
- mem_fun (*this, &ARDOUR_UI::toggle_control_protocol),
- *i)));
-
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-
- with_feedback = false;
-
- if ((*i)->protocol || (*i)->requested) {
- tact->set_active ();
- }
-
- ui += "<menuitem action='";
- ui += action_name;
- ui += "'/>\n";
-
- // Enable feedback
-
- if ((*i)->supports_feedback) {
-
- action_name += "Feedback";
- string feedback_label = action_label + " " + _("Feedback");
-
- Glib::RefPtr<Action> act = ActionManager::register_toggle_action (
- editor->editor_actions, action_name.c_str(), feedback_label.c_str(), (bind (
- mem_fun (*this, &ARDOUR_UI::toggle_control_protocol_feedback),
- *i, "Editor", action_name)));
-
- ui += "<menuitem action='";
- ui += action_name;
- ui += "'/>\n";
-
- if ((*i)->protocol) {
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
- tact->set_active ((*i)->protocol->get_feedback ());
- }
- }
- }
- }
-
- ui += "</menu>\n</menu>\n</menubar>\n";
-
- ActionManager::ui_manager->add_ui_from_string (ui);
-}
-