Audacity 3.2.0
PlugFrame.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file PlugFrame.cpp
6
7 @author Vitaly Sverchinsky
8
9 @brief Part of Audacity VST3 module
10
11**********************************************************************/
12
13#include "PlugFrame.h"
14#include <wx/wupdlock.h>
15
17 : mWindow(window)
18{
19 FUNKNOWN_CTOR
20}
21
23{
24 FUNKNOWN_DTOR;
25}
26
27void internal::PlugFrame::init(Steinberg::IPlugView* view, Steinberg::ViewRect* size)
28{
29 if(!mInitialized)
30 resizeView(view, size);
31}
32
33Steinberg::tresult internal::PlugFrame::resizeView(Steinberg::IPlugView* view, Steinberg::ViewRect* newSize)
34{
35 if(auto window = mWindow.get())
36 {
37 auto topWindow = wxGetTopLevelParent(window);
38
39 wxWindowUpdateLocker windowUpdateLocker(topWindow);
40
41 window->SetInitialSize({newSize->getWidth(), newSize->getHeight() });
42
43 topWindow->SetMinSize(wxDefaultSize);
44 topWindow->Fit();
45 topWindow->SetMinSize(topWindow->GetSize());
46
47 if(!mInitialized)
48 {
49 mInitialized = true;
50 topWindow->Center();
51 }
52 return view->onSize(newSize);
53 }
54 return Steinberg::kResultFalse;
55}
56
57IMPLEMENT_FUNKNOWN_METHODS(internal::PlugFrame, Steinberg::IPlugFrame, Steinberg::IPlugFrame::iid)
IMPLEMENT_FUNKNOWN_METHODS(RunLoop, Steinberg::Linux::IRunLoop, Steinberg::Linux::IRunLoop::iid)
Dispatches window resize events from VST PlugView to the wxWindow.
Definition: PlugFrame.h:23
virtual ~PlugFrame()
Definition: PlugFrame.cpp:22
Steinberg::tresult PLUGIN_API resizeView(Steinberg::IPlugView *view, Steinberg::ViewRect *newSize) override
Definition: PlugFrame.cpp:33
void init(Steinberg::IPlugView *view, Steinberg::ViewRect *size)
Definition: PlugFrame.cpp:27
PlugFrame(wxWindow *window)
Definition: PlugFrame.cpp:16