13
0

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
This commit is contained in:
Sampo Savolainen 2006-08-10 14:41:53 +00:00
parent 77a13df5bd
commit 00bf20c236
6 changed files with 80 additions and 4 deletions

View File

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

View File

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

View File

@ -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__

View File

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

View File

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

View File

@ -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__