13
0

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* 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);

View File

@ -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<Bindings*>::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 ()
{

View File

@ -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<string> paths;
@ -395,6 +402,8 @@ KeyEditor::Tab::populate ()
}
row[columns.action] = *a;
}
return data_model->children().size();
}
void

View File

@ -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 ();

View File

@ -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;
}