iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
ReaperExtBase Class Reference

Reaper extension base class interface. More...

#include <ReaperExtBase.h>

Inheritance diagram for ReaperExtBase:
[legend]

Public Member Functions

 ReaperExtBase (reaper_plugin_info_t *pRec)
 
void BeginInformHostOfParamChangeFromUI (int paramIdx) override
 
void EndInformHostOfParamChangeFromUI (int paramIdx) override
 
bool EditorResizeFromUI (int viewWidth, int viewHeight, bool needsPlatformResize) override
 
virtual void OnIdle ()
 Called during idle processing - override to perform periodic tasks. More...
 
virtual void OnActionRun (int commandId, int flag)
 Called after any action in the main section runs (via "hookpostcommand"). More...
 
virtual void SaveProjectState (ProjectStateContext *ctx)
 Called (via "projectconfig") when the project is being saved, so the extension can persist state into the .RPP. More...
 
virtual bool LoadProjectStateLine (const char *line)
 Called (via "projectconfig") for each project line not consumed by Reaper. More...
 
virtual void OnBeginLoadProjectState (bool isUndo)
 Called (via "projectconfig") before project state is loaded (also on "new project"). More...
 
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. More...
 
void ShowHideMainWindow ()
 Toggles the visibility of the main extension window. More...
 
void ToggleDocking ()
 Toggles between docked and floating state. More...
 
bool IsDocked () const
 Returns true if the window is currently docked. More...
 
int * GetWindowTogglePtr ()
 Toggle state for an action that shows/hides the main window. More...
 
int * GetDockTogglePtr ()
 Toggle state for an action that docks/undocks the main window. More...
 
void SetDockId (const char *id)
 Sets the unique identifier used for dock state persistence. More...
 
void SetMenuName (const char *name)
 Sets the title of the submenu that this extension's actions are added to, inside REAPER's Extensions menu. More...
 

Static Public Member Functions

static bool HookCommandProc (int command, int flag)
 
static int ToggleActionCallback (int command)
 
static void MenuHook (const char *menuidstr, void *menu, int flag)
 
static void PostCommandProc (int command, int flag)
 
static void BeginLoadProjectState (bool isUndo, project_config_extension_t *reg)
 
static bool ProcessExtensionLine (const char *line, ProjectStateContext *ctx, bool isUndo, project_config_extension_t *reg)
 
static void SaveExtensionConfig (ProjectStateContext *ctx, bool isUndo, project_config_extension_t *reg)
 

Detailed Description

Reaper extension base class interface.

Definition at line 40 of file ReaperExtBase.h.

Constructor & Destructor Documentation

◆ ReaperExtBase()

ReaperExtBase::ReaperExtBase ( reaper_plugin_info_t *  pRec)

Definition at line 5 of file ReaperExtBase.cpp.

◆ ~ReaperExtBase()

ReaperExtBase::~ReaperExtBase ( )
virtual

Definition at line 16 of file ReaperExtBase.cpp.

Member Function Documentation

◆ BeginInformHostOfParamChangeFromUI()

void ReaperExtBase::BeginInformHostOfParamChangeFromUI ( int  paramIdx)
inlineoverride

Definition at line 48 of file ReaperExtBase.h.

◆ BeginLoadProjectState()

void ReaperExtBase::BeginLoadProjectState ( bool  isUndo,
project_config_extension_t *  reg 
)
static

Definition at line 351 of file ReaperExtBase.cpp.

◆ EditorResizeFromUI()

bool ReaperExtBase::EditorResizeFromUI ( int  viewWidth,
int  viewHeight,
bool  needsPlatformResize 
)
override

Definition at line 50 of file ReaperExtBase.cpp.

◆ EndInformHostOfParamChangeFromUI()

void ReaperExtBase::EndInformHostOfParamChangeFromUI ( int  paramIdx)
inlineoverride

Definition at line 50 of file ReaperExtBase.h.

◆ GetDockTogglePtr()

int * ReaperExtBase::GetDockTogglePtr ( )
inline

Toggle state for an action that docks/undocks the main window.

Pass to RegisterAction() as pToggle so the action gets a tick in menus and the action list while docked. Reflects the persisted preference, so it is meaningful even when the window is closed

Definition at line 108 of file ReaperExtBase.h.

◆ GetWindowTogglePtr()

int * ReaperExtBase::GetWindowTogglePtr ( )
inline

Toggle state for an action that shows/hides the main window.

Pass to RegisterAction() as pToggle so the action gets a tick in menus and the action list while the window is open

Definition at line 103 of file ReaperExtBase.h.

◆ HookCommandProc()

bool ReaperExtBase::HookCommandProc ( int  command,
int  flag 
)
static

Definition at line 371 of file ReaperExtBase.cpp.

◆ IsDocked()

bool ReaperExtBase::IsDocked ( ) const
inline

Returns true if the window is currently docked.

Definition at line 99 of file ReaperExtBase.h.

Referenced by ShowHideMainWindow(), and ToggleDocking().

◆ LoadProjectStateLine()

virtual bool ReaperExtBase::LoadProjectStateLine ( const char *  line)
inlinevirtual

Called (via "projectconfig") for each project line not consumed by Reaper.

Parameters
lineThe line of project data
Returns
true if this line belonged to the extension and was handled

Definition at line 71 of file ReaperExtBase.h.

◆ MenuHook()

void ReaperExtBase::MenuHook ( const char *  menuidstr,
void *  menu,
int  flag 
)
static

Definition at line 277 of file ReaperExtBase.cpp.

◆ OnActionRun()

virtual void ReaperExtBase::OnActionRun ( int  commandId,
int  flag 
)
inlinevirtual

Called after any action in the main section runs (via "hookpostcommand").

Override to react to user edits without polling.

Parameters
commandIdThe command that ran
flagReaper-supplied flag

Definition at line 61 of file ReaperExtBase.h.

◆ OnBeginLoadProjectState()

virtual void ReaperExtBase::OnBeginLoadProjectState ( bool  isUndo)
inlinevirtual

Called (via "projectconfig") before project state is loaded (also on "new project").

Override to reset state to defaults.

Parameters
isUndotrue if this load is part of an undo/redo

Definition at line 76 of file ReaperExtBase.h.

◆ OnIdle()

virtual void ReaperExtBase::OnIdle ( )
inlinevirtual

Called during idle processing - override to perform periodic tasks.

Definition at line 55 of file ReaperExtBase.h.

◆ PostCommandProc()

void ReaperExtBase::PostCommandProc ( int  command,
int  flag 
)
static

Definition at line 344 of file ReaperExtBase.cpp.

◆ ProcessExtensionLine()

bool ReaperExtBase::ProcessExtensionLine ( const char *  line,
ProjectStateContext *  ctx,
bool  isUndo,
project_config_extension_t *  reg 
)
static

Definition at line 358 of file ReaperExtBase.cpp.

◆ RegisterAction()

void ReaperExtBase::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.

Parameters
actionNameThe name of the action to register, as shown in the action list. Must be a persistent pointer (e.g. a string literal)
funcThe function to call when the action is executed
addMenuItemIf true, adds a menu item for this action to the extension's submenu of REAPER's Extensions menu
pToggleOptional pointer to an int for toggle state
contextMenuIdOptional REAPER context-menu id to also add this action to, e.g. "Media item context", "Track control panel context". nullptr = none.
menuLabelOptional shorter label to use for menu items, since actionName is usually prefixed to disambiguate it in the action list. Must be a persistent pointer. nullptr = use actionName.

Definition at line 212 of file ReaperExtBase.cpp.

◆ SaveExtensionConfig()

void ReaperExtBase::SaveExtensionConfig ( ProjectStateContext *  ctx,
bool  isUndo,
project_config_extension_t *  reg 
)
static

Definition at line 364 of file ReaperExtBase.cpp.

◆ SaveProjectState()

virtual void ReaperExtBase::SaveProjectState ( ProjectStateContext *  ctx)
inlinevirtual

Called (via "projectconfig") when the project is being saved, so the extension can persist state into the .RPP.

Write lines with ctx->AddLine(...).

Parameters
ctxThe project state context to write to

Definition at line 66 of file ReaperExtBase.h.

◆ SetDockId()

void ReaperExtBase::SetDockId ( const char *  id)
inline

Sets the unique identifier used for dock state persistence.

Parameters
idUnique identifier string (defaults to PLUG_CLASS_NAME)

Definition at line 112 of file ReaperExtBase.h.

◆ SetMenuName()

void ReaperExtBase::SetMenuName ( const char *  name)
inline

Sets the title of the submenu that this extension's actions are added to, inside REAPER's Extensions menu.

Parameters
nameSubmenu title (defaults to PLUG_CLASS_NAME)

Definition at line 117 of file ReaperExtBase.h.

◆ ShowHideMainWindow()

void ReaperExtBase::ShowHideMainWindow ( )

Toggles the visibility of the main extension window.

Definition at line 118 of file ReaperExtBase.cpp.

References IsDocked().

◆ ToggleActionCallback()

int ReaperExtBase::ToggleActionCallback ( int  command)
static

Definition at line 384 of file ReaperExtBase.cpp.

◆ ToggleDocking()

void ReaperExtBase::ToggleDocking ( )

Toggles between docked and floating state.

Definition at line 132 of file ReaperExtBase.cpp.

References IsDocked().


The documentation for this class was generated from the following files: