-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayout.lua
More file actions
368 lines (327 loc) · 9.71 KB
/
layout.lua
File metadata and controls
368 lines (327 loc) · 9.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
local CurrentPage = PageNames[props["page_index"].Value]
-- ============================================================
-- CONTROL PAGE
-- ============================================================
-- Layout constants - 5px grid, panel width = 500px (boxes x=5, w=490):
--
-- Power Control box: y=5, h=80 → bottom=85
-- gap=10
-- Status box: y=95, h=125 → bottom=220
-- gap=10
-- Audio box: y=230, h=110
--
local W = 490 -- box interior width
local statusY = 95
local statusBoxH = 125
local audioY = 230
local panelH = audioY + 110 + 10
if CurrentPage == "Control" then
-- ---- Power Control box: y=5, h=80 ----
table.insert(graphics, {
Type = "GroupBox",
Text = "Power Control",
Fill = { 195, 195, 195 },
StrokeWidth = 2,
StrokeColor = { 0, 210, 255 },
CornerRadius = 8,
Position = { 5, 5 },
Size = { W, 80 }
})
-- Buttons: 130px wide each, 20px gap, centered in W=490
-- total = 2*130+20 = 280; left edge = (490-280)/2 + 5 = 110
layout["PowerOn"] = {
PrettyName = "Power~WOL",
Style = "Button",
Legend = "Power On (WOL)",
Position = { 110, 35 },
Size = { 130, 30 },
Color = { 0, 200, 220 }
}
layout["Shutdown"] = {
PrettyName = "Power~Shutdown",
Style = "Button",
Legend = "Shutdown",
Position = { 260, 35 },
Size = { 130, 30 },
Color = { 255, 140, 0 }
}
-- ---- Connection Status box: y=95 ----
table.insert(graphics, {
Type = "GroupBox",
Text = "Connection Status",
Fill = { 200, 200, 200 },
StrokeWidth = 2,
StrokeColor = { 0, 210, 255 },
CornerRadius = 8,
Position = { 5, statusY },
Size = { W, statusBoxH }
})
-- Label column: right-aligned, x=10, w=75, ends at x=85
-- LED: x=90, w=20, ends at x=110
-- Text box: x=115, w=355 (fills to box right edge 5+490-10=485 → 485-115=370, snap to 355 leaving 15px margin)
local labelX = 10
local labelW = 75
local ledX = 90
local textX = 115
local textW = 355
table.insert(graphics, {
Type = "Text",
Text = "Status:",
Position = { labelX, statusY + 30 },
Size = { labelW, 20 },
FontSize = 11,
HTextAlign = "Right",
Color = { 60, 60, 60 }
})
layout["OnlineStatus"] = {
PrettyName = "Status~Online",
Style = "Indicator",
Color = { 0, 200, 0 },
Position = { ledX, statusY + 32 },
Size = { 16, 16 }
}
layout["StatusText"] = {
PrettyName = "Status~Text",
Style = "Text",
Color = { 180, 0, 0 },
Position = { textX, statusY + 30 },
Size = { textW, 20 },
FontSize = 11
}
table.insert(graphics, {
Type = "Text",
Text = "PC Name:",
Position = { labelX, statusY + 55 },
Size = { labelW, 20 },
FontSize = 11,
HTextAlign = "Right",
Color = { 60, 60, 60 }
})
layout["DiscoveredName"] = {
PrettyName = "Status~PC Hostname",
Style = "Text",
Position = { textX, statusY + 55 },
Size = { textW, 20 },
FontSize = 11
}
table.insert(graphics, {
Type = "Text",
Text = "Last Poll:",
Position = { labelX, statusY + 80 },
Size = { labelW, 20 },
FontSize = 11,
HTextAlign = "Right",
Color = { 60, 60, 60 }
})
layout["LastPoll"] = {
PrettyName = "Status~Last Poll",
Style = "Text",
Position = { textX, statusY + 80 },
Size = { textW, 20 },
FontSize = 11
}
-- ---- Audio box: y=audioY, h=110 ----
table.insert(graphics, {
Type = "GroupBox",
Text = "Audio",
Fill = { 195, 195, 195 },
StrokeWidth = 2,
StrokeColor = { 0, 210, 255 },
CornerRadius = 8,
Position = { 5, audioY },
Size = { W, 110 }
})
-- Volume row: label | fader | digit box | Mute button
-- Fader: from x=75, 240px wide
-- Digit box: x=320, 55px wide (type exact volume)
-- Mute: 100px wide at x=385
table.insert(graphics, {
Type = "Text",
Text = "Volume:",
Position = { 10, audioY + 30 },
Size = { 60, 20 },
FontSize = 12,
HTextAlign = "Right",
Color = { 60, 60, 60 }
})
layout["Volume"] = {
PrettyName = "Audio~Vol",
Style = "Fader",
Position = { 75, audioY + 30 },
Size = { 240, 20 }
}
layout["VolumeEntry"] = {
PrettyName = "Audio~Vol Entry",
Style = "TextBox",
Position = { 320, audioY + 28 },
Size = { 55, 24 },
FontSize = 12
}
layout["Mute"] = {
PrettyName = "Audio~Mute",
Style = "Button",
Legend = "Mute",
Position = { 385, audioY + 25 },
Size = { 100, 30 },
Color = { 213, 0, 0 }
}
-- Min/Max row: label | field | spacer | label | field | warning LED
-- Min label+field on left, Max label+field centered-ish, warning LED on far right
table.insert(graphics, {
Type = "Text",
Text = "Vol Min:",
Position = { 10, audioY + 70 },
Size = { 60, 20 },
FontSize = 11,
HTextAlign = "Right",
Color = { 60, 60, 60 }
})
layout["VolumeMin"] = {
PrettyName = "Audio~Volume Min",
Style = "TextBox",
Position = { 75, audioY + 70 },
Size = { 70, 20 },
FontSize = 11
}
table.insert(graphics, {
Type = "Text",
Text = "Vol Max:",
Position = { 165, audioY + 70 },
Size = { 60, 20 },
FontSize = 11,
HTextAlign = "Right",
Color = { 60, 60, 60 }
})
layout["VolumeMax"] = {
PrettyName = "Audio~Volume Max",
Style = "TextBox",
Position = { 230, audioY + 70 },
Size = { 70, 20 },
FontSize = 11
}
-- Warning LED + label: shown when PC volume is outside min/max
table.insert(graphics, {
Type = "Text",
Text = "Out of range:",
Position = { 315, audioY + 70 },
Size = { 80, 20 },
FontSize = 10,
HTextAlign = "Right",
Color = { 60, 60, 60 }
})
layout["VolumeWarning"] = {
PrettyName = "Audio~Out of Range",
Style = "Indicator",
Position = { 400, audioY + 72 },
Size = { 16, 16 },
Color = { 255, 140, 0 }
}
-- ============================================================
-- SETUP PAGE
-- ============================================================
elseif CurrentPage == "Setup" then
table.insert(graphics, {
Type = "GroupBox",
Text = "Connection Configuration",
Fill = { 200, 200, 200 },
StrokeWidth = 2,
StrokeColor = { 0, 210, 255 },
CornerRadius = 8,
Position = { 5, 5 },
Size = { 490, 210 }
})
local function cfg_label(text, y)
table.insert(graphics, {
Type = "Text",
Text = text,
Position = { 12, y },
Size = { 110, 16 },
FontSize = 11,
HTextAlign = "Right",
Color = { 60, 60, 60 }
})
end
-- Auto-populated / read-only fields - grey styling, no border.
local function cfg_auto(name, y)
return {
PrettyName = "Setup~" .. name,
Style = "Text",
Position = { 127, y },
Size = { 250, 16 },
FontSize = 11,
HTextAlign = "Left",
Color = { 160, 160, 160 },
StrokeWidth = 0,
Fill = { 40, 40, 40 }
}
end
-- Editable fields - black fill, white text, cyan border.
local function cfg_edit(name, y)
return {
PrettyName = "Setup~" .. name,
Style = "Text",
Position = { 127, y },
Size = { 250, 16 },
FontSize = 11,
HTextAlign = "Left",
Color = { 255, 255, 255 },
StrokeColor = { 0, 210, 255 },
StrokeWidth = 1,
Fill = { 0, 0, 0 }
}
end
cfg_label("Computer Name:", 35)
layout["CfgComputerName"] = cfg_auto("Computer Name", 35)
cfg_label("Hostname / IP:", 55)
layout["CfgHostname"] = cfg_auto("Hostname", 55)
cfg_label("MAC Address:", 75)
layout["MacDisplay"] = cfg_auto("MAC Display", 75)
cfg_label("HTTP Port:", 95)
layout["CfgHttpPort"] = cfg_edit("HTTP Port", 95)
cfg_label("Poll Interval:", 115)
layout["CfgPollInterval"] = cfg_edit("Poll Interval", 115)
cfg_label("Auth Token:", 135)
layout["CfgAuthToken"] = cfg_auto("Auth Token", 135)
-- Update button
layout["CfgUpdate"] = {
PrettyName = "Setup~Update",
Style = "Button",
ButtonStyle = "Normal",
Legend = "Update",
Position = { 380, 155 },
Size = { 107, 25 },
FontSize = 12,
Color = { 255, 255, 255 },
UnvisibleColor = { 0, 0, 0 },
StrokeColor = { 0, 210, 255 },
StrokeWidth = 2,
CornerRadius = 4
}
table.insert(graphics, {
Type = "Text",
Text = "Grey fields are auto-populated. Cyan-bordered fields can be changed at runtime.",
Position = { 12, 160 },
Size = { 365, 14 },
FontSize = 9,
HTextAlign = "Left",
Color = { 105, 104, 104 }
})
table.insert(graphics, {
Type = "Text",
Text = "Token is stored in C:\\QSYS Remote PC Control\\config.txt on the Windows PC.",
Position = { 12, 175 },
Size = { 475, 14 },
FontSize = 9,
HTextAlign = "Left",
Color = { 105, 104, 104 }
})
table.insert(graphics, {
Type = "Text",
Text = "Copy the auto-discovered MAC address above into the MAC Address property in Designer to persist.",
Position = { 12, 188 },
Size = { 475, 14 },
FontSize = 9,
HTextAlign = "Left",
Color = { 220, 160, 0 }
})
end