summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2015-06-20 09:32:46 -0700
committerPaul Davis <paul@linuxaudiosystems.com>2015-06-21 12:42:48 -0400
commit974e5dcc0ca4dcaebf084097728c6e3fe88781c0 (patch)
treefe6208a68600bc3dd52b183bf311fe8ab84ed25c
parente5ea600ba020236fcc2ed1c88b987ebb9b2b7aa5 (diff)
Add option to mackie control profile editor to remove binding (fixes #6301)
-rw-r--r--libs/surfaces/mackie/gui.cc35
1 files changed, 30 insertions, 5 deletions
diff --git a/libs/surfaces/mackie/gui.cc b/libs/surfaces/mackie/gui.cc
index 105bac060c..0df0935f56 100644
--- a/libs/surfaces/mackie/gui.cc
+++ b/libs/surfaces/mackie/gui.cc
@@ -242,6 +242,15 @@ 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. */
+ TreeIter rowp;
+ TreeModel::Row parent;
+ rowp = available_action_model->append();
+ parent = *(rowp);
+ parent[available_action_columns.name] = _("Remove Binding");
+
for (l = labels.begin(), k = keys.begin(), p = paths.begin(), t = tooltips.begin(); l != labels.end(); ++k, ++p, ++t, ++l) {
TreeModel::Row row;
@@ -451,6 +460,11 @@ MackieControlProtocolGUI::refresh_function_key_editor ()
void
MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib::ustring &text, TreeModelColumnBase col)
{
+ // Remove Binding is not in the action map but still valid
+ bool remove (false);
+ if ( text == "Remove Binding") {
+ remove = true;
+ }
Gtk::TreePath path(sPath);
Gtk::TreeModel::iterator row = function_key_model->get_iter(path);
@@ -459,17 +473,23 @@ MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib
std::map<std::string,std::string>::iterator i = action_map.find (text);
if (i == action_map.end()) {
- return;
+ if (!remove) {
+ return;
+ }
}
-
Glib::RefPtr<Gtk::Action> act = ActionManager::get_action (i->second.c_str());
- if (act) {
+ if (act || remove) {
/* update visible text, using string supplied by
available action model so that it matches and is found
within the model.
*/
- (*row).set_value (col.index(), text);
+ if (remove) {
+ Glib::ustring dot = "\u2022";
+ (*row).set_value (col.index(), dot);
+ } else {
+ (*row).set_value (col.index(), text);
+ }
/* update the current DeviceProfile, using the full
* path
@@ -497,7 +517,12 @@ MackieControlProtocolGUI::action_changed (const Glib::ustring &sPath, const Glib
modifier = 0;
}
- _cp.device_profile().set_button_action ((*row)[function_key_columns.id], modifier, i->second);
+ if (remove) {
+ _cp.device_profile().set_button_action ((*row)[function_key_columns.id], modifier, "");
+ } else {
+ _cp.device_profile().set_button_action ((*row)[function_key_columns.id], modifier, i->second);
+ }
+
} else {
std::cerr << "no such action\n";
}