X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fmackie%2Fgui.cc;h=15be6394ef1b1a2556b14d451cc6520dda2cbfd3;hb=b5dbfc9931bc586fb2b5a50a2493e8c158c99896;hp=ac03e41e4e86a9ccc5ecbe3a26a9fa493b46dee1;hpb=fbdb4c602ebd9be2c567825d27bc259cf96505f6;p=ardour.git diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc index ac03e41e4e..15be6394ef 100644 --- a/libs/surfaces/mackie/gui.cc +++ b/libs/surfaces/mackie/gui.cc @@ -34,6 +34,7 @@ #include "pbd/stacktrace.h" #include "gtkmm2ext/actions.h" +#include "gtkmm2ext/bindings.h" #include "gtkmm2ext/gui_thread.h" #include "gtkmm2ext/utils.h" @@ -47,7 +48,7 @@ #include "surface.h" #include "surface_port.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace Gtk; @@ -202,12 +203,12 @@ MackieControlProtocolGUI::MackieControlProtocolGUI (MackieControlProtocol& p) vector profiles; - profiles.push_back ("default"); - for (std::map::iterator i = DeviceProfile::device_profiles.begin(); i != DeviceProfile::device_profiles.end(); ++i) { + cerr << "add discovered profile " << i->first << endl; profiles.push_back (i->first); } Gtkmm2ext::set_popdown_strings (_profile_combo, profiles); + cerr << "set active profile from " << p.device_profile().name() << endl; _profile_combo.set_active_text (p.device_profile().name()); _profile_combo.signal_changed().connect (sigc::mem_fun (*this, &MackieControlProtocolGUI::profile_combo_changed)); @@ -332,6 +333,7 @@ MackieControlProtocolGUI::device_dependent_widget () int row = 0; uint32_t n_surfaces = 1 + _cp.device_info().extenders(); + uint32_t main_pos = _cp.device_info().master_position(); if (!_cp.device_info().uses_ipmidi()) { dd_table = Gtk::manage (new Gtk::Table (n_surfaces, 2)); @@ -386,12 +388,12 @@ MackieControlProtocolGUI::device_dependent_widget () string receive_string; if (n_surfaces > 1) { - if (n == 0) { - send_string = _("Main surface sends via:"); - receive_string = _("Main surface receives via:"); + if (n == main_pos) { + send_string = string_compose(_("Main surface at position %1 sends via:"), n + 1); + receive_string = string_compose(_("Main surface at position %1 receives via:"), n + 1); } else { - send_string = string_compose (_("Extender %1 sends via:"), n); - receive_string = string_compose (_("Extender %1 receives via:"), n); + send_string = string_compose (_("Extender at position %1 sends via:"), n + 1); + receive_string = string_compose (_("Extender at position %1 receives via:"), n + 1); } } else { send_string = _("Surface sends via:"); @@ -451,12 +453,13 @@ MackieControlProtocolGUI::build_available_action_menu () vector labels; vector tooltips; vector keys; - vector bindings; + vector > actions; + typedef std::map NodeMap; NodeMap nodes; NodeMap::iterator r; - ActionManager::get_all_actions (labels, paths, tooltips, keys, bindings); + Gtkmm2ext::ActionMap::get_all_actions (paths, labels, tooltips, keys, actions); vector::iterator k; vector::iterator p; @@ -466,8 +469,9 @@ MackieControlProtocolGUI::build_available_action_menu () available_action_model->clear (); /* Because there are button bindings built in that are not - in the key binding map, there needs to be a way to undo - a profile edit. */ + in the key binding map, there needs to be a way to undo + a profile edit. + */ TreeIter rowp; TreeModel::Row parent; rowp = available_action_model->append(); @@ -489,7 +493,6 @@ MackieControlProtocolGUI::build_available_action_menu () parent = *(rowp); parent[available_action_columns.name] = _("CmdAlt"); - for (l = labels.begin(), k = keys.begin(), p = paths.begin(), t = tooltips.begin(); l != labels.end(); ++k, ++p, ++t, ++l) { TreeModel::Row row; @@ -620,54 +623,68 @@ MackieControlProtocolGUI::refresh_function_key_editor () string action; const string defstring = "\u2022"; - action = dp.get_button_action (bid, 0); - if (action.empty()) { - row[function_key_columns.plain] = defstring; - } else { - if (action.find ('/') == string::npos) { - /* Probably a key alias */ - row[function_key_columns.plain] = action; - } else { + /* We only allow plain bindings for Fn keys. All others are + * reserved for hard-coded actions. + */ - act = ActionManager::get_action (action.c_str()); - if (act) { - row[function_key_columns.plain] = act->get_label(); + if (bid >= Mackie::Button::F1 && bid <= Mackie::Button::F8) { + + action = dp.get_button_action (bid, 0); + if (action.empty()) { + row[function_key_columns.plain] = defstring; + } else { + if (action.find ('/') == string::npos) { + /* Probably a key alias */ + row[function_key_columns.plain] = action; } else { - row[function_key_columns.plain] = defstring; + + act = ActionManager::get_action (action.c_str()); + if (act) { + row[function_key_columns.plain] = act->get_label(); + } else { + row[function_key_columns.plain] = defstring; + } } } } - action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_CONTROL); - if (action.empty()) { - row[function_key_columns.control] = defstring; - } else { - if (action.find ('/') == string::npos) { - /* Probably a key alias */ - row[function_key_columns.control] = action; + /* We only allow plain bindings for Fn keys. All others are + * reserved for hard-coded actions. + */ + + if (bid >= Mackie::Button::F1 && bid <= Mackie::Button::F8) { + + action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_SHIFT); + if (action.empty()) { + row[function_key_columns.shift] = defstring; } else { - act = ActionManager::get_action (action.c_str()); - if (act) { - row[function_key_columns.control] = act->get_label(); + if (action.find ('/') == string::npos) { + /* Probably a key alias */ + row[function_key_columns.shift] = action; } else { - row[function_key_columns.control] = defstring; + act = ActionManager::get_action (action.c_str()); + if (act) { + row[function_key_columns.shift] = act->get_label(); + } else { + row[function_key_columns.shift] = defstring; + } } } } - action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_SHIFT); + action = dp.get_button_action (bid, MackieControlProtocol::MODIFIER_CONTROL); if (action.empty()) { - row[function_key_columns.shift] = defstring; + row[function_key_columns.control] = defstring; } else { if (action.find ('/') == string::npos) { /* Probably a key alias */ - row[function_key_columns.shift] = action; + row[function_key_columns.control] = action; } else { act = ActionManager::get_action (action.c_str()); if (act) { - row[function_key_columns.shift] = act->get_label(); + row[function_key_columns.control] = act->get_label(); } else { - row[function_key_columns.shift] = defstring; + row[function_key_columns.control] = defstring; } } } @@ -869,7 +886,11 @@ MackieControlProtocolGUI::build_midi_port_list (vector const & ports, bo for (vector::const_iterator p = ports.begin(); p != ports.end(); ++p) { row = *store->append (); row[midi_port_columns.full_name] = *p; - row[midi_port_columns.short_name] = (*p).substr ((*p).find (':') + 1); + std::string pn = ARDOUR::AudioEngine::instance()->get_pretty_name_by_name (*p); + if (pn.empty ()) { + pn = (*p).substr ((*p).find (':') + 1); + } + row[midi_port_columns.short_name] = pn; } return store;