alter name of AutomationLine::show() to much more sensibly named ::update_visibility()
[ardour.git] / gtk2_ardour / vst_plugin_ui.cc
index be8eae3240269a052241b3642e408fa4436b6a3f..3afb17a652734f7428446ea98b89e90d2d1a7a7f 100644 (file)
 
 */
 
+#include <gtkmm.h>
 #include "ardour/vst_plugin.h"
 #include "ardour/vst_types.h"
 #include "vst_plugin_ui.h"
+
+#ifdef PLATFORM_WINDOWS
+#include <gdk/gdkwin32.h>
+#elif defined __APPLE__
+// TODO
+#else
 #include <gdk/gdkx.h>
+#endif
 
 VSTPluginUI::VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> insert, boost::shared_ptr<ARDOUR::VSTPlugin> plugin)
        : PlugUIBase (insert)
@@ -39,7 +47,9 @@ VSTPluginUI::VSTPluginUI (boost::shared_ptr<ARDOUR::PluginInsert> insert, boost:
        bypass_button.set_active (!insert->active ());
 
        pack_start (*box, false, false);
+#ifdef GDK_WINDOWING_X11
        pack_start (_socket, true, true);
+#endif
 }
 
 VSTPluginUI::~VSTPluginUI ()
@@ -50,30 +60,34 @@ VSTPluginUI::~VSTPluginUI ()
 void
 VSTPluginUI::preset_selected ()
 {
+#ifdef GDK_WINDOWING_X11
        _socket.grab_focus ();
+#endif
        PlugUIBase::preset_selected ();
 }
 
 int
 VSTPluginUI::get_preferred_height ()
 {
-       return _vst->state()->height;
+       return _vst->state()->height + _vst->state()->voffset;
 }
 
 int
 VSTPluginUI::get_preferred_width ()
 {
-       return _vst->state()->width;
+       return _vst->state()->width + _vst->state()->hoffset;
 }
 
 int
 VSTPluginUI::package (Gtk::Window& win)
 {
+#ifdef GDK_WINDOWING_X11
        /* Forward configure events to plugin window */
        win.signal_configure_event().connect (sigc::mem_fun (*this, &VSTPluginUI::configure_handler), false);
 
        /* This assumes that the window's owner understands the XEmbed protocol */
        _socket.add_id (get_XID ());
+#endif
        
        return 0;
 }
@@ -96,6 +110,7 @@ VSTPluginUI::on_window_hide()
 bool
 VSTPluginUI::configure_handler (GdkEventConfigure*)
 {
+#ifdef GDK_WINDOWING_X11
        XEvent event;
        gint x, y;
        GdkWindow* w;
@@ -129,6 +144,7 @@ VSTPluginUI::configure_handler (GdkEventConfigure*)
        XSendEvent (GDK_WINDOW_XDISPLAY (w), GDK_WINDOW_XWINDOW (w), False, StructureNotifyMask, &event);
        gdk_error_trap_pop ();
 
+#endif
        return false;
 }