diff --git a/projects/nat-archive-tool/src/nat/Archive.kiss b/projects/nat-archive-tool/src/nat/Archive.kiss index 1e72a926..37ad571f 100644 --- a/projects/nat-archive-tool/src/nat/Archive.kiss +++ b/projects/nat-archive-tool/src/nat/Archive.kiss @@ -35,14 +35,26 @@ (File.saveContent (joinPath archiveDir "playgrounds.json") (haxe.Json.stringify playgrounds "\t"))) (method addSystem [:System system] - // Assign entries to the Systems that care about them - (doFor =>id entry entries - (system.checkEntryInOrOut this entry)) (systems.push system) system) +(method addAndProcessSystem [:System system &opt :ArchiveUI ui] + (addSystem system) + (refreshSystem system) + (system.process this ui) + system) + +(method refreshSystem [:System system] + (doFor =>id e entries + (system.checkEntryInOrOut this e))) + +(method forceProcessAll [&opt :ArchiveUI ui] + (doFor system systems (refreshSystem system)) + (processSystems)) + (method processSystems [&opt :ArchiveUI ui] - (doFor system systems (system.process this ui))) + (doFor system systems + (system.process this ui))) (prop &mut :Entry->Dynamic defaultInitializer null) diff --git a/projects/nat-archive-tool/src/nat/ArchiveController.kiss b/projects/nat-archive-tool/src/nat/ArchiveController.kiss index 7526556d..c50e33f8 100644 --- a/projects/nat-archive-tool/src/nat/ArchiveController.kiss +++ b/projects/nat-archive-tool/src/nat/ArchiveController.kiss @@ -153,7 +153,10 @@ (when lastChangeSet (doFor e lastChangeSet (assert (and e (isEntry e)) "Lib function forgot to return the Entry that was modified")) + (doFor e lastChangeSet + (archive.refreshEntry e)) (ui.handleChanges archive lastChangeSet) + (archive.processSystems) (when doAfter (doAfter)))))] // To facilitate asynchronous arg input via UI, we need to construct an insanely complicated nested callback to give the UI (doFor arg (reverse command.args) @@ -205,11 +208,11 @@ (set ui.controller this) // Add systems! - (archive.addSystem nameSystem) + (archive.addAndProcessSystem nameSystem ui) (archive.addSystem (new RemarkableAPISystem)) (archive.addSystem (new WikipediaImageSystem)) (archive.addSystem (new ImageAttachmentSystem)) - (archive.addSystem (new KeyShortcutSystem this)) + (archive.addAndProcessSystem (new KeyShortcutSystem this) ui) (archive.addSystem (new DLSystem)) (archive.addSystem (new AutoStepperSystem)) (archive.addSystem (new ColorSystem)) @@ -234,15 +237,9 @@ (whenLet [ps (ui.playgroundSystem)] (set playgroundSystem ps) - (archive.addSystem ps) (set ps.setupProcess true) - (ps.process archive ui) + (archive.addAndProcessSystem ps) (ps.switchPlaygroundKey (dictGet archive.playgrounds "default"))) - - // Just for testing: - // (archive.addSystem (new AttachmentSystem ["jpg" "jpeg" "png"] ->[archive e files] ~files)) - - (archive.processSystems ui) (defCommand Help [] (ui.displayMessage diff --git a/projects/nat-flixel-desktop-playground/source/PlayState.kiss b/projects/nat-flixel-desktop-playground/source/PlayState.kiss index 110a815a..9fe35fa1 100644 --- a/projects/nat-flixel-desktop-playground/source/PlayState.kiss +++ b/projects/nat-flixel-desktop-playground/source/PlayState.kiss @@ -184,12 +184,6 @@ (var SCROLL_BOUND_MARGIN 2000) (method handleChanges [:Archive archive :ChangeSet changeSet] - (when changeSet - // process the WikipediaImageSystem and run spriteSystem process on newly created entries that get one - (archive.processSystems this) - // Do a second loop through the systems, so Playground systems that trigger Core systems have their effects processed - (archive.processSystems this)) - (doFor e changeSet // Entries whose data changed to remove them from the sprite pool will already have been removed // by refreshEntry()