Skip to content

Commit 1e184ab

Browse files
committed
Retain 'init' as permanent first step
1 parent 801e187 commit 1e184ab

File tree

5 files changed

+84
-44
lines changed

5 files changed

+84
-44
lines changed

iwsy/resources/ecs/blocks.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,23 @@ Restart:
7878
set property PropertyName of Defaults to property PropertyName of PropertyDefaults
7979
add 1 to N
8080
end
81+
set Block to object
8182
set property `defaults` of Block to Defaults
8283
json add Block to Blocks
8384
set property `blocks` of Presentation to Blocks
8485
go to Restart
8586
end
8687

8788
put the json count of Blocks into NBlocks
88-
set the elements of ShowBlock to NBlocks
89-
set the elements of EditButton to NBlocks
90-
set the elements of SaveButton to NBlocks
91-
set the elements of Editor to NBlocks
92-
set the elements of Up to NBlocks
93-
set the elements of DeleteBlock to NBlocks
89+
if NBlocks is greater than 0
90+
begin
91+
set the elements of ShowBlock to NBlocks
92+
set the elements of EditButton to NBlocks
93+
set the elements of SaveButton to NBlocks
94+
set the elements of Editor to NBlocks
95+
set the elements of Up to NBlocks
96+
set the elements of DeleteBlock to NBlocks
97+
end
9498
create Table in Panel
9599
set the style of Table to `width:100%`
96100
put 0 into N

iwsy/resources/ecs/content.txt

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,20 @@ Restart:
7979
end
8080

8181
put the json count of Items into NumItems
82-
set the elements of EditButton to NumItems
83-
set the elements of Editor to NumItems
84-
set the elements of SaveButton to NumItems
85-
set the elements of Up to NumItems
86-
set the elements of DeleteItem to NumItems
87-
set the elements of ItemNameInput to NumItems
88-
set the elements of TextArea to NumItems
82+
if NumItems is greater than 0
83+
begin
84+
set the elements of EditButton to NumItems
85+
set the elements of Editor to NumItems
86+
set the elements of SaveButton to NumItems
87+
set the elements of Up to NumItems
88+
set the elements of DeleteItem to NumItems
89+
set the elements of ItemNameInput to NumItems
90+
set the elements of TextArea to NumItems
91+
end
8992
create Table in Panel
9093
set the style of Table to `width:100%`
9194
put 0 into N
92-
while N is less than the elements of EditButton
95+
while N is less than NumItems
9396
begin
9497
index EditButton to N
9598
index Up to N
@@ -211,6 +214,7 @@ SaveSelectedItem:
211214
index TextArea to SelectedItem
212215
put the content of TextArea into Content
213216
replace newline with `%0a` in Content
217+
replace `"` with `"` in Content
214218
set property `content` of Item to Content
215219
set element SelectedItem of Items to Item
216220
set property `content` of Presentation to Items

iwsy/resources/ecs/iwsy.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ L2:
183183
iwsy init
184184

185185
create FileManPanel in Left
186-
set the style of FileManPanel to `flex:1;display:none`
186+
set the style of FileManPanel to `flex:1;display:none;margin-top:0.5em;border-top:1px solid black`
187187

188188
! The right-hand panel
189189
create Right in Body
@@ -273,6 +273,7 @@ L2:
273273
end
274274
end
275275
clear FileIsOpen
276+
clear Player
276277
set the content of NameEditor to empty
277278
put empty into CurrentScriptName
278279
gosub to CreateNewPresentation
@@ -442,10 +443,20 @@ DeletePresentation:
442443

443444
CreateNewPresentation:
444445
set Presentation to object
446+
set Content to object
447+
set property `title` of Content to `Init`
448+
set property `action` of Content to `init`
449+
set property `label` of Content to ``
450+
set property `aspect ratio` of Content to `16:9`
451+
set property `background` of Content to ``
452+
set property `border` of Content to `1px solid black`
445453
set Item to array
454+
json add Content to Item
446455
set property `steps` of Presentation to Item
456+
set Item to array
447457
set property `blocks` of Presentation to Item
448458
set property `content` of Presentation to Item
459+
iwsy load Player Presentation
449460
return
450461

451462
SetupSteps:

iwsy/resources/ecs/steps.txt

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
div Editor
1515
div Title
1616
div Empty
17+
hr HR
1718
button StepButton
1819
button Header
1920
button InsertBefore
@@ -169,7 +170,7 @@ Restart:
169170
put element N of Steps into CurrentStep
170171
set the text of StepButton to property `title` of CurrentStep
171172
create Cell in Row1
172-
if N is 0
173+
if N is less than 2
173174
begin
174175
create Empty in Cell
175176
set the style of Empty to `width:1em;margin:0.2em 0 0 0.2em`
@@ -183,14 +184,26 @@ Restart:
183184
set attribute `src` of Up to `/resources/icon/up.png`
184185
end
185186
create Cell in Row1
186-
set the style of Cell to `width:1.4em;text-align:center`
187-
index DeleteStep to N
188-
create Link in Cell
189-
create DeleteStep in Link
190-
set the style of DeleteStep to `width:1em;margin-top:0.1em`
191-
set attribute `src` of DeleteStep to `resources/icon/stop.png`
187+
if N is 0
188+
begin
189+
create Empty in Cell
190+
set the style of Empty to `width:1.4em;margin-top:0.1em`
191+
end
192+
else
193+
begin
194+
set the style of Cell to `width:1.4em;text-align:center`
195+
index DeleteStep to N
196+
create Link in Cell
197+
create DeleteStep in Link
198+
set the style of DeleteStep to `width:1em;margin-top:0.1em`
199+
set attribute `src` of DeleteStep to `resources/icon/stop.png`
200+
end
192201
index Editor to N
193202
create Editor in Row
203+
if N is 0
204+
begin
205+
create HR in StepsPanel
206+
end
194207
add 1 to N
195208
end
196209
on click StepButton
@@ -270,7 +283,6 @@ Restart:
270283

271284
! Set up the fixed lists
272285
set ActionNames to array
273-
json add `init` to ActionNames
274286
json add `set content` to ActionNames
275287
json add `show` to ActionNames
276288
json add `hide` to ActionNames
@@ -291,6 +303,7 @@ Restart:
291303
json add `false` to ContinueTypes
292304

293305
put property `steps` of Presentation into Steps
306+
put -1 into SelectedStep
294307
clear Running
295308

296309
stop
@@ -365,7 +378,19 @@ EditStep:
365378

366379
ReloadStepEditor:
367380
set the style of Table to `width:100%`
368-
create TR in Table
381+
put property `action` of CurrentStep into Action
382+
if SelectedStep is not 0
383+
begin
384+
create TR in Table
385+
create TD in TR
386+
set the content of TD to `Action:`
387+
create TD in TR
388+
create ActionSelect in TD
389+
set the style of ActionSelect to `width:100%`
390+
set ActionSelect from ActionNames as Action
391+
end
392+
393+
create TR in Table
369394
create TD in TR
370395
set the style of TD to `width:6em`
371396
set the content of TD to `Title:`
@@ -374,24 +399,20 @@ ReloadStepEditor:
374399
create TitleInput in TD
375400
set the style of TitleInput to `width:100%`
376401
set the content of TitleInput to property `title` of CurrentStep
377-
create TR in Table
378-
create TD in TR
379-
set the style of TD to `width:6em`
380-
set the content of TD to `Label:`
381-
create TD in TR
382-
index LabelInput to SelectedStep
383-
create LabelInput in TD
384-
set the style of LabelInput to `width:100%`
385-
set the content of LabelInput to property `label` of CurrentStep
386-
create TR in Table
387-
create TD in TR
388-
set the content of TD to `Action:`
389-
create TD in TR
390-
create ActionSelect in TD
391-
set the style of ActionSelect to `width:100%`
392-
put property `action` of CurrentStep into Action
393-
set ActionSelect from ActionNames as Action
394-
if Action is `init` gosub to EditInit
402+
if SelectedStep is not 0
403+
begin
404+
create TR in Table
405+
create TD in TR
406+
set the style of TD to `width:6em`
407+
set the content of TD to `Label:`
408+
create TD in TR
409+
index LabelInput to SelectedStep
410+
create LabelInput in TD
411+
set the style of LabelInput to `width:100%`
412+
set the content of LabelInput to property `label` of CurrentStep
413+
end
414+
415+
if Action is `init` gosub to EditInit
395416
else if Action is `set content` gosub to EditSetContent
396417
else if Action is `show` gosub to EditShow
397418
else if Action is `hide` gosub to EditHide

iwsy/resources/json/propertyDefaults.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"parent": "",
44
"left": 0,
55
"top": 0,
6-
"width": "100%",
7-
"height": "100%",
6+
"width": "1000",
7+
"height": "1000",
88
"background": "",
99
"border": "",
1010
"borderRadius": "",

0 commit comments

Comments
 (0)