The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
5.2KB

  1. #ifndef _REAPER_PLUGIN_FX_EMBED_H_
  2. #define _REAPER_PLUGIN_FX_EMBED_H_
  3. /*
  4. * to support via VST2: canDo("hasCockosEmbeddedUI") should return 0xbeef0000
  5. * dispatcher will be called with opcode=effVendorSpecific, index=effEditDraw, value=parm2, ptr=(void*)(INT_PTR)parm3, opt=message (REAPER_FXEMBED_WM_*)
  6. *
  7. * to support via VST3: IController should support IReaperUIEmbedInterface, see reaper_vst3_interfaces.h
  8. *
  9. * to support via LV2: todo
  10. */
  11. // these alias to win32's WM_*
  12. #define REAPER_FXEMBED_WM_IS_SUPPORTED 0x0000
  13. /* return 1 if embedding is supported and available
  14. * return -1 if embedding is supported and unavailable
  15. * return 0 if embedding is not supported
  16. */
  17. #define REAPER_FXEMBED_WM_CREATE 0x0001 // called when embedding begins (return value ignored)
  18. #define REAPER_FXEMBED_WM_DESTROY 0x0002 // called when embedding ends (return value ignored)
  19. typedef struct REAPER_FXEMBED_DrawInfo // alias of REAPER_inline_positioninfo
  20. {
  21. int context; // 0=unknown (v6.23 and earlier), 1=TCP, 2=MCP
  22. int dpi; // 0=unknown (v6.23 and earlier), otherwise 24.8 fixed point (256=100%)
  23. int mousewheel_amt; // for REAPER_FXEMBED_WM_MOUSEWHEEL, 120 = step, typically
  24. double _res2;
  25. int width, height;
  26. int mouse_x, mouse_y;
  27. int flags; // REAPER_FXEMBED_DRAWINFO_FLAG_PAINT_OPTIONAL etc
  28. int _res3;
  29. void *spare[6];
  30. } REAPER_FXEMBED_DrawInfo;
  31. #define REAPER_FXEMBED_DRAWINFO_FLAG_PAINT_OPTIONAL 1
  32. #define REAPER_FXEMBED_DRAWINFO_FLAG_LBUTTON_CAPTURED 0x10000
  33. #define REAPER_FXEMBED_DRAWINFO_FLAG_RBUTTON_CAPTURED 0x20000
  34. #define REAPER_FXEMBED_WM_PAINT 0x000F
  35. /*
  36. * draw embedded UI.
  37. * parm2: REAPER_FXEMBED_IBitmap * to draw into. note
  38. * parm3: REAPER_FXEMBED_DrawInfo *
  39. *
  40. * if flags has REAPER_FXEMBED_DRAWINFO_FLAG_PAINT_OPTIONAL set, update is optional. if no change since last draw, return 0.
  41. * if flags has REAPER_FXEMBED_DRAWINFO_FLAG_LBUTTON_CAPTURED set, left mouse button is down and captured
  42. * if flags has REAPER_FXEMBED_DRAWINFO_FLAG_RBUTTON_CAPTURED set, right mouse button is down and captured
  43. *
  44. * HiDPI:
  45. * if REAPER_FXEMBED_IBitmap::Extended(REAPER_FXEMBED_EXT_GET_ADVISORY_SCALING,NULL) returns nonzero, then it is a 24.8 scalefactor for UI drawing
  46. *
  47. * return 1 if drawing occurred, 0 otherwise.
  48. *
  49. */
  50. #define REAPER_FXEMBED_WM_SETCURSOR 0x0020 // parm3: REAPER_FXEMBED_DrawInfo*. set mouse cursor and return REAPER_FXEMBED_RETNOTIFY_HANDLED, or return 0.
  51. #define REAPER_FXEMBED_WM_GETMINMAXINFO 0x0024
  52. /*
  53. * get size hints. parm3 = (REAPER_FXEMBED_SizeHints*). return 1 if supported
  54. * note that these are just hints, the actual size may vary
  55. */
  56. typedef struct REAPER_FXEMBED_SizeHints { // alias to MINMAXINFO
  57. int preferred_aspect; // 16.16 fixed point (65536 = 1:1, 32768 = 1:2, etc)
  58. int minimum_aspect; // 16.16 fixed point
  59. int _res1, _res2, _res3, _res4;
  60. int min_width, min_height;
  61. int max_width, max_height;
  62. } REAPER_FXEMBED_SizeHints;
  63. /*
  64. * mouse messages
  65. * parm3 = (REAPER_FXEMBED_DrawInfo*)
  66. * capture is automatically set on mouse down, released on mouse up
  67. * when not captured, will always receive a mousemove when exiting the window
  68. */
  69. #define REAPER_FXEMBED_WM_MOUSEMOVE 0x0200
  70. #define REAPER_FXEMBED_WM_LBUTTONDOWN 0x0201
  71. #define REAPER_FXEMBED_WM_LBUTTONUP 0x0202
  72. #define REAPER_FXEMBED_WM_LBUTTONDBLCLK 0x0203
  73. #define REAPER_FXEMBED_WM_RBUTTONDOWN 0x0204
  74. #define REAPER_FXEMBED_WM_RBUTTONUP 0x0205
  75. #define REAPER_FXEMBED_WM_RBUTTONDBLCLK 0x0206
  76. #define REAPER_FXEMBED_WM_MOUSEWHEEL 0x020A
  77. /* REAPER_FXEMBED_WM_SETCURSOR should return REAPER_FXEMBED_RETNOTIFY_HANDLED if a cursor was set
  78. */
  79. #define REAPER_FXEMBED_RETNOTIFY_HANDLED 0x0000001
  80. /* if the mouse messages return with REAPER_FXEMBED_RETNOTIFY_INVALIDATE set, a non-optional
  81. * redraw is initiated (generally sooner than the next timer-based redraw)
  82. */
  83. #define REAPER_FXEMBED_RETNOTIFY_INVALIDATE 0x1000000
  84. /*
  85. * bitmap interface
  86. * this is an alias of LICE_IBitmap etc from WDL/lice/lice.h
  87. *
  88. */
  89. #define REAPER_FXEMBED_RGBA(r,g,b,a) (((b)&0xff)|(((g)&0xff)<<8)|(((r)&0xff)<<16)|(((a)&0xff)<<24))
  90. #define REAPER_FXEMBED_GETB(v) ((v)&0xff)
  91. #define REAPER_FXEMBED_GETG(v) (((v)>>8)&0xff)
  92. #define REAPER_FXEMBED_GETR(v) (((v)>>16)&0xff)
  93. #define REAPER_FXEMBED_GETA(v) (((v)>>24)&0xff)
  94. #ifdef __cplusplus
  95. class REAPER_FXEMBED_IBitmap // alias of LICE_IBitmap
  96. {
  97. public:
  98. virtual ~REAPER_FXEMBED_IBitmap() { }
  99. virtual unsigned int *getBits()=0;
  100. virtual int getWidth()=0;
  101. virtual int getHeight()=0;
  102. virtual int getRowSpan()=0; // includes any off-bitmap data. this is in sizeof(unsigned int) units, not bytes.
  103. virtual bool isFlipped() { return false; }
  104. virtual bool resize(int w, int h)=0;
  105. virtual void *getDC() { return 0; } // do not use
  106. virtual INT_PTR Extended(int id, void* data) { return 0; }
  107. };
  108. #endif
  109. #define REAPER_FXEMBED_EXT_GET_ADVISORY_SCALING 0x2003 // data ignored, returns .8 fixed point. returns 0 if unscaled
  110. #endif