23struct reaper_plugin_info_t;
24struct project_config_extension_t;
25class ProjectStateContext;
48 void BeginInformHostOfParamChangeFromUI(
int paramIdx)
override {};
50 void EndInformHostOfParamChangeFromUI(
int paramIdx)
override {};
52 bool EditorResizeFromUI(
int viewWidth,
int viewHeight,
bool needsPlatformResize)
override;
90 void RegisterAction(
const char* actionName, std::function<
void()> func,
bool addMenuItem =
false,
int* pToggle =
nullptr,
const char* contextMenuId =
nullptr,
const char* menuLabel =
nullptr);
99 bool IsDocked()
const {
return (mDockState.state & 2) == 2; }
121 static bool HookCommandProc(
int command,
int flag);
124 static int ToggleActionCallback(
int command);
128 static void MenuHook(
const char* menuidstr,
void* menu,
int flag);
131 static void PostCommandProc(
int command,
int flag);
135 static void BeginLoadProjectState(
bool isUndo, project_config_extension_t* reg);
136 static bool ProcessExtensionLine(
const char* line, ProjectStateContext* ctx,
bool isUndo, project_config_extension_t* reg);
137 static void SaveExtensionConfig(ProjectStateContext* ctx,
bool isUndo, project_config_extension_t* reg);
140 static WDL_DLGRET MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
142 void OnTimer(
Timer& t);
143 void CreateMainWindow();
144 void DestroyMainWindow();
145 void SaveDockState();
146 void LoadDockState();
147 void EnsureStateLoaded();
148 void UpdateToggleStates();
150 reaper_plugin_info_t* mRec =
nullptr;
151 std::unique_ptr<Timer> mTimer;
153 WDL_FastString mDockId;
154 WDL_FastString mMenuName;
155 bool mSaveStateOnDestroy =
true;
156 bool mStateLoaded =
false;
157 int mWindowToggle = 0;
Used for choosing an editor delegate.
This file includes classes for implementing timers - in order to get a regular callback on the main t...
State structure for dock window persistence - matches SWS pattern.
Reaper extension base class interface.
void RegisterAction(const char *actionName, std::function< void()> func, bool addMenuItem=false, int *pToggle=nullptr, const char *contextMenuId=nullptr, const char *menuLabel=nullptr)
Registers an action with the REAPER extension system.
void ShowHideMainWindow()
Toggles the visibility of the main extension window.
bool IsDocked() const
Returns true if the window is currently docked.
virtual void OnActionRun(int commandId, int flag)
Called after any action in the main section runs (via "hookpostcommand").
virtual void SaveProjectState(ProjectStateContext *ctx)
Called (via "projectconfig") when the project is being saved, so the extension can persist state into...
virtual bool LoadProjectStateLine(const char *line)
Called (via "projectconfig") for each project line not consumed by Reaper.
void ToggleDocking()
Toggles between docked and floating state.
void SetMenuName(const char *name)
Sets the title of the submenu that this extension's actions are added to, inside REAPER's Extensions ...
int * GetWindowTogglePtr()
Toggle state for an action that shows/hides the main window.
int * GetDockTogglePtr()
Toggle state for an action that docks/undocks the main window.
virtual void OnBeginLoadProjectState(bool isUndo)
Called (via "projectconfig") before project state is loaded (also on "new project").
void SetDockId(const char *id)
Sets the unique identifier used for dock state persistence.
virtual void OnIdle()
Called during idle processing - override to perform periodic tasks.