mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-05 21:25:46 +01:00
add keybinding whitelist support
This commit is contained in:
parent
aed11efa77
commit
80c594555c
2 changed files with 27 additions and 12 deletions
|
|
@ -114,24 +114,32 @@ KeyEditor::KeyEditor ()
|
|||
|
||||
unbind_button.set_sensitive (false);
|
||||
|
||||
load_blacklist ();
|
||||
load_blackwhitelists ();
|
||||
}
|
||||
|
||||
void
|
||||
KeyEditor::load_blacklist ()
|
||||
KeyEditor::load_blackwhitelists ()
|
||||
{
|
||||
string blacklist;
|
||||
string list;
|
||||
|
||||
if (!find_file (ARDOUR::ardour_data_search_path(), X_("keybindings.blacklist"), blacklist)) {
|
||||
return;
|
||||
if (find_file (ARDOUR::ardour_data_search_path(), X_("keybindings.blacklist"), list)) {
|
||||
ifstream in (list.c_str());
|
||||
|
||||
while (in) {
|
||||
string str;
|
||||
in >> str;
|
||||
action_blacklist.insert (make_pair (str, str));
|
||||
}
|
||||
}
|
||||
|
||||
ifstream in (blacklist.c_str());
|
||||
|
||||
while (in) {
|
||||
string str;
|
||||
in >> str;
|
||||
action_blacklist.insert (make_pair (str, str));
|
||||
if (find_file (ARDOUR::ardour_data_search_path(), X_("keybindings.whitelist"), list)) {
|
||||
ifstream in (list.c_str());
|
||||
|
||||
while (in) {
|
||||
string str;
|
||||
in >> str;
|
||||
action_whitelist.insert (make_pair (str, str));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -274,9 +282,15 @@ KeyEditor::populate ()
|
|||
string without_action = (*p).substr (9);
|
||||
|
||||
if (action_blacklist.find (without_action) != action_blacklist.end()) {
|
||||
/* this action is in the blacklist */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!action_whitelist.empty() && action_whitelist.find (without_action) == action_whitelist.end()) {
|
||||
/* there is a whitelist, and this action isn't in it */
|
||||
continue;
|
||||
}
|
||||
|
||||
parts.clear ();
|
||||
|
||||
split (*p, parts, '/');
|
||||
|
|
|
|||
|
|
@ -77,7 +77,8 @@ class KeyEditor : public ArdourWindow
|
|||
void reset ();
|
||||
|
||||
std::map<std::string,std::string> action_blacklist;
|
||||
void load_blacklist ();
|
||||
std::map<std::string,std::string> action_whitelist;
|
||||
void load_blackwhitelists ();
|
||||
};
|
||||
|
||||
#endif /* __ardour_gtk_key_editor_h__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue