From c9c054ff6ae7dd6c840369e78e556c6ea81237e7 Mon Sep 17 00:00:00 2001 From: Sinus Date: Tue, 15 Nov 2022 03:59:00 +0100 Subject: [PATCH] UI tweaks (#80) - title bar doubleclick search now has a background - main window is now wider - backslashes replaced with forward slashes in path matching --- config.lua | 12 ++++++------ core.lua | 12 ++++++------ ldb.lua | 4 ++-- sack.lua | 26 +++++++++++++++++--------- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/config.lua b/config.lua index 7298a45..c888426 100644 --- a/config.lua +++ b/config.lua @@ -88,29 +88,29 @@ frame:SetScript("OnShow", function(frame) end BugSackFontSizeText:SetText(L["Font size"]) - local dropdown = CreateFrame("Frame", "BugSackSoundDropdown", frame, "UIDropDownMenuTemplate") - dropdown:SetPoint("LEFT", fontSizeDropdown, "RIGHT", 140, 0) - dropdown.initialize = function() + local soundDropdown = CreateFrame("Frame", "BugSackSoundDropdown", frame, "UIDropDownMenuTemplate") + soundDropdown:SetPoint("LEFT", fontSizeDropdown, "RIGHT", 150, 0) + soundDropdown.initialize = function() wipe(info) for _, sound in next, LibStub("LibSharedMedia-3.0"):List("sound") do info.text = sound info.value = sound info.func = function(self) addon.db.soundMedia = self.value - BugSackSoundDropdownText:SetText(self:GetText()) + soundDropdown.Text:SetText(self:GetText()) end info.checked = sound == addon.db.soundMedia UIDropDownMenu_AddButton(info) end end - BugSackSoundDropdownText:SetText(L["Sound"]) + soundDropdown.Text:SetText(L["Sound"]) local master = newCheckbox( L.useMaster, L.useMasterDesc, function(self, value) addon.db.useMaster = value end) master:SetChecked(addon.db.useMaster) - master:SetPoint("LEFT", dropdown, "RIGHT", 140, 0) + master:SetPoint("LEFT", soundDropdown, "RIGHT", 140, 0) local clear = CreateFrame("Button", "BugSackSaveButton", frame, "UIPanelButtonTemplate") clear:SetText(L["Wipe saved bugs"]) diff --git a/core.lua b/core.lua index 6a375ff..597513d 100644 --- a/core.lua +++ b/core.lua @@ -34,7 +34,7 @@ addon.healthCheck = true -- Sound local media = LibStub("LibSharedMedia-3.0") -media:Register("sound", "BugSack: Fatality", "Interface\\AddOns\\BugSack\\Media\\error.ogg") +media:Register("sound", "BugSack: Fatality", "Interface\\AddOns\\"..addonName.."\\Media\\error.ogg") ----------------------------------------------------------------------- -- Utility @@ -185,22 +185,22 @@ end do local function colorStack(ret) ret = tostring(ret) or "" -- Yes, it gets called with nonstring from somewhere /mikk - ret = ret:gsub("[%.I][%.n][%.t][%.e][%.r]face\\", "") - ret = ret:gsub("%.?%.?%.?\\?AddOns\\", "") + ret = ret:gsub("[%.I][%.n][%.t][%.e][%.r]face/", "") + ret = ret:gsub("%.?%.?%.?/?AddOns/", "") ret = ret:gsub("|([^chHr])", "||%1"):gsub("|$", "||") -- Pipes ret = ret:gsub("<(.-)>", "|cffffea00<%1>|r") -- Things wrapped in <> ret = ret:gsub("%[(.-)%]", "|cffffea00[%1]|r") -- Things wrapped in [] ret = ret:gsub("([\"`'])(.-)([\"`'])", "|cff8888ff%1%2%3|r") -- Quotes ret = ret:gsub(":(%d+)([%S\n])", ":|cff00ff00%1|r%2") -- Line numbers - ret = ret:gsub("([^\\]+%.lua)", "|cffffffff%1|r") -- Lua files + ret = ret:gsub("([^/]+%.lua)", "|cffffffff%1|r") -- Lua files return ret end addon.ColorStack = colorStack local function colorLocals(ret) ret = tostring(ret) or "" -- Yes, it gets called with nonstring from somewhere /mikk - ret = ret:gsub("[%.I][%.n][%.t][%.e][%.r]face\\", "") - ret = ret:gsub("%.?%.?%.?\\?AddOns\\", "") + ret = ret:gsub("[%.I][%.n][%.t][%.e][%.r]face/", "") + ret = ret:gsub("%.?%.?%.?/?AddOns/", "") ret = ret:gsub("|(%a)", "||%1"):gsub("|$", "||") -- Pipes ret = ret:gsub("> %@(.-):(%d+)", "> @|cffeda55f%1|r:|cff00ff00%2|r") -- Files/Line Numbers of locals ret = ret:gsub("(%s-)([%a_%(][%a_%d%*%)]+) = ", "%1|cffffff80%2|r = ") -- Table keys diff --git a/ldb.lua b/ldb.lua index 441819d..fd289a2 100644 --- a/ldb.lua +++ b/ldb.lua @@ -8,7 +8,7 @@ if not ldb then return end local plugin = ldb:NewDataObject(addonName, { type = "data source", text = "0", - icon = "Interface\\AddOns\\BugSack\\Media\\icon", + icon = "Interface\\AddOns\\"..addonName.."\\Media\\icon", }) local BugGrabber = BugGrabber @@ -33,7 +33,7 @@ end hooksecurefunc(addon, "UpdateDisplay", function() local count = #addon:GetErrors(BugGrabber:GetSessionId()) plugin.text = count - plugin.icon = count == 0 and "Interface\\AddOns\\BugSack\\Media\\icon" or "Interface\\AddOns\\BugSack\\Media\\icon_red" + plugin.icon = count == 0 and "Interface\\AddOns\\"..addonName.."\\Media\\icon" or "Interface\\AddOns\\"..addonName.."\\Media\\icon_red" end) do diff --git a/sack.lua b/sack.lua index 6799cb5..2c908c9 100644 --- a/sack.lua +++ b/sack.lua @@ -177,7 +177,7 @@ local function createBugSack() window:Hide() window:SetFrameStrata("DIALOG") - window:SetWidth(500) + window:SetWidth(800) window:SetHeight(310) window:SetPoint("CENTER") window:SetMovable(true) @@ -320,10 +320,19 @@ local function createBugSack() searchLabel:SetTextColor(1, 1, 1, 1) searchLabel:Hide() - searchBox = CreateFrame("EditBox", nil, window) + searchBox = CreateFrame("EditBox", nil, window, "BackdropTemplate") searchBox:SetTextInsets(4, 4, 0, 0) searchBox:SetMaxLetters(50) searchBox:SetFontObject("ChatFontNormal") + searchBox:SetBackdrop({ + edgeFile = nil, + bgFile = "Interface\\ChatFrame\\ChatFrameBackground", + insets = { left = 0, right = 0, top = 0, bottom = 0 }, + tile = true, + tileSize = 16, + edgeSize = 1, + }) + searchBox:SetBackdropColor(0, 0, 0, 0.5) searchBox:SetScript("OnShow", function(self) self:SetFocus() end) @@ -338,14 +347,11 @@ local function createBugSack() searchBox:SetPoint("BOTTOMRIGHT", titlebg, "BOTTOMRIGHT", -26, 1) searchBox:Hide() - local searchBackdrop = searchBox:CreateTexture(nil, "BACKGROUND") - searchBackdrop:SetAllPoints() - searchBackdrop:SetColorTexture(0, 0, 0, 0.5) - nextButton = CreateFrame("Button", "BugSackNextButton", window, "UIPanelButtonTemplate") nextButton:SetPoint("BOTTOMRIGHT", window, -11, 16) nextButton:SetFrameStrata("FULLSCREEN") - nextButton:SetWidth(130) + nextButton:SetHeight(40) + nextButton:SetWidth(200) nextButton:SetText(L["Next >"]) nextButton:SetScript("OnClick", function() if IsShiftKeyDown() then @@ -359,7 +365,8 @@ local function createBugSack() prevButton = CreateFrame("Button", "BugSackPrevButton", window, "UIPanelButtonTemplate") prevButton:SetPoint("BOTTOMLEFT", window, 14, 16) prevButton:SetFrameStrata("FULLSCREEN") - prevButton:SetWidth(130) + prevButton:SetHeight(40) + prevButton:SetWidth(200) prevButton:SetText(L["< Previous"]) prevButton:SetScript("OnClick", function() if IsShiftKeyDown() then @@ -375,6 +382,7 @@ local function createBugSack() sendButton:SetPoint("LEFT", prevButton, "RIGHT") sendButton:SetPoint("RIGHT", nextButton, "LEFT") sendButton:SetFrameStrata("FULLSCREEN") + sendButton:SetHeight(40) sendButton:SetText(L["Send bugs"]) sendButton:SetScript("OnClick", function() local eo = currentSackContents[currentErrorIndex] @@ -396,7 +404,7 @@ local function createBugSack() textArea:SetMaxLetters(99999) textArea:EnableMouse(true) textArea:SetScript("OnEscapePressed", textArea.ClearFocus) - textArea:SetWidth(450) + textArea:SetWidth(750) scroll:SetScrollChild(textArea)