Skip to content

Commit 12caa46

Browse files
authored
Merge pull request #140 from easycoder/dev
Reorganise file structure
2 parents 90cb1e9 + 1e07d07 commit 12caa46

File tree

6 files changed

+64
-17
lines changed

6 files changed

+64
-17
lines changed
File renamed without changes.

iwsy/resources/ecs/help.txt

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import div Container
66

7+
div Player
78
callback DecoratorCallback
89
a Link
910
variable Mobile
@@ -12,6 +13,8 @@
1213
variable Payload
1314
variable ImageCount
1415
variable LinkCount
16+
variable HasEmbed
17+
variable Embed
1518
variable Function
1619
variable Data
1720
variable Source
@@ -32,14 +35,22 @@
3235
load showdown
3336
on DecoratorCallback go to Decorate
3437

35-
on message go to Show
38+
on message
39+
begin
40+
if the message is `stop`
41+
begin
42+
if HasEmbed iwsy stop
43+
end
44+
else go to Show
45+
end
3646
set ready
3747
stop
3848

3949
Show:
4050
set style `display` of Container to `block`
4151
get Page from storage as `.help`
4252
GetPage:
53+
clear HasEmbed
4354
if Page is empty
4455
begin
4556
put `iwsy` into Page
@@ -66,9 +77,22 @@ GetPage:
6677
end
6778
on click Link
6879
begin
80+
if HasEmbed iwsy stop
6981
put attribute `data-page` of Link into Page
7082
go to GetPage
7183
end
84+
if HasEmbed
85+
begin
86+
attach Player to `iwsy-embed`
87+
put attribute `data-url` of Player into Data
88+
rest get Embed from Data
89+
put the position of the last `/` in Data into N
90+
add 1 to N
91+
put left N of Data into Data
92+
iwsy load Player Embed
93+
iwsy path Data
94+
iwsy run
95+
end
7296
stop
7397

7498
!------------------------------------------------------------------------------
@@ -92,6 +116,7 @@ Decorate:
92116
put `<span style="font-family:monospace;color:darkred">` cat Data cat `</span>` into Payload
93117
else if Function is `img` gosub to ProcessImage
94118
else if Function is `page` gosub to ProcessPage
119+
else if Function is `embed` gosub to ProcessEmbed
95120
end
96121
end
97122
set the payload of DecoratorCallback to Payload
@@ -140,7 +165,7 @@ ProcessImage:
140165
add 1 to ImageCount
141166
return
142167

143-
! Process a request for a new page.
168+
! Process a request for a new page
144169
ProcessPage:
145170
put the position of `:` in Data into N
146171
if N is -1 return
@@ -152,6 +177,12 @@ ProcessPage:
152177
add 1 to LinkCount
153178
return
154179

180+
! Process a request for an embedded presentation
181+
ProcessEmbed:
182+
put `<div id="iwsy-embed" data-url="` cat Data cat `" style "width:100%"></div>` into Payload
183+
set HasEmbed
184+
return
185+
155186
Exit:
156187
set style `display` of Container to `none`
157188
stop

iwsy/resources/ecs/iwsy.txt

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
variable Presentation
5353
variable OriginalPresentation
5454
variable Name
55-
variable ShowRun
5655
variable ReadOnly
5756
variable CallStack
5857
variable Message
@@ -121,8 +120,8 @@ Start:
121120

122121
! The left-hand panel
123122
create Left in Body
124-
set the style of Left to
125-
`flex:1;height:100%;border-right:1px solid black;margin-right:0.5em;display:flex;flex-direction:column`
123+
set the style of Left to `flex:1;height:100%;border-right:1px solid black;margin-right:0.5em;`
124+
cat `display:flex;flex-direction:column;max-width:50%`
126125

127126
create Masthead in Left
128127
set the style of Masthead to
@@ -194,7 +193,7 @@ Start:
194193
set attribute `title` of FileMan to `File Manager`
195194
create Link in Buttons
196195
create RunStop in Link
197-
set the style of RunStop to `width:40px;margin-right:1.5em`
196+
set the style of RunStop to `width:40px;margin-right:0.5em`
198197
set attribute `src` of RunStop to `resources/icon/run.png`
199198
set attribute `title` of RunStop to `Run`
200199
create Link in Buttons
@@ -221,7 +220,7 @@ Start:
221220
set the style of FileManPanel to `flex:1;display:none;margin-top:0.5em;border-top:1px solid black`
222221

223222
create HelpPanel in Left
224-
set the style of HelpPanel to `flex:1;display:none;margin-top:0.5em;border-top:1px solid black`
223+
set the style of HelpPanel to `flex:1;display:none;margin-top:0.5em;border-top:1px solid black;overflow:scroll`
225224

226225
! The right-hand panel
227226
create Right in Body
@@ -313,6 +312,9 @@ Start:
313312
end
314313
clear FileIsOpen
315314
clear Player
315+
clear Running
316+
iwsy stop
317+
set attribute `src` of RunStop to `resources/icon/run.png`
316318
set the content of NameEditor to empty
317319
put empty into CurrentScriptName
318320
gosub to CreateNewPresentation
@@ -400,7 +402,7 @@ Start:
400402
end
401403
end
402404

403-
on click RunStop
405+
on click FileMan
404406
begin
405407
if Running stop
406408
if UserRecord is empty stop
@@ -411,6 +413,7 @@ Start:
411413
end
412414
set style `display` of Player to `none`
413415
set style `display` of HelpPanel to `none`
416+
if HelpModule is running send `stop` to HelpModule
414417
set style `display` of FileManPanel to `block`
415418
send to FileManModule
416419
end
@@ -473,6 +476,7 @@ Start:
473476
begin
474477
set style `display` of FileManPanel to `none`
475478
set style `display` of HelpPanel to `none`
479+
if HelpModule is running send `stop` to HelpModule
476480
set style `display` of Player to `block`
477481
put property `block` of Message into N
478482
iwsy block N
@@ -553,7 +557,8 @@ FullScreenManual:
553557

554558
ShowHelp:
555559
if Running stop
556-
if HelpModule is not running
560+
if HelpModule is running send `stop` to HelpModule
561+
else
557562
begin
558563
require js
559564
`https://cdn.jsdelivr.net/gh/easycoder/easycoder.github.io/dist/plugins/showdown.js?v=` cat now
@@ -768,9 +773,11 @@ SelectFile:
768773
gosub to SetStatusGreen
769774
set the text of Status to `Presentation '` cat File cat `' loaded`
770775
fork to ResetStatus
771-
set ShowRun
776+
clear Running
777+
set attribute `src` of RunStop to `resources/icon/run.png`
772778
set style `display` of FileManPanel to `none`
773779
set style `display` of HelpPanel to `none`
780+
if HelpModule is running send `stop` to HelpModule
774781
set style `display` of Player to `block`
775782
iwsy script Presentation
776783

@@ -806,11 +813,13 @@ DoRunStop:
806813
begin
807814
put property `steps` of Presentation into Item
808815
if the json count of Item is 1 stop
809-
set Running
816+
if HelpModule is running send `stop` to HelpModule
810817
set style `display` of Player to `block`
811818
set style `display` of FileManPanel to `none`
819+
set style `display` of HelpPanel to `none`
812820
gosub to ClearStepsButtons
813821
set attribute `src` of RunStop to `resources/icon/runstop.png`
822+
set Running
814823

815824
put 0 into N
816825
gosub to SelectSection
@@ -820,7 +829,6 @@ DoRunStop:
820829
put the iwsy step into N
821830
if N is -1
822831
begin
823-
! set the content of NameEditor to empty
824832
put the iwsy script into Presentation
825833
go to PrepareScript
826834
end
@@ -834,8 +842,8 @@ DoRunStop:
834842
end
835843

836844
put Presentation into OriginalPresentation
837-
! put NameEditor into OriginalName
838845
set style `display` of HelpPanel to `none`
846+
if HelpModule is running send `stop` to HelpModule
839847
set Message to object
840848
set property `action` of Message to `running`
841849
send Message to StepsModule
@@ -844,7 +852,6 @@ DoRunStop:
844852
gosub to ClearStepsButtons
845853
set attribute `src` of RunStop to `resources/icon/run.png`
846854
clear Running
847-
! set the text of NameEditor to OriginalName
848855
put OriginalPresentation into Presentation
849856
go to PrepareScript
850857
end
@@ -862,6 +869,12 @@ PrepareScript:
862869
RunFullScreen:
863870
put property `steps` of Presentation into Item
864871
if the json count of Item is 1 stop
872+
if HelpModule is running send `stop` to HelpModule
873+
set style `display` of Player to `block`
874+
set style `display` of FileManPanel to `none`
875+
set style `display` of HelpPanel to `none`
876+
iwsy init
877+
iwsy script Presentation
865878
if Running iwsy stop
866879
else iwsy run fullscreen
867880
toggle Running

iwsy/resources/ecs/steps.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,10 +776,12 @@ EditBlockList:
776776
gosub to SaveCurrentStep
777777
json add empty to Blocks
778778
set property `blocks` of CurrentStep to Blocks
779+
set element SelectedStep of Steps to CurrentStep
779780
clear Table
780781
go to ReloadStepEditor
781782
end
782783
put property `blocks` of CurrentStep into Blocks
784+
if Blocks is empty set Blocks to array
783785
put the json count of Blocks into N
784786
set the elements of BlockSelect to N
785787
set the elements of DeleteContent to N
@@ -814,6 +816,7 @@ EditBlockList:
814816
put the index of DeleteContent into N
815817
json delete element N of Blocks
816818
set property `blocks` of CurrentStep to Blocks
819+
set element SelectedStep of Steps to CurrentStep
817820
clear Table
818821
go to ReloadStepEditor
819822
end
@@ -912,7 +915,7 @@ CreateNewAction:
912915
put property `blocks` of CurrentStep into Blocks
913916
if Blocks is empty
914917
begin
915-
set Blocks to object
918+
set Blocks to array
916919
set property `blocks` of CurrentStep to Blocks
917920
end
918921
end
@@ -1026,7 +1029,7 @@ SaveCurrentStep:
10261029
put property `blocks` of CurrentStep into Blocks
10271030
if Blocks is empty
10281031
begin
1029-
set Blocks to object
1032+
set Blocks to array
10301033
set property `blocks` of CurrentStep to Blocks
10311034
end
10321035
end

iwsy/resources/json/quickstart/demo.json renamed to iwsy/resources/scripts/demo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
"top": 0,
171171
"width": 1000,
172172
"height": 1000,
173-
"background": "url('resources/img/SemoigoDawn.jpg')",
173+
"background": "url('resources/img/quickstart/SemoigoDawn.jpg')",
174174
"border": "",
175175
"borderRadius": "",
176176
"fontFamily": "",

0 commit comments

Comments
 (0)