176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
...
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
maxX = math.max(state.x, maxX)
end
totalH = totalH + rowH
state.h = math.max(state.h, totalH) + state.padding
state.w = state.x + state.padding/2
state.x = maxX
elseif def.kind == 'pane' then
widget('scroll_container[%s,%s;%s,%s;%s;vertical]',
state.x, state.y, state.w, state.h,
def.id)
local y = 0
for _, w in ipairs(def) do
local src, st = starlit.ui.build(w, state)
widget('container[%s,%s]%scontainer_end[]', 0, y, src)
y=y + state.spacing + st.h
state.w = math.max(state.w, st.w)
end
widget('scroll_container_end[]')
if y > state.h then
widget('scrollbar[%s,%s;%s,%s;vertical;%s;]',
state.x, state.y, .5, state.h,
def.id)
end
state.w = state.w + state.padding
state.h = state.h + state.padding/2
elseif def.kind == 'list' then
local slotTypes = {
plain = {hue = 200, sat = -.1, lum = 0};
-- element = {hue = 20, sat = -.3, lum = 0};
chip = {hue = 0, sat = -1, lum = 0};
-- psi = {hue = 300, sat = 0, lum = 0};
power = {hue = 50, sat = 0, lum = .2};
................................................................................
if def.mode or def.container then
if def.mode then
l = string.format('background9[%s,%s;%s,%s;%s;false;64]',
originX, originY, state.w, state.h,
E(string.format('starlit-ui-bg-%s.png%s^[resize:128x128',
(def.mode == 'sw') and 'digital'
or 'panel', cmod))) .. l
end
if parent == nil or state.color ~= parent.color then
l = btnColorDef() .. l
end
end
if not parent then
return string.format('formspec_version[6]size[%s,%s]%s', state.w, state.h, l), state
|
>
>
>
>
>
<
>
>
>
>
>
>
>
>
>
>
<
>
|
|
>
|
>
>
|
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
...
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
maxX = math.max(state.x, maxX)
end
totalH = totalH + rowH
state.h = math.max(state.h, totalH) + state.padding
state.w = state.x + state.padding/2
state.x = maxX
elseif def.kind == 'pane' then
local top = state.y
widget('scroll_container[%s,%s;%s,%s;%s;vertical]',
state.x, state.y, state.w, state.h,
def.id)
local y = 0
local x,w = state.x,state.w
-- state.x = state.x + .75
-- state.w = state.w - .75
local widgs = {}
for _, w in ipairs(def) do
local src, st = starlit.ui.build(w, state)
table.insert(widgs, {
y=y, src=src
})
y=y + state.spacing + st.h
state.w = math.max(state.w, st.w)
end
local xo, barred = 0, false
if y-top > state.h then
barred, xo = true, .60
end
for k,v in ipairs(widgs) do
widget('container[%s,%s]%scontainer_end[]', xo, v.y, v.src)
end
widget('scroll_container_end[]')
if barred then
widget('scrollbaroptions[max=%s]scrollbar[%s,%s;%s,%s;vertical;%s;]',
(y-top-state.h)*10, x, state.y, .5, state.h,
def.id)
end
state.x = x
state.w = w + state.padding
state.h = state.h + state.padding/2
state.y = state.y + state.h
elseif def.kind == 'list' then
local slotTypes = {
plain = {hue = 200, sat = -.1, lum = 0};
-- element = {hue = 20, sat = -.3, lum = 0};
chip = {hue = 0, sat = -1, lum = 0};
-- psi = {hue = 300, sat = 0, lum = 0};
power = {hue = 50, sat = 0, lum = .2};
................................................................................
if def.mode or def.container then
if def.mode then
l = string.format('background9[%s,%s;%s,%s;%s;false;64]',
originX, originY, state.w, state.h,
E(string.format('starlit-ui-bg-%s.png%s^[resize:128x128',
(def.mode == 'sw') and 'digital'
or 'panel', cmod))) .. l
-- l = string.format('style_type[scrollbar;bgcolor=#1155ff]') .. l
end
if parent == nil or state.color ~= parent.color then
l = btnColorDef() .. l
end
end
if not parent then
return string.format('formspec_version[6]size[%s,%s]%s', state.w, state.h, l), state
|