Route every extension bank-directory lookup through one bankRootOf seam
The pure bankRootFor(rppPath, unsavedRoot) and the shell bankRootOf(ReaProject*) replace eleven hand-rolled .rpp-parent derivations. No unsaved root is supplied yet, so behaviour and refusals are unchanged. Save-As relocation now reads the stored lastBankRoot_.
This commit is contained in:
@@ -13,12 +13,12 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "core/capture/capture_paths.h" // projectDirOfRpp
|
||||
#include "core/wire/bake_wire.h"
|
||||
#include "core/wire/ext_state_read.h" // readProjExtStateGrowing (the shared grow loop)
|
||||
#include "ext_keys.h"
|
||||
#include "shell/capture/bake_landing.h"
|
||||
#include "shell/panel/panel_input.h" // bankPanelRefresh
|
||||
#include "shell/persist/bank_root.h"
|
||||
#include "shell/persist/session.h"
|
||||
#include "shell/undo/undo_block.h" // the ONE undo-block opener
|
||||
|
||||
@@ -77,19 +77,17 @@ KeyRead readKey(ReaProject* proj, const std::string& key) {
|
||||
|
||||
struct OpenProject {
|
||||
ReaProject* proj = nullptr;
|
||||
std::string dir; // the project's own directory; empty for a never-saved project
|
||||
std::string dir; // the project's bank root; empty when it has no bank location
|
||||
};
|
||||
|
||||
// Every open project tab. The request key lives in the INSTANCE's project, which is not
|
||||
// necessarily the focused one, so the scan cannot assume the current tab holds it.
|
||||
std::vector<OpenProject> openProjects() {
|
||||
std::vector<OpenProject> out;
|
||||
std::vector<char> buf(4096, '\0');
|
||||
for (int idx = 0;; ++idx) {
|
||||
buf[0] = '\0';
|
||||
ReaProject* proj = EnumProjects(idx, buf.data(), static_cast<int>(buf.size()));
|
||||
ReaProject* proj = EnumProjects(idx, nullptr, 0);
|
||||
if (!proj) break;
|
||||
out.push_back(OpenProject{proj, projectDirOfRpp(std::string(buf.data()))});
|
||||
out.push_back(OpenProject{proj, bankRootOf(proj)});
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user