Skip to content

Commit

Permalink
UI tweaks (#80)
Browse files Browse the repository at this point in the history
- title bar doubleclick search now has a background
- main window is now wider
- backslashes replaced with forward slashes in path matching
  • Loading branch information
SinusPi authored Nov 15, 2022
1 parent 3206c94 commit c9c054f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 23 deletions.
12 changes: 6 additions & 6 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
12 changes: 6 additions & 6 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ldb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
26 changes: 17 additions & 9 deletions sack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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]
Expand All @@ -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)

Expand Down

0 comments on commit c9c054f

Please sign in to comment.