Stage 3: operations layer (src/edit) and one undo entry point

- src/edit/ (in anm2ed_core): frame, track, animation, region, grid and
  change-all edits as plain functions of the model. Each returns the uids of what
  it created for the UI to select; copies get fresh uids.
- Document::edit_apply snapshots, runs an operation and commits; edit_begin
  starts drag edits. window_edit, edit_command_push, snapshot_command_push,
  SnapshotKind and the tracks/frames/regions/textures snapshot kinds are gone;
  Snapshots has a single push(message, isTextures).
- Timeline, animations, regions, shaders, items, wizards, taskbar and file merge
  call the edit layer; they keep only selection, scrolling and toasts.
- Snapshots, Storage, Playback and ImGui core build into anm2ed_core, so undo is
  testable: tests/undo.cpp runs a seeded random walk of edits per fixture and
  checks every undo/redo state by hash, plus selection follow through undo.
- types::edit renamed types::edit_state (clashed with the edit namespace).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-10-03 15:26:53 -04:00
1 parent 20bfbace7a
commit 700b613c62
63 files changed
+3223 -1775

No files matched your search

+18 -18
View File
@@ -83,16 +83,16 @@ namespace anm2ed::imgui
};
window.reload = [](Window& window, Manager&, Settings&, Document& document, Clipboard&)
{
window_edit(document, window.changeType, localize.get(EDIT_RELOAD_SOUNDS),
[&]()
{
for (auto id : document.sound.selection)
if (auto sound = window_element_get(window, document, id))
{
document.sound_reload(id);
toast_log(Level::INFO, TOAST_RELOAD_SOUND, id, path::to_utf8(sound->path));
}
});
document.edit_apply(EDIT_RELOAD_SOUNDS, window.changeType,
[&](Anm2&)
{
for (auto id : document.sound.selection)
if (auto sound = window_element_get(window, document, id))
{
document.sound_reload(id);
toast_log(Level::INFO, TOAST_RELOAD_SOUND, id, path::to_utf8(sound->path));
}
});
};
window.body_update = [](Window& window, Manager& manager, Settings&, Resources&, Clipboard&, Document& document)
{
@@ -115,14 +115,14 @@ namespace anm2ed::imgui
{
auto sound = window_element_get(window, document, id);
if (!sound) return;
window_edit(document, window.changeType, localize.get(EDIT_REPLACE_SOUND),
[&]()
{
sound->path = window_asset_path_get(document, dialogPath);
document.sound_reload(id);
toast_log(Level::INFO, TOAST_REPLACE_SOUND, id,
path::to_utf8(sound->path));
});
document.edit_apply(EDIT_REPLACE_SOUND, window.changeType,
[&](Anm2&)
{
sound->path = window_asset_path_get(document, dialogPath);
document.sound_reload(id);
toast_log(Level::INFO, TOAST_REPLACE_SOUND, id,
path::to_utf8(sound->path));
});
}});
window.dialog->reset();
}