From 38d101bf286918700d4cfe35a477fa5b5a8f44cd Mon Sep 17 00:00:00 2001 From: olilarkin Date: Sun, 21 Apr 2024 20:21:01 +0000 Subject: [PATCH] deploy: iPlug2/iPlug2@c6d3793b912b03542407c9defdc0e2f69db1d15c --- ...ext__include__in__plug__src_8h_source.html | 273 +++++++++--------- _reaper_ext_base_8cpp_source.html | 2 +- struct_reaper_action.html | 10 +- 3 files changed, 143 insertions(+), 142 deletions(-) diff --git a/_reaper_ext__include__in__plug__src_8h_source.html b/_reaper_ext__include__in__plug__src_8h_source.html index c871d2d8..a3459607 100644 --- a/_reaper_ext__include__in__plug__src_8h_source.html +++ b/_reaper_ext__include__in__plug__src_8h_source.html @@ -88,143 +88,144 @@
1
2#ifndef NO_IGRAPHICS
3#define BUNDLE_ID ""
-
4#include "IGraphics_include_in_plug_src.h"
-
5#endif
-
6
-
7#define REAPERAPI_IMPLEMENT
-
8void (*AttachWindowTopmostButton)(HWND hwnd);
-
9#include "reaper_plugin_functions.h"
-
10
-
11#include "resource.h"
-
12#include <vector>
-
13#include <map>
-
14
-
15REAPER_PLUGIN_HINSTANCE gHINSTANCE;
-
16HWND gParent;
-
17HWND gHWND = NULL;
-
18std::unique_ptr<PLUG_CLASS_NAME> gPlug;
-
19RECT gPrevBounds;
-
20int gErrorCount = 0;
-
21
- -
24{
-
25 int* pToggle = nullptr;
-
26 gaccel_register_t accel = {{0,0,0}, ""};
-
27 std::function<void()> func;
-
28 bool addMenuItem = false;
-
29};
-
30
-
31std::vector<ReaperAction> gActions;
-
32
-
33//TODO: don't #include cpp here
-
34#include "ReaperExtBase.cpp"
-
35
-
36// super nasty looking macro here but allows importing functions from Reaper with simple looking code
-
37#define IMPAPI(x) if (!((*((void **)&(x)) = (void*) pRec->GetFunc(#x)))) gErrorCount++;
-
38
-
39#pragma mark - ENTRY POINT
-
40extern "C"
-
41{
-
42 REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(REAPER_PLUGIN_HINSTANCE hInstance, reaper_plugin_info_t* pRec)
-
43 {
-
44 gHINSTANCE = hInstance;
-
45
-
46 if (pRec)
-
47 {
-
48 if (pRec->caller_version != REAPER_PLUGIN_VERSION || !pRec->GetFunc)
-
49 return 0;
-
50
-
51 gPlug = std::make_unique<PLUG_CLASS_NAME>(pRec);
-
52
-
53 // initialize API function pointers from Reaper
-
54 IMPAPI(Main_OnCommand);
-
55 IMPAPI(GetResourcePath);
-
56 IMPAPI(AddExtensionsMainMenu);
-
57 IMPAPI(AttachWindowTopmostButton);
-
58 IMPAPI(ShowConsoleMsg);
-
59 IMPAPI(DockWindowAdd);
-
60 IMPAPI(DockWindowActivate);
-
61
-
62 if (gErrorCount > 0)
-
63 return 0;
-
64
-
65 pRec->Register("hookcommand", (void*) ReaperExtBase::HookCommandProc);
-
66 pRec->Register("toggleaction", (void*) ReaperExtBase::ToggleActionCallback);
-
67
-
68 AddExtensionsMainMenu();
-
69
-
70 gParent = pRec->hwnd_main;
-
71
-
72 HMENU hMenu = GetSubMenu(GetMenu(gParent),
-
73#ifdef OS_WIN
-
74 8
-
75#else // OS X has one extra menu
-
76 9
-
77#endif
-
78 );
-
79
-
80 int menuIdx = 6;
-
81
-
82 for(auto& action : gActions)
-
83 {
-
84 if(action.addMenuItem)
-
85 {
-
86 MENUITEMINFO mi={sizeof(MENUITEMINFO),};
-
87 mi.fMask = MIIM_TYPE | MIIM_ID;
-
88 mi.fType = MFT_STRING;
-
89 mi.dwTypeData = LPSTR(action.accel.desc);
-
90 mi.wID = action.accel.accel.cmd;
-
91 InsertMenuItem(hMenu, menuIdx++, TRUE, &mi);
-
92 }
-
93 }
-
94
-
95 return 1;
-
96 }
-
97 else
-
98 {
-
99 return 0;
-
100 }
-
101 }
-
102};
-
103
+
4#define APP_GROUP_ID ""
+
5#include "IGraphics_include_in_plug_src.h"
+
6#endif
+
7
+
8#define REAPERAPI_IMPLEMENT
+
9void (*AttachWindowTopmostButton)(HWND hwnd);
+
10#include "reaper_plugin_functions.h"
+
11
+
12#include "resource.h"
+
13#include <vector>
+
14#include <map>
+
15
+
16REAPER_PLUGIN_HINSTANCE gHINSTANCE;
+
17HWND gParent;
+
18HWND gHWND = NULL;
+
19std::unique_ptr<PLUG_CLASS_NAME> gPlug;
+
20RECT gPrevBounds;
+
21int gErrorCount = 0;
+
22
+ +
25{
+
26 int* pToggle = nullptr;
+
27 gaccel_register_t accel = {{0,0,0}, ""};
+
28 std::function<void()> func;
+
29 bool addMenuItem = false;
+
30};
+
31
+
32std::vector<ReaperAction> gActions;
+
33
+
34//TODO: don't #include cpp here
+
35#include "ReaperExtBase.cpp"
+
36
+
37// super nasty looking macro here but allows importing functions from Reaper with simple looking code
+
38#define IMPAPI(x) if (!((*((void **)&(x)) = (void*) pRec->GetFunc(#x)))) gErrorCount++;
+
39
+
40#pragma mark - ENTRY POINT
+
41extern "C"
+
42{
+
43 REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(REAPER_PLUGIN_HINSTANCE hInstance, reaper_plugin_info_t* pRec)
+
44 {
+
45 gHINSTANCE = hInstance;
+
46
+
47 if (pRec)
+
48 {
+
49 if (pRec->caller_version != REAPER_PLUGIN_VERSION || !pRec->GetFunc)
+
50 return 0;
+
51
+
52 gPlug = std::make_unique<PLUG_CLASS_NAME>(pRec);
+
53
+
54 // initialize API function pointers from Reaper
+
55 IMPAPI(Main_OnCommand);
+
56 IMPAPI(GetResourcePath);
+
57 IMPAPI(AddExtensionsMainMenu);
+
58 IMPAPI(AttachWindowTopmostButton);
+
59 IMPAPI(ShowConsoleMsg);
+
60 IMPAPI(DockWindowAdd);
+
61 IMPAPI(DockWindowActivate);
+
62
+
63 if (gErrorCount > 0)
+
64 return 0;
+
65
+
66 pRec->Register("hookcommand", (void*) ReaperExtBase::HookCommandProc);
+
67 pRec->Register("toggleaction", (void*) ReaperExtBase::ToggleActionCallback);
+
68
+
69 AddExtensionsMainMenu();
+
70
+
71 gParent = pRec->hwnd_main;
+
72
+
73 HMENU hMenu = GetSubMenu(GetMenu(gParent),
+
74#ifdef OS_WIN
+
75 8
+
76#else // OS X has one extra menu
+
77 9
+
78#endif
+
79 );
+
80
+
81 int menuIdx = 6;
+
82
+
83 for(auto& action : gActions)
+
84 {
+
85 if(action.addMenuItem)
+
86 {
+
87 MENUITEMINFO mi={sizeof(MENUITEMINFO),};
+
88 mi.fMask = MIIM_TYPE | MIIM_ID;
+
89 mi.fType = MFT_STRING;
+
90 mi.dwTypeData = LPSTR(action.accel.desc);
+
91 mi.wID = action.accel.accel.cmd;
+
92 InsertMenuItem(hMenu, menuIdx++, TRUE, &mi);
+
93 }
+
94 }
+
95
+
96 return 1;
+
97 }
+
98 else
+
99 {
+
100 return 0;
+
101 }
+
102 }
+
103};
104
-
105#ifndef OS_WIN
-
106#define SWELL_DLG_FLAGS_AUTOGEN SWELL_DLG_WS_FLIPPED//|SWELL_DLG_WS_RESIZABLE
-
107#include "swell-dlggen.h"
-
108#include "main.rc_mac_dlg"
-
109#undef BEGIN
-
110#undef END
-
111#include "swell-menugen.h"
-
112#include "main.rc_mac_menu"
-
113float iplug::GetScaleForHWND(HWND hWnd)
-
114{
-
115 return 1.f;
-
116}
-
117#else
-
118
-
119UINT(WINAPI* __GetDpiForWindow)(HWND);
-
120
-
121float GetScaleForHWND(HWND hWnd)
-
122{
-
123 if (!__GetDpiForWindow)
-
124 {
-
125 HINSTANCE h = LoadLibraryA("user32.dll");
-
126 if (h) *(void**)&__GetDpiForWindow = GetProcAddress(h, "GetDpiForWindow");
-
127
-
128 if (!__GetDpiForWindow)
-
129 return 1;
-
130 }
-
131
-
132 int dpi = __GetDpiForWindow(hWnd);
-
133
-
134 if (dpi != USER_DEFAULT_SCREEN_DPI)
-
135 return static_cast<float>(dpi) / USER_DEFAULT_SCREEN_DPI;
-
136
-
137 return 1;
-
138}
-
139
-
140#endif
-
Helper struct for registering Reaper Actions.
+
105
+
106#ifndef OS_WIN
+
107#define SWELL_DLG_FLAGS_AUTOGEN SWELL_DLG_WS_FLIPPED//|SWELL_DLG_WS_RESIZABLE
+
108#include "swell-dlggen.h"
+
109#include "main.rc_mac_dlg"
+
110#undef BEGIN
+
111#undef END
+
112#include "swell-menugen.h"
+
113#include "main.rc_mac_menu"
+
114float iplug::GetScaleForHWND(HWND hWnd)
+
115{
+
116 return 1.f;
+
117}
+
118#else
+
119
+
120UINT(WINAPI* __GetDpiForWindow)(HWND);
+
121
+
122float GetScaleForHWND(HWND hWnd)
+
123{
+
124 if (!__GetDpiForWindow)
+
125 {
+
126 HINSTANCE h = LoadLibraryA("user32.dll");
+
127 if (h) *(void**)&__GetDpiForWindow = GetProcAddress(h, "GetDpiForWindow");
+
128
+
129 if (!__GetDpiForWindow)
+
130 return 1;
+
131 }
+
132
+
133 int dpi = __GetDpiForWindow(hWnd);
+
134
+
135 if (dpi != USER_DEFAULT_SCREEN_DPI)
+
136 return static_cast<float>(dpi) / USER_DEFAULT_SCREEN_DPI;
+
137
+
138 return 1;
+
139}
+
140
+
141#endif
+
Helper struct for registering Reaper Actions.