add note onset detection to the ferret, c/o the aubio-based Onset VAMP plugin (REQUIR...
[ardour.git] / gtk2_ardour / keyeditor.cc
index 6974f600952a473f7d8355ef9beb9860fe0d43bf..e44d92943f15aa3b76765d529465da200811ef9b 100644 (file)
@@ -3,6 +3,7 @@
 #include <ardour/profile.h>
 
 #include <gtkmm/stock.h>
+#include <gtkmm/label.h>
 #include <gtkmm/accelkey.h>
 #include <gtkmm/accelmap.h>
 #include <gtkmm/uimanager.h>
 #include <pbd/strsplit.h>
 #include <pbd/replace_all.h>
 
+#include <ardour/profile.h>
+
 #include "actions.h"
 #include "keyboard.h"
 #include "keyeditor.h"
+#include "utils.h"
 
 #include "i18n.h"
 
@@ -48,19 +52,30 @@ KeyEditor::KeyEditor ()
        scroller.add (view);
        scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
 
-       unbind_box.pack_start (unbind_button, false, false);
-
-       unbind_button.signal_clicked().connect (mem_fun (*this, &KeyEditor::unbind));
 
        get_vbox()->set_spacing (6);
        get_vbox()->pack_start (scroller);
-       get_vbox()->pack_start (unbind_box, false, false);
+
+       if (!ARDOUR::Profile->get_sae()) {
+
+               Label* hint = manage (new Label (_("Select an action, then press the key(s) to (re)set its shortcut")));
+               hint->show ();
+               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));
+
+               get_vbox()->pack_start (unbind_box, false, false);
+               unbind_box.show ();
+               unbind_button.show ();
+               
+       }
+
        get_vbox()->set_border_width (12);
 
-       scroller.show ();
        view.show ();
-       unbind_box.show ();
-       unbind_button.show ();
+       scroller.show ();
+
        unbind_button.set_sensitive (false);
 }
 
@@ -153,6 +168,8 @@ KeyEditor::on_key_release_event (GdkEventKey* ev)
                        goto out;
                } 
 
+               possibly_translate_keyval_to_make_legal_accelerator (ev->keyval);
+
                bool result = AccelMap::change_entry (path,
                                                      ev->keyval,
                                                      (ModifierType) ev->state,
@@ -241,9 +258,16 @@ KeyEditor::populate ()
 
 #ifdef GTKOSX
                        string label = (*k);
-                       replace_all (label, "<Mod5>", _("Command-"));
+
+                       /* Gtk/Quartz maps:
+                          NSAlternate/NSOption key to Mod1
+                          NSCommand key to Meta 
+                       */
+
+                       replace_all (label, "<Meta>", _("Command-"));
                        replace_all (label, "<Alt>", _("Option-"));
                        replace_all (label, "<Shift>", _("Shift-"));
+                       replace_all (label, "<Control>", _("Control-"));
                        row[columns.binding] = label;
 #else          
                        row[columns.binding] = (*k);