Audacity 3.2.0
VSTControlGTK.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 VSTControlGTK.cpp
6
7 Leland Lucius
8
9**********************************************************************/
10
11#include "VSTControlGTK.h"
12
13#include <wx/dynlib.h>
14#include <wx/sizer.h>
15
16#include <gtk/gtk.h>
17#include <gdk/gdkx.h>
18
20{
21 Display *display { nullptr };
22 Window window { 0 };
23
25 {
26 display = nullptr;
27 window = 0;
28 }
29};
30
32{
33
34}
35
37{
38 if (mImpl)
39 mLink->callDispatcher(effEditClose, 0, (intptr_t)mImpl->display, (void *)mImpl->window, 0.0);
40}
41
42bool VSTControl::Create(wxWindow *parent, VSTLink *link)
43{
44 if (!VSTControlBase::Create(parent, link))
45 {
46 return false;
47 }
48
49 mImpl = std::make_unique<VSTControl::Impl>();
50
51 VstRect *rect;
52
53 // Some effects like to have us get their rect before opening them.
54 mLink->callDispatcher(effEditGetRect, 0, 0, &rect, 0.0);
55
56 // Make sure the parent has a window
57 if (!gtk_widget_get_realized(GTK_WIDGET(m_wxwindow)))
58 {
59 gtk_widget_realize(GTK_WIDGET(m_wxwindow));
60 }
61
62 GdkWindow *gwin = gtk_widget_get_window(GTK_WIDGET(m_wxwindow));
63 mImpl->display = GDK_WINDOW_XDISPLAY(gwin);
64 mImpl->window = GDK_WINDOW_XID(gwin);
65
66 mLink->callDispatcher(effEditOpen, 0, (intptr_t)mImpl->display, (void *)mImpl->window, 0.0);
67
68 // Get the final bounds of the effect GUI
69 mLink->callDispatcher(effEditGetRect, 0, 0, &rect, 0.0);
70
71 // Add the effect host window to the layout
72 SetMinSize(wxSize(rect->right - rect->left, rect->bottom - rect->top));
73
74 // Must get the size again since SetPeer() could cause it to change
75 SetInitialSize(GetMinSize());
76
77 return true;
78}
const int effEditClose
Definition: aeffectx.h:107
const int effEditGetRect
Definition: aeffectx.h:105
const int effEditOpen
Definition: aeffectx.h:106
virtual bool Create(wxWindow *parent, VSTLink *link)
Definition: VSTControl.h:31
VSTLink * mLink
Definition: VSTControl.h:46
virtual ~VSTControl()
bool Create(wxWindow *parent, VSTLink *link) override
std::unique_ptr< Impl > mImpl
Definition: VSTControlGTK.h:26
short right
Definition: aeffectx.h:388
short left
Definition: aeffectx.h:386
short top
Definition: aeffectx.h:385
short bottom
Definition: aeffectx.h:387