feat(view): D2 view shell — apply mode toggle plan to live project

Reads I_FOLDERDEPTH into a FolderTree (pure view_tree helper, unit-tested),
snapshots to-be-parked tracks before parking, runs the D1 planner, and applies
park/restore flag + per-FX-offline writes under an undo block. Master and
mute/solo untouched; acts only on tagged tracks.
This commit is contained in:
2026-07-22 20:55:50 -04:00
parent 2d040d6896
commit c068279aac
6 changed files with 448 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#pragma once
// view_tree — the ONE genuinely pure piece of the D2 view shell: turning REAPER's
// linear I_FOLDERDEPTH stream into the parent<->child FolderTree the pure model
// consumes. The REAPER reads (GetTrack / GetTrackGUID / I_FOLDERDEPTH) stay in
// view.cpp; this tree arithmetic is REAPER-free so the fiddly folder-depth walk is
// unit-tested outside the DAW (mirrors capture_paths splitting the path math out).
//
// PURE MODULE (CLAUDE.md §load-bearing split): NO REAPER types, NO SWELL, NO
// vendor/ includes. Standard library + view_mode_model.h (for FolderTree) only.
#include <string>
#include <vector>
#include "view_mode_model.h"
namespace reasampler {
// One track's contribution to the folder walk, read from REAPER in arrange order.
// folderDepth is I_FOLDERDEPTH verbatim: 0 = normal, 1 = folder parent (opens a
// folder after this track), <0 = closes |folderDepth| folder levels after this
// track (-1 last in innermost, -2 last in innermost + next-innermost, ...).
struct TrackFolderEntry {
std::string guid;
int folderDepth = 0;
};
// Walks the ordered entries, tracking the open-folder stack, and assigns each
// node its immediate parentGuid (empty = top level) and isParent (opens a folder).
// Pure and total: tolerates malformed depth streams (a close deeper than the stack
// is clamped to empty) so a corrupt/stale project can never fault the shell.
FolderTree buildFolderTree(const std::vector<TrackFolderEntry>& entries);
} // namespace reasampler