Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Commit 5727dbf

Browse files
committed
Improved layout
Signed-off-by: RyanLua <[email protected]>
1 parent 5d9479e commit 5727dbf

File tree

1 file changed

+118
-119
lines changed

1 file changed

+118
-119
lines changed

src/Signs/PluginGui/init.lua

Lines changed: 118 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function PluginGui:newPluginGui(widgetGui)
7171
-- Text collapse
7272
local textCollapse = CollapsibleTitledSection.new(
7373
"TextCollapse", -- name suffix of the gui object
74-
"Text", -- the text displayed beside the collapsible arrow
74+
"Text Contents", -- the text displayed beside the collapsible arrow
7575
true, -- have the content frame auto-update its size?
7676
true, -- minimizable?
7777
false -- minimized by default?
@@ -90,31 +90,28 @@ function PluginGui:newPluginGui(widgetGui)
9090
CustomTextLabel:UpdateText(newValue)
9191
end)
9292

93-
-- Text transparency slider
94-
local transparencyTextSlider = LabeledSlider.new(
95-
"TransparencyTextSlider", -- name suffix of gui object
96-
"Transparency", -- title text of the multi choice
97-
11, -- how many intervals to split the slider into
98-
1, -- the starting value of the slider
99-
0.1 -- multiplier for the slider value
93+
-- Rich text checkbox
94+
local markupCheckbox = LabeledCheckbox.new(
95+
"MarkupCheckbox", -- name suffix of gui object
96+
"Rich Text", -- text beside the checkbox
97+
false, -- initial value
98+
false, -- initially disabled?
99+
"articles/gui-rich-text" -- link to wiki page
100100
)
101-
transparencyTextSlider:GetFrame().Parent = textCollapse:GetContentsFrame()
102-
transparencyTextSlider:SetValueChangedFunction(function(newValue)
103-
CustomTextLabel:UpdateTextTransparency(newValue)
101+
markupCheckbox:GetFrame().Parent = textCollapse:GetContentsFrame()
102+
markupCheckbox:SetValueChangedFunction(function(newValue)
103+
CustomTextLabel:UpdateRichText(newValue)
104104
end)
105105

106-
-- Text rotation slider
107-
local rotationTextSlider = LabeledSlider.new(
108-
"RotationSlider", -- name suffix of gui object
109-
"Text Rotation", -- title text of the multi choice
110-
9, -- how many intervals to split the slider into
111-
1, -- the starting value of the slider
112-
45 -- multiplier for the slider value
106+
-- Size collapse
107+
local sizeCollapse = CollapsibleTitledSection.new(
108+
"SizeCollapse", -- name suffix of the gui object
109+
"Sizing & Wrapping", -- the text displayed beside the collapsible arrow
110+
true, -- have the content frame auto-update its size?
111+
true, -- minimizable?
112+
true -- minimized by default?
113113
)
114-
rotationTextSlider:GetFrame().Parent = textCollapse:GetContentsFrame()
115-
rotationTextSlider:SetValueChangedFunction(function(newValue)
116-
CustomTextLabel:UpdateTextRotation(newValue)
117-
end)
114+
createFrame:AddChild(sizeCollapse:GetSectionFrame())
118115

119116
-- Size slider
120117
local sizeTextSlider = LabeledSlider.new(
@@ -124,47 +121,11 @@ function PluginGui:newPluginGui(widgetGui)
124121
4, -- the starting value of the slider
125122
5 -- multiplier for the slider value
126123
)
127-
sizeTextSlider:GetFrame().Parent = textCollapse:GetContentsFrame()
124+
sizeTextSlider:GetFrame().Parent = sizeCollapse:GetContentsFrame()
128125
sizeTextSlider:SetValueChangedFunction(function(newValue)
129126
CustomTextLabel:UpdateTextSize(newValue)
130127
end)
131128

132-
-- Line height slider
133-
local heightTextSlider = LabeledSlider.new(
134-
"HeightSlider", -- name suffix of gui object
135-
"Line Height", -- title text of the multi choice
136-
5, -- how many intervals to split the slider into
137-
3, -- the starting value of the slider
138-
0.5 -- multiplier for the slider value
139-
)
140-
heightTextSlider:GetFrame().Parent = textCollapse:GetContentsFrame()
141-
heightTextSlider:SetValueChangedFunction(function(newValue)
142-
CustomTextLabel:UpdateLineHeight(newValue)
143-
end)
144-
145-
-- Rich text checkbox
146-
local markupCheckbox = LabeledCheckbox.new(
147-
"MarkupCheckbox", -- name suffix of gui object
148-
"Rich Text", -- text beside the checkbox
149-
false, -- initial value
150-
false, -- initially disabled?
151-
"articles/gui-rich-text" -- link to wiki page
152-
)
153-
markupCheckbox:GetFrame().Parent = textCollapse:GetContentsFrame()
154-
markupCheckbox:SetValueChangedFunction(function(newValue)
155-
CustomTextLabel:UpdateRichText(newValue)
156-
end)
157-
158-
-- Text scaled checkbox
159-
local scaledCheckbox = LabeledCheckbox.new(
160-
"ScaledCheckbox", -- name suffix of gui object
161-
"Text Scaled", -- text beside the checkbox
162-
false, -- initial value
163-
false, -- initially disabled?
164-
"api-reference/property/TextLabel/TextScaled" -- link to wiki page
165-
)
166-
scaledCheckbox:GetFrame().Parent = textCollapse:GetContentsFrame()
167-
168129
-- Text wrapped checkbox
169130
local wrappedCheckbox = LabeledCheckbox.new(
170131
"WrappedCheckbox", -- name suffix of gui object
@@ -173,12 +134,20 @@ function PluginGui:newPluginGui(widgetGui)
173134
false, -- initially disabled?
174135
"api-reference/property/TextLabel/TextWrapped" -- link to wiki page
175136
)
176-
wrappedCheckbox:GetFrame().Parent = textCollapse:GetContentsFrame()
137+
wrappedCheckbox:GetFrame().Parent = sizeCollapse:GetContentsFrame()
177138
wrappedCheckbox:SetValueChangedFunction(function(newValue)
178139
CustomTextLabel:UpdateTextWrapped(newValue)
179140
end)
180141

181142
-- Text scaled checkbox
143+
local scaledCheckbox = LabeledCheckbox.new(
144+
"ScaledCheckbox", -- name suffix of gui object
145+
"Text Scaled", -- text beside the checkbox
146+
false, -- initial value
147+
false, -- initially disabled?
148+
"api-reference/property/TextLabel/TextScaled" -- link to wiki page
149+
)
150+
scaledCheckbox:GetFrame().Parent = sizeCollapse:GetContentsFrame()
182151
scaledCheckbox:SetValueChangedFunction(function(newValue)
183152
CustomTextLabel:UpdateTextScaled(newValue)
184153
if scaledCheckbox:GetValue() == true then
@@ -191,6 +160,82 @@ function PluginGui:newPluginGui(widgetGui)
191160
end
192161
end)
193162

163+
-- Ratio choice
164+
local ratioChoice = LabeledMultiChoice.new(
165+
"RatioChoice", -- name suffix of gui object
166+
"Aspect Ratio", -- title text of the multi choice
167+
AspectRatio, -- choices array
168+
5 -- the starting index of the selection
169+
)
170+
ratioChoice:GetFrame().Parent = sizeCollapse:GetContentsFrame()
171+
ratioChoice:SetValueChangedFunction(function(newIndex)
172+
local newValue = AspectRatio[newIndex].Value
173+
CustomTextLabel:UpdateAspectRatio(newValue)
174+
end)
175+
176+
-- Alignment collapse
177+
local alignmentCollapse = CollapsibleTitledSection.new(
178+
"AlignmentCollapse", -- name suffix of the gui object
179+
"Alignment & Rotation", -- the text displayed beside the collapsible arrow
180+
true, -- have the content frame auto-update its size?
181+
true, -- minimizable?
182+
true -- minimized by default?
183+
)
184+
createFrame:AddChild(alignmentCollapse:GetSectionFrame())
185+
186+
-- Text rotation slider
187+
local rotationTextSlider = LabeledSlider.new(
188+
"RotationSlider", -- name suffix of gui object
189+
"Text Rotation", -- title text of the multi choice
190+
9, -- how many intervals to split the slider into
191+
1, -- the starting value of the slider
192+
45 -- multiplier for the slider value
193+
)
194+
rotationTextSlider:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
195+
rotationTextSlider:SetValueChangedFunction(function(newValue)
196+
CustomTextLabel:UpdateTextRotation(newValue)
197+
end)
198+
199+
-- Line height slider
200+
local heightTextSlider = LabeledSlider.new(
201+
"HeightSlider", -- name suffix of gui object
202+
"Line Height", -- title text of the multi choice
203+
5, -- how many intervals to split the slider into
204+
3, -- the starting value of the slider
205+
0.5 -- multiplier for the slider value
206+
)
207+
heightTextSlider:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
208+
heightTextSlider:SetValueChangedFunction(function(newValue)
209+
CustomTextLabel:UpdateLineHeight(newValue)
210+
end)
211+
212+
213+
-- Horizontal alignment choice
214+
local yChoice = LabeledMultiChoice.new(
215+
"YChoice", -- name suffix of gui object
216+
"Horizontal Alignment", -- title text of the multi choice
217+
TextYAlignment, -- choices array
218+
2 -- the starting index of the selection
219+
)
220+
yChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
221+
yChoice:SetValueChangedFunction(function(newIndex)
222+
local newValue = TextYAlignment[newIndex].Mode
223+
CustomTextLabel:UpdateVerticalAlignment(newValue)
224+
end)
225+
226+
-- Vertical alignment choice
227+
local xChoice = LabeledMultiChoice.new(
228+
"XChoice", -- name suffix of gui object
229+
"Vertical Alignment", -- title text of the multi choice
230+
TextXAlignment, -- choices array
231+
2 -- the starting index of the selection
232+
)
233+
xChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
234+
xChoice:SetValueChangedFunction(function(newIndex)
235+
local newValue = TextXAlignment[newIndex].Mode
236+
CustomTextLabel:UpdateHorizontalAlignment(newValue)
237+
end)
238+
194239
-- Font collapse
195240
local fontCollapse = CollapsibleTitledSection.new(
196241
"FontCollapse", -- name suffix of the gui object
@@ -201,6 +246,19 @@ function PluginGui:newPluginGui(widgetGui)
201246
)
202247
createFrame:AddChild(fontCollapse:GetSectionFrame())
203248

249+
-- Text transparency slider
250+
local transparencyTextSlider = LabeledSlider.new(
251+
"TransparencyTextSlider", -- name suffix of gui object
252+
"Transparency", -- title text of the multi choice
253+
11, -- how many intervals to split the slider into
254+
1, -- the starting value of the slider
255+
0.1 -- multiplier for the slider value
256+
)
257+
transparencyTextSlider:GetFrame().Parent = fontCollapse:GetContentsFrame()
258+
transparencyTextSlider:SetValueChangedFunction(function(newValue)
259+
CustomTextLabel:UpdateTextTransparency(newValue)
260+
end)
261+
204262
-- Bold checkbox
205263
local boldCheckbox = LabeledCheckbox.new(
206264
"BoldCheckbox", -- name suffix of gui object
@@ -254,42 +312,6 @@ function PluginGui:newPluginGui(widgetGui)
254312
CustomTextLabel:UpdateFontFace(newValue)
255313
end)
256314

257-
-- Alignment collapse
258-
local alignmentCollapse = CollapsibleTitledSection.new(
259-
"AlignmentCollapse", -- name suffix of the gui object
260-
"Alignment", -- the text displayed beside the collapsible arrow
261-
true, -- have the content frame auto-update its size?
262-
true, -- minimizable?
263-
true -- minimized by default?
264-
)
265-
createFrame:AddChild(alignmentCollapse:GetSectionFrame())
266-
267-
-- Horizontal alignment choice
268-
local yChoice = LabeledMultiChoice.new(
269-
"YChoice", -- name suffix of gui object
270-
"Horizontal Alignment", -- title text of the multi choice
271-
TextYAlignment, -- choices array
272-
2 -- the starting index of the selection
273-
)
274-
yChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
275-
yChoice:SetValueChangedFunction(function(newIndex)
276-
local newValue = TextYAlignment[newIndex].Mode
277-
CustomTextLabel:UpdateVerticalAlignment(newValue)
278-
end)
279-
280-
-- Vertical alignment choice
281-
local xChoice = LabeledMultiChoice.new(
282-
"XChoice", -- name suffix of gui object
283-
"Vertical Alignment", -- title text of the multi choice
284-
TextXAlignment, -- choices array
285-
2 -- the starting index of the selection
286-
)
287-
xChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
288-
xChoice:SetValueChangedFunction(function(newIndex)
289-
local newValue = TextXAlignment[newIndex].Mode
290-
CustomTextLabel:UpdateHorizontalAlignment(newValue)
291-
end)
292-
293315
-- Stroke collapse
294316
local strokeCollapse = CollapsibleTitledSection.new(
295317
"StrokeCollapse", -- name suffix of the gui object
@@ -371,29 +393,6 @@ function PluginGui:newPluginGui(widgetGui)
371393
CustomTextLabel:UpdateStrokeColor(newValue)
372394
end)
373395

374-
-- Size collapse
375-
local sizeCollapse = CollapsibleTitledSection.new(
376-
"SizeCollapse", -- name suffix of the gui object
377-
"Size", -- the text displayed beside the collapsible arrow
378-
true, -- have the content frame auto-update its size?
379-
true, -- minimizable?
380-
true -- minimized by default?
381-
)
382-
createFrame:AddChild(sizeCollapse:GetSectionFrame())
383-
384-
-- Size choice
385-
local ratioChoice = LabeledMultiChoice.new(
386-
"RatioChoice", -- name suffix of gui object
387-
"Aspect Ratio", -- title text of the multi choice
388-
AspectRatio, -- choices array
389-
5 -- the starting index of the selection
390-
)
391-
ratioChoice:GetFrame().Parent = sizeCollapse:GetContentsFrame()
392-
ratioChoice:SetValueChangedFunction(function(newIndex)
393-
local newValue = AspectRatio[newIndex].Value
394-
CustomTextLabel:UpdateAspectRatio(newValue)
395-
end)
396-
397396
-- Background collapse
398397
local backgroundCollapse = CollapsibleTitledSection.new(
399398
"BackgroundCollapse", -- name suffix of the gui object

0 commit comments

Comments
 (0)