5#include "IGraphics_include_in_plug_src.h"
8#define REAPERAPI_IMPLEMENT
9void (*AttachWindowTopmostButton)(HWND hwnd);
10#include "reaper_plugin_functions.h"
18REAPER_PLUGIN_HINSTANCE gHINSTANCE;
21std::unique_ptr<PLUG_CLASS_NAME> gPlug;
28 int* pToggle =
nullptr;
29 gaccel_register_t accel = {{0,0,0},
""};
30 std::function<void()> func;
31 bool addMenuItem =
false;
32 const char* contextMenuId =
nullptr;
33 const char* menuLabel =
nullptr;
38std::deque<ReaperAction> gActions;
42project_config_extension_t gProjectConfig = {
43 ReaperExtBase::ProcessExtensionLine,
44 ReaperExtBase::SaveExtensionConfig,
45 ReaperExtBase::BeginLoadProjectState,
50#include "ReaperExtBase.cpp"
53#define IMPAPI(x) if (!((*((void **)&(x)) = (void*) pRec->GetFunc(#x)))) gErrorCount++;
55#pragma mark - ENTRY POINT
58 REAPER_PLUGIN_DLL_EXPORT
int REAPER_PLUGIN_ENTRYPOINT(REAPER_PLUGIN_HINSTANCE hInstance, reaper_plugin_info_t* pRec)
60 gHINSTANCE = hInstance;
64 if (pRec->caller_version != REAPER_PLUGIN_VERSION || !pRec->GetFunc)
67 gPlug = std::make_unique<PLUG_CLASS_NAME>(pRec);
70 IMPAPI(Main_OnCommand);
71 IMPAPI(GetResourcePath);
72 IMPAPI(AddExtensionsMainMenu);
73 IMPAPI(AttachWindowTopmostButton);
74 IMPAPI(ShowConsoleMsg);
75 IMPAPI(DockWindowAdd);
76 IMPAPI(DockWindowAddEx);
77 IMPAPI(DockWindowRemove);
78 IMPAPI(DockWindowActivate);
79 IMPAPI(DockIsChildOfDock);
81 IMPAPI(EnsureNotCompletelyOffscreen);
86 pRec->Register(
"hookcommand", (
void*) ReaperExtBase::HookCommandProc);
87 pRec->Register(
"toggleaction", (
void*) ReaperExtBase::ToggleActionCallback);
88 pRec->Register(
"hookcustommenu", (
void*) ReaperExtBase::MenuHook);
89 pRec->Register(
"hookpostcommand", (
void*) ReaperExtBase::PostCommandProc);
90 pRec->Register(
"projectconfig", (
void*) &gProjectConfig);
94 AddExtensionsMainMenu();
96 gParent = pRec->hwnd_main;
109#define SWELL_DLG_FLAGS_AUTOGEN SWELL_DLG_WS_FLIPPED|SWELL_DLG_WS_RESIZABLE
110#include "swell-dlggen.h"
111#include "main.rc_mac_dlg"
114#include "swell-menugen.h"
115#include "main.rc_mac_menu"
116float iplug::GetScaleForHWND(HWND hWnd)
122UINT(WINAPI* __GetDpiForWindow)(HWND);
124float GetScaleForHWND(HWND hWnd)
126 if (!__GetDpiForWindow)
128 HINSTANCE h = LoadLibraryA(
"user32.dll");
129 if (h) *(
void**)&__GetDpiForWindow = GetProcAddress(h,
"GetDpiForWindow");
131 if (!__GetDpiForWindow)
135 int dpi = __GetDpiForWindow(hWnd);
137 if (dpi != USER_DEFAULT_SCREEN_DPI)
138 return static_cast<float>(dpi) / USER_DEFAULT_SCREEN_DPI;
Helper struct for registering Reaper Actions.