change the way the key editor gets populated; drop binding sets with no actions

This commit is contained in:
Paul Davis 2016-03-15 19:46:28 -04:00
parent 694c7254e1
commit a06a5ecfd6
5 changed files with 15 additions and 39 deletions

View file

@ -231,9 +231,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
XMLNode* keyboard_settings () const; XMLNode* keyboard_settings () const;
XMLNode* tearoff_settings (const char*) 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 (); void save_ardour_state ();
gboolean configure_handler (GdkEventConfigure* conf); gboolean configure_handler (GdkEventConfigure* conf);

View file

@ -54,6 +54,7 @@
#include "main_clock.h" #include "main_clock.h"
#include "meterbridge.h" #include "meterbridge.h"
#include "meter_patterns.h" #include "meter_patterns.h"
#include "monitor_section.h"
#include "midi_tracer.h" #include "midi_tracer.h"
#include "mixer_ui.h" #include "mixer_ui.h"
#include "public_editor.h" #include "public_editor.h"
@ -803,41 +804,13 @@ ARDOUR_UI::create_key_editor ()
{ {
KeyEditor* kedit = new KeyEditor; KeyEditor* kedit = new KeyEditor;
if (global_bindings) { for (std::list<Bindings*>::iterator b = Bindings::bindings.begin(); b != Bindings::bindings.end(); ++b) {
kedit->add_tab (_("Global"), *global_bindings); kedit->add_tab ((*b)->name(), **b);
}
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);
} }
return kedit; 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* BundleManager*
ARDOUR_UI::create_bundle_manager () ARDOUR_UI::create_bundle_manager ()
{ {

View file

@ -114,7 +114,13 @@ void
KeyEditor::add_tab (string const & name, Bindings& bindings) KeyEditor::add_tab (string const & name, Bindings& bindings)
{ {
Tab* t = new Tab (*this, name, &bindings); Tab* t = new Tab (*this, name, &bindings);
t->populate ();
if (t->populate () == 0) {
/* no bindings */
delete t;
return;
}
t->show_all (); t->show_all ();
notebook.append_page (*t, name); notebook.append_page (*t, name);
} }
@ -135,6 +141,7 @@ KeyEditor::remove_tab (string const &name)
} }
} }
} }
cerr << "Removed " << name << endl;
} }
void void
@ -305,7 +312,7 @@ KeyEditor::Tab::bind (GdkEventKey* release_event, guint pressed_key)
} }
} }
void uint32_t
KeyEditor::Tab::populate () KeyEditor::Tab::populate ()
{ {
vector<string> paths; vector<string> paths;
@ -395,6 +402,8 @@ KeyEditor::Tab::populate ()
} }
row[columns.action] = *a; row[columns.action] = *a;
} }
return data_model->children().size();
} }
void void

View file

@ -49,7 +49,7 @@ class KeyEditor : public ArdourWindow
public: public:
Tab (KeyEditor&, std::string const &name, Gtkmm2ext::Bindings*); Tab (KeyEditor&, std::string const &name, Gtkmm2ext::Bindings*);
void populate (); uint32_t populate ();
void unbind (); void unbind ();
void bind (GdkEventKey* release_event, guint pressed_key); void bind (GdkEventKey* release_event, guint pressed_key);
void action_selected (); void action_selected ();

View file

@ -97,7 +97,6 @@ MonitorSection::MonitorSection (Session* s)
load_bindings (); load_bindings ();
if (bindings) { if (bindings) {
set_data ("ardour-bindings", 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 () MonitorSection::~MonitorSection ()
{ {
ARDOUR_UI::instance()->remove_keyboard_binding_tab (_("Monitor Section"));
for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) { for (ChannelButtons::iterator i = _channel_buttons.begin(); i != _channel_buttons.end(); ++i) {
delete *i; delete *i;
} }