Skip to content

Commit b2322dd

Browse files
committed
Development
1 parent 9556248 commit b2322dd

File tree

6 files changed

+149
-389
lines changed

6 files changed

+149
-389
lines changed

mostrami/resources/ecs/mostrami.txt

Lines changed: 61 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
div Tabs
1212
div Tab
1313
div ScriptName
14-
div DefaultsPanel
14+
div StepsPanel
1515
div BlocksPanel
1616
div ContentPanel
17-
div StepsPanel
17+
div DefaultsPanel
1818
span Status
1919
span Span
2020
input NameEditor
@@ -26,10 +26,10 @@
2626
img Delete
2727
img Cycle
2828
a Link
29-
module DefaultsModule
29+
module StepsModule
3030
module BlocksModule
3131
module ContentModule
32-
module StepsModule
32+
module DefaultsModule
3333
variable Mobile
3434
variable Current
3535
variable Content
@@ -46,7 +46,7 @@
4646
variable Message
4747
variable Section
4848
variable Item
49-
variable Array
49+
variable CurrentScriptName
5050
variable N
5151

5252
! The browser
@@ -162,9 +162,9 @@ L2:
162162
index SectionButton to 0
163163
create SectionButton in Tab
164164
set the style of SectionButton to `width:100%`
165-
set the content of SectionButton to `Defaults`
166-
create DefaultsPanel in ContentDiv
167-
set the style of DefaultsPanel to `position:absolute;left:0;top:0;width:100%;height:100%;`
165+
set the content of SectionButton to `Steps`
166+
create StepsPanel in ContentDiv
167+
set the style of StepsPanel to `position:absolute;left:0;top:0;width:100%;height:100%;`
168168
create Tab in Tabs
169169
set the style of Tab to `display:inline-block;width:` cat N cat `px`
170170
index SectionButton to 1
@@ -186,24 +186,13 @@ L2:
186186
index SectionButton to 3
187187
create SectionButton in Tab
188188
set the style of SectionButton to `width:100%`
189-
set the content of SectionButton to `Steps`
190-
create StepsPanel in ContentDiv
191-
set the style of StepsPanel to `position:absolute;left:0;top:0;width:100%;height:100%;`
189+
set the content of SectionButton to `Defaults`
190+
create DefaultsPanel in ContentDiv
191+
set the style of DefaultsPanel to `position:absolute;left:0;top:0;width:100%;height:100%;`
192192

193-
put -1 into Section
194-
on click SectionButton
195-
begin
196-
put the index of SectionButton into N
197-
if Section is not -1
198-
begin
199-
index SectionButton to Section
200-
set style `background` of SectionButton to ``
201-
end
202-
put N into Section
203-
index SectionButton to Section
204-
set style `background` of SectionButton to `lightgray`
205-
gosub to UpdateCurrentSection
206-
end
193+
put 0 into Section
194+
index SectionButton to 0
195+
on click SectionButton gosub to SelectSection
207196

208197
! Create the file browser
209198
create Overlay in Body
@@ -232,8 +221,8 @@ L2:
232221

233222
on click New
234223
begin
235-
gosub to StopTestModule
236-
if Content is not Current
224+
! gosub to StopTestModule
225+
if Presentation is not Current
237226
begin
238227
if confirm `Content has changed. Do you want to save it?`
239228
begin
@@ -243,14 +232,16 @@ L2:
243232
set the content of Status to `No script name has been given`
244233
go to ResetStatus
245234
end
246-
if PasswordValid rest post Content to `_save/json~` cat Name
247-
else put Content into storage as CurrentName
235+
if PasswordValid rest post Presentation to `_save/json/` cat Name
236+
else put Presentation into storage as CurrentName
248237
end
249238
end
250239
clear FileIsOpen
251240
set the content of NameEditor to empty
252-
put empty into Content
253-
put Content into Current
241+
put empty into CurrentScriptName
242+
put empty into Presentation
243+
put empty into Current
244+
gosub to UpdateCurrentSection
254245
end
255246

256247
on click Open go to DoOpen
@@ -264,14 +255,17 @@ L2:
264255
set the content of Status to `No script name has been given`
265256
go to ResetStatus
266257
end
267-
if the position of `.ecs` in Name is -1 put Name cat `.ecs` into Name
258+
if the position of `.json` in Name is -1 put Name cat `.json` into Name
268259
replace ` ` with `_` in Name
269-
if Content is not Current
260+
set the content of NameEditor to Name
261+
if Name is not CurrentScriptName put empty into Current
262+
if Presentation is not Current
270263
begin
271-
if PasswordValid rest post Content to `_save/json~` cat Name
272-
else put Content into storage as Name
273-
put Content into Current
264+
if PasswordValid rest post Presentation to `_save/json/` cat Name
265+
else put Presentation into storage as Name
266+
put Presentation into Current
274267
set the content of Status to `Presentation '` cat Name cat `' saved`
268+
put Name into CurrentScriptName
275269
fork to ResetStatus
276270
end
277271
else
@@ -292,43 +286,29 @@ L2:
292286
end
293287
if confirm `Are you sure you want to delete "` cat Name cat `"?`
294288
begin
295-
if PasswordValid rest post Content to `_delete/json~` cat Name
289+
if PasswordValid rest post to `_delete/json/` cat Name
296290
else remove Name from storage
297291
set the content of Status to `Script "` cat Name cat `" deleted`
298292
set the content of NameEditor to empty
299-
put empty into Content
300-
put Content into Current
293+
put empty into CurrentScriptName
294+
put empty into Presentation
295+
put Presentation into Current
301296
go to ResetStatus
302297
end
303298
end
304299

305-
set Presentation to object
306-
set Item to object
307-
set property `global` of Presentation to Item
308-
set property `container` of Presentation to Item
309-
set property `defaults` of Presentation to Item
310-
set property `blocks` of Presentation to Item
311-
set property `content` of Presentation to Item
312-
set Item to object
313-
set property `comment` of Item to `Pause for a second`
314-
set property `action` of Item to `pause`
315-
set property `duration` of Item to 1
316-
set Array to array
317-
json add Item to Array
318-
set property `steps` of Presentation to Array
319-
put Presentation into Current
320-
gosub to SetupDefaults
300+
gosub to SetupSteps
321301
gosub to SetupBlocks
322302
gosub to SetupContent
323-
gosub to SetupSteps
324-
gosub to UpdateCurrentSection
303+
gosub to SetupDefaults
304+
gosub to SelectSection
325305
stop
326306

327-
SetupDefaults:
328-
if DefaultsModule is not running
307+
SetupSteps:
308+
if StepsModule is not running
329309
begin
330-
rest get Script from `/resources/ecs/defaults.txt`
331-
run Script with DefaultsPanel and Presentation as DefaultsModule
310+
rest get Script from `/resources/ecs/steps.txt`
311+
run Script with StepsPanel and Presentation as StepsModule
332312
end
333313
return
334314

@@ -348,23 +328,31 @@ SetupContent:
348328
end
349329
return
350330

351-
SetupSteps:
352-
if StepsModule is not running
331+
SetupDefaults:
332+
if DefaultsModule is not running
353333
begin
354-
rest get Script from `/resources/ecs/steps.txt`
355-
run Script with StepsPanel and Presentation as StepsModule
334+
rest get Script from `/resources/ecs/defaults.txt`
335+
run Script with DefaultsPanel and Presentation as DefaultsModule
356336
end
357337
return
358338

339+
SelectSection:
340+
put the index of SectionButton into N
341+
index SectionButton to Section
342+
set style `background` of SectionButton to ``
343+
put N into Section
344+
index SectionButton to Section
345+
set style `background` of SectionButton to `lightgray`
346+
359347
UpdateCurrentSection:
360-
set style `display` of DefaultsPanel to `none`
348+
set style `display` of StepsPanel to `none`
361349
set style `display` of BlocksPanel to `none`
362350
set style `display` of ContentPanel to `none`
363-
set style `display` of StepsPanel to `none`
351+
set style `display` of DefaultsPanel to `none`
364352
if Section is 0
365353
begin
366-
set style `display` of DefaultsPanel to `block`
367-
send to DefaultsModule
354+
set style `display` of StepsPanel to `block`
355+
send to StepsModule
368356
end
369357
else if Section is 1
370358
begin
@@ -378,8 +366,8 @@ UpdateCurrentSection:
378366
end
379367
else if Section is 3
380368
begin
381-
set style `display` of StepsPanel to `block`
382-
send to StepsModule
369+
set style `display` of DefaultsPanel to `block`
370+
send to DefaultsModule
383371
end
384372
return
385373

@@ -392,7 +380,7 @@ DoOpen:
392380
begin
393381
if confirm `Content has changed. Do you want to save it?`
394382
begin
395-
if PasswordValid rest post Content to `_save/json~` cat Name
383+
if PasswordValid rest post Content to `_save/json/` cat Name
396384
else put Content into storage as Name
397385
end
398386
end
@@ -484,6 +472,7 @@ DoOpen:
484472
SelectFile:
485473
index File to the index of FileName
486474
set the content of NameEditor to File
475+
put File into CurrentScriptName
487476
if PasswordValid rest get Presentation from `/resources/json/` cat File
488477
else get Presentation from storage as File
489478
put Presentation into Current

mostrami/resources/ecs/scripted.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
put the content of ContentEditor into Content
131131
if Content is not Current
132132
begin
133-
rest post Content to `_save/resources/ecs/` cat Name
133+
rest post Content to `_save/ecs/` cat Name
134134
put Content into Current
135135
set the content of Status to `Script '` cat Name cat `' saved`
136136
fork to ResetStatus
@@ -156,7 +156,7 @@
156156
if confirm `Are you sure you want to delete '` cat Name cat `'?`
157157
begin
158158
codemirror close ContentEditor
159-
rest post to `_delete/resources/ecs/` cat Name
159+
rest post to `_delete/ecs/` cat Name
160160
set the content of Status to `Script '` cat Name cat `' deleted`
161161
set the content of NameEditor to empty
162162
put empty into Content
@@ -168,15 +168,21 @@
168168
stop
169169

170170
DoOpen:
171-
if FileIsOpen codemirror close ContentEditor
172171
put the content of ContentEditor into Content
173172
if Content is not Current
174173
begin
175174
if confirm `Content has changed. Do you want to save it?`
176175
begin
177-
rest post Content to `_save/resources/ecs/' cat CurrentName
176+
rest post Content to `_save/ecs/' cat CurrentName
178177
end
178+
else stop
179+
! begin
180+
! codemirror attach to ContentEditor
181+
! codemirror set content of ContentEditor to Content
182+
! stop
183+
! end
179184
end
185+
if FileIsOpen codemirror close ContentEditor
180186

181187
! Animate the background
182188
set style `display` of Overlay to `block`
@@ -268,4 +274,4 @@ CloseBrowser:
268274
ResetStatus:
269275
wait 2
270276
set the content of Status to ``
271-
stop
277+
stop

0 commit comments

Comments
 (0)