#include <pbd/failed_constructor.h>
#include <gtkmm/widget.h>
+#include <gtkmm/box.h>
#include <gtkmm2ext/click_box.h>
#include <gtkmm2ext/fastmeter.h>
#include <gtkmm2ext/barcontroller.h>
#ifdef VST_SUPPORT
#include <ardour/vst_plugin.h>
#endif
+#ifdef HAVE_LV2
+#include <ardour/lv2_plugin.h>
+#include "lv2_plugin_ui.h"
+#endif
#include <lrdf.h>
#include "utils.h"
#include "gui_thread.h"
#include "public_editor.h"
+#include "keyboard.h"
#include "i18n.h"
using namespace Gtk;
using namespace sigc;
-PluginUIWindow::PluginUIWindow (boost::shared_ptr<PluginInsert> insert, nframes64_t sr, nframes64_t period, bool scrollable)
+PluginUIWindow::PluginUIWindow (Gtk::Window* win, boost::shared_ptr<PluginInsert> insert, bool scrollable)
+ : parent (win)
{
bool have_gui = false;
non_gtk_gui = false;
+ was_visible = false;
Label* label = manage (new Label());
label->set_markup ("<b>THIS IS THE PLUGIN UI</b>");
error << _("Eh? LADSPA plugins don't have editors!") << endmsg;
break;
+ case ARDOUR::LV2:
+ have_gui = create_lv2_editor (insert);
+ break;
+
default:
#ifndef VST_SUPPORT
error << _("unknown type of editor-supplying plugin (note: no VST support in this version of ardour)")
GenericPluginUI* pu = new GenericPluginUI (insert, scrollable);
_pluginui = pu;
- add (*pu);
+ add( *pu );
+
+ /*
+ Gtk::HBox *hbox = new Gtk::HBox();
+ hbox->pack_start( *pu);
+ // TODO: this should be nicer
+ hbox->pack_start( eqgui_bin );
+ add (*manage(hbox));
+ */
+
set_wmclass (X_("ardour_plugin_editor"), "Ardour");
signal_map_event().connect (mem_fun (*pu, &GenericPluginUI::start_updating));
{
}
+void
+PluginUIWindow::set_parent (Gtk::Window* win)
+{
+ parent = win;
+}
+
+void
+PluginUIWindow::on_map ()
+{
+ Window::on_map ();
+ set_keep_above (true);
+}
+
+bool
+PluginUIWindow::on_enter_notify_event (GdkEventCrossing *ev)
+{
+ Keyboard::the_keyboard().enter_window (ev, this);
+ return false;
+}
+
+bool
+PluginUIWindow::on_leave_notify_event (GdkEventCrossing *ev)
+{
+ Keyboard::the_keyboard().leave_window (ev, this);
+ return false;
+}
+
void
PluginUIWindow::on_show ()
{
- cerr << "PluginWindow shown\n";
-
+ if (_pluginui) {
+ _pluginui->update_presets ();
+ }
+
Window::on_show ();
+
+ if (parent) {
+ // set_transient_for (*parent);
+ }
}
void
PluginUIWindow::on_hide ()
{
- cerr << "PluginWindow hidden\n";
Window::on_hide ();
}
cerr << "APP activated ? " << yn << endl;
if (_pluginui) {
if (yn) {
- _pluginui->activate ();
- present ();
+ if (was_visible) {
+ _pluginui->activate ();
+ present ();
+ was_visible = true;
+ }
} else {
+ was_visible = is_visible();
hide ();
_pluginui->deactivate ();
}
#endif
}
+bool
+PluginUIWindow::create_lv2_editor(boost::shared_ptr<PluginInsert> insert)
+{
+#ifndef HAVE_LV2
+ return false;
+#else
+
+ boost::shared_ptr<LV2Plugin> vp;
+
+ if ((vp = boost::dynamic_pointer_cast<LV2Plugin> (insert->plugin())) == 0) {
+ error << _("create_lv2_editor called on non-LV2 plugin") << endmsg;
+ throw failed_constructor ();
+ } else {
+ LV2PluginUI* lpu = new LV2PluginUI (insert, vp);
+ _pluginui = lpu;
+ add (*lpu);
+ lpu->package (*this);
+ }
+
+ non_gtk_gui = false;
+ return true;
+#endif
+}
+
bool
PluginUIWindow::on_key_press_event (GdkEventKey* event)
{
}
}
}
+
+void
+PlugUIBase::update_presets ()
+{
+ set_popdown_strings (preset_combo, plugin->get_presets());
+}