add reset bindings button to key bindings editor
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 10 Jul 2014 15:04:24 +0000 (11:04 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 10 Jul 2014 15:04:24 +0000 (11:04 -0400)
gtk2_ardour/keyeditor.cc
gtk2_ardour/keyeditor.h

index 409f89dfaf57411a267f995443015a78b7e29b83..e9a0ed85a486ff1033a4fcaecf84b02098aa5023 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "pbd/strsplit.h"
 
+#include "ardour/filesystem_paths.h"
 #include "ardour/profile.h"
 
 #include "actions.h"
@@ -75,9 +76,8 @@ KeyEditor::KeyEditor ()
        scroller.add (view);
        scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
 
-       add (vpacker);
-
        vpacker.set_spacing (6);
+       vpacker.set_border_width (12);
        vpacker.pack_start (scroller);
 
        if (!ARDOUR::Profile->get_sae()) {
@@ -94,8 +94,18 @@ KeyEditor::KeyEditor ()
                unbind_button.show ();
 
        }
+       
+       reset_button.add (reset_label);
+       reset_label.set_markup (string_compose ("<span size=\"large\" weight=\"bold\">%1</span>", _("Reset Bindings to Defaults")));
+                               
+       reset_box.pack_start (reset_button, true, false);
+       reset_box.show ();
+       reset_button.show ();
+       reset_label.show ();
+       reset_button.signal_clicked().connect (sigc::mem_fun (*this, &KeyEditor::reset));
+       vpacker.pack_start (reset_box);
 
-       vpacker.set_border_width (12);
+       add (vpacker);
 
        view.show ();
        scroller.show ();
@@ -295,3 +305,9 @@ KeyEditor::populate ()
                }
        }
 }
+
+void
+KeyEditor::reset ()
+{
+       Keyboard::the_keyboard().reset_bindings ();
+}
index 51cf1dc127ea147890b5560e6071759aa9bfbde2..76e70f10ba43796a7fc1f5d14f1de65d72d5e1ae 100644 (file)
@@ -61,6 +61,9 @@ class KeyEditor : public ArdourWindow
        KeyEditorColumns columns;
        Gtk::Button unbind_button;
        Gtk::HButtonBox unbind_box;
+       Gtk::HBox reset_box;
+       Gtk::Button reset_button;
+       Gtk::Label reset_label;
 
        void unbind ();
 
@@ -69,6 +72,8 @@ class KeyEditor : public ArdourWindow
 
        void action_selected ();
        void populate ();
+
+       void reset ();
 };
 
 #endif /* __ardour_gtk_key_editor_h__ */