if the action associated with a binding is insensitive, do not activate it, and return false from Bindings::activate()

This allows "stacking" of bindings by desensitizing the actions associated with a "lower" level
of bindings at certain times (e.g. MIDI editing bindings thare are sensitized in the appropriate
editing modes
This commit is contained in:
Paul Davis 2020-04-16 10:44:20 -06:00
parent cc74c7b7ad
commit ffd9aa2fc9
1 changed files with 7 additions and 2 deletions

View File

@ -494,8 +494,13 @@ Bindings::activate (KeyboardKey kb, Operation op)
if (action) {
/* lets do it ... */
DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1: %2\n", unshifted, k->second.action_name));
action->activate ();
if (action->get_sensitive()) {
DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1: %2\n", unshifted, k->second.action_name));
action->activate ();
} else {
DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1: %2 - insensitive, skipped\n", unshifted, k->second.action_name));
return false;
}
} else {
DEBUG_TRACE (DEBUG::Bindings, string_compose ("binding for %1 is known but has no action\n", unshifted));
}