blob: 62f01a0fb802b88467185f58bf22196c8e5e80ff (
plain) (
blame)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
/*
* AbstractVstEditor.h
* -------------------
* Purpose: Common plugin editor interface class. This code is shared between custom and default plugin user interfaces.
* 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"
#ifndef NO_PLUGINS
#include <vector>
#include "../soundlib/Snd_defs.h"
#include "Moddoc.h"
OPENMPT_NAMESPACE_BEGIN
class IMixPlugin;
struct UpdateHint;
class CAbstractVstEditor: public CDialog
{
protected:
CMenu m_Menu;
CMenu m_PresetMenu;
std::vector<std::unique_ptr<CMenu>> m_presetMenuGroup;
CMenu m_InputMenu;
CMenu m_OutputMenu;
CMenu m_MacroMenu;
CMenu m_OptionsMenu;
static UINT m_clipboardFormat;
int32 m_currentPresetMenu = 0;
int32 m_clientHeight;
int m_nLearnMacro = -1;
int m_nCurProg = -1;
INSTRUMENTINDEX m_nInstrument;
bool m_isMinimized = false;
bool m_updateDisplay = false;
CModDoc::NoteToChannelMap m_noteChannel; // Note -> Preview channel assignment
// Adjust window size if menu bar height changes
class WindowSizeAdjuster
{
CWnd &m_wnd;
int m_menuHeight = 0;
public:
WindowSizeAdjuster(CWnd &wnd);
~WindowSizeAdjuster();
};
public:
IMixPlugin &m_VstPlugin;
CAbstractVstEditor(IMixPlugin &plugin);
virtual ~CAbstractVstEditor();
void SetupMenu(bool force = false);
void SetTitle();
void SetLearnMacro(int inMacro);
int GetLearnMacro();
void SetPreset(int32 preset);
void UpdatePresetField();
afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
afx_msg void OnLoadPreset();
afx_msg void OnSavePreset();
afx_msg void OnCopyParameters();
afx_msg void OnPasteParameters();
afx_msg void OnRandomizePreset();
afx_msg void OnRenamePlugin();
afx_msg void OnSetPreset(UINT nID);
afx_msg void OnBypassPlug();
afx_msg void OnRecordAutomation();
afx_msg void OnRecordMIDIOut();
afx_msg void OnPassKeypressesToPlug();
afx_msg void OnSetPreviousVSTPreset();
afx_msg void OnSetNextVSTPreset();
afx_msg void OnVSTPresetBackwardJump();
afx_msg void OnVSTPresetForwardJump();
afx_msg void OnVSTPresetRename();
afx_msg void OnCreateInstrument();
afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hMenu);
afx_msg LRESULT OnCustomKeyMsg(WPARAM, LPARAM);
afx_msg LRESULT OnMidiMsg(WPARAM, LPARAM);
afx_msg void OnDropFiles(HDROP hDropInfo);
afx_msg void OnMove(int x, int y);
afx_msg void OnClose() { DoClose(); }
// Overridden methods:
void PostNcDestroy() override;
void OnOK() override { DoClose(); }
void OnCancel() override { DoClose(); }
virtual bool OpenEditor(CWnd *parent);
virtual void DoClose();
virtual void UpdateParamDisplays() { if(m_updateDisplay) { SetupMenu(true); m_updateDisplay = false; } }
virtual void UpdateParam(int32 /*param*/) { }
virtual void UpdateView(UpdateHint hint);
virtual bool IsResizable() const = 0;
virtual bool SetSize(int contentWidth, int contentHeight) = 0;
void UpdateDisplay() { m_updateDisplay = true; }
DECLARE_MESSAGE_MAP()
protected:
BOOL PreTranslateMessage(MSG *msg) override;
bool HandleKeyMessage(MSG &msg);
void UpdatePresetMenu(bool force = false);
void GeneratePresetMenu(int32 offset, CMenu &parent);
void UpdateInputMenu();
void UpdateOutputMenu();
void UpdateMacroMenu();
void UpdateOptionsMenu();
INSTRUMENTINDEX GetBestInstrumentCandidate() const;
bool CheckInstrument(INSTRUMENTINDEX ins) const;
bool ValidateCurrentInstrument();
void OnToggleEditor(UINT nID);
void OnSetInputInstrument(UINT nID);
afx_msg void OnInitMenu(CMenu* pMenu);
void PrepareToLearnMacro(UINT nID);
void OnActivate(UINT nState, CWnd *pWndOther, BOOL bMinimized);
void StoreWindowPos();
void RestoreWindowPos();
};
OPENMPT_NAMESPACE_END
#endif // NO_PLUGINS
|