Skip to content

Commit 9dd08a5

Browse files
committed
Revert "Badge: shape (square, rounded, pill), border thickness, fill and border colours"
This reverts commit 20592a1.
1 parent 9f8d2d7 commit 9dd08a5

7 files changed

Lines changed: 15 additions & 233 deletions

File tree

‎CLAUDE.md‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ live in game after `/reload`.
6969
"lsm:<name>", looked up lazily, no embedded lib), colour "progress" (`ProgressColor`, off by
7070
default), shadow check (off by default). Dropdowns wrap long lists into columns
7171
(`DROPDOWN_MAX_ROWS`) and can draw entries in their own font (`fontFor`).
72-
- Badge (branch experiment/badge, 2026-11-09): progress text in a badge; shape square/rounded/pill
73-
(`BADGE_SHAPES`, caps `icons/badge/*.tga` made by `tools/make_badge.lua`, `ShapeLayer`), border
74-
thickness, fill and border colours via the game colour picker (`OpenColorPicker`, both APIs,
75-
`AddColorSwatch`). Colour settings are {r,g,b,a} tables, always replaced, never edited in place.
7672
- (Older layout notes below.)
7773
- Left: a box of **four Ace3-style tabs** (game textures `UI-OptionsFrame-ActiveTab/InActiveTab`,
7874
tabs stretched to fill, like BlizzMove): **Display** (Enable addon; Quest mobs ☑ + size, horizontal

‎CSCoder_QuestIndicator.lua‎

Lines changed: 15 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ local DEFAULTS = {
3333
progressColor = "white", -- "white", "gold", "green", "kind" (same colour as the icon) or "progress" (red to green)
3434
progressFormat = "slash", -- "slash" 8/12, "spaced" 8 / 12, "both" 8/12 (67%), "percent" 67%, "left" 4 left
3535
progressShadow = false, -- drop shadow behind the text
36-
progressBadge = true, -- the text sits in a badge -- experiment
37-
badgeShape = "rounded", -- "square", "rounded" or "pill"
38-
badgeBorderSize = 1, -- border thickness in pixels (0 = none)
39-
badgeColor = { 0.05, 0.04, 0.02, 0.85 }, -- fill (r, g, b, a); replaced, never changed in place
40-
badgeBorderColor = { 1, 0.82, 0, 0.9 }, -- border
36+
progressBadge = true, -- the text sits in a badge (dark pill, gold border) -- experiment
4137
progressX = 36, -- its X
4238
progressY = 0, -- its Y
4339
bounce = true, -- floating up/down animation
@@ -112,63 +108,9 @@ local KIND_TINT = { daily = { 0.55, 0.8, 1 }, group = { 1, 0.5, 0.45 } }
112108
local TEXT_FONTS = { friz = "Fonts\\FRIZQT__.TTF", arial = "Fonts\\ARIALN.TTF", skurri = "Fonts\\skurri.ttf", morpheus = "Fonts\\MORPHEUS.TTF" }
113109
local TEXT_FONT_ORDER = { "friz", "arial", "skurri", "morpheus" }
114110
local PROGRESS_FORMATS = { "slash", "spaced", "both", "percent", "left" }
115-
-- Badge behind the progress text: a border shape with the fill shape inset by the border
116-
-- thickness. Rounded and pill ends are white cap textures (left end; the right end is the same
117-
-- texture mirrored), tinted and stretched to the badge height; the middle is a plain colour.
118-
local BADGE_PAD_X, BADGE_PAD_Y = 8, 4
119-
local BADGE_SHAPES = { "square", "rounded", "pill" }
120-
local BADGE_CAPS = {
121-
rounded = { file = "badge\\rounded", ratio = 16 / 64 }, -- cap width / height
122-
pill = { file = "badge\\pill", ratio = 32 / 64 },
123-
}
124-
125-
local function BadgeLayer(text, layer, sublevel)
126-
local left = text:CreateTexture(nil, layer, nil, sublevel)
127-
local middle = text:CreateTexture(nil, layer, nil, sublevel)
128-
local right = text:CreateTexture(nil, layer, nil, sublevel)
129-
return { left = left, middle = middle, right = right }
130-
end
131-
132-
-- Lays out one layer (border or fill) inside the text frame, inset by `inset` pixels.
133-
local function ShapeLayer(parts, text, shape, inset, width, height, color)
134-
local r, g, b, a = color[1], color[2], color[3], color[4] or 1
135-
local h = height - inset * 2
136-
local cap = BADGE_CAPS[shape]
137-
parts.middle:ClearAllPoints()
138-
parts.middle:SetColorTexture(r, g, b, a)
139-
if not cap or h <= 0 then
140-
parts.left:Hide(); parts.right:Hide()
141-
parts.middle:SetPoint("TOPLEFT", text, "TOPLEFT", inset, -inset)
142-
parts.middle:SetPoint("BOTTOMRIGHT", text, "BOTTOMRIGHT", -inset, inset)
143-
parts.middle:SetShown(h > 0)
144-
return
145-
end
146-
local capWidth = math.min(h * cap.ratio, (width - inset * 2) / 2)
147-
for _, side in ipairs({ "left", "right" }) do
148-
local tex = parts[side]
149-
tex:SetTexture(IconPath(cap.file))
150-
tex:SetVertexColor(r, g, b, a)
151-
tex:SetSize(capWidth, h)
152-
tex:ClearAllPoints()
153-
if side == "left" then
154-
tex:SetTexCoord(0, 1, 0, 1)
155-
tex:SetPoint("LEFT", text, "LEFT", inset, 0)
156-
else
157-
tex:SetTexCoord(1, 0, 0, 1)
158-
tex:SetPoint("RIGHT", text, "RIGHT", -inset, 0)
159-
end
160-
tex:Show()
161-
end
162-
parts.middle:SetPoint("TOPLEFT", parts.left, "TOPRIGHT")
163-
parts.middle:SetPoint("BOTTOMRIGHT", parts.right, "BOTTOMLEFT")
164-
parts.middle:Show()
165-
end
166-
167-
local function ShowBadge(text, show)
168-
for _, layer in ipairs({ text.badgeBorder, text.badgeFill }) do
169-
for _, tex in pairs(layer) do tex:SetShown(show) end
170-
end
171-
end
111+
local BADGE_BACKDROP = { bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
112+
tile = true, tileSize = 16, edgeSize = 10, insets = { left = 2, right = 2, top = 2, bottom = 2 } }
113+
local BADGE_PAD_X, BADGE_PAD_Y = 8, 5
172114

173115
local TEXT_OUTLINES = { none = "", thin = "OUTLINE", thick = "THICKOUTLINE" }
174116
local TEXT_COLORS = { white = { 1, 1, 1 }, gold = { 1, 0.82, 0 }, green = { 0.3, 1, 0.3 } }
@@ -475,20 +417,14 @@ local function StyleIcon(f)
475417
color = color or TEXT_COLORS.white
476418
label:SetTextColor(color[1], color[2], color[3])
477419
label:SetText(shown)
478-
-- Badge: the chosen shape sized to the text, in the chosen fill and border colours.
479-
if db.progressBadge then
480-
local height = math.floor((label:GetStringHeight() or 12) + BADGE_PAD_Y * 2 + 0.5)
481-
local width = math.floor((label:GetStringWidth() or 30) + BADGE_PAD_X * 2 + 0.5)
482-
if BADGE_CAPS[db.badgeShape] then width = width + height * BADGE_CAPS[db.badgeShape].ratio * 0.6 end
483-
width = math.max(width, height)
484-
text:SetSize(width, height)
485-
local border = db.badgeBorderSize or 0
486-
ShapeLayer(text.badgeBorder, text, db.badgeShape, 0, width, height, border > 0 and db.badgeBorderColor or { 0, 0, 0, 0 })
487-
ShapeLayer(text.badgeFill, text, db.badgeShape, border, width, height, db.badgeColor)
488-
ShowBadge(text, true)
489-
if border == 0 then for _, tex in pairs(text.badgeBorder) do tex:Hide() end end
420+
-- Badge: a dark pill sized to the text, with a gold border.
421+
if db.progressBadge and text.SetBackdrop then
422+
text:SetBackdrop(BADGE_BACKDROP)
423+
text:SetBackdropColor(0.05, 0.04, 0.02, 0.85)
424+
text:SetBackdropBorderColor(1, 0.82, 0, 0.9)
425+
text:SetSize((label:GetStringWidth() or 30) + BADGE_PAD_X * 2, (label:GetStringHeight() or 12) + BADGE_PAD_Y * 2)
490426
else
491-
ShowBadge(text, false)
427+
if text.SetBackdrop then text:SetBackdrop(nil) end
492428
text:SetSize(60, 20)
493429
end
494430
text:SetScale(1 / scale)
@@ -556,12 +492,9 @@ local function CreateIcon()
556492
icon:SetAllPoints()
557493
f.icon = icon
558494

559-
local text = CreateFrame("Frame", nil, f)
495+
-- Backdrop template so the progress text can sit in a badge (dark pill, gold border).
496+
local text = CreateFrame("Frame", nil, f, BackdropTemplateMixin and "BackdropTemplate" or nil)
560497
text:SetSize(60, 20)
561-
-- Badge layers under the text (see ShapeLayer): border, then the fill on top of it.
562-
text.badgeBorder = BadgeLayer(text, "BACKGROUND", 1)
563-
text.badgeFill = BadgeLayer(text, "BORDER", 1)
564-
ShowBadge(text, false)
565498
text.label = text:CreateFontString(nil, "OVERLAY")
566499
text.label:SetPoint("CENTER")
567500
text.label:SetFont(TEXT_FONTS.friz, DEFAULTS.progressSize, "OUTLINE")
@@ -1081,71 +1014,6 @@ local function AddSlider(parent, labelKey, settingKey, low, high, step, x, y, fo
10811014
return slider, title, input
10821015
end
10831016

1084-
-- Opens the game's colour picker (with opacity) on `color` ({ r, g, b, a }); onChange gets a
1085-
-- new table on every change, and the original back on cancel. Handles both the current
1086-
-- picker API (SetupColorPickerAndShow) and the older one (fields + Show).
1087-
local function OpenColorPicker(color, onChange)
1088-
local picker = _G.ColorPickerFrame
1089-
if not picker then return end
1090-
local r, g, b, a = color[1], color[2], color[3], color[4] or 1
1091-
local function Current()
1092-
local nr, ng, nb = picker:GetColorRGB()
1093-
local na = a
1094-
if picker.GetColorAlpha then
1095-
na = picker:GetColorAlpha()
1096-
elseif _G.OpacitySliderFrame then
1097-
na = 1 - _G.OpacitySliderFrame:GetValue() -- the old slider holds transparency
1098-
end
1099-
onChange({ nr, ng, nb, na })
1100-
end
1101-
local function Cancel() onChange({ r, g, b, a }) end
1102-
if picker.SetupColorPickerAndShow then
1103-
picker:SetupColorPickerAndShow({ r = r, g = g, b = b, opacity = a, hasOpacity = true,
1104-
swatchFunc = Current, opacityFunc = Current, cancelFunc = Cancel })
1105-
else
1106-
picker.func, picker.opacityFunc, picker.cancelFunc = Current, Current, Cancel
1107-
picker.hasOpacity, picker.opacity, picker.previousValues = true, 1 - a, { r, g, b, a }
1108-
picker:SetColorRGB(r, g, b)
1109-
picker:Hide()
1110-
picker:Show()
1111-
end
1112-
end
1113-
1114-
-- A colour swatch with its label; a click opens the colour picker for db[settingKey].
1115-
local function AddColorSwatch(parent, labelKey, settingKey, x, y)
1116-
local b = CreateFrame("Button", nil, parent)
1117-
b:SetSize(22, 22)
1118-
b:SetPoint("TOPLEFT", x, y)
1119-
local edge = b:CreateTexture(nil, "BACKGROUND")
1120-
edge:SetAllPoints()
1121-
edge:SetColorTexture(0.7, 0.7, 0.7, 1)
1122-
local checker = b:CreateTexture(nil, "BORDER") -- dark under the colour, so transparency shows
1123-
checker:SetPoint("TOPLEFT", 2, -2)
1124-
checker:SetPoint("BOTTOMRIGHT", -2, 2)
1125-
checker:SetColorTexture(0.15, 0.15, 0.15, 1)
1126-
local swatch = b:CreateTexture(nil, "ARTWORK")
1127-
swatch:SetPoint("TOPLEFT", 2, -2)
1128-
swatch:SetPoint("BOTTOMRIGHT", -2, 2)
1129-
local label = parent:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
1130-
label:SetPoint("LEFT", b, "RIGHT", 8, 0)
1131-
Loc(label, labelKey)
1132-
b:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square", "ADD")
1133-
local function Sync()
1134-
local c = db[settingKey] or DEFAULTS[settingKey]
1135-
swatch:SetColorTexture(c[1], c[2], c[3], c[4] or 1)
1136-
end
1137-
b:SetScript("OnClick", function()
1138-
OpenColorPicker(db[settingKey] or DEFAULTS[settingKey], function(color)
1139-
db[settingKey] = color
1140-
Sync()
1141-
ApplySettings()
1142-
end)
1143-
end)
1144-
refreshers[#refreshers + 1] = Sync
1145-
parent:HookScript("OnShow", Sync)
1146-
return b, label
1147-
end
1148-
11491017
-- A section heading with its own on/off check on the left.
11501018
local function AddSectionCheck(parent, labelKey, settingKey, x, y)
11511019
local check = AddCheck(parent, labelKey, nil, settingKey, x - 4, y + 6)
@@ -1692,8 +1560,7 @@ local DISPLAY_KEYS = { "active", "enabled", "objects", "anchor", "scale", "offse
16921560
"objectAnchor", "objectScale", "objectOffsetX", "objectOffset" }
16931561
local ICON_KEYS = { "style", "bounce", "bounceHeight", "bounceSpeed", "glow", "glowAlpha" }
16941562
local PROGRESS_KEYS = { "progress", "progressAttach", "progressFloat", "progressSize", "progressFont",
1695-
"progressOutline", "progressColor", "progressFormat", "progressShadow", "progressBadge", "badgeShape", "badgeBorderSize", "badgeColor", "badgeBorderColor",
1696-
"progressX", "progressY" }
1563+
"progressOutline", "progressColor", "progressFormat", "progressShadow", "progressBadge", "progressX", "progressY" }
16971564
local BEHAVIOR_KEYS = { "colorByType", "combat", "minimap", "minimapAngle", "sound", "soundChoice" }
16981565

16991566
local function ResetKeys(keys)
@@ -1802,15 +1669,6 @@ local function BuildProgressTab(tab)
18021669
local function FreeTextOn() return ProgressOn() and not db.progressAttach end
18031670
Gate(FreeTextOn, AddSlider(tab, "POS_X", "progressX", -POSITION_RANGE, POSITION_RANGE, 1, COL1 + 4, TOP - 270, "%d"))
18041671
Gate(FreeTextOn, AddSlider(tab, "POS_Y", "progressY", -POSITION_RANGE, POSITION_RANGE, 1, COL2 + 4, TOP - 270, "%d"))
1805-
1806-
-- Badge look: shape and border thickness, then fill and border colours (the text colour is above).
1807-
local function BadgeOn() return ProgressOn() and db.progressBadge end
1808-
Gate(BadgeOn, AddDropdown(tab, "BADGE_SHAPE", BADGE_SHAPES,
1809-
function(value) return L["SHAPE_" .. value] end, Choice("badgeShape"), SetChoice("badgeShape"),
1810-
COL1 + 4, TOP - 322, COLUMN_DROPDOWN))
1811-
Gate(BadgeOn, AddSlider(tab, "BADGE_BORDER", "badgeBorderSize", 0, 4, 1, COL2 + 4, TOP - 322, "%d"))
1812-
Gate(BadgeOn, AddColorSwatch(tab, "BADGE_COLOR", "badgeColor", COL1 + 4, TOP - 376))
1813-
Gate(BadgeOn, AddColorSwatch(tab, "BADGE_BORDER_COLOR", "badgeBorderColor", COL2 + 4, TOP - 376))
18141672
end
18151673

18161674
local function BuildIconTab(tab)
@@ -1972,7 +1830,7 @@ end
19721830
local SETTINGS_SECTIONS = {
19731831
{ key = "TAB_DISPLAY", build = BuildDisplayTab, height = 258 },
19741832
{ key = "TAB_ICON", build = BuildIconTab, height = 184 },
1975-
{ key = "TAB_PROGRESS", build = BuildProgressTab, height = 404 },
1833+
{ key = "TAB_PROGRESS", build = BuildProgressTab, height = 310 },
19761834
{ key = "TAB_BEHAVIOR", build = BuildBehaviorTab, height = 152 },
19771835
}
19781836
local SECTION_GAP = 18

‎Locales.lua‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -770,26 +770,6 @@ local badgeText = {
770770
for code, texts in pairs(badgeText) do
771771
locales[code].PROGRESS_BADGE, locales[code].PROGRESS_BADGE_TIP = texts[1], texts[2]
772772
end
773-
774-
-- Badge look: shape, border thickness, colours.
775-
local badgeLook = {
776-
enUS = { BADGE_SHAPE = "Badge shape", SHAPE_square = "Square", SHAPE_rounded = "Rounded", SHAPE_pill = "Pill",
777-
BADGE_BORDER = "Border thickness", BADGE_COLOR = "Badge color", BADGE_BORDER_COLOR = "Border color" },
778-
ptBR = { BADGE_SHAPE = "Formato do badge", SHAPE_square = "Quadrado", SHAPE_rounded = "Arredondado", SHAPE_pill = "Pílula",
779-
BADGE_BORDER = "Espessura da borda", BADGE_COLOR = "Cor do badge", BADGE_BORDER_COLOR = "Cor da borda" },
780-
esES = { BADGE_SHAPE = "Forma de la insignia", SHAPE_square = "Cuadrada", SHAPE_rounded = "Redondeada", SHAPE_pill = "Píldora",
781-
BADGE_BORDER = "Grosor del borde", BADGE_COLOR = "Color de la insignia", BADGE_BORDER_COLOR = "Color del borde" },
782-
deDE = { BADGE_SHAPE = "Form des Abzeichens", SHAPE_square = "Eckig", SHAPE_rounded = "Abgerundet", SHAPE_pill = "Pille",
783-
BADGE_BORDER = "Randstärke", BADGE_COLOR = "Abzeichenfarbe", BADGE_BORDER_COLOR = "Randfarbe" },
784-
frFR = { BADGE_SHAPE = "Forme du badge", SHAPE_square = "Carré", SHAPE_rounded = "Arrondi", SHAPE_pill = "Pastille",
785-
BADGE_BORDER = "Épaisseur du bord", BADGE_COLOR = "Couleur du badge", BADGE_BORDER_COLOR = "Couleur du bord" },
786-
itIT = { BADGE_SHAPE = "Forma del badge", SHAPE_square = "Quadrato", SHAPE_rounded = "Arrotondato", SHAPE_pill = "Pillola",
787-
BADGE_BORDER = "Spessore del bordo", BADGE_COLOR = "Colore del badge", BADGE_BORDER_COLOR = "Colore del bordo" },
788-
}
789-
for code, keys in pairs(badgeLook) do
790-
for k, v in pairs(keys) do locales[code][k] = v end
791-
end
792-
793773
-- Icon anchor: which side of the nameplate the icon sits on.
794774
local anchorText = {
795775
enUS = { ICON_ANCHOR = "Anchor", ANCHOR_top = "Top", ANCHOR_bottom = "Bottom", ANCHOR_left = "Left", ANCHOR_right = "Right" },

‎icons/badge/pill.tga‎

-8.02 KB
Binary file not shown.

‎icons/badge/rounded.tga‎

-4.02 KB
Binary file not shown.

‎tools/make_badge.lua‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎tools/wowmock.lua‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ env.Settings = {
7070
OpenToCategory = function() end,
7171
}
7272
env.BackdropTemplateMixin = {}
73-
-- Colour picker (current API): reports a green the moment it opens.
74-
env.ColorPickerFrame = {
75-
GetColorRGB = function() return 0.1, 0.8, 0.1 end,
76-
GetColorAlpha = function() return 1 end,
77-
SetupColorPickerAndShow = function(self, info) info.swatchFunc() end,
78-
}
7973
env.Enum = { TooltipDataLineType = { QuestObjective = 8, QuestTitle = 17 } }
8074
env.SlashCmdList = {}
8175
-- Lua builtins the addon uses
@@ -158,5 +152,3 @@ for _, e in ipairs(errors) do print(" " .. e) end
158152
local pname = db.profiles.Default and "Default" or db.chars["Tester - Realm"]
159153
local p = db.profiles[pname]
160154
print(pname .. ": scale", p.scale, "offset", p.offset, "style", p.style, "glow", p.glow, "| root.scale", db.scale, "| savedCVars", db.savedCVars and db.savedCVars.SoftTargetIconGameObject)
161-
local bc = p.badgeColor or {}
162-
print("badge:", p.badgeShape, "border", p.badgeBorderSize, "fill", bc[1], bc[2], bc[3], bc[4])

0 commit comments

Comments
 (0)