summaryrefslogtreecommitdiff
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
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
-rw-r--r--gtk2_ardour/new_session_dialog.cc23
-rw-r--r--gtk2_ardour/plugin_selector.cc39
-rw-r--r--gtk2_ardour/plugin_selector.h2
-rw-r--r--gtk2_ardour/plugin_ui.cc14
-rw-r--r--gtk2_ardour/plugin_ui.h3
-rw-r--r--gtk2_ardour/public_editor.h3
6 files changed, 80 insertions, 4 deletions
diff --git a/gtk2_ardour/new_session_dialog.cc b/gtk2_ardour/new_session_dialog.cc
index 47a2b2b6d3..993db62d59 100644
--- a/gtk2_ardour/new_session_dialog.cc
+++ b/gtk2_ardour/new_session_dialog.cc
@@ -141,15 +141,17 @@ NewSessionDialog::NewSessionDialog()
advanced_table->attach(*m_control_bus_channel_count, 1, 2, 2, 3, Gtk::AttachOptions(), Gtk::AttachOptions(), 0, 0);
advanced_table->attach(*m_master_bus_channel_count, 1, 2, 1, 2, Gtk::AttachOptions(), Gtk::AttachOptions(), 0, 0);
advanced_table->attach(*m_create_master_bus, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(), 0, 0);
+
m_connect_inputs->set_flags(Gtk::CAN_FOCUS);
m_connect_inputs->set_relief(Gtk::RELIEF_NORMAL);
m_connect_inputs->set_mode(true);
- m_connect_inputs->set_active(false);
+ m_connect_inputs->set_active(true);
m_connect_inputs->set_border_width(0);
+
m_limit_input_ports->set_flags(Gtk::CAN_FOCUS);
m_limit_input_ports->set_relief(Gtk::RELIEF_NORMAL);
m_limit_input_ports->set_mode(true);
- m_limit_input_ports->set_sensitive(false);
+ m_limit_input_ports->set_sensitive(true);
m_limit_input_ports->set_border_width(0);
m_input_limit_count->set_flags(Gtk::CAN_FOCUS);
m_input_limit_count->set_update_policy(Gtk::UPDATE_ALWAYS);
@@ -157,6 +159,7 @@ NewSessionDialog::NewSessionDialog()
m_input_limit_count->set_digits(0);
m_input_limit_count->set_wrap(false);
m_input_limit_count->set_sensitive(false);
+
input_port_limit_hbox->pack_start(*m_limit_input_ports, Gtk::PACK_SHRINK, 6);
input_port_limit_hbox->pack_start(*m_input_limit_count, Gtk::PACK_EXPAND_PADDING, 0);
input_port_vbox->pack_start(*m_connect_inputs, Gtk::PACK_SHRINK, 0);
@@ -177,12 +180,12 @@ NewSessionDialog::NewSessionDialog()
m_connect_outputs->set_flags(Gtk::CAN_FOCUS);
m_connect_outputs->set_relief(Gtk::RELIEF_NORMAL);
m_connect_outputs->set_mode(true);
- m_connect_outputs->set_active(false);
+ m_connect_outputs->set_active(true);
m_connect_outputs->set_border_width(0);
m_limit_output_ports->set_flags(Gtk::CAN_FOCUS);
m_limit_output_ports->set_relief(Gtk::RELIEF_NORMAL);
m_limit_output_ports->set_mode(true);
- m_limit_output_ports->set_sensitive(false);
+ m_limit_output_ports->set_sensitive(true);
m_limit_output_ports->set_border_width(0);
m_output_limit_count->set_flags(Gtk::CAN_FOCUS);
m_output_limit_count->set_update_policy(Gtk::UPDATE_ALWAYS);
@@ -597,12 +600,24 @@ void
NewSessionDialog::connect_inputs_clicked ()
{
m_limit_input_ports->set_sensitive(m_connect_inputs->get_active());
+
+ if (m_connect_inputs->get_active() && m_limit_input_ports->get_active()) {
+ m_input_limit_count->set_sensitive(true);
+ } else {
+ m_input_limit_count->set_sensitive(false);
+ }
}
void
NewSessionDialog::connect_outputs_clicked ()
{
m_limit_output_ports->set_sensitive(m_connect_outputs->get_active());
+
+ if (m_connect_outputs->get_active() && m_limit_output_ports->get_active()) {
+ m_output_limit_count->set_sensitive(true);
+ } else {
+ m_output_limit_count->set_sensitive(false);
+ }
}
void
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
diff --git a/gtk2_ardour/plugin_selector.h b/gtk2_ardour/plugin_selector.h
index 654088e3d8..d71203131c 100644
--- a/gtk2_ardour/plugin_selector.h
+++ b/gtk2_ardour/plugin_selector.h
@@ -147,6 +147,8 @@ class PluginSelector : public ArdourDialog
void btn_apply_clicked();
void use_plugin (ARDOUR::PluginInfoPtr);
void cleanup ();
+
+ void set_correct_focus();
};
#endif // __ardour_plugin_selector_h__
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index 350240cb1e..f9db649737 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -27,6 +27,7 @@
#include <pbd/xml++.h>
#include <pbd/failed_constructor.h>
+#include <gtkmm/widget.h>
#include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/fastmeter.h>
#include <gtkmm2ext/barcontroller.h>
@@ -51,6 +52,7 @@
#include "plugin_ui.h"
#include "utils.h"
#include "gui_thread.h"
+#include "public_editor.h"
#include "i18n.h"
@@ -111,11 +113,23 @@ PluginUIWindow::PluginUIWindow (AudioEngine &engine, boost::shared_ptr<PluginIns
if (h > 600) h = 600;
set_default_size (450, h);
}
+
}
PluginUIWindow::~PluginUIWindow ()
{
}
+bool
+PluginUIWindow::on_key_press_event (GdkEventKey* event)
+{
+ return PublicEditor::instance().on_key_press_event(event);
+}
+
+bool
+PluginUIWindow::on_key_release_event (GdkEventKey* event)
+{
+ return PublicEditor::instance().on_key_release_event(event);
+}
void
PluginUIWindow::plugin_going_away (ARDOUR::Redirect* ignored)
diff --git a/gtk2_ardour/plugin_ui.h b/gtk2_ardour/plugin_ui.h
index 5b1fd89178..acd22294dd 100644
--- a/gtk2_ardour/plugin_ui.h
+++ b/gtk2_ardour/plugin_ui.h
@@ -203,6 +203,9 @@ class PluginUIWindow : public ArdourDialog
PlugUIBase& pluginui() { return *_pluginui; }
void resize_preferred();
+
+ virtual bool on_key_press_event (GdkEventKey*);
+ virtual bool on_key_release_event (GdkEventKey*);
private:
PlugUIBase* _pluginui;
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index f70e4c20bd..f85210327c 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -31,6 +31,7 @@ namespace Gtk {
class Editor;
class TimeAxisViewItem;
class TimeAxisView;
+class PluginUIWindow;
class PluginSelector;
class PlaylistSelector;
class XMLNode;
@@ -171,6 +172,8 @@ class PublicEditor : public Gtk::Window, public Stateful {
virtual bool canvas_markerview_end_handle_event(GdkEvent* event, ArdourCanvas::Item*,MarkerView*) = 0;
static PublicEditor* _instance;
+
+ friend class PluginUIWindow;
};
#endif // __gtk_ardour_public_editor_h__