Component-oriented playgrounds - Close #124
This commit is contained in:
@@ -211,7 +211,6 @@
|
|||||||
(archive.addSystem ps)
|
(archive.addSystem ps)
|
||||||
(set ps.setupProcess true)
|
(set ps.setupProcess true)
|
||||||
(ps.process archive ui)
|
(ps.process archive ui)
|
||||||
(set ps.setupProcess false)
|
|
||||||
(ps.switchPlaygroundKey (dictGet archive.playgrounds "default")))
|
(ps.switchPlaygroundKey (dictGet archive.playgrounds "default")))
|
||||||
|
|
||||||
// Just for testing:
|
// Just for testing:
|
||||||
@@ -243,7 +242,11 @@
|
|||||||
|
|
||||||
(defCommand CreateEntry [name (Text null)]
|
(defCommand CreateEntry [name (Text null)]
|
||||||
[(archive.createEntry ->e
|
[(archive.createEntry ->e
|
||||||
(addComponent archive e Name name))])
|
{
|
||||||
|
(when (and playgroundSystem (playgroundSystem.currentDefaultTags))
|
||||||
|
(addTags archive e (playgroundSystem.currentDefaultTags)))
|
||||||
|
(addComponent archive e Name name)
|
||||||
|
})])
|
||||||
|
|
||||||
(defCommand CreateEntries [names (VarText null)]
|
(defCommand CreateEntries [names (VarText null)]
|
||||||
// createEntry returns a list, so these lists must be flattened
|
// createEntry returns a list, so these lists must be flattened
|
||||||
@@ -338,11 +341,14 @@
|
|||||||
(true (addComponent archive e Scale scale))))
|
(true (addComponent archive e Scale scale))))
|
||||||
entries)
|
entries)
|
||||||
|
|
||||||
(defCommand CreatePlayground [name (Text null) catsMatchExp (Text null)]
|
// TODO use VarTags
|
||||||
|
(defCommand CreatePlayground [name (Text null) catsMatchExp (Text null) defaultTags (VarText null)]
|
||||||
(archive.changePlaygrounds ->:Void [:DynamicAccess<Dynamic> p]
|
(archive.changePlaygrounds ->:Void [:DynamicAccess<Dynamic> p]
|
||||||
(dictSet p name (object catsMatch catsMatchExp)))
|
(dictSet p name (object catsMatch catsMatchExp)))
|
||||||
// TODO make the corresponding playground entry and return it
|
(let [[e] (CreateTaggedEntry ["playground"] name)]
|
||||||
[])
|
(addComponent archive e CatsMatchExp catsMatchExp)
|
||||||
|
(addComponent archive e TagList defaultTags)
|
||||||
|
[e]))
|
||||||
|
|
||||||
(defCommand SwitchPlayground [name (Text null)]
|
(defCommand SwitchPlayground [name (Text null)]
|
||||||
(archive.changePlaygrounds ->:Void [:DynamicAccess<Dynamic> p] (dictSet p "default" name))
|
(archive.changePlaygrounds ->:Void [:DynamicAccess<Dynamic> p] (dictSet p "default" name))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
(load "../Lib.kiss")
|
(load "../Lib.kiss")
|
||||||
|
|
||||||
(prop &mut :String _playgroundKey "")
|
(prop &mut :String _playgroundKey "")
|
||||||
(prop &mut :TagList currentDefaultTags [])
|
(method :TagList currentDefaultTags [] (or (dictGet playgroundDefaultTags _playgroundKey) []))
|
||||||
(method :String getPlaygroundKey [] _playgroundKey)
|
(method :String getPlaygroundKey [] _playgroundKey)
|
||||||
|
|
||||||
(prop :Map<String,TagList> playgroundDefaultTags (new Map))
|
(prop :Map<String,TagList> playgroundDefaultTags (new Map))
|
||||||
@@ -50,10 +50,11 @@
|
|||||||
(prop &mut :Bool setupProcess false)
|
(prop &mut :Bool setupProcess false)
|
||||||
|
|
||||||
(method &override :Void process [:Archive archive &opt :ArchiveUI ui]
|
(method &override :Void process [:Archive archive &opt :ArchiveUI ui]
|
||||||
(when _playgroundKey
|
(when setupProcess
|
||||||
(set setupProcess true)
|
|
||||||
(super.process archive ui)
|
(super.process archive ui)
|
||||||
(set setupProcess false)
|
(set setupProcess false)
|
||||||
|
(return))
|
||||||
|
(when _playgroundKey
|
||||||
(super.process archive ui)
|
(super.process archive ui)
|
||||||
(doFor e (entries.iterator)
|
(doFor e (entries.iterator)
|
||||||
(when (hasComponent e Positions)
|
(when (hasComponent e Positions)
|
||||||
|
|||||||
Reference in New Issue
Block a user