From f88db6389b6f2c04a56d7593b3c4854c1a07645c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 26 Dec 2014 12:47:38 -0500 Subject: [PATCH] add keybindings blacklist support. --- gtk2_ardour/keyeditor.cc | 31 ++++++++++++++++++++++++++++++- gtk2_ardour/keyeditor.h | 4 ++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index d39abf5057..67da173750 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -31,6 +31,7 @@ #include "gtkmm2ext/utils.h" +#include "pbd/file_utils.h" #include "pbd/strsplit.h" #include "ardour/filesystem_paths.h" @@ -112,6 +113,26 @@ KeyEditor::KeyEditor () vpacker.show (); unbind_button.set_sensitive (false); + + load_blacklist (); +} + +void +KeyEditor::load_blacklist () +{ + string blacklist; + + if (!find_file (ARDOUR::ardour_data_search_path(), X_("keybindings.blacklist"), blacklist)) { + return; + } + + ifstream in (blacklist.c_str()); + + while (in) { + string str; + in >> str; + action_blacklist.insert (make_pair (str, str)); + } } void @@ -248,8 +269,16 @@ KeyEditor::populate () TreeModel::Row row; vector parts; - parts.clear (); + /* Rip off "" before comparing with blacklist */ + string without_action = (*p).substr (9); + + if (action_blacklist.find (without_action) != action_blacklist.end()) { + continue; + } + + parts.clear (); + split (*p, parts, '/'); if (parts.empty()) { diff --git a/gtk2_ardour/keyeditor.h b/gtk2_ardour/keyeditor.h index 76e70f10ba..4627324824 100644 --- a/gtk2_ardour/keyeditor.h +++ b/gtk2_ardour/keyeditor.h @@ -21,6 +21,7 @@ #define __ardour_gtk_key_editor_h__ #include +#include #include #include @@ -74,6 +75,9 @@ class KeyEditor : public ArdourWindow void populate (); void reset (); + + std::map action_blacklist; + void load_blacklist (); }; #endif /* __ardour_gtk_key_editor_h__ */