summaryrefslogtreecommitdiff
path: root/gtk2_ardour/plugin_selector.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/plugin_selector.cc')
-rw-r--r--gtk2_ardour/plugin_selector.cc53
1 files changed, 46 insertions, 7 deletions
diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc
index e0a62b177f..6c72767b11 100644
--- a/gtk2_ardour/plugin_selector.cc
+++ b/gtk2_ardour/plugin_selector.cc
@@ -49,7 +49,7 @@ PluginSelector::PluginSelector (PluginManager *mgr)
manager = mgr;
session = 0;
- current_selection = PluginInfo::LADSPA;
+ current_selection = ARDOUR::LADSPA;
lmodel = Gtk::ListStore::create(lcols);
ladspa_display.set_model (lmodel);
@@ -141,6 +141,7 @@ PluginSelector::PluginSelector (PluginManager *mgr)
set_response_sensitive (RESPONSE_APPLY, false);
get_vbox()->pack_start (*table);
+ // Notebook tab order must be the same in here as in set_correct_focus()
using namespace Gtk::Notebook_Helpers;
notebook.pages().push_back (TabElem (lscroller, _("LADSPA")));
@@ -161,6 +162,7 @@ PluginSelector::PluginSelector (PluginManager *mgr)
ladspa_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked));
ladspa_display.get_selection()->signal_changed().connect (mem_fun(*this, &PluginSelector::ladspa_display_selection_changed));
+ ladspa_display.grab_focus();
#ifdef VST_SUPPORT
if (Config->get_use_vst()) {
@@ -188,6 +190,43 @@ PluginSelector::PluginSelector (PluginManager *mgr)
#ifdef HAVE_COREAUDIO
au_refiller ();
#endif
+
+ signal_show().connect (mem_fun (*this, &PluginSelector::set_correct_focus));
+}
+
+/**
+ * Makes sure keyboard focus is always in the plugin list
+ * of the selected notebook tab.
+ **/
+void
+PluginSelector::set_correct_focus()
+{
+ int cp = notebook.get_current_page();
+
+ if (cp == 0) {
+ ladspa_display.grab_focus();
+ return;
+ }
+
+#ifdef VST_SUPPORT
+ if (Config->get_use_vst()) {
+ cp--;
+
+ if (cp == 0) {
+ vst_display.grab_focus();
+ return;
+ }
+ }
+#endif
+
+#ifdef HAVE_COREAUDIO
+ cp--;
+
+ if (cp == 0) {
+ au_display.grab_focus();
+ return;
+ }
+#endif
}
void
@@ -286,7 +325,7 @@ PluginSelector::vst_display_selection_changed()
btn_add->set_sensitive (false);
}
- current_selection = PluginInfo::VST;
+ current_selection = ARDOUR::VST;
}
#endif //VST_SUPPORT
@@ -332,7 +371,7 @@ PluginSelector::au_display_selection_changed()
btn_add->set_sensitive (false);
}
- current_selection = PluginInfo::AudioUnit;
+ current_selection = ARDOUR::AudioUnit;
}
#endif //HAVE_COREAUDIO
@@ -361,19 +400,19 @@ PluginSelector::btn_add_clicked()
Gtk::TreeModel::Row row;
switch (current_selection) {
- case PluginInfo::LADSPA:
+ case ARDOUR::LADSPA:
row = *(ladspa_display.get_selection()->get_selected());
name = row[lcols.name];
pi = row[lcols.plugin];
break;
- case PluginInfo::VST:
+ case ARDOUR::VST:
#ifdef VST_SUPPORT
row = *(vst_display.get_selection()->get_selected());
name = row[vcols.name];
pi = row[vcols.plugin];
#endif
break;
- case PluginInfo::AudioUnit:
+ case ARDOUR::AudioUnit:
#ifdef HAVE_COREAUDIO
row = *(au_display.get_selection()->get_selected());
name = row[aucols.name];
@@ -426,7 +465,7 @@ PluginSelector::ladspa_display_selection_changed()
btn_add->set_sensitive (false);
}
- current_selection = PluginInfo::LADSPA;
+ current_selection = ARDOUR::LADSPA;
}
void