Q-W4: split actions.cpp into design_view_actions/bank_actions/prune_action + shared action_registry; bank verbs deduped into promptless bankOp* inner verbs in panel_bank_ops (one mutation home, two UX skins); command-id strings byte-identical; actions.h shim carrier retired

This commit is contained in:
2026-07-29 12:56:02 -04:00
parent 5232227323
commit 430e117620
24 changed files with 1353 additions and 1241 deletions
+49
View File
@@ -0,0 +1,49 @@
// action_registry.cpp — shared registration plumbing (Q-W4 split of actions.cpp).
// See action_registry.h. Needs no REAPER API pointers: rec->Register is a member
// call on the dispatch struct REAPER hands the entry point.
#include "shell/actions/action_registry.h"
#include <deque>
#include <string>
#include "core/version/app_version.h" // channelCommandId / channelActionName
namespace reasampler {
namespace {
using version::channelActionName;
using version::channelCommandId;
// Durable store of composed, channel-qualified strings (ids + labels). A std::deque
// never invalidates references on push_back, so a c_str() handed to REAPER (a
// command_id at register, a gaccel desc for its lifetime) stays valid until process
// exit. Memoized by suffix so register and the mirror-unregister get the SAME id
// pointer for a given action.
std::deque<std::string> g_strStore;
} // namespace
const char* channelIdFor(const char* suffix) {
const std::string composed = channelCommandId(suffix);
for (const std::string& s : g_strStore)
if (s == composed) return s.c_str();
g_strStore.push_back(composed);
return g_strStore.back().c_str();
}
int registerAction(reaper_plugin_info_t* rec, const char* suffix,
gaccel_register_t& accel, const char* phrase) {
const char* id = channelIdFor(suffix);
const int cmd = rec->Register("command_id", (void*)id);
if (cmd) {
g_strStore.push_back(channelActionName(phrase));
accel.accel.cmd = cmd;
accel.desc = g_strStore.back().c_str();
rec->Register("gaccel", (void*)&accel);
}
return cmd;
}
} // namespace reasampler