merge with master and fix 2 conflicts
[ardour.git] / gtk2_ardour / keyeditor.cc
index bafa0a4f6c99b4f4c4c40c8c6b0c293ad5074ecc..f23e24695888cb937f51fa5c663747c2b382478d 100644 (file)
@@ -23,8 +23,6 @@
 
 #include <map>
 
-#include "ardour/profile.h"
-
 #include <gtkmm/stock.h>
 #include <gtkmm/label.h>
 #include <gtkmm/accelkey.h>
@@ -34,7 +32,6 @@
 #include "gtkmm2ext/utils.h"
 
 #include "pbd/strsplit.h"
-#include "pbd/replace_all.h"
 
 #include "ardour/profile.h"
 
@@ -79,7 +76,10 @@ KeyEditor::KeyEditor ()
        scroller.add (view);
        scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
 
-       add (scroller);
+       add (vpacker);
+
+       vpacker.set_spacing (6);
+       vpacker.pack_start (scroller);
 
        if (!ARDOUR::Profile->get_sae()) {
 
@@ -90,14 +90,17 @@ KeyEditor::KeyEditor ()
                unbind_box.pack_start (unbind_button, false, false);
                unbind_button.signal_clicked().connect (sigc::mem_fun (*this, &KeyEditor::unbind));
 
-               add (unbind_box);
+               vpacker.pack_start (unbind_box, false, false);
                unbind_box.show ();
                unbind_button.show ();
 
        }
 
+       vpacker.set_border_width (12);
+
        view.show ();
        scroller.show ();
+       vpacker.show ();
 
        unbind_button.set_sensitive (false);
 }
@@ -109,8 +112,6 @@ KeyEditor::unbind ()
 
        unbind_button.set_sensitive (false);
 
-       cerr << "trying to unbind\n";
-
        if (i != model->children().end()) {
                string path = (*i)[columns.path];
 
@@ -193,9 +194,7 @@ KeyEditor::on_key_release_event (GdkEventKey* ev)
                        goto out;
                }
 
-               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,
@@ -203,8 +202,6 @@ KeyEditor::on_key_release_event (GdkEventKey* ev)
                                                      ModifierType (Keyboard::RelevantModifierKeyMask & ev->state),
                                                      true);
 
-               cerr << "New binding to " << ev->keyval << " worked: " << result << endl;
-
                if (result) {
                        AccelKey key;
                        (*i)[columns.binding] = ActionManager::get_key_representation (path, key);
@@ -250,6 +247,18 @@ KeyEditor::populate ()
                        continue;
                }
 
+               //kinda kludgy way to avoid displaying menu items as mappable
+               if ( parts[1] == _("Main_menu") )
+                       continue;
+               if ( parts[1] == _("redirectmenu") )
+                       continue;
+               if ( parts[1] == _("Editor_menus") )
+                       continue;
+               if ( parts[1] == _("RegionList") )
+                       continue;
+               if ( parts[1] == _("ProcessorMenu") )
+                       continue;
+
                if ((r = nodes.find (parts[1])) == nodes.end()) {
 
                        /* top level is missing */
@@ -283,24 +292,7 @@ KeyEditor::populate ()
                if (*k == ActionManager::unbound_string) {
                        row[columns.binding] = string();
                } else {
-
-#ifdef GTKOSX
-                       string label = (*k);
-                       
-                       /* Gtk/Quartz maps:
-                          NSAlternate/NSOption key to Mod1
-                          NSCommand key to Mod2
-                       */
-
-//                     replace_all (label, "<Primary>", _("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);
-#endif
                }
        }
 }