From 96ae97ddcb743cde5876b38446d2d0dbf9fb2f73 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 30 Nov 2011 15:29:53 +0000 Subject: [PATCH] preparations for using ardour's own keybinding system for the editor (not actually used) git-svn-id: svn://localhost/ardour2/branches/3.0@10841 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor.bindings | 205 ++++++++++++++++++++++++++++++++++ gtk2_ardour/editor.cc | 4 + gtk2_ardour/editor.h | 5 + gtk2_ardour/editor_actions.cc | 24 ++++ gtk2_ardour/mixer.bindings | 2 +- 5 files changed, 239 insertions(+), 1 deletion(-) create mode 100644 gtk2_ardour/editor.bindings diff --git a/gtk2_ardour/editor.bindings b/gtk2_ardour/editor.bindings new file mode 100644 index 0000000000..0e63a91780 --- /dev/null +++ b/gtk2_ardour/editor.bindings @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 0e4b4dfdd4..8bfa7aa147 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -637,6 +637,10 @@ Editor::Editor () /* register actions now so that set_state() can find them and set toggles/checks etc */ register_actions (); + /* when we start using our own keybinding system for the editor, this + * will be uncommented + */ + // load_bindings (); setup_toolbar (); setup_midi_toolbar (); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index ea8aa02d2b..7d7c38c30b 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -42,6 +42,7 @@ #include "gtkmm2ext/click_box.h" #include "gtkmm2ext/dndtreeview.h" #include "gtkmm2ext/stateful_button.h" +#include "gtkmm2ext/bindings.h" #include "pbd/stateful.h" #include "pbd/signals.h" @@ -1069,6 +1070,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void register_actions (); void register_region_actions (); + void load_bindings (); + Gtkmm2ext::ActionMap editor_action_map; + Gtkmm2ext::Bindings key_bindings; + int ensure_cursor (framepos_t* pos); void cut_copy (Editing::CutCopyOp); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 0d5534a055..a149dba796 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -20,9 +20,15 @@ #include #include + +#include "pbd/filesystem.h" +#include "pbd/file_utils.h" +#include "pbd/search_path.h" + #include "gtkmm2ext/tearoff.h" #include "ardour/ardour.h" +#include "ardour/filesystem_paths.h" #include "ardour/profile.h" #include "ardour/session.h" @@ -616,6 +622,24 @@ Editor::register_actions () ActionManager::add_action_group (editor_actions); } +void +Editor::load_bindings () +{ + /* XXX move this to a better place */ + + key_bindings.set_action_map (editor_action_map); + + sys::path binding_file; + SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path(); + + if (find_file_in_search_path (spath, "editor.bindings", binding_file)) { + key_bindings.load (binding_file.to_string()); + info << string_compose (_("Loaded editor bindings from %1"), binding_file.to_string()) << endmsg; + } else { + error << string_compose (_("Could not find editor.bindings in search path %1"), spath.to_string()) << endmsg; + } +} + void Editor::toggle_ruler_visibility (RulerType rt) { diff --git a/gtk2_ardour/mixer.bindings b/gtk2_ardour/mixer.bindings index 3daeab53ca..25d4cfb077 100644 --- a/gtk2_ardour/mixer.bindings +++ b/gtk2_ardour/mixer.bindings @@ -1,5 +1,5 @@ - +