diff --git a/OctoBus.lua b/OctoBus.lua index c3d75a4..68d3f8a 100644 --- a/OctoBus.lua +++ b/OctoBus.lua @@ -909,16 +909,18 @@ local OB_OK, OB_ERR = pcall(function () local font = STANDARD_TEXT_FONT or "Fonts\\FRIZQT__.TTF" local anchorTo = Minimap - -- flat dark panel with a thin border + -- classic Blizzard tooltip-style panel: dark blue fill, silver rounded border + local BG_R, BG_G, BG_B = 0.09, 0.09, 0.19 -- TOOLTIP_DEFAULT_BACKGROUND_COLOR + local BD_R, BD_G, BD_B = 1, 1, 1 -- TOOLTIP_DEFAULT_COLOR local function CreateBackdrop(f) f:SetBackdrop({ - bgFile = "Interface\\Buttons\\WHITE8X8", - edgeFile = "Interface\\Buttons\\WHITE8X8", - tile = false, tileSize = 0, edgeSize = 1, - insets = { left = 1, right = 1, top = 1, bottom = 1 }, + bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", + edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", + tile = true, tileSize = 16, edgeSize = 16, + insets = { left = 4, right = 4, top = 4, bottom = 4 }, }) - f:SetBackdropColor(0.02, 0.02, 0.02, 0.75) - f:SetBackdropBorderColor(0.22, 0.22, 0.22, 1) + f:SetBackdropColor(BG_R, BG_G, BG_B, 0.75) + f:SetBackdropBorderColor(BD_R, BD_G, BD_B, 1) end -- square or round minimap? "auto" looks at the minimap: the stock UI keeps it inside @@ -988,7 +990,7 @@ local OB_OK, OB_ERR = pcall(function () local textScale = CFG.textScale or 1 local WIDTH = math.floor(280 * textScale * (CFG.widthScale or 1) + 0.5) local ROW_H = math.floor(18 * textScale + 0.5) - local TOP = math.floor(22 * textScale + 0.5) + local TOP = math.floor(26 * textScale + 0.5) local panel = CreateFrame("Frame", "OctoBusPanel", UIParent) panel:SetFrameStrata("MEDIUM") @@ -1001,18 +1003,19 @@ local OB_OK, OB_ERR = pcall(function () CreateBackdrop(panel) panel.title = panel:CreateFontString(nil, "OVERLAY") - panel.title:SetFont(font, 10, "OUTLINE") - panel.title:SetPoint("TOPLEFT", panel, "TOPLEFT", 8, -6) - panel.title:SetText("|cff33ffccTransports|r") + panel.title:SetFont(font, 10) + panel.title:SetPoint("TOPLEFT", panel, "TOPLEFT", 10, -9) + panel.title:SetTextColor(1, 0.82, 0) + panel.title:SetText("Transports") panel.status = panel:CreateFontString(nil, "OVERLAY") - panel.status:SetFont(font, 9, "OUTLINE") - panel.status:SetPoint("TOPRIGHT", panel, "TOPRIGHT", -8, -7) + panel.status:SetFont(font, 9) + panel.status:SetPoint("TOPRIGHT", panel, "TOPRIGHT", -10, -10) panel.status:SetTextColor(0.6, 0.6, 0.6) panel.foot = panel:CreateFontString(nil, "OVERLAY") - panel.foot:SetFont(font, 9, "OUTLINE") - panel.foot:SetPoint("BOTTOMLEFT", panel, "BOTTOMLEFT", 8, 4) + panel.foot:SetFont(font, 9) + panel.foot:SetPoint("BOTTOMLEFT", panel, "BOTTOMLEFT", 10, 7) panel.foot:SetJustifyH("LEFT") -- The window is pinned by one corner (CFG.anchor, set in the settings window; default @@ -1042,7 +1045,7 @@ local OB_OK, OB_ERR = pcall(function () -- click the title: switch between all routes and routes for where you are local titleBtn = CreateFrame("Button", nil, panel) - titleBtn:SetPoint("TOPLEFT", panel, "TOPLEFT", 4, -2) + titleBtn:SetPoint("TOPLEFT", panel, "TOPLEFT", 6, -5) titleBtn:SetWidth(150) titleBtn:SetHeight(16) titleBtn:RegisterForClicks("LeftButtonUp") @@ -1064,7 +1067,7 @@ local OB_OK, OB_ERR = pcall(function () local grip = CreateFrame("Frame", nil, panel) grip:SetWidth(14) grip:SetHeight(14) - grip:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -1, 1) + grip:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -3, 3) grip:SetFrameLevel(panel:GetFrameLevel() + 10) grip:EnableMouse(true) grip.dots = {} @@ -1124,13 +1127,19 @@ local OB_OK, OB_ERR = pcall(function () local rows = {} - -- text outline: "thin" (default), "thick", or "shadow" (thin outline plus a drop shadow) + -- text outline: "none" (default: the stock Blizzard drop shadow, no outline), "thin", + -- "thick", or "shadow" (thin outline plus a drop shadow) local function StyleText(fs, size) - local o = CFG.outline or "thin" - fs:SetFont(font, size, o == "thick" and "THICKOUTLINE" or "OUTLINE") + local o = CFG.outline or "none" + local flags = "" + if o == "thick" then flags = "THICKOUTLINE" elseif o ~= "none" then flags = "OUTLINE" end + fs:SetFont(font, size, flags) if o == "shadow" then fs:SetShadowColor(0, 0, 0, 1) fs:SetShadowOffset(1.5, -1.5) + elseif o == "none" then + fs:SetShadowColor(0, 0, 0, 1) + fs:SetShadowOffset(1, -1) else fs:SetShadowOffset(0, 0) end @@ -1139,8 +1148,8 @@ local OB_OK, OB_ERR = pcall(function () local function PlaceRow(row, i) row:SetHeight(ROW_H) row:ClearAllPoints() - row:SetPoint("TOPLEFT", panel, "TOPLEFT", 4, -(TOP + (i - 1) * ROW_H)) - row:SetPoint("RIGHT", panel, "RIGHT", -4, 0) + row:SetPoint("TOPLEFT", panel, "TOPLEFT", 6, -(TOP + (i - 1) * ROW_H)) + row:SetPoint("RIGHT", panel, "RIGHT", -6, 0) local fs = math.floor(10 * textScale + 0.5) if row.name then StyleText(row.name, fs) @@ -1162,22 +1171,28 @@ local OB_OK, OB_ERR = pcall(function () row.bg = row:CreateTexture(nil, "BACKGROUND") row.bg:SetAllPoints(row) - row.bg:SetTexture("Interface\\Buttons\\WHITE8X8") + row.bg:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") + row.bg:SetBlendMode("ADD") row.bg:SetVertexColor(0, 0, 0, 0) + -- classic list hover glow + row:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") + local hl = row:GetHighlightTexture() + if hl then hl:SetBlendMode("ADD") hl:SetAlpha(0.5) end + row.icon = row:CreateTexture(nil, "ARTWORK") row.icon:SetWidth(14) row.icon:SetHeight(14) row.icon:SetPoint("LEFT", row, "LEFT", 2, 0) row.name = row:CreateFontString(nil, "OVERLAY") - row.name:SetFont(font, 10, "OUTLINE") + row.name:SetFont(font, 10) row.name:SetPoint("LEFT", row.icon, "RIGHT", 4, 0) row.name:SetJustifyH("LEFT") row.time = row:CreateFontString(nil, "OVERLAY") - row.time:SetFont(font, 10, "OUTLINE") + row.time:SetFont(font, 10) row.time:SetPoint("RIGHT", row, "RIGHT", -20, 0) row.time:SetJustifyH("RIGHT") @@ -1270,13 +1285,13 @@ local OB_OK, OB_ERR = pcall(function () local wa = CFG.alpha or 1 local bg = CFG.bgAlpha or 0.75 panel:SetAlpha(1) - panel:SetBackdropColor(0.02, 0.02, 0.02, bg * wa) - panel:SetBackdropBorderColor(0.22, 0.22, 0.22, math.min(1, bg + 0.25) * wa) + panel:SetBackdropColor(BG_R, BG_G, BG_B, bg * wa) + panel:SetBackdropBorderColor(BD_R, BD_G, BD_B, math.min(1, bg + 0.25) * wa) grip:SetAlpha(wa) textScale = CFG.textScale or 1 WIDTH = math.floor(280 * textScale * (CFG.widthScale or 1) + 0.5) ROW_H = math.floor(18 * textScale + 0.5) - TOP = math.floor(22 * textScale + 0.5) + TOP = math.floor(26 * textScale + 0.5) panel:SetWidth(WIDTH) StyleText(panel.title, math.floor(10 * textScale + 0.5)) StyleText(panel.status, math.floor(9 * textScale + 0.5)) @@ -1398,11 +1413,11 @@ local OB_OK, OB_ERR = pcall(function () if state == "docked" then row.icon:SetTexture(ICON_HERE) row.icon:SetVertexColor(0.3, 1, 0.3) - row.bg:SetVertexColor(0.1, 0.5, 0.1, 0.35) + row.bg:SetVertexColor(0.2, 0.9, 0.2, 0.6) elseif state == "departing" then row.icon:SetTexture(ICON_HERE) row.icon:SetVertexColor(1, 0.82, 0) - row.bg:SetVertexColor(0.5, 0.4, 0, 0.3) + row.bg:SetVertexColor(1, 0.82, 0, 0.5) else row.icon:SetTexture(ICON_AWAY) if secs and CFG.alert > 0 and secs <= CFG.alert then @@ -1421,10 +1436,10 @@ local OB_OK, OB_ERR = pcall(function () local w = (rows[i].name:GetStringWidth() or 0) + (rows[i].time:GetStringWidth() or 0) if w > need then need = w end end - need = math.floor(need + 4 + 2 + 14 + 4 + 20 + 12 * textScale + 4) + need = math.floor(need + 6 + 2 + 14 + 4 + 20 + 12 * textScale + 6) panel:SetWidth(need > WIDTH and need or WIDTH) - panel:SetHeight(TOP + n * ROW_H + ((cal or (panel.foot:GetText() or "") ~= "") and math.floor(18 * textScale + 0.5) or 10)) - panel.title:SetText("|cff33ffccTransports|r" .. (CFG.full and " |cff777777- all|r" or "")) + panel:SetHeight(TOP + n * ROW_H + ((cal or (panel.foot:GetText() or "") ~= "") and math.floor(20 * textScale + 0.5) or 12)) + panel.title:SetText("Transports" .. (CFG.full and " |cff777777- all|r" or "")) if recOn then panel.status:SetText("|cffff4444REC|r " .. (type(DB.rec) == "table" and table.getn(DB.rec) or 0)) else diff --git a/OctoBusOptions.lua b/OctoBusOptions.lua index f8e0359..34afff2 100644 --- a/OctoBusOptions.lua +++ b/OctoBusOptions.lua @@ -4,26 +4,25 @@ ]] local font = STANDARD_TEXT_FONT or "Fonts\\FRIZQT__.TTF" -local W = 300 -local frame, controls = nil, {} +local W = 330 -- content width; the frame adds the dialog border around it +local PAD = 8 +local frame, body, controls = nil, nil, {} local loading = false +-- the stock Blizzard dialog box: marbled dark background, gold-trimmed border local function Backdrop(f) f:SetBackdrop({ - bgFile = "Interface\\Buttons\\WHITE8X8", - edgeFile = "Interface\\Buttons\\WHITE8X8", - tile = false, tileSize = 0, edgeSize = 1, - insets = { left = 1, right = 1, top = 1, bottom = 1 }, + bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", + edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", + tile = true, tileSize = 32, edgeSize = 32, + insets = { left = 11, right = 12, top = 12, bottom = 11 }, }) - f:SetBackdropColor(0.02, 0.02, 0.02, 0.92) - f:SetBackdropBorderColor(0.3, 0.3, 0.3, 1) end local function Heading(text, y) - local fs = frame:CreateFontString(nil, "OVERLAY") - fs:SetFont(font, 11, "OUTLINE") - fs:SetPoint("TOPLEFT", frame, "TOPLEFT", 12, y) - fs:SetText("|cff33ffcc" .. text .. "|r") + local fs = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") + fs:SetPoint("TOPLEFT", body, "TOPLEFT", 12, y) + fs:SetText(text) end local sliderCount = 0 @@ -32,14 +31,13 @@ local function Slider(label, y, lo, hi, step, get, set, fmt) sliderCount = sliderCount + 1 local name = "OctoBusOptionsSlider" .. sliderCount local s = CreateFrame("Slider", name, frame, "OptionsSliderTemplate") - s:SetPoint("TOPLEFT", frame, "TOPLEFT", 18, y) + s:SetPoint("TOPLEFT", body, "TOPLEFT", 18, y) s:SetWidth(W - 36) s:SetMinMaxValues(lo, hi) s:SetValueStep(step) getglobal(name .. "Low"):SetText("") getglobal(name .. "High"):SetText("") local text = getglobal(name .. "Text") - text:SetFont(font, 10) s.Update = function() loading = true s:SetValue(get()) @@ -63,9 +61,8 @@ local function Check(label, x, y, get, set) local c = CreateFrame("CheckButton", name, frame, "OptionsCheckButtonTemplate") c:SetWidth(24) c:SetHeight(24) - c:SetPoint("TOPLEFT", frame, "TOPLEFT", x, y) + c:SetPoint("TOPLEFT", body, "TOPLEFT", x, y) 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 @@ -82,8 +79,8 @@ local function Build() local OB = OctoBus local C = OB.cfg frame = CreateFrame("Frame", "OctoBusOptions", UIParent) - frame:SetWidth(W) - frame:SetHeight(700) + frame:SetWidth(W + 2 * PAD) + frame:SetHeight(700 + 2 * PAD) frame:SetPoint("CENTER", UIParent, "CENTER", 0, 60) frame:SetFrameStrata("DIALOG") frame:SetClampedToScreen(true) @@ -95,13 +92,24 @@ local function Build() Backdrop(frame) table.insert(UISpecialFrames, "OctoBusOptions") -- Escape closes it - local title = frame:CreateFontString(nil, "OVERLAY") - title:SetFont(font, 12, "OUTLINE") - title:SetPoint("TOP", frame, "TOP", 0, -10) - title:SetText("|cff33ffccOcto|rBus settings") + -- everything is laid out inside this, clear of the thick dialog border + body = CreateFrame("Frame", nil, frame) + body:SetPoint("TOPLEFT", frame, "TOPLEFT", PAD, -PAD) + body:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -PAD, PAD) + + -- gold title plate across the top edge, like the stock option windows + local header = frame:CreateTexture(nil, "ARTWORK") + header:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") + header:SetWidth(256) + header:SetHeight(64) + header:SetPoint("TOP", frame, "TOP", 0, 12) + + local title = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") + title:SetPoint("TOP", header, "TOP", 0, -14) + title:SetText("OctoBus Settings") local close = CreateFrame("Button", nil, frame, "UIPanelCloseButton") - close:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 2, 2) + close:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -5, -5) close:SetFrameLevel(frame:GetFrameLevel() + 5) close:SetScript("OnClick", function() frame:Hide() end) @@ -114,15 +122,13 @@ local function Build() 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) + local outl = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") + outl:SetPoint("TOPLEFT", body, "TOPLEFT", 18, -284) outl:SetText("Text outline:") - outl:SetTextColor(1, 0.82, 0) - local OUTLINES = { { "thin", "Thin", 96 }, { "thick", "Thick", 156 }, { "shadow", "Shadow", 222 } } + local OUTLINES = { { "none", "None", 92 }, { "thin", "Thin", 152 }, { "thick", "Thick", 206 }, { "shadow", "Shadow", 264 } } 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, + Check(OUTLINES[i][2], OUTLINES[i][3], -278, function() return (C.outline or "none") == key end, function() C.outline = key OB.ApplyLook() @@ -134,11 +140,9 @@ local function Build() 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, -372) + local corner = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") + corner:SetPoint("TOPLEFT", body, "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, -386 }, { "TOPRIGHT", "Top right", 150, -386 }, { "BOTTOMLEFT", "Bottom left", 14, -410 }, { "BOTTOMRIGHT", "Bottom right", 150, -410 }, @@ -175,7 +179,7 @@ local function Build() local reset = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate") reset:SetWidth(150) reset:SetHeight(20) - reset:SetPoint("BOTTOM", frame, "BOTTOM", 0, 12) + reset:SetPoint("BOTTOM", body, "BOTTOM", 0, 12) reset:SetText("Reset window look") reset:SetScript("OnClick", function() C.bgAlpha, C.alpha, C.textScale, C.textAlpha, C.widthScale, C.vibrance, C.outline = nil, nil, nil, nil, nil, nil, nil