From f83a7f4131214e74ccc06bc2dab28da3d4e49302 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 15 Mar 2016 16:42:45 -0400 Subject: extend API of key binding editor to allow for tab removal --- gtk2_ardour/keyeditor.cc | 18 ++++++++++++++++++ gtk2_ardour/keyeditor.h | 1 + 2 files changed, 19 insertions(+) diff --git a/gtk2_ardour/keyeditor.cc b/gtk2_ardour/keyeditor.cc index f300b4751c..f567bbf751 100644 --- a/gtk2_ardour/keyeditor.cc +++ b/gtk2_ardour/keyeditor.cc @@ -119,6 +119,24 @@ KeyEditor::add_tab (string const & name, Bindings& bindings) notebook.append_page (*t, name); } + +void +KeyEditor::remove_tab (string const &name) +{ + guint npages = notebook.get_n_pages (); + + for (guint n = 0; n < npages; ++n) { + Widget* w = notebook.get_nth_page (n); + Tab* tab = dynamic_cast (w); + if (tab) { + if (tab->name == name) { + notebook.remove_page (*w); + return; + } + } + } +} + void KeyEditor::unbind () { diff --git a/gtk2_ardour/keyeditor.h b/gtk2_ardour/keyeditor.h index 1c90269875..d9b8ed9768 100644 --- a/gtk2_ardour/keyeditor.h +++ b/gtk2_ardour/keyeditor.h @@ -41,6 +41,7 @@ class KeyEditor : public ArdourWindow KeyEditor (); void add_tab (std::string const &name, Gtkmm2ext::Bindings&); + void remove_tab (std::string const &name); private: class Tab : public Gtk::VBox -- cgit v1.2.3