From 5206b3dedb2eb83d023e121217094bb40726e3bf Mon Sep 17 00:00:00 2001 From: VKamyshniy Date: Fri, 13 Feb 2015 03:21:08 +0200 Subject: [PATCH] [Summary] Implementing XML-ized tracks specific keyeditor --- gtk2_ardour/keyeditor.cc | 66 ++++++++-------------------------------- gtk2_ardour/keyeditor.h | 27 ++++++---------- 2 files changed, 23 insertions(+), 70 deletions(-) diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index 6aeb3bf467..59b01de1e5 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -51,10 +51,10 @@ using namespace PBD; using Gtkmm2ext::Keyboard; KeyEditor::KeyEditor () - : ArdourWindow (_("Key Bindings")) - , unbind_button (_("Remove shortcut")) - , unbind_box (BUTTONBOX_END) - + : WavesDialog ("waves_keyeditor.xml", true, false) + , view (get_tree_view ("view")) + , unbind_button (get_waves_button ("unbind_button")) + , reset_button (get_waves_button ("reset_button")) { can_bind = false; last_state = 0; @@ -73,48 +73,11 @@ KeyEditor::KeyEditor () view.set_name (X_("KeyEditorTree")); 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); - - vpacker.set_spacing (6); - vpacker.set_border_width (12); - vpacker.pack_start (scroller); - - 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 (sigc::mem_fun (*this, &KeyEditor::unbind)); - - vpacker.pack_start (unbind_box, false, false); - unbind_box.show (); - unbind_button.show (); - - } - - reset_button.add (reset_label); - reset_label.set_markup (string_compose ("%1", _("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, false, false); - - add (vpacker); - - view.show (); - scroller.show (); - vpacker.show (); - + unbind_button.signal_clicked.connect (sigc::mem_fun (*this, &KeyEditor::unbind)); + reset_button.signal_clicked.connect (sigc::mem_fun (*this, &KeyEditor::reset)); unbind_button.set_sensitive (false); - load_blackwhitelists (); + load_blackwhitelists (); } void @@ -144,7 +107,7 @@ KeyEditor::load_blackwhitelists () } void -KeyEditor::unbind () +KeyEditor::unbind (WavesButton*) { TreeModel::iterator i = view.get_selection()->get_selected(); @@ -172,13 +135,7 @@ KeyEditor::on_show () { populate (); view.get_selection()->unselect_all (); - ArdourWindow::on_show (); -} - -void -KeyEditor::on_unmap () -{ - ArdourWindow::on_unmap (); + WavesDialog::on_show (); } void @@ -350,7 +307,10 @@ KeyEditor::populate () } void -KeyEditor::reset () +KeyEditor::reset (WavesButton*) { Keyboard::the_keyboard().reset_bindings (); + populate (); + view.get_selection()->unselect_all (); + unbind_button.set_sensitive (false); } diff --git a/gtk2_ardour/keyeditor.h b/gtk2_ardour/keyeditor.h index e2b4a48a95..6a76665b4f 100644 --- a/gtk2_ardour/keyeditor.h +++ b/gtk2_ardour/keyeditor.h @@ -27,17 +27,15 @@ #include #include #include +#include "waves_dialog.h" -#include "ardour_window.h" - -class KeyEditor : public ArdourWindow +class KeyEditor : public WavesDialog { public: KeyEditor (); protected: void on_show (); - void on_unmap (); bool on_key_press_event (GdkEventKey*); bool on_key_release_event (GdkEventKey*); @@ -55,18 +53,13 @@ class KeyEditor : public ArdourWindow Gtk::TreeModelColumn bindable; }; - Gtk::VBox vpacker; - Gtk::ScrolledWindow scroller; - Gtk::TreeView view; Glib::RefPtr model; KeyEditorColumns columns; - Gtk::Button unbind_button; - Gtk::HButtonBox unbind_box; - Gtk::HBox reset_box; - Gtk::Button reset_button; - Gtk::Label reset_label; + Gtk::TreeView& view; + WavesButton& unbind_button; + WavesButton& reset_button; - void unbind (); + void unbind (WavesButton*); bool can_bind; guint last_state; @@ -74,11 +67,11 @@ class KeyEditor : public ArdourWindow void action_selected (); void populate (); - void reset (); + void reset (WavesButton*); - std::map action_blacklist; - std::map action_whitelist; - void load_blackwhitelists (); + std::map action_blacklist; + std::map action_whitelist; + void load_blackwhitelists (); }; #endif /* __ardour_gtk_key_editor_h__ */