Settings: text opacity, name/time gap, place colour vibrance, text outline; window opacity spares text; checkbox and open fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WyQKCL92ZLwPi9qmYQtNdc
This commit is contained in:
Claude
2026-10-12 16:23:41 -04:00
parent 20d4608c21
commit 15e9d5185c
4 changed files with 108 additions and 35 deletions
+44 -18
View File
@@ -67,6 +67,9 @@ local function Check(label, x, y, get, set)
local text = getglobal(name .. "Text")
text:SetFont(font, 10)
text:SetText(label)
-- the template makes the box clickable 100 px to its right, which reaches over the
-- next box on the same line: limit the click area to the box and its own label
c:SetHitRectInsets(0, -((text:GetStringWidth() or 0) + 6), 0, 0)
c.Update = function() c:SetChecked(get() and 1 or nil) end
c:SetScript("OnClick", function() set(this:GetChecked() and true or false) end)
table.insert(controls, c)
@@ -80,7 +83,7 @@ local function Build()
local C = OB.cfg
frame = CreateFrame("Frame", "OctoBusOptions", UIParent)
frame:SetWidth(W)
frame:SetHeight(538)
frame:SetHeight(676)
frame:SetPoint("CENTER", UIParent, "CENTER", 0, 60)
frame:SetFrameStrata("DIALOG")
frame:SetClampedToScreen(true)
@@ -99,26 +102,46 @@ local function Build()
local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 2, 2)
close:SetFrameLevel(frame:GetFrameLevel() + 5)
close:SetScript("OnClick", function() frame:Hide() end)
local function look(key) return function(v) C[key] = v OB.ApplyLook() end end
Heading("Window", -34)
Slider("Background opacity", -64, 0, 1, 0.05, function() return C.bgAlpha or 0.75 end, look("bgAlpha"), pct)
Slider("Window opacity", -102, 0.2, 1, 0.05, function() return C.alpha or 1 end, look("alpha"), pct)
Slider("Window opacity (all but text)", -102, 0.2, 1, 0.05, function() return C.alpha or 1 end, look("alpha"), pct)
Slider("Text size", -140, 0.7, 1.5, 0.05, function() return C.textScale or 1 end, look("textScale"), pct)
Slider("Window size", -178, OB.scaleMin, OB.scaleMax, 0.05, function() return C.scale or 1 end,
Slider("Text opacity", -178, 0, 1, 0.05, function() return C.textAlpha or 1 end, look("textAlpha"), pct)
Slider("Gap between names and times", -216, 0.6, 1.6, 0.05, function() return C.widthScale or 1 end, look("widthScale"), pct)
Slider("Place colour vibrance", -254, 0.2, 1, 0.05, function() return C.vibrance or 0.75 end, look("vibrance"), pct)
local outl = frame:CreateFontString(nil, "OVERLAY")
outl:SetFont(font, 10)
outl:SetPoint("TOPLEFT", frame, "TOPLEFT", 18, -284)
outl:SetText("Text outline:")
outl:SetTextColor(1, 0.82, 0)
local OUTLINES = { { "thin", "Thin", 96 }, { "thick", "Thick", 156 }, { "shadow", "Shadow", 222 } }
for i = 1, table.getn(OUTLINES) do
local key = OUTLINES[i][1]
Check(OUTLINES[i][2], OUTLINES[i][3], -278, function() return (C.outline or "thin") == key end,
function()
C.outline = key
OB.ApplyLook()
for j = 1, table.getn(controls) do controls[j].Update() end
end)
end
Slider("Window size", -316, OB.scaleMin, OB.scaleMax, 0.05, function() return C.scale or 1 end,
function(v) OB.SetScale(v) end, pct)
Check("Lock position and size", 14, -204, function() return C.locked end, function(v) OB.SetLocked(v) end)
Check("Lock position and size", 14, -342, function() return C.locked end, function(v) OB.SetLocked(v) end)
-- which corner stays in place when the list gets longer or shorter
local corner = frame:CreateFontString(nil, "OVERLAY")
corner:SetFont(font, 10)
corner:SetPoint("TOPLEFT", frame, "TOPLEFT", 18, -234)
corner:SetPoint("TOPLEFT", frame, "TOPLEFT", 18, -372)
corner:SetText("Corner that stays put as the list grows or shrinks:")
corner:SetTextColor(1, 0.82, 0)
local CORNERS = {
{ "TOPLEFT", "Top left", 14, -248 }, { "TOPRIGHT", "Top right", 150, -248 },
{ "BOTTOMLEFT", "Bottom left", 14, -272 }, { "BOTTOMRIGHT", "Bottom right", 150, -272 },
{ "TOPLEFT", "Top left", 14, -386 }, { "TOPRIGHT", "Top right", 150, -386 },
{ "BOTTOMLEFT", "Bottom left", 14, -410 }, { "BOTTOMRIGHT", "Bottom right", 150, -410 },
}
for i = 1, table.getn(CORNERS) do
local a = CORNERS[i][1]
@@ -129,20 +152,20 @@ local function Build()
end)
end
Heading("Routes", -302)
Check("Open by itself only at route ends", 14, -320, function() return C.zoneOnly end,
Heading("Routes", -440)
Check("Open by itself only at route ends", 14, -458, function() return C.zoneOnly end,
function(v) C.zoneOnly = v end)
Check("Show all routes (not just for where you are)", 14, -344, function() return C.full end,
Check("Show all routes (not just for where you are)", 14, -482, function() return C.full end,
function(v) C.full = v OB.Refresh() end)
Check("Show the Sparkwater Port boat", 14, -368, function() return not C.hideBoat end,
Check("Show the Sparkwater Port boat", 14, -506, function() return not C.hideBoat end,
function(v) C.hideBoat = not v OB.Refresh() end)
Heading("Alerts (click a row to put a bell on it)", -400)
Slider("Warn before arrival", -430, 10, 120, 5, function() return C.alert or 45 end,
Heading("Alerts (click a row to put a bell on it)", -538)
Slider("Warn before arrival", -568, 10, 120, 5, function() return C.alert or 45 end,
function(v) C.alert = v end, function(v) return math.floor(v + 0.5) .. " s" end)
Check("Chat message", 14, -452, function() return C.chat end, function(v) C.chat = v end)
Check("Sound", 120, -452, function() return C.sound end, function(v) C.sound = v end)
Check("Flash the minimap icon", 14, -476, function() return C.flash end, function(v) C.flash = v end)
Check("Chat message", 14, -590, function() return C.chat end, function(v) C.chat = v end)
Check("Sound", 120, -590, function() return C.sound end, function(v) C.sound = v end)
Check("Flash the minimap icon", 14, -614, function() return C.flash end, function(v) C.flash = v end)
local reset = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
reset:SetWidth(150)
@@ -150,7 +173,7 @@ local function Build()
reset:SetPoint("BOTTOM", frame, "BOTTOM", 0, 12)
reset:SetText("Reset window look")
reset:SetScript("OnClick", function()
C.bgAlpha, C.alpha, C.textScale = nil, nil, nil
C.bgAlpha, C.alpha, C.textScale, C.textAlpha, C.widthScale, C.vibrance, C.outline = nil, nil, nil, nil, nil, nil, nil
OB.SetScale(1)
OB.ApplyLook()
for i = 1, table.getn(controls) do controls[i].Update() end
@@ -162,7 +185,10 @@ function OctoBus_Options()
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccOctoBus:|r not running, so its settings are unavailable.")
return
end
if not frame then Build() end
if not frame then
Build()
frame:Hide() -- a new frame starts out shown; without this the first click hid it
end
if frame:IsShown() then frame:Hide() return end
for i = 1, table.getn(controls) do controls[i].Update() end
OctoBus.Show() -- show the timer window so changes can be seen