feat(banks): bindable multi-bank action family — create/rename/delete/evacuate/activate/move/copy + full-height toggles (B3)

This commit is contained in:
2026-07-24 05:35:16 -04:00
parent 288c1e44e4
commit cbfc13c4e0
8 changed files with 546 additions and 1 deletions
+16
View File
@@ -668,6 +668,22 @@ std::optional<BankBook> BankBook::deserialize(const std::string& json) {
return book;
}
// ---------------------------------------------------------------------------
// Active-bank cycle ordering (pure, free function — mirror of nextModeId)
// ---------------------------------------------------------------------------
std::string nextBankId(const std::vector<std::string>& orderedBankIds,
const std::string& currentBankId) {
if (orderedBankIds.empty()) return {}; // nothing to cycle to
for (std::size_t i = 0; i < orderedBankIds.size(); ++i) {
if (orderedBankIds[i] == currentBankId)
return orderedBankIds[(i + 1) % orderedBankIds.size()]; // wrap past the last
}
// Active id not in the list (stale/unknown) — jump to the first id as a sane
// home rather than returning "" (matches nextModeId's fallback).
return orderedBankIds.front();
}
BankBook BankBook::loadFromPersisted(const std::string& banksJson,
const std::string& legacyJson) {
// Precedence 1: the authoritative `banks` blob. A present-but-malformed blob is