From 53c47e0ccd663ee2118f988c0dde140b7aee4173 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 3 Oct 2015 11:08:47 -0400 Subject: add support to display and set key aliases in mackie GUI --- libs/surfaces/mackie/gui.cc | 82 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 62 insertions(+), 20 deletions(-) (limited to 'libs/surfaces/mackie/gui.cc') diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc index 99aeec14d8..d9d473728f 100644 --- a/libs/surfaces/mackie/gui.cc +++ b/libs/surfaces/mackie/gui.cc @@ -256,6 +256,22 @@ MackieControlProtocolGUI::build_available_action_menu () parent = *(rowp); parent[available_action_columns.name] = _("Remove Binding"); + /* Key aliasing */ + + rowp = available_action_model->append(); + parent = *(rowp); + parent[available_action_columns.name] = _("Shift"); + rowp = available_action_model->append(); + parent = *(rowp); + parent[available_action_columns.name] = _("Control"); + rowp = available_action_model->append(); + parent = *(rowp); + parent[available_action_columns.name] = _("Option"); + rowp = available_action_model->append(); + 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; @@ -390,11 +406,17 @@ MackieControlProtocolGUI::refresh_function_key_editor () if (action.empty()) { row[function_key_columns.plain] = defstring; } else { - act = ActionManager::get_action (action.c_str()); - if (act) { - row[function_key_columns.plain] = act->get_label(); + 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; + } } } @@ -402,11 +424,16 @@ MackieControlProtocolGUI::refresh_function_key_editor () if (action.empty()) { row[function_key_columns.control] = 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.control] = action; } else { - row[function_key_columns.control] = defstring; + act = ActionManager::get_action (action.c_str()); + if (act) { + row[function_key_columns.control] = act->get_label(); + } else { + row[function_key_columns.control] = defstring; + } } } @@ -414,11 +441,16 @@ MackieControlProtocolGUI::refresh_function_key_editor () if (action.empty()) { row[function_key_columns.shift] = defstring; } else { - act = ActionManager::get_action (action.c_str()); - if (act) { - row[function_key_columns.shift] = act->get_label(); + if (action.find ('/') == string::npos) { + /* Probably a key alias */ + row[function_key_columns.shift] = action; } else { - row[function_key_columns.shift] = 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; + } } } @@ -426,11 +458,16 @@ MackieControlProtocolGUI::refresh_function_key_editor () if (action.empty()) { row[function_key_columns.option] = defstring; } else { - act = ActionManager::get_action (action.c_str()); - if (act) { - row[function_key_columns.option] = act->get_label(); + if (action.find ('/') == string::npos) { + /* Probably a key alias */ + row[function_key_columns.option] = action; } else { - row[function_key_columns.option] = defstring; + act = ActionManager::get_action (action.c_str()); + if (act) { + row[function_key_columns.option] = act->get_label(); + } else { + row[function_key_columns.option] = defstring; + } } } @@ -438,11 +475,16 @@ MackieControlProtocolGUI::refresh_function_key_editor () if (action.empty()) { row[function_key_columns.cmdalt] = defstring; } else { - act = ActionManager::get_action (action.c_str()); - if (act) { - row[function_key_columns.cmdalt] = act->get_label(); + if (action.find ('/') == string::npos) { + /* Probably a key alias */ + row[function_key_columns.cmdalt] = action; } else { - row[function_key_columns.cmdalt] = defstring; + act = ActionManager::get_action (action.c_str()); + if (act) { + row[function_key_columns.cmdalt] = act->get_label(); + } else { + row[function_key_columns.cmdalt] = defstring; + } } } -- cgit v1.2.3