summaryrefslogtreecommitdiff
path: root/gtk2_ardour/plugin_selector.cc
diff options
context:
space:
mode:
authorSampo Savolainen <v2@iki.fi>2006-08-10 14:41:53 +0000
committerSampo Savolainen <v2@iki.fi>2006-08-10 14:41:53 +0000
commit00bf20c236d38a754e62c74cec3518aeec70d78a (patch)
tree9cf7fd363ba996ae3e9d49a443b3719e7756a822 /gtk2_ardour/plugin_selector.cc
parent77a13df5bd70bf87ee856b81acec7eeed5b1f033 (diff)
Plugin selector keyboard focus should now stay in the plugin list. More
sensible defaults for the NSD and accelerators will work in plugin windows (plus keyboard will not affect the plugin window itself). git-svn-id: svn://localhost/ardour2/trunk@783 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/plugin_selector.cc')
-rw-r--r--gtk2_ardour/plugin_selector.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/gtk2_ardour/plugin_selector.cc b/gtk2_ardour/plugin_selector.cc
index 20db1b3944..2ebaaae100 100644
--- a/gtk2_ardour/plugin_selector.cc
+++ b/gtk2_ardour/plugin_selector.cc
@@ -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