Skip to content

Commit 8329323

Browse files
committed
Development
1 parent 4dd50cb commit 8329323

File tree

4 files changed

+264
-127
lines changed

4 files changed

+264
-127
lines changed

mostrami/resources/ecs/blocks.txt

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
div Editor
88
div Row
99
div Cell
10+
div Title
1011
table Table
1112
tr TR
1213
td TD
1314
select PropertySelect
1415
input PropertyValue
1516
button EditButton
1617
img Add
18+
img AddBlock
1719
img Delete
1820
a Link
1921
variable Blocks
@@ -23,6 +25,7 @@
2325
variable BlockProperties
2426
variable PropertyNames
2527
variable PropertyName
28+
variable SelectedBlock
2629
variable Name
2730
variable Action
2831
variable N
@@ -54,15 +57,39 @@ Start:
5457
json add `blockBackground` to BlockProperties
5558
json add `blockBorder` to BlockProperties
5659
json add `blockBorderRadius` to BlockProperties
57-
60+
61+
Restart:
5862
put property `blocks` of Presentation into Blocks
5963
put the json keys of Blocks into BlockNames
60-
create Table in Panel
61-
set the style of Table to `width:100%;border:1px solid black`
62-
put the json count of BlockNames into N
64+
65+
clear Panel
66+
create Row in Panel
67+
set the style of Row to `display:flex;margin-top:0.5em`
68+
create Title in Row
69+
set the style of Title to
70+
`flex:1;font-size:110%;font-weight:bold;background:lightgray;text-align:center`
71+
set the content of Title to `Blocks`
72+
create Cell in Row
73+
set the style of Cell to `width:1.4em;text-align:center`
74+
create Link in Cell
75+
create AddBlock in Link
76+
set the style of AddBlock to `width:1em;margin-top:0.1em`
77+
set attribute `src` of AddBlock to `resources/icon/plus.png`
78+
on click AddBlock
79+
begin
80+
put prompt `Name of new block:` with `new block` into BlockName
81+
set Block to object
82+
set property BlockName of Blocks to Block
83+
set property `blocks` of Presentation to Blocks
84+
go to Restart
85+
end
86+
87+
put the json count of BlockNames into N
6388
set the elements of EditButton to N
6489
set the elements of Editor to N
6590
set the elements of Add to N
91+
create Table in Panel
92+
if N is greater than 0 set the style of Table to `width:100%;border:1px solid black`
6693
put 0 into B
6794
while B is less than the elements of EditButton
6895
begin
@@ -93,7 +120,7 @@ Start:
93120
end
94121
on click EditButton
95122
begin
96-
put the index of EditButton into B
123+
put the index of EditButton into SelectedBlock
97124
put the text of EditButton into Action
98125
put 0 into N
99126
while N is less than the json count of BlockNames
@@ -107,9 +134,10 @@ Start:
107134
set style `display` of Editor to `none`
108135
add 1 to N
109136
end
110-
index EditButton to B
137+
index EditButton to SelectedBlock
111138
if Action is `Edit`
112139
begin
140+
RestartEditor:
113141
set style `background` of EditButton to `lightgray`
114142
set the text of EditButton to `Close`
115143
index Add to B
@@ -157,6 +185,11 @@ Start:
157185
end
158186
on click Add
159187
begin
160-
alert `Add ` cat the index of Add
188+
index BlockNames to SelectedBlock
189+
put property BlockNames of Blocks into Block
190+
set property ` ` of Block to ` `
191+
set property BlockNames of Blocks to Block
192+
set property `blocks` of Presentation to Blocks
193+
go to RestartEditor
161194
end
162-
stop
195+
stop

mostrami/resources/ecs/defaults.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Start:
4242

4343
create GlobalTitle in Panel
4444
set the style of GlobalTitle to `font-weight:bold;font-size:110%;background:lightgray;`
45-
cat `padding:0.2em;text-align:center;margin-top:1em`
45+
cat `padding:0.2em;text-align:center;margin-top:0.5em`
4646

4747
create GlobalPanel in Panel
4848
set the style of GlobalPanel to

mostrami/resources/ecs/mostrami.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ L2:
240240
clear FileIsOpen
241241
set the content of NameEditor to empty
242242
put empty into CurrentScriptName
243-
put empty into Presentation
244-
put empty into Current
243+
gosub to CreateNewPresentation
244+
put Presentation into Current
245245
gosub to UpdateCurrentSection
246246
end
247247

@@ -303,6 +303,7 @@ L2:
303303
end
304304
end
305305

306+
gosub to CreateNewPresentation
306307
gosub to SetupSteps
307308
gosub to SetupBlocks
308309
gosub to SetupContent
@@ -311,6 +312,18 @@ L2:
311312
put Presentation into Current
312313
stop
313314

315+
CreateNewPresentation:
316+
set Presentation to object
317+
set Item to object
318+
set property `global` of Presentation to Item
319+
set property `container` of Presentation to Item
320+
set property `defaults` of Presentation to Item
321+
set property `blocks` of Presentation to Item
322+
set property `content` of Presentation to Item
323+
set Item to array
324+
set property `steps` of Presentation to Item
325+
return
326+
314327
SetupSteps:
315328
if StepsModule is not running
316329
begin

0 commit comments

Comments
 (0)