forked from juce-framework/JUCE
-
Notifications
You must be signed in to change notification settings - Fork 1
/
reaper_plugin_fx_embed.h
140 lines (110 loc) · 5.2 KB
/
reaper_plugin_fx_embed.h
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
#ifndef _REAPER_PLUGIN_FX_EMBED_H_
#define _REAPER_PLUGIN_FX_EMBED_H_
/*
* to support via VST2: canDo("hasCockosEmbeddedUI") should return 0xbeef0000
* dispatcher will be called with opcode=effVendorSpecific, index=effEditDraw, value=parm2, ptr=(void*)(INT_PTR)parm3, opt=message (REAPER_FXEMBED_WM_*)
*
* to support via VST3: IController should support IReaperUIEmbedInterface, see reaper_vst3_interfaces.h
*
* to support via LV2: todo
*/
// these alias to win32's WM_*
#define REAPER_FXEMBED_WM_IS_SUPPORTED 0x0000
/* return 1 if embedding is supported and available
* return -1 if embedding is supported and unavailable
* return 0 if embedding is not supported
*/
#define REAPER_FXEMBED_WM_CREATE 0x0001 // called when embedding begins (return value ignored)
#define REAPER_FXEMBED_WM_DESTROY 0x0002 // called when embedding ends (return value ignored)
typedef struct REAPER_FXEMBED_DrawInfo // alias of REAPER_inline_positioninfo
{
int context; // 0=unknown (v6.23 and earlier), 1=TCP, 2=MCP
int dpi; // 0=unknown (v6.23 and earlier), otherwise 24.8 fixed point (256=100%)
int mousewheel_amt; // for REAPER_FXEMBED_WM_MOUSEWHEEL, 120 = step, typically
double _res2;
int width, height;
int mouse_x, mouse_y;
int flags; // REAPER_FXEMBED_DRAWINFO_FLAG_PAINT_OPTIONAL etc
int _res3;
void *spare[6];
} REAPER_FXEMBED_DrawInfo;
#define REAPER_FXEMBED_DRAWINFO_FLAG_PAINT_OPTIONAL 1
#define REAPER_FXEMBED_DRAWINFO_FLAG_LBUTTON_CAPTURED 0x10000
#define REAPER_FXEMBED_DRAWINFO_FLAG_RBUTTON_CAPTURED 0x20000
#define REAPER_FXEMBED_WM_PAINT 0x000F
/*
* draw embedded UI.
* parm2: REAPER_FXEMBED_IBitmap * to draw into. note
* parm3: REAPER_FXEMBED_DrawInfo *
*
* if flags has REAPER_FXEMBED_DRAWINFO_FLAG_PAINT_OPTIONAL set, update is optional. if no change since last draw, return 0.
* if flags has REAPER_FXEMBED_DRAWINFO_FLAG_LBUTTON_CAPTURED set, left mouse button is down and captured
* if flags has REAPER_FXEMBED_DRAWINFO_FLAG_RBUTTON_CAPTURED set, right mouse button is down and captured
*
* HiDPI:
* if REAPER_FXEMBED_IBitmap::Extended(REAPER_FXEMBED_EXT_GET_ADVISORY_SCALING,NULL) returns nonzero, then it is a 24.8 scalefactor for UI drawing
*
* return 1 if drawing occurred, 0 otherwise.
*
*/
#define REAPER_FXEMBED_WM_SETCURSOR 0x0020 // parm3: REAPER_FXEMBED_DrawInfo*. set mouse cursor and return REAPER_FXEMBED_RETNOTIFY_HANDLED, or return 0.
#define REAPER_FXEMBED_WM_GETMINMAXINFO 0x0024
/*
* get size hints. parm3 = (REAPER_FXEMBED_SizeHints*). return 1 if supported
* note that these are just hints, the actual size may vary
*/
typedef struct REAPER_FXEMBED_SizeHints { // alias to MINMAXINFO
int preferred_aspect; // 16.16 fixed point (65536 = 1:1, 32768 = 1:2, etc)
int minimum_aspect; // 16.16 fixed point
int _res1, _res2, _res3, _res4;
int min_width, min_height;
int max_width, max_height;
} REAPER_FXEMBED_SizeHints;
/*
* mouse messages
* parm3 = (REAPER_FXEMBED_DrawInfo*)
* capture is automatically set on mouse down, released on mouse up
* when not captured, will always receive a mousemove when exiting the window
*/
#define REAPER_FXEMBED_WM_MOUSEMOVE 0x0200
#define REAPER_FXEMBED_WM_LBUTTONDOWN 0x0201
#define REAPER_FXEMBED_WM_LBUTTONUP 0x0202
#define REAPER_FXEMBED_WM_LBUTTONDBLCLK 0x0203
#define REAPER_FXEMBED_WM_RBUTTONDOWN 0x0204
#define REAPER_FXEMBED_WM_RBUTTONUP 0x0205
#define REAPER_FXEMBED_WM_RBUTTONDBLCLK 0x0206
#define REAPER_FXEMBED_WM_MOUSEWHEEL 0x020A
/* REAPER_FXEMBED_WM_SETCURSOR should return REAPER_FXEMBED_RETNOTIFY_HANDLED if a cursor was set
*/
#define REAPER_FXEMBED_RETNOTIFY_HANDLED 0x0000001
/* if the mouse messages return with REAPER_FXEMBED_RETNOTIFY_INVALIDATE set, a non-optional
* redraw is initiated (generally sooner than the next timer-based redraw)
*/
#define REAPER_FXEMBED_RETNOTIFY_INVALIDATE 0x1000000
/*
* bitmap interface
* this is an alias of LICE_IBitmap etc from WDL/lice/lice.h
*
*/
#define REAPER_FXEMBED_RGBA(r,g,b,a) (((b)&0xff)|(((g)&0xff)<<8)|(((r)&0xff)<<16)|(((a)&0xff)<<24))
#define REAPER_FXEMBED_GETB(v) ((v)&0xff)
#define REAPER_FXEMBED_GETG(v) (((v)>>8)&0xff)
#define REAPER_FXEMBED_GETR(v) (((v)>>16)&0xff)
#define REAPER_FXEMBED_GETA(v) (((v)>>24)&0xff)
#ifdef __cplusplus
class REAPER_FXEMBED_IBitmap // alias of LICE_IBitmap
{
public:
virtual ~REAPER_FXEMBED_IBitmap() { }
virtual unsigned int *getBits()=0;
virtual int getWidth()=0;
virtual int getHeight()=0;
virtual int getRowSpan()=0; // includes any off-bitmap data. this is in sizeof(unsigned int) units, not bytes.
virtual bool isFlipped() { return false; }
virtual bool resize(int w, int h)=0;
virtual void *getDC() { return 0; } // do not use
virtual INT_PTR Extended(int id, void* data) { return 0; }
};
#endif
#define REAPER_FXEMBED_EXT_GET_ADVISORY_SCALING 0x2003 // data ignored, returns .8 fixed point. returns 0 if unscaled
#endif