Skip to content

Commit

Permalink
Improved layout
Browse files Browse the repository at this point in the history
Signed-off-by: RyanLua <80087248+RyanLua@users.noreply.github.com>
  • Loading branch information
RyanLua committed Apr 27, 2023
1 parent 5d9479e commit 5727dbf
Showing 1 changed file with 118 additions and 119 deletions.
237 changes: 118 additions & 119 deletions src/Signs/PluginGui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function PluginGui:newPluginGui(widgetGui)
-- Text collapse
local textCollapse = CollapsibleTitledSection.new(
"TextCollapse", -- name suffix of the gui object
"Text", -- the text displayed beside the collapsible arrow
"Text Contents", -- the text displayed beside the collapsible arrow
true, -- have the content frame auto-update its size?
true, -- minimizable?
false -- minimized by default?
Expand All @@ -90,31 +90,28 @@ function PluginGui:newPluginGui(widgetGui)
CustomTextLabel:UpdateText(newValue)
end)

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

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

-- Size slider
local sizeTextSlider = LabeledSlider.new(
Expand All @@ -124,47 +121,11 @@ function PluginGui:newPluginGui(widgetGui)
4, -- the starting value of the slider
5 -- multiplier for the slider value
)
sizeTextSlider:GetFrame().Parent = textCollapse:GetContentsFrame()
sizeTextSlider:GetFrame().Parent = sizeCollapse:GetContentsFrame()
sizeTextSlider:SetValueChangedFunction(function(newValue)
CustomTextLabel:UpdateTextSize(newValue)
end)

-- Line height slider
local heightTextSlider = LabeledSlider.new(
"HeightSlider", -- name suffix of gui object
"Line Height", -- title text of the multi choice
5, -- how many intervals to split the slider into
3, -- the starting value of the slider
0.5 -- multiplier for the slider value
)
heightTextSlider:GetFrame().Parent = textCollapse:GetContentsFrame()
heightTextSlider:SetValueChangedFunction(function(newValue)
CustomTextLabel:UpdateLineHeight(newValue)
end)

-- Rich text checkbox
local markupCheckbox = LabeledCheckbox.new(
"MarkupCheckbox", -- name suffix of gui object
"Rich Text", -- text beside the checkbox
false, -- initial value
false, -- initially disabled?
"articles/gui-rich-text" -- link to wiki page
)
markupCheckbox:GetFrame().Parent = textCollapse:GetContentsFrame()
markupCheckbox:SetValueChangedFunction(function(newValue)
CustomTextLabel:UpdateRichText(newValue)
end)

-- Text scaled checkbox
local scaledCheckbox = LabeledCheckbox.new(
"ScaledCheckbox", -- name suffix of gui object
"Text Scaled", -- text beside the checkbox
false, -- initial value
false, -- initially disabled?
"api-reference/property/TextLabel/TextScaled" -- link to wiki page
)
scaledCheckbox:GetFrame().Parent = textCollapse:GetContentsFrame()

-- Text wrapped checkbox
local wrappedCheckbox = LabeledCheckbox.new(
"WrappedCheckbox", -- name suffix of gui object
Expand All @@ -173,12 +134,20 @@ function PluginGui:newPluginGui(widgetGui)
false, -- initially disabled?
"api-reference/property/TextLabel/TextWrapped" -- link to wiki page
)
wrappedCheckbox:GetFrame().Parent = textCollapse:GetContentsFrame()
wrappedCheckbox:GetFrame().Parent = sizeCollapse:GetContentsFrame()
wrappedCheckbox:SetValueChangedFunction(function(newValue)
CustomTextLabel:UpdateTextWrapped(newValue)
end)

-- Text scaled checkbox
local scaledCheckbox = LabeledCheckbox.new(
"ScaledCheckbox", -- name suffix of gui object
"Text Scaled", -- text beside the checkbox
false, -- initial value
false, -- initially disabled?
"api-reference/property/TextLabel/TextScaled" -- link to wiki page
)
scaledCheckbox:GetFrame().Parent = sizeCollapse:GetContentsFrame()
scaledCheckbox:SetValueChangedFunction(function(newValue)
CustomTextLabel:UpdateTextScaled(newValue)
if scaledCheckbox:GetValue() == true then
Expand All @@ -191,6 +160,82 @@ function PluginGui:newPluginGui(widgetGui)
end
end)

-- Ratio choice
local ratioChoice = LabeledMultiChoice.new(
"RatioChoice", -- name suffix of gui object
"Aspect Ratio", -- title text of the multi choice
AspectRatio, -- choices array
5 -- the starting index of the selection
)
ratioChoice:GetFrame().Parent = sizeCollapse:GetContentsFrame()
ratioChoice:SetValueChangedFunction(function(newIndex)
local newValue = AspectRatio[newIndex].Value
CustomTextLabel:UpdateAspectRatio(newValue)
end)

-- Alignment collapse
local alignmentCollapse = CollapsibleTitledSection.new(
"AlignmentCollapse", -- name suffix of the gui object
"Alignment & Rotation", -- the text displayed beside the collapsible arrow
true, -- have the content frame auto-update its size?
true, -- minimizable?
true -- minimized by default?
)
createFrame:AddChild(alignmentCollapse:GetSectionFrame())

-- Text rotation slider
local rotationTextSlider = LabeledSlider.new(
"RotationSlider", -- name suffix of gui object
"Text Rotation", -- title text of the multi choice
9, -- how many intervals to split the slider into
1, -- the starting value of the slider
45 -- multiplier for the slider value
)
rotationTextSlider:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
rotationTextSlider:SetValueChangedFunction(function(newValue)
CustomTextLabel:UpdateTextRotation(newValue)
end)

-- Line height slider
local heightTextSlider = LabeledSlider.new(
"HeightSlider", -- name suffix of gui object
"Line Height", -- title text of the multi choice
5, -- how many intervals to split the slider into
3, -- the starting value of the slider
0.5 -- multiplier for the slider value
)
heightTextSlider:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
heightTextSlider:SetValueChangedFunction(function(newValue)
CustomTextLabel:UpdateLineHeight(newValue)
end)


-- Horizontal alignment choice
local yChoice = LabeledMultiChoice.new(
"YChoice", -- name suffix of gui object
"Horizontal Alignment", -- title text of the multi choice
TextYAlignment, -- choices array
2 -- the starting index of the selection
)
yChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
yChoice:SetValueChangedFunction(function(newIndex)
local newValue = TextYAlignment[newIndex].Mode
CustomTextLabel:UpdateVerticalAlignment(newValue)
end)

-- Vertical alignment choice
local xChoice = LabeledMultiChoice.new(
"XChoice", -- name suffix of gui object
"Vertical Alignment", -- title text of the multi choice
TextXAlignment, -- choices array
2 -- the starting index of the selection
)
xChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
xChoice:SetValueChangedFunction(function(newIndex)
local newValue = TextXAlignment[newIndex].Mode
CustomTextLabel:UpdateHorizontalAlignment(newValue)
end)

-- Font collapse
local fontCollapse = CollapsibleTitledSection.new(
"FontCollapse", -- name suffix of the gui object
Expand All @@ -201,6 +246,19 @@ function PluginGui:newPluginGui(widgetGui)
)
createFrame:AddChild(fontCollapse:GetSectionFrame())

-- Text transparency slider
local transparencyTextSlider = LabeledSlider.new(
"TransparencyTextSlider", -- name suffix of gui object
"Transparency", -- title text of the multi choice
11, -- how many intervals to split the slider into
1, -- the starting value of the slider
0.1 -- multiplier for the slider value
)
transparencyTextSlider:GetFrame().Parent = fontCollapse:GetContentsFrame()
transparencyTextSlider:SetValueChangedFunction(function(newValue)
CustomTextLabel:UpdateTextTransparency(newValue)
end)

-- Bold checkbox
local boldCheckbox = LabeledCheckbox.new(
"BoldCheckbox", -- name suffix of gui object
Expand Down Expand Up @@ -254,42 +312,6 @@ function PluginGui:newPluginGui(widgetGui)
CustomTextLabel:UpdateFontFace(newValue)
end)

-- Alignment collapse
local alignmentCollapse = CollapsibleTitledSection.new(
"AlignmentCollapse", -- name suffix of the gui object
"Alignment", -- the text displayed beside the collapsible arrow
true, -- have the content frame auto-update its size?
true, -- minimizable?
true -- minimized by default?
)
createFrame:AddChild(alignmentCollapse:GetSectionFrame())

-- Horizontal alignment choice
local yChoice = LabeledMultiChoice.new(
"YChoice", -- name suffix of gui object
"Horizontal Alignment", -- title text of the multi choice
TextYAlignment, -- choices array
2 -- the starting index of the selection
)
yChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
yChoice:SetValueChangedFunction(function(newIndex)
local newValue = TextYAlignment[newIndex].Mode
CustomTextLabel:UpdateVerticalAlignment(newValue)
end)

-- Vertical alignment choice
local xChoice = LabeledMultiChoice.new(
"XChoice", -- name suffix of gui object
"Vertical Alignment", -- title text of the multi choice
TextXAlignment, -- choices array
2 -- the starting index of the selection
)
xChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
xChoice:SetValueChangedFunction(function(newIndex)
local newValue = TextXAlignment[newIndex].Mode
CustomTextLabel:UpdateHorizontalAlignment(newValue)
end)

-- Stroke collapse
local strokeCollapse = CollapsibleTitledSection.new(
"StrokeCollapse", -- name suffix of the gui object
Expand Down Expand Up @@ -371,29 +393,6 @@ function PluginGui:newPluginGui(widgetGui)
CustomTextLabel:UpdateStrokeColor(newValue)
end)

-- Size collapse
local sizeCollapse = CollapsibleTitledSection.new(
"SizeCollapse", -- name suffix of the gui object
"Size", -- the text displayed beside the collapsible arrow
true, -- have the content frame auto-update its size?
true, -- minimizable?
true -- minimized by default?
)
createFrame:AddChild(sizeCollapse:GetSectionFrame())

-- Size choice
local ratioChoice = LabeledMultiChoice.new(
"RatioChoice", -- name suffix of gui object
"Aspect Ratio", -- title text of the multi choice
AspectRatio, -- choices array
5 -- the starting index of the selection
)
ratioChoice:GetFrame().Parent = sizeCollapse:GetContentsFrame()
ratioChoice:SetValueChangedFunction(function(newIndex)
local newValue = AspectRatio[newIndex].Value
CustomTextLabel:UpdateAspectRatio(newValue)
end)

-- Background collapse
local backgroundCollapse = CollapsibleTitledSection.new(
"BackgroundCollapse", -- name suffix of the gui object
Expand Down

0 comments on commit 5727dbf

Please sign in to comment.