From a06a5ecfd6cce641bca67c9927f44207a91ffc42 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 15 Mar 2016 19:46:28 -0400 Subject: [PATCH] change the way the key editor gets populated; drop binding sets with no actions --- gtk2_ardour/ardour_ui.h | 3 --- gtk2_ardour/ardour_ui_dialogs.cc | 33 +++----------------------------- gtk2_ardour/keyeditor.cc | 13 +++++++++++-- gtk2_ardour/keyeditor.h | 2 +- gtk2_ardour/monitor_section.cc | 3 --- 5 files changed, 15 insertions(+), 39 deletions(-) diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 2f1820ebfc..bc58341ec7 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -231,9 +231,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr XMLNode* keyboard_settings () const; XMLNode* tearoff_settings (const char*) const; - void add_keyboard_binding_tab (std::string const & name, Gtkmm2ext::Bindings&); - void remove_keyboard_binding_tab (std::string const & name); - void save_ardour_state (); gboolean configure_handler (GdkEventConfigure* conf); diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 8da911dd7d..c284decb4a 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -54,6 +54,7 @@ #include "main_clock.h" #include "meterbridge.h" #include "meter_patterns.h" +#include "monitor_section.h" #include "midi_tracer.h" #include "mixer_ui.h" #include "public_editor.h" @@ -803,41 +804,13 @@ ARDOUR_UI::create_key_editor () { KeyEditor* kedit = new KeyEditor; - if (global_bindings) { - kedit->add_tab (_("Global"), *global_bindings); - } - - if (editor->bindings) { - kedit->add_tab (_("Editing"), *editor->bindings); - } - - if (mixer->bindings) { - kedit->add_tab (_("Mixing"), *mixer->bindings); - } - - if (ProcessorBox::bindings) { - kedit->add_tab (_("Processor Box"), *ProcessorBox::bindings); + for (std::list::iterator b = Bindings::bindings.begin(); b != Bindings::bindings.end(); ++b) { + kedit->add_tab ((*b)->name(), **b); } return kedit; } -void -ARDOUR_UI::add_keyboard_binding_tab (std::string const& name, Gtkmm2ext::Bindings& b) -{ - if (key_editor) { - key_editor->add_tab (name, b); - } -} - -void -ARDOUR_UI::remove_keyboard_binding_tab (std::string const& name) -{ - if (key_editor) { - key_editor->remove_tab (name); - } -} - BundleManager* ARDOUR_UI::create_bundle_manager () { diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index 794e2e258c..8c4aaa1911 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -114,7 +114,13 @@ void KeyEditor::add_tab (string const & name, Bindings& bindings) { Tab* t = new Tab (*this, name, &bindings); - t->populate (); + + if (t->populate () == 0) { + /* no bindings */ + delete t; + return; + } + t->show_all (); notebook.append_page (*t, name); } @@ -135,6 +141,7 @@ KeyEditor::remove_tab (string const &name) } } } + cerr << "Removed " << name << endl; } void @@ -305,7 +312,7 @@ KeyEditor::Tab::bind (GdkEventKey* release_event, guint pressed_key) } } -void +uint32_t KeyEditor::Tab::populate () { vector paths; @@ -395,6 +402,8 @@ KeyEditor::Tab::populate () } row[columns.action] = *a; } + + return data_model->children().size(); } void diff --git a/gtk2_ardour/keyeditor.h b/gtk2_ardour/keyeditor.h index 2a612160fa..91834c4dea 100644 --- a/gtk2_ardour/keyeditor.h +++ b/gtk2_ardour/keyeditor.h @@ -49,7 +49,7 @@ class KeyEditor : public ArdourWindow public: Tab (KeyEditor&, std::string const &name, Gtkmm2ext::Bindings*); - void populate (); + uint32_t populate (); void unbind (); void bind (GdkEventKey* release_event, guint pressed_key); void action_selected (); diff --git a/gtk2_ardour/monitor_section.cc b/gtk2_ardour/monitor_section.cc index 364e2fe8bd..63227ac58c 100644 --- a/gtk2_ardour/monitor_section.cc +++ b/gtk2_ardour/monitor_section.cc @@ -97,7 +97,6 @@ MonitorSection::MonitorSection (Session* s) load_bindings (); if (bindings) { set_data ("ardour-bindings", bindings); - ARDOUR_UI::instance()->add_keyboard_binding_tab (_("Monitor Section"), *bindings); } } @@ -492,8 +491,6 @@ MonitorSection::MonitorSection (Session* s) MonitorSection::~MonitorSection () { - ARDOUR_UI::instance()->remove_keyboard_binding_tab (_("Monitor Section")); - for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) { delete *i; }