Skip to content

Commit 3037866

Browse files
authored
Merge pull request #74 from easycoder/dev
Further development
2 parents c3ec054 + 4dd50cb commit 3037866

File tree

4 files changed

+360
-54
lines changed

4 files changed

+360
-54
lines changed

mostrami/resources/ecs/blocks.txt

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,159 @@
44

55
import div Panel and variable Presentation
66

7+
div Editor
8+
div Row
9+
div Cell
10+
table Table
11+
tr TR
12+
td TD
13+
select PropertySelect
14+
input PropertyValue
15+
button EditButton
16+
img Add
17+
img Delete
18+
a Link
19+
variable Blocks
20+
variable Block
21+
variable BlockNames
22+
variable BlockName
23+
variable BlockProperties
24+
variable PropertyNames
25+
variable PropertyName
26+
variable Name
27+
variable Action
28+
variable N
29+
variable B
30+
731
on message go to Start
832
set ready
933
stop
1034

1135
Start:
36+
if the message is `save`
37+
begin
38+
stop
39+
end
40+
41+
set BlockProperties to array
42+
json add `fontFamily` to BlockProperties
43+
json add `fontSize` to BlockProperties
44+
json add `fontWeight` to BlockProperties
45+
json add `fontStyle` to BlockProperties
46+
json add `fontColor` to BlockProperties
47+
json add `textAlign` to BlockProperties
48+
json add `textMarginLeft` to BlockProperties
49+
json add `textMarginTop` to BlockProperties
50+
json add `blockLeft` to BlockProperties
51+
json add `blockTop` to BlockProperties
52+
json add `blockWidth` to BlockProperties
53+
json add `blockHeight` to BlockProperties
54+
json add `blockBackground` to BlockProperties
55+
json add `blockBorder` to BlockProperties
56+
json add `blockBorderRadius` to BlockProperties
57+
58+
put property `blocks` of Presentation into Blocks
59+
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
63+
set the elements of EditButton to N
64+
set the elements of Editor to N
65+
set the elements of Add to N
66+
put 0 into B
67+
while B is less than the elements of EditButton
68+
begin
69+
put element B of BlockNames into Name
70+
create TR in Table
71+
create TD in TR
72+
set the style of TD to `width:8em;border:1px solid black`
73+
set the content of TD to Name
74+
create TD in TR
75+
set the style of TD to `border:1px solid black`
76+
index EditButton to B
77+
index Add to B
78+
index Editor to B
79+
create Row in TD
80+
set the style of Row to `display:flex`
81+
create EditButton in Row
82+
set the style of EditButton to `flex:1`
83+
set the text of EditButton to `Edit`
84+
create Cell in Row
85+
set the style of Cell to `width:1.4em;text-align:center`
86+
create Link in Cell
87+
create Add in Link
88+
set the style of Add to `width:1em;margin-top:0.1em;display:none`
89+
set attribute `src` of Add to `/resources/icon/plus.png`
90+
create Editor in TD
91+
set the style of Editor to `display:none`
92+
add 1 to B
93+
end
94+
on click EditButton
95+
begin
96+
put the index of EditButton into B
97+
put the text of EditButton into Action
98+
put 0 into N
99+
while N is less than the json count of BlockNames
100+
begin
101+
index EditButton to N
102+
set style `background` of EditButton to ``
103+
set the text of EditButton to `Edit`
104+
index Add to N
105+
set style `display` of Add to `none`
106+
index Editor to N
107+
set style `display` of Editor to `none`
108+
add 1 to N
109+
end
110+
index EditButton to B
111+
if Action is `Edit`
112+
begin
113+
set style `background` of EditButton to `lightgray`
114+
set the text of EditButton to `Close`
115+
index Add to B
116+
set style `display` of Add to `inline-block`
117+
index Editor to B
118+
set style `display` of Editor to `block`
119+
clear Editor
120+
put element B of BlockNames into BlockName
121+
put property BlockName of Blocks into Block
122+
put the json keys of Block into PropertyNames
123+
put the json count of PropertyNames into N
124+
set the elements of PropertySelect to N
125+
set the elements of PropertyValue to N
126+
set the elements of Delete to N
127+
put 0 into N
128+
while N is less than the json count of PropertyNames
129+
begin
130+
create Row in Editor
131+
set the style of Row to `display:flex`
132+
put element N of PropertyNames into PropertyName
133+
index PropertySelect to N
134+
create PropertySelect in Row
135+
set the style of PropertySelect to `flex:1`
136+
set PropertySelect from BlockProperties as PropertyName
137+
index PropertyValue to N
138+
create PropertyValue in Row
139+
set the style of PropertyValue to `flex:1`
140+
set the content of PropertyValue to property PropertyName of Block
141+
create Cell in Row
142+
set the style of Cell to `width:1.4em;text-align:center`
143+
create Link in Cell
144+
create Delete in Link
145+
set the style of Delete to `width:1em;margin-top:0.1em`
146+
set attribute `src` of Delete to `resources/icon/stop.png`
147+
add 1 to N
148+
end
149+
on click Delete
150+
begin
151+
alert `Delete ` cat the index of Delete
152+
end
153+
end
154+
else
155+
begin
156+
end
157+
end
158+
on click Add
159+
begin
160+
alert `Add ` cat the index of Add
161+
end
12162
stop

mostrami/resources/ecs/defaults.txt

Lines changed: 123 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,148 @@
1010
div ContainerPanel
1111
div DefaultsTitle
1212
div DefaultsPanel
13+
div Row
14+
div Label
15+
input GlobalInput
16+
input ContainerInput
17+
input DefaultsInput
18+
variable Globals
19+
variable Container
20+
variable Defaults
21+
variable GlobalItems
22+
variable ContainerItems
23+
variable DefaultsItems
24+
variable Name
25+
variable Value
26+
variable N
27+
28+
on message go to Start
29+
set ready
30+
stop
31+
32+
Start:
33+
if the message is `save`
34+
begin
35+
stop
36+
end
37+
38+
clear Panel
39+
40+
set style `display` of Panel to `flex`
41+
set style `flex-direction` of Panel to `column`
1342

1443
create GlobalTitle in Panel
15-
set the style of GlobalTitle to
16-
`font-weight:bold;font-size:110%;background:lightgray;padding:0.2em;text-align:center`
44+
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`
1746

1847
create GlobalPanel in Panel
19-
set the style of GlobalPanel to `height:auto;max-height:30%;flex:1;overflow-y:scroll;margin-top:0.5em`
48+
set the style of GlobalPanel to
49+
`height:auto;max-height:25%;overflow-y:scroll;margin-top:0.5em`
2050

2151
create ContainerTitle in Panel
22-
set the style of ContainerTitle to
23-
`font-weight:bold;font-size:110%;background:lightgray;padding:0.2em;text-align:center`
52+
set the style of ContainerTitle to `font-weight:bold;font-size:110%;background:lightgray;`
53+
cat `padding:0.2em;text-align:center;margin-top:1em`
2454

2555
create ContainerPanel in Panel
26-
set the style of ContainerPanel to `height:auto;max-height:30%;flex:1;overflow-y:scroll;margin-top:0.5em`
56+
set the style of ContainerPanel to
57+
`height:auto;max-height:20%;overflow-y:scroll;margin-top:0.5em`
2758

2859
create DefaultsTitle in Panel
29-
set the style of DefaultsTitle to
30-
`font-weight:bold;font-size:110%;background:lightgray;padding:0.2em;text-align:center`
60+
set the style of DefaultsTitle to `font-weight:bold;font-size:110%;background:lightgray;`
61+
cat `padding:0.2em;text-align:center;margin-top:1em`
3162

3263
create DefaultsPanel in Panel
33-
set the style of DefaultsPanel to `flex:1;overflow-y:scroll;margin-top:0.5em`
64+
set the style of DefaultsPanel to
65+
`flex:1;max-height:60%;overflow-y:scroll;margin-top:0.5em`
3466

35-
on message go to Start
36-
set ready
37-
stop
67+
set GlobalItems to array
68+
json add `title` to GlobalItems
69+
json add `description` to GlobalItems
70+
json add `aspectW` to GlobalItems
71+
json add `aspectH` to GlobalItems
3872

39-
Start:
40-
set style `display` of Panel to `flex`
41-
set style `flex-direction` of Panel to `column`
73+
set ContainerItems to array
74+
json add `background` to ContainerItems
75+
json add `border` to ContainerItems
76+
77+
set DefaultsItems to array
78+
json add `fontFamily` to DefaultsItems
79+
json add `fontSize` to DefaultsItems
80+
json add `fontWeight` to DefaultsItems
81+
json add `fontStyle` to DefaultsItems
82+
json add `fontColor` to DefaultsItems
83+
json add `textAlign` to DefaultsItems
84+
json add `textMarginLeft` to DefaultsItems
85+
json add `textMarginTop` to DefaultsItems
86+
json add `blockLeft` to DefaultsItems
87+
json add `blockTop` to DefaultsItems
88+
json add `blockWidth` to DefaultsItems
89+
json add `blockBackground` to DefaultsItems
90+
json add `blockBorder` to DefaultsItems
91+
json add `blockBorderRadius` to DefaultsItems
92+
93+
put property `global` of Presentation into Globals
94+
put property `container` of Presentation into Container
95+
put property `defaults` of Presentation into Defaults
4296

4397
clear GlobalPanel
4498
clear ContainerPanel
4599
clear DefaultsPanel
46100
set the content of GlobalTitle to `Global defaults`
47101
set the content of ContainerTitle to `Container defaults`
48102
set the content of DefaultsTitle to `Block defaults`
103+
104+
put the json count of GlobalItems into N
105+
set the elements of GlobalInput to N
106+
put 0 into N
107+
while N is less than the elements of GlobalInput
108+
begin
109+
create Row in GlobalPanel
110+
set the style of Row to `display:flex;margin-top:0.2em`
111+
create Label in Row
112+
set the style of Label to `width:10em`
113+
put element N of GlobalItems into Name
114+
set the content of Label to Name
115+
create GlobalInput in Row
116+
set the style of GlobalInput to `flex:1;margin-right:0.5em`
117+
put property Name of Globals into Value
118+
set the text of GlobalInput to Value
119+
add 1 to N
120+
end
121+
122+
put the json count of ContainerItems into N
123+
set the elements of ContainerInput to N
124+
put 0 into N
125+
while N is less than the elements of ContainerInput
126+
begin
127+
create Row in ContainerPanel
128+
set the style of Row to `display:flex;margin-top:0.2em`
129+
create Label in Row
130+
set the style of Label to `width:10em`
131+
put element N of ContainerItems into Name
132+
set the content of Label to Name
133+
create ContainerInput in Row
134+
set the style of ContainerInput to `flex:1;margin-right:0.5em`
135+
put property Name of Container into Value
136+
set the text of ContainerInput to Value
137+
add 1 to N
138+
end
139+
140+
put the json count of DefaultsItems into N
141+
set the elements of DefaultsInput to N
142+
put 0 into N
143+
while N is less than the elements of DefaultsInput
144+
begin
145+
create Row in DefaultsPanel
146+
set the style of Row to `display:flex;margin-top:0.2em`
147+
create Label in Row
148+
set the style of Label to `width:10em`
149+
put element N of DefaultsItems into Name
150+
set the content of Label to Name
151+
create DefaultsInput in Row
152+
set the style of DefaultsInput to `flex:1;margin-right:0.5em`
153+
put property Name of Defaults into Value
154+
set the text of DefaultsInput to Value
155+
add 1 to N
156+
end
49157
stop

mostrami/resources/ecs/mostrami.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ L2:
308308
gosub to SetupContent
309309
gosub to SetupDefaults
310310
gosub to SelectSection
311+
put Presentation into Current
311312
stop
312313

313314
SetupSteps:

0 commit comments

Comments
 (0)