X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fkeyeditor.cc;h=2a72adb5dd2b35119e795640a45a2f0cbb0799bd;hb=d8e93be2ee68fc6a18a7ca17d36ffc67c94207b3;hp=6b1aec7f4ee7f22ca99a13dc01d3a081d1cd2829;hpb=bb9cc45cd22af67ac275a5e73accbe14fee664d8;p=ardour.git diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index 6b1aec7f4e..2a72adb5dd 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -8,6 +8,8 @@ #include #include +#include "gtkmm2ext/utils.h" + #include "pbd/strsplit.h" #include "pbd/replace_all.h" @@ -25,8 +27,10 @@ using namespace Gtk; using namespace Gdk; using namespace PBD; +using Gtkmm2ext::Keyboard; + KeyEditor::KeyEditor () - : ArdourDialog (_("Shortcut Editor"), false) + : ArdourDialog (_("Key Bindings"), false) , unbind_button (_("Remove shortcut")) , unbind_box (BUTTONBOX_END) @@ -47,7 +51,7 @@ KeyEditor::KeyEditor () view.set_rules_hint (true); view.set_name (X_("KeyEditorTree")); - view.get_selection()->signal_changed().connect (mem_fun (*this, &KeyEditor::action_selected)); + view.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &KeyEditor::action_selected)); scroller.add (view); scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); @@ -63,7 +67,7 @@ KeyEditor::KeyEditor () unbind_box.set_spacing (6); unbind_box.pack_start (*hint, false, true); unbind_box.pack_start (unbind_button, false, false); - unbind_button.signal_clicked().connect (mem_fun (*this, &KeyEditor::unbind)); + unbind_button.signal_clicked().connect (sigc::mem_fun (*this, &KeyEditor::unbind)); get_vbox()->pack_start (unbind_box, false, false); unbind_box.show (); @@ -86,6 +90,8 @@ KeyEditor::unbind () unbind_button.set_sensitive (false); + cerr << "trying to unbind\n"; + if (i != model->children().end()) { string path = (*i)[columns.path]; @@ -168,24 +174,21 @@ KeyEditor::on_key_release_event (GdkEventKey* ev) goto out; } - possibly_translate_keyval_to_make_legal_accelerator (ev->keyval); + cerr << "real lkeyval: " << ev->keyval << endl; + Gtkmm2ext::possibly_translate_keyval_to_make_legal_accelerator (ev->keyval); + cerr << "using keyval = " << ev->keyval << endl; + bool result = AccelMap::change_entry (path, ev->keyval, ModifierType (Keyboard::RelevantModifierKeyMask & ev->state), true); + cerr << "New binding to " << ev->keyval << " worked: " << result << endl; + if (result) { - bool known; AccelKey key; - - known = ActionManager::lookup_entry (path, key); - - if (known) { - (*i)[columns.binding] = ActionManager::ui_manager->get_accel_group()->name (key.get_key(), Gdk::ModifierType (key.get_mod())); - } else { - (*i)[columns.binding] = string(); - } + (*i)[columns.binding] = ActionManager::get_key_representation (path, key); } }