+ delete _pluginui;
+}
+
+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;
+}
+
+bool
+PluginUIWindow::on_focus_in_event (GdkEventFocus *ev)
+{
+ Window::on_focus_in_event (ev);
+ //Keyboard::the_keyboard().magic_widget_grab_focus ();
+ return false;
+}
+
+bool
+PluginUIWindow::on_focus_out_event (GdkEventFocus *ev)
+{
+ Window::on_focus_out_event (ev);
+ //Keyboard::the_keyboard().magic_widget_drop_focus ();
+ return false;
+}
+
+void
+PluginUIWindow::on_show ()
+{
+ set_role("plugin_ui");
+
+ if (_pluginui) {
+ _pluginui->update_preset_list ();
+ _pluginui->update_preset ();
+ }
+
+ if (_pluginui) {
+ if (_pluginui->on_window_show (_title)) {
+ Window::on_show ();
+ }
+ }
+
+ if (parent) {
+ // set_transient_for (*parent);
+ }
+}
+
+void
+PluginUIWindow::on_hide ()
+{
+ Window::on_hide ();
+
+ if (_pluginui) {
+ _pluginui->on_window_hide ();
+ }
+}
+
+void
+PluginUIWindow::set_title(const std::string& title)
+{
+ Gtk::Window::set_title(title);
+ _title = title;
+}
+
+bool
+#ifdef WINDOWS_VST_SUPPORT
+PluginUIWindow::create_windows_vst_editor(boost::shared_ptr<PluginInsert> insert)
+#else
+PluginUIWindow::create_windows_vst_editor(boost::shared_ptr<PluginInsert>)
+#endif
+{
+#ifndef WINDOWS_VST_SUPPORT
+ return false;
+#else
+
+ boost::shared_ptr<WindowsVSTPlugin> vp;
+
+ if ((vp = boost::dynamic_pointer_cast<WindowsVSTPlugin> (insert->plugin())) == 0) {
+ error << _("unknown type of editor-supplying plugin (note: no VST support in this version of ardour)")
+ << endmsg;
+ throw failed_constructor ();
+ } else {
+ WindowsVSTPluginUI* vpu = new WindowsVSTPluginUI (insert, vp);
+
+ _pluginui = vpu;
+ _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused));
+ add (*vpu);
+ vpu->package (*this);
+ }
+
+ return true;
+#endif
+}
+
+bool
+#ifdef LXVST_SUPPORT
+PluginUIWindow::create_lxvst_editor(boost::shared_ptr<PluginInsert> insert)
+#else
+PluginUIWindow::create_lxvst_editor(boost::shared_ptr<PluginInsert>)
+#endif
+{
+#ifndef LXVST_SUPPORT
+ return false;
+#else
+
+ boost::shared_ptr<LXVSTPlugin> lxvp;
+
+ if ((lxvp = boost::dynamic_pointer_cast<LXVSTPlugin> (insert->plugin())) == 0) {
+ error << _("unknown type of editor-supplying plugin (note: no linuxVST support in this version of ardour)")
+ << endmsg;
+ throw failed_constructor ();
+ } else {
+ LXVSTPluginUI* lxvpu = new LXVSTPluginUI (insert, lxvp);
+
+ _pluginui = lxvpu;
+ _pluginui->KeyboardFocused.connect (sigc::mem_fun (*this, &PluginUIWindow::keyboard_focused));
+ add (*lxvpu);
+ lxvpu->package (*this);
+ }
+
+ return true;
+#endif