summaryrefslogtreecommitdiff
path: root/gtk2_ardour/plugin_ui.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-12-10 21:32:27 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-12-10 21:32:27 +0000
commitacf1490e45034a961b7703154c5eabaf6a9aec55 (patch)
tree73fc1d9befef1f751ef4b956322d7eeeb99b4eba /gtk2_ardour/plugin_ui.cc
parentf3dd3e6b18be7d22ca31e5424c2a07922b44b74e (diff)
AU support; mv LADSPA gui to Generic; small fix(?) for NSD issue with absolute/full pathnames
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2755 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/plugin_ui.cc')
-rw-r--r--gtk2_ardour/plugin_ui.cc109
1 files changed, 86 insertions, 23 deletions
diff --git a/gtk2_ardour/plugin_ui.cc b/gtk2_ardour/plugin_ui.cc
index 1f028691cb..9b2874d87d 100644
--- a/gtk2_ardour/plugin_ui.cc
+++ b/gtk2_ardour/plugin_ui.cc
@@ -42,6 +42,9 @@
#ifdef VST_SUPPORT
#include <ardour/vst_plugin.h>
#endif
+#ifndef HAVE_AUDIOUNITS
+#include <ardour/audio_unit.h>
+#endif
#include <lrdf.h>
@@ -64,41 +67,42 @@ using namespace sigc;
PluginUIWindow::PluginUIWindow (boost::shared_ptr<PluginInsert> insert, bool scrollable)
: ArdourDialog ("plugin ui")
{
- if (insert->plugin()->has_editor()) {
-
-#ifdef VST_SUPPORT
-
- boost::shared_ptr<VSTPlugin> vp;
+ bool have_gui = false;
+ non_gtk_gui = false;
- if ((vp = boost::dynamic_pointer_cast<VSTPlugin> (insert->plugin())) != 0) {
-
-
- VSTPluginUI* vpu = new VSTPluginUI (insert, vp);
-
- _pluginui = vpu;
- get_vbox()->add (*vpu);
- vpu->package (*this);
+ if (insert->plugin()->has_editor()) {
+ switch (insert->type()) {
+ case ARDOUR::VST:
+ have_gui = create_vst_editor (insert);
+ break;
+
+ case ARDOUR::AudioUnit:
+ have_gui = create_audiounit_editor (insert);
+ break;
- } else {
-#endif
+ case ARDOUR::LADSPA:
+ error << _("Eh? LADSPA plugins don't have editors!") << endmsg;
+ break;
+
+ default:
error << _("unknown type of editor-supplying plugin (note: no VST support in this version of ardour)")
<< endmsg;
throw failed_constructor ();
-#ifdef VST_SUPPORT
}
-#endif
- } else {
+ }
- LadspaPluginUI* pu = new LadspaPluginUI (insert, scrollable);
+ if (!have_gui) {
+
+ GenericPluginUI* pu = new GenericPluginUI (insert, scrollable);
_pluginui = pu;
get_vbox()->add (*pu);
set_wmclass (X_("ardour_plugin_editor"), "Ardour");
- signal_map_event().connect (mem_fun (*pu, &LadspaPluginUI::start_updating));
- signal_unmap_event().connect (mem_fun (*pu, &LadspaPluginUI::stop_updating));
+ signal_map_event().connect (mem_fun (*pu, &GenericPluginUI::start_updating));
+ signal_unmap_event().connect (mem_fun (*pu, &GenericPluginUI::stop_updating));
}
set_position (Gtk::WIN_POS_MOUSE);
@@ -108,12 +112,19 @@ PluginUIWindow::PluginUIWindow (boost::shared_ptr<PluginInsert> insert, bool scr
signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), reinterpret_cast<Window*> (this)));
insert->GoingAway.connect (mem_fun(*this, &PluginUIWindow::plugin_going_away));
+ gint h = _pluginui->get_preferred_height ();
+ gint w = _pluginui->get_preferred_width ();
+
if (scrollable) {
- gint h = _pluginui->get_preferred_height ();
if (h > 600) h = 600;
- set_default_size (450, h);
+ if (w > 600) w = 600;
+
+ if (w < 0) {
+ w = 450;
+ }
}
+ set_default_size (w, h);
}
PluginUIWindow::~PluginUIWindow ()
@@ -121,8 +132,60 @@ PluginUIWindow::~PluginUIWindow ()
}
bool
+PluginUIWindow::create_vst_editor(boost::shared_ptr<PluginInsert> insert)
+{
+#ifndef VST_SUPPORT
+ return false;
+#else
+ VSTPluginUI* vpu = new VSTPluginUI (insert, vp);
+
+ _pluginui = vpu;
+ get_vbox()->add (*vpu);
+ vpu->package (*this);
+
+ non_gtk_gui = true;
+ return true;
+#endif
+}
+
+bool
+PluginUIWindow::create_audiounit_editor (boost::shared_ptr<PluginInsert> insert)
+{
+#if !defined(HAVE_AUDIOUNITS) || !defined(GTKOSX)
+ return false;
+#else
+ VBox* box;
+ _pluginui = create_au_gui (insert, &box);
+ get_vbox()->add (*box);
+ non_gtk_gui = true;
+
+ extern sigc::signal<void,bool> ApplicationActivationChanged;
+ ApplicationActivationChanged.connect (mem_fun (*this, &PluginUIWindow::app_activated));
+
+ return true;
+#endif
+}
+
+void
+PluginUIWindow::app_activated (bool yn)
+{
+#if defined(HAVE_AUDIOUNITS) && defined(GTKOSX)
+ if (yn) {
+ ARDOUR_UI::instance()->the_editor().ensure_float (*this);
+ show ();
+ } else {
+ hide ();
+ }
+#endif
+}
+
+bool
PluginUIWindow::on_key_press_event (GdkEventKey* event)
{
+ if (non_gtk_gui) {
+ return false;
+ }
+
if (!key_press_focus_accelerator_handler (*this, event)) {
return PublicEditor::instance().on_key_press_event(event);
} else {