Publish the Media Explorer import into REAPER's Media Explorer action section as well as Main — custom_action + hookcommand2, second forever-stable id, one handler.
This commit is contained in:
+14
-2
@@ -216,8 +216,8 @@ static project_config_extension_t g_projectConfig{
|
||||
nullptr, // userData
|
||||
};
|
||||
|
||||
// REAPER calls this for EVERY action fired anywhere; claim only our own id, return
|
||||
// false otherwise so REAPER keeps looking. This TU's own family dispatches through
|
||||
// REAPER calls this for every action fired in the MAIN section; claim only our own id,
|
||||
// return false otherwise so REAPER keeps looking. This TU's own family dispatches through
|
||||
// the registration table; the other families claim their own ids after it.
|
||||
static bool OnHookCommand(int command, int /*flag*/)
|
||||
{
|
||||
@@ -229,6 +229,16 @@ static bool OnHookCommand(int command, int /*flag*/)
|
||||
return false;
|
||||
}
|
||||
|
||||
// "hookcommand" covers the main section only, so actions we published into another
|
||||
// section arrive here instead. Claim ONLY those — every main-section id stays with
|
||||
// OnHookCommand, so no command can be claimed by both hooks.
|
||||
static bool OnHookCommand2(KbdSectionInfo* /*sec*/, int command, int /*val*/, int /*val2*/,
|
||||
int /*relmode*/, HWND /*hwnd*/)
|
||||
{
|
||||
if (command == 0) return false;
|
||||
return reasampler::ingestHandleSectionCommand(command);
|
||||
}
|
||||
|
||||
// REAPER polls this to render each of OUR actions' checked state in menus/toolbars.
|
||||
// Return 1 (on) / 0 (off) for ids we own, -1 for everything else (per the contract).
|
||||
static int OnToggleAction(int command)
|
||||
@@ -255,6 +265,7 @@ extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(
|
||||
g_rec->Register("-projectconfig", (void*)&g_projectConfig);
|
||||
g_rec->Register("-toggleaction", (void*)&OnToggleAction);
|
||||
g_rec->Register("-hookcommand", (void*)&OnHookCommand);
|
||||
g_rec->Register("-hookcommand2", (void*)&OnHookCommand2);
|
||||
reasampler::designViewUnregisterActions(g_rec);
|
||||
reasampler::bankUnregisterActions(g_rec);
|
||||
reasampler::ingestUnregisterActions(g_rec);
|
||||
@@ -307,6 +318,7 @@ extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(
|
||||
reasampler::ingestRegisterActions(rec, &g_session);
|
||||
|
||||
rec->Register("hookcommand", (void*)&OnHookCommand);
|
||||
rec->Register("hookcommand2", (void*)&OnHookCommand2);
|
||||
|
||||
// Drives project-load / Save-As detection: the timer polls the active project
|
||||
// each tick; on a project load it reloads the bank from ext state, on a Save-As
|
||||
|
||||
Reference in New Issue
Block a user