Slim Document: move data-model code out, unify edit plumbing

- Region generate/scan move to anm2/regions.cpp; both generators number from 1
- file_merge moves to anm2/merge.cpp and is table-driven
- MaxRects packer moves to util/pack
- Uniform config apply/trim/save move to resource/shader
- Snapshots push from their owned state; Document snapshot wrappers removed
- DocumentData base replaces the hand-written move constructor
- toast_log replaces 55 duplicated toast + English log pairs
- Apply repo .clang-format to touched files

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 13:08:00 -04:00
1 parent a9f48bc3a0
commit 3f31cedeed
32 files changed
+3405 -4428

No files matched your search

+24 -23
View File
@@ -36,11 +36,10 @@ namespace anm2ed::imgui
{
auto targetFrames = makeManyRegionReferences;
auto format = settings.generateRegionNameFormat;
auto mapping = isMakeManyRegionsMapFrames ? Document::RegionFrameMapping::SET
: Document::RegionFrameMapping::PRESERVE;
auto mapping = isMakeManyRegionsMapFrames ? RegionFrameMapping::SET : RegionFrameMapping::PRESERVE;
edit_command_push(EDIT_GENERATE_REGIONS_FROM_ANIMATIONS, Document::ALL,
[=, this](Manager&, Document& document) mutable
{ document.regions_generate_from_frames(targetFrames, format, mapping); });
{ document.anm2.regions_generate({}, targetFrames, format, mapping); });
makeManyRegionsPopup.close();
}
@@ -178,16 +177,17 @@ namespace anm2ed::imgui
if (!selectedFrames.empty())
{
if (!isShortenChordHeld) frames_snapshot_command_push(EDIT_SHORTEN_FRAME, selectedFrames);
command_push([=, this](Manager&, Document& document)
{
for (auto frameReference : selectedFrames)
{
auto frame = command_frame_get(document, frameReference);
if (!frame) continue;
frame->duration = std::max(FRAME_DURATION_MIN, frame->duration - 1);
}
document.anm2_change(Document::FRAMES);
});
command_push(
[=, this](Manager&, Document& document)
{
for (auto frameReference : selectedFrames)
{
auto frame = command_frame_get(document, frameReference);
if (!frame) continue;
frame->duration = std::max(FRAME_DURATION_MIN, frame->duration - 1);
}
document.change(Document::FRAMES);
});
}
}
isShortenChordHeld = isShortenFrame;
@@ -203,16 +203,17 @@ namespace anm2ed::imgui
if (!selectedFrames.empty())
{
if (!isExtendChordHeld) frames_snapshot_command_push(EDIT_EXTEND_FRAME, selectedFrames);
command_push([=, this](Manager&, Document& document)
{
for (auto frameReference : selectedFrames)
{
auto frame = command_frame_get(document, frameReference);
if (!frame) continue;
frame->duration = std::min(FRAME_DURATION_MAX, frame->duration + 1);
}
document.anm2_change(Document::FRAMES);
});
command_push(
[=, this](Manager&, Document& document)
{
for (auto frameReference : selectedFrames)
{
auto frame = command_frame_get(document, frameReference);
if (!frame) continue;
frame->duration = std::min(FRAME_DURATION_MAX, frame->duration + 1);
}
document.change(Document::FRAMES);
});
}
}
isExtendChordHeld = isExtendFrame;