add keybindings blacklist support.

This commit is contained in:
Paul Davis 2014-12-26 12:47:38 -05:00
parent 69532d0372
commit f88db6389b
2 changed files with 34 additions and 1 deletions

View file

@ -31,6 +31,7 @@
#include "gtkmm2ext/utils.h" #include "gtkmm2ext/utils.h"
#include "pbd/file_utils.h"
#include "pbd/strsplit.h" #include "pbd/strsplit.h"
#include "ardour/filesystem_paths.h" #include "ardour/filesystem_paths.h"
@ -112,6 +113,26 @@ KeyEditor::KeyEditor ()
vpacker.show (); vpacker.show ();
unbind_button.set_sensitive (false); 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 void
@ -248,8 +269,16 @@ KeyEditor::populate ()
TreeModel::Row row; TreeModel::Row row;
vector<string> parts; vector<string> parts;
parts.clear (); /* Rip off "<Actions>" 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, '/'); split (*p, parts, '/');
if (parts.empty()) { if (parts.empty()) {

View file

@ -21,6 +21,7 @@
#define __ardour_gtk_key_editor_h__ #define __ardour_gtk_key_editor_h__
#include <string> #include <string>
#include <map>
#include <gtkmm/buttonbox.h> #include <gtkmm/buttonbox.h>
#include <gtkmm/treeview.h> #include <gtkmm/treeview.h>
@ -74,6 +75,9 @@ class KeyEditor : public ArdourWindow
void populate (); void populate ();
void reset (); void reset ();
std::map<std::string,std::string> action_blacklist;
void load_blacklist ();
}; };
#endif /* __ardour_gtk_key_editor_h__ */ #endif /* __ardour_gtk_key_editor_h__ */