forked from audacity/audacity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVSTControlGTK.cpp
More file actions
75 lines (56 loc) · 1.65 KB
/
Copy pathVSTControlGTK.cpp
File metadata and controls
75 lines (56 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**********************************************************************
Audacity: A Digital Audio Editor
VSTControlGTK.cpp
Leland Lucius
**********************************************************************/
#include "VSTControlGTK.h"
#include <wx/dynlib.h>
#include <wx/sizer.h>
#if 0
static int trappedErrorCode = 0;
static int X11TrapHandler(Display *, XErrorEvent *err)
{
return 0;
}
#endif
VSTControl::VSTControl()
: VSTControlBase()
{
mXdisp = 0;
mXwin = 0;
}
VSTControl::~VSTControl()
{
if (mXwin)
{
mLink->callDispatcher(effEditClose, 0, (intptr_t)mXdisp, (void *)mXwin, 0.0);
mXdisp = 0;
mXwin = 0;
}
}
bool VSTControl::Create(wxWindow *parent, VSTEffectLink *link)
{
if (!VSTControlBase::Create(parent, link))
{
return false;
}
VstRect *rect;
// Some effects like to have us get their rect before opening them.
mLink->callDispatcher(effEditGetRect, 0, 0, &rect, 0.0);
// Make sure the parent has a window
if (!gtk_widget_get_realized(GTK_WIDGET(m_wxwindow)))
{
gtk_widget_realize(GTK_WIDGET(m_wxwindow));
}
GdkWindow *gwin = gtk_widget_get_window(GTK_WIDGET(m_wxwindow));
mXdisp = GDK_WINDOW_XDISPLAY(gwin);
mXwin = GDK_WINDOW_XID(gwin);
mLink->callDispatcher(effEditOpen, 0, (intptr_t)mXdisp, (void *)mXwin, 0.0);
// Get the final bounds of the effect GUI
mLink->callDispatcher(effEditGetRect, 0, 0, &rect, 0.0);
// Add the effect host window to the layout
SetMinSize(wxSize(rect->right - rect->left, rect->bottom - rect->top));
// Must get the size again since SetPeer() could cause it to change
SetInitialSize(GetMinSize());
return true;
}