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
|
/*
* VSTEditor.h
* -----------
* Purpose: Implementation of the custom plugin editor window that is used if a plugin provides an own editor GUI.
* Notes : (currently none)
* Authors: OpenMPT Devs
* The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
*/
#pragma once
#include "openmpt/all/BuildSettings.hpp"
#include "AbstractVstEditor.h"
OPENMPT_NAMESPACE_BEGIN
#ifdef MPT_WITH_VST
class COwnerVstEditor : public CAbstractVstEditor
{
protected:
CStatic m_plugWindow;
int m_width = 0, m_height = 0;
public:
COwnerVstEditor(CVstPlugin &plugin) : CAbstractVstEditor(plugin) { }
~COwnerVstEditor() override { }
// Plugins may request to change the GUI size.
bool IsResizable() const override { return true; }
bool SetSize(int contentWidth, int contentHeight) override;
void UpdateParamDisplays() override;
bool OpenEditor(CWnd *parent) override;
void DoClose() override;
protected:
afx_msg BOOL OnEraseBkgnd(CDC *) { return TRUE; }
afx_msg void OnPaint();
LRESULT OnPreTranslateKeyDown(WPARAM wParam, LPARAM lParam) { return HandlePreTranslateMessage(WM_KEYDOWN, wParam, lParam); }
LRESULT OnPreTranslateKeyUp(WPARAM wParam, LPARAM lParam) { return HandlePreTranslateMessage(WM_KEYUP, wParam, lParam); }
LRESULT OnPreTranslateSysKeyDown(WPARAM wParam, LPARAM lParam) { return HandlePreTranslateMessage(WM_SYSKEYDOWN, wParam, lParam); }
LRESULT OnPreTranslateSysKeyUp(WPARAM wParam, LPARAM lParam) { return HandlePreTranslateMessage(WM_SYSKEYUP, wParam, lParam); }
LRESULT HandlePreTranslateMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
MSG msg = {m_plugWindow, message, wParam, lParam, 0, {}};
return HandleKeyMessage(msg);
}
DECLARE_MESSAGE_MAP()
};
#endif // MPT_WITH_VST
OPENMPT_NAMESPACE_END
|