Q-W6: registration table (OCP) in main.cpp; bank verbs -> shell/bank_ops(Session&); persist.h + wav_trim + namespaces.h shims deleted; 61/61

capture.h realtime seam split to capture_realtime_shell.h; GetProjExtState grow-loop rehomed to core/wire/ext_state_read; stale persist.cpp/bank_panel.cpp comment refs fixed; CLAUDE.md persist/bank_book/actions bullets updated. Command-id suffixes, display phrases, and undo labels byte-identical.
This commit is contained in:
2026-07-29 13:40:09 -04:00
parent 4831e0e172
commit f3be4d8cce
81 changed files with 970 additions and 1085 deletions
+20 -18
View File
@@ -1,11 +1,12 @@
// bank_actions.cpp — the multi-bank bindable action family (Phase B3; Q-W4 split of
// actions.cpp). See bank_actions.h.
//
// Q-W4 dedupe: each mutating handler is a THIN UX SKIN — text prompts (promptBankName),
// name resolution, and console feedback — over the promptless bankOp* inner verbs
// homed in panel_bank_ops (model op + persistBankOp, one bank op = one Ctrl-Z). The
// book's rules (pool privileges, collapse-by-hash, active-fallback-to-pool) all live
// in bank_book; these handlers only drive the verbs and react to the boolean.
// Q-W4 dedupe / Q-W6 seam: each mutating handler is a THIN UX SKIN — text prompts
// (promptBankName), name resolution, and console feedback — over the promptless
// bankOp* inner verbs homed in shell/bank_ops (model op + persistBankOp, one bank op
// = one Ctrl-Z), driven against this family's registered session. The book's rules
// (pool privileges, collapse-by-hash, active-fallback-to-pool) all live in
// bank_book; these handlers only drive the verbs and react to the boolean.
//
// REFERENCE-INVALIDATION GUARDRAIL (B2 review): book().activeIndex() / bank()->index
// return a reference INTO the book's internal vector, which a create/delete can
@@ -27,9 +28,10 @@
#include "shell/actions/prune_action.h" // doBankPruneFolder — the guarded prune body
#include "core/model/bank_book.h" // BankBook, nextBankId, kPoolBankId (B1)
#include "persist.h" // ReaSamplerSession (owns book())
#include "shell/panel/panel_bank_ops.h" // bankOp* inner verbs + promptBankName + selection seam
#include "shell/bank_ops/bank_ops.h" // bankOp* promptless verbs (Q-W6 non-UI seam)
#include "shell/panel/panel_bank_ops.h" // promptBankName + the panel selection seam
#include "shell/panel/panel_layout.h" // full-height toggles (B3)
#include "shell/persist/session.h" // ReaSamplerSession (owns book())
#define REAPERAPI_MINIMAL
#define REAPERAPI_WANT_ShowConsoleMsg
@@ -61,9 +63,9 @@ constexpr const char* kIdBankBanksFull = "BANK_BANKS_FULLHEIGHT";
// and R3 extends the confirm-and-delete step behind this SAME id — never a throwaway id.
constexpr const char* kIdBankPruneFolder = "BANK_PRUNE_FOLDER";
// The live session the actions read (name resolution, member counts, prune). The
// mutations themselves run through the bankOp* verbs, which resolve the same session
// via the panel seam. Set once by bankRegisterActions; not owned here.
// The live session the actions read (name resolution, member counts, prune) and
// pass to the bankOp* verbs by reference (bankHandleCommand guards it non-null
// before any handler runs). Set once by bankRegisterActions; not owned here.
ReaSamplerSession* g_session = nullptr;
int g_cmdBankCreate = 0;
@@ -116,7 +118,7 @@ std::string bankIdByDisplayName(const std::string& name) {
void doBankCreate() {
std::string name;
if (!promptBankName("ReaSampler: create bank", "Bank name:", "", name)) return;
if (bankOpCreate(name).empty()) {
if (bankOpCreate(*g_session, name).empty()) {
ShowConsoleMsg(
("ReaSampler: could not create bank \"" + name +
"\" (a bank with that name already exists).\n")
@@ -139,7 +141,7 @@ void doBankRename() {
}
std::string newName;
if (!promptBankName("ReaSampler: rename bank", "New name:", which, newName)) return;
if (!bankOpRename(id, newName)) {
if (!bankOpRename(*g_session, id, newName)) {
// The verb rejects the pool (un-renamable) or a name already used by another
// bank (unique display names, trimmed + case-insensitive).
ShowConsoleMsg("ReaSampler: cannot rename that bank (the pool is un-renamable, "
@@ -184,7 +186,7 @@ void doBankDelete() {
}
// S9: bump only when the deleted bank held samples — dropping them changes what a live
// instance referencing one could play. Deleting an EMPTY bank is purely organizational.
if (!bankOpDelete(id, /*bumpGeneration=*/members > 0)) {
if (!bankOpDelete(*g_session, id, /*bumpGeneration=*/members > 0)) {
ShowConsoleMsg("ReaSampler: cannot delete that bank (the pool is un-deletable).\n");
}
}
@@ -202,7 +204,7 @@ void doBankEvacuate() {
ShowConsoleMsg(("ReaSampler: no bank named \"" + which + "\".\n").c_str());
return;
}
if (!bankOpEvacuate(id)) {
if (!bankOpEvacuate(*g_session, id)) {
ShowConsoleMsg("ReaSampler: cannot evacuate that bank (the pool is the "
"destination, not a source).\n");
}
@@ -218,13 +220,13 @@ void doBankActivateNext() {
for (const Bank& b : g_session->book().banks()) ids.push_back(b.id);
const std::string target = nextBankId(ids, g_session->book().activeBankId());
if (target.empty()) return; // degenerate (no banks) — cannot happen (pool seeded)
bankOpActivate(target);
bankOpActivate(*g_session, target);
}
// Activate the pool directly (the common "back to the default target" jump). Bindable
// direct-by-id form; a general activate-bank-by-name/menu is a panel affordance.
void doBankActivatePool() {
bankOpActivate(kPoolBankId);
bankOpActivate(*g_session, kPoolBankId);
}
// Move or copy the panel's selected samples into a named destination bank (prompted
@@ -257,7 +259,7 @@ void doBankTransferSelected(bool copy) {
ShowConsoleMsg("ReaSampler: source and destination are the same bank.\n");
return;
}
bankOpTransfer(selected, srcId, destId, copy);
bankOpTransfer(*g_session, selected, srcId, destId, copy);
}
// Remove the panel's selected samples from the SOURCE bank (the focused region's
@@ -275,7 +277,7 @@ void doBankRemoveSelected() {
ShowConsoleMsg("ReaSampler: the selection's bank no longer exists.\n");
return;
}
bankOpRemove(selected, srcId);
bankOpRemove(*g_session, selected, srcId);
}
} // namespace