mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-02 03:39:59 +00:00
backdrop api: rework every single frame sizing
This commit breaks alot of compatibility and maybe other things too. The change was necessary, because the old framework ran up against its limits. A lot of new configuration options are now possible and some of them were already added.
This commit is contained in:
+59
-49
@@ -1,15 +1,16 @@
|
||||
pfUI:RegisterModule("gui", function ()
|
||||
local default_border = tonumber(pfUI_config.appearance.border.default)
|
||||
|
||||
pfUI.gui = CreateFrame("Frame",nil,UIParent)
|
||||
|
||||
pfUI.gui:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
|
||||
pfUI.gui:SetFrameStrata("DIALOG")
|
||||
pfUI.gui:SetWidth(480)
|
||||
pfUI.gui:SetHeight(360)
|
||||
pfUI.gui:SetWidth(500)
|
||||
pfUI.gui:SetHeight(500)
|
||||
pfUI.gui:Hide()
|
||||
|
||||
pfUI.gui:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.gui:SetBackdropColor(0,0,0,.75)
|
||||
pfUI.utils:CreateBackdrop(pfUI.gui, nil, nil, true)
|
||||
pfUI.gui:SetPoint("CENTER",0,0)
|
||||
pfUI.gui:SetMovable(true)
|
||||
pfUI.gui:EnableMouse(true)
|
||||
@@ -49,7 +50,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui.reloadDialog:Hide()
|
||||
tinsert(UISpecialFrames, "pfReloadDiag")
|
||||
|
||||
pfUI.gui.reloadDialog:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.utils:CreateBackdrop(pfUI.gui.reloadDialog)
|
||||
pfUI.gui.reloadDialog:SetPoint("CENTER",0,0)
|
||||
|
||||
pfUI.gui.reloadDialog.text = pfUI.gui.reloadDialog:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||
@@ -58,7 +59,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui.reloadDialog.text:SetText("Some settings need to reload the UI to take effect.\nDo you want to reloadUI now?")
|
||||
|
||||
pfUI.gui.reloadDialog.yes = CreateFrame("Button", "pfReloadYes", pfUI.gui.reloadDialog, "UIPanelButtonTemplate")
|
||||
pfUI.gui.reloadDialog.yes:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.utils:CreateBackdrop(pfUI.gui.reloadDialog.yes, nil, true)
|
||||
pfUI.gui.reloadDialog.yes:SetWidth(100)
|
||||
pfUI.gui.reloadDialog.yes:SetHeight(20)
|
||||
pfUI.gui.reloadDialog.yes:SetPoint("BOTTOMLEFT", 20,15)
|
||||
@@ -156,9 +157,8 @@ pfUI:RegisterModule("gui", function ()
|
||||
frame.drag = CreateFrame("Frame", nil, frame)
|
||||
frame.drag:SetAllPoints(frame)
|
||||
frame.drag:SetFrameStrata("DIALOG")
|
||||
frame.drag:SetBackdrop(pfUI.backdrop_col)
|
||||
frame.drag:SetBackdropBorderColor(.2, 1, .8)
|
||||
frame.drag:SetBackdropColor(1,1,1,.75)
|
||||
pfUI.utils:CreateBackdrop(frame.drag, nil, nil, true)
|
||||
frame.drag.backdrop:SetBackdropBorderColor(.2, 1, .8)
|
||||
frame.drag:EnableMouseWheel(1)
|
||||
frame.drag.text = frame.drag:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||
frame.drag.text:SetFont("Interface\\AddOns\\pfUI\\fonts\\" .. pfUI_config.global.font_default .. ".ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
@@ -199,7 +199,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
local cframe = getglobal("pfRaid" .. i)
|
||||
cframe:StartMoving()
|
||||
cframe:StopMovingOrSizing()
|
||||
cframe.drag:SetBackdropBorderColor(1,1,1,1)
|
||||
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
|
||||
end
|
||||
end
|
||||
if strsub(frame:GetName(),0,7) == "pfGroup" then
|
||||
@@ -207,7 +207,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
local cframe = getglobal("pfGroup" .. i)
|
||||
cframe:StartMoving()
|
||||
cframe:StopMovingOrSizing()
|
||||
cframe.drag:SetBackdropBorderColor(1,1,1,1)
|
||||
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
|
||||
end
|
||||
end
|
||||
_, _, _, xpos, ypos = frame:GetPoint()
|
||||
@@ -215,14 +215,14 @@ pfUI:RegisterModule("gui", function ()
|
||||
else
|
||||
frame.oldPos = nil
|
||||
end
|
||||
frame.drag:SetBackdropBorderColor(1,1,1,1)
|
||||
frame.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
|
||||
frame:StartMoving()
|
||||
end)
|
||||
|
||||
frame.drag:SetScript("OnMouseUp",function()
|
||||
frame:StopMovingOrSizing()
|
||||
_, _, _, xpos, ypos = frame:GetPoint()
|
||||
frame.drag:SetBackdropBorderColor(.2,1,.8,1)
|
||||
frame.drag.backdrop:SetBackdropBorderColor(.2,1,.8,1)
|
||||
|
||||
if frame.oldPos then
|
||||
local diffxpos = frame.oldPos[1] - xpos
|
||||
@@ -231,7 +231,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
if strsub(frame:GetName(),0,6) == "pfRaid" then
|
||||
for i=1,40 do
|
||||
local cframe = getglobal("pfRaid" .. i)
|
||||
cframe.drag:SetBackdropBorderColor(.2,1,.8,1)
|
||||
cframe.drag.backdrop:SetBackdropBorderColor(.2,1,.8,1)
|
||||
if cframe:GetName() ~= frame:GetName() then
|
||||
local _, _, _, xpos, ypos = cframe:GetPoint()
|
||||
cframe:SetPoint("TOPLEFT", xpos - diffxpos, ypos - diffypos)
|
||||
@@ -249,7 +249,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
elseif strsub(frame:GetName(),0,7) == "pfGroup" then
|
||||
for i=1,4 do
|
||||
local cframe = getglobal("pfGroup" .. i)
|
||||
cframe.drag:SetBackdropBorderColor(.2,1,.8,1)
|
||||
cframe.drag.backdrop:SetBackdropBorderColor(.2,1,.8,1)
|
||||
if cframe:GetName() ~= frame:GetName() then
|
||||
local _, _, _, xpos, ypos = cframe:GetPoint()
|
||||
cframe:SetPoint("TOPLEFT", xpos - diffxpos, ypos - diffypos)
|
||||
@@ -293,18 +293,20 @@ pfUI:RegisterModule("gui", function ()
|
||||
end
|
||||
|
||||
function pfUI.gui:SwitchTab(frame)
|
||||
local elements = { pfUI.gui.global, pfUI.gui.modules, pfUI.gui.uf , pfUI.gui.bar, pfUI.gui.panel,
|
||||
pfUI.gui.tooltip, pfUI.gui.castbar, pfUI.gui.thirdparty, pfUI.gui.chat, pfUI.gui.nameplates }
|
||||
local elements = {
|
||||
pfUI.gui.global, pfUI.gui.appearance, pfUI.gui.modules, pfUI.gui.uf,
|
||||
pfUI.gui.bar, pfUI.gui.panel, pfUI.gui.tooltip, pfUI.gui.castbar,
|
||||
pfUI.gui.thirdparty, pfUI.gui.chat, pfUI.gui.nameplates,
|
||||
}
|
||||
|
||||
for _, hide in pairs(elements) do
|
||||
hide:Hide()
|
||||
hide.switch:SetBackdropBorderColor(1,1,1)
|
||||
hide.switch:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.utils:CreateBackdrop(hide.switch, nil, true)
|
||||
end
|
||||
pfUI.gui.scroll:SetScrollChild(frame)
|
||||
pfUI.gui.scroll:UpdateScrollState()
|
||||
pfUI.gui.scroll:SetVerticalScroll(0)
|
||||
frame.switch:SetBackdrop(pfUI.backdrop_col)
|
||||
pfUI.utils:CreateBackdrop(frame.switch, nil, true)
|
||||
frame.switch:SetBackdropBorderColor(.2,1,.8)
|
||||
frame:Show()
|
||||
end
|
||||
@@ -326,23 +328,22 @@ pfUI:RegisterModule("gui", function ()
|
||||
end
|
||||
|
||||
local frame = CreateFrame("Frame", nil, pfUI.gui)
|
||||
frame:SetWidth(400)
|
||||
frame:SetWidth(pfUI.gui:GetWidth() - 3*default_border - 100)
|
||||
frame:SetHeight(100)
|
||||
|
||||
frame.switch = CreateFrame("Button", nil, pfUI.gui)
|
||||
frame.switch:ClearAllPoints()
|
||||
frame.switch:SetWidth(80)
|
||||
frame.switch:SetHeight(20)
|
||||
frame.switch:SetWidth(100)
|
||||
frame.switch:SetHeight(22)
|
||||
|
||||
if bottom then
|
||||
frame.switch:SetPoint("BOTTOMLEFT", 0, pfUI.gui.tabBottom * 20)
|
||||
frame.switch:SetPoint("BOTTOMLEFT", default_border, pfUI.gui.tabBottom * (22 + default_border) + default_border)
|
||||
else
|
||||
frame.switch:SetPoint("TOPLEFT", 0, -pfUI.gui.tabTop * 20)
|
||||
frame.switch:SetPoint("TOPLEFT", default_border, -pfUI.gui.tabTop* (22 + default_border) -default_border)
|
||||
end
|
||||
frame.switch:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.utils:CreateBackdrop(frame.switch, nil, true)
|
||||
frame.switch.text = frame.switch:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||
frame.switch.text:SetFont("Interface\\AddOns\\pfUI\\fonts\\" .. pfUI_config.global.font_default .. ".ttf", pfUI_config.global.font_size, "OUTLINE")
|
||||
frame.switch.text:ClearAllPoints()
|
||||
frame.switch.text:SetAllPoints(frame.switch)
|
||||
frame.switch.text:SetPoint("CENTER", 0, 0)
|
||||
frame.switch.text:SetFontObject(GameFontWhite)
|
||||
@@ -397,7 +398,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
frame.config = config
|
||||
|
||||
if widget == "warning" then
|
||||
frame:SetBackdrop(pfUI.backdrop_col)
|
||||
pfUI.utils:CreateBackdrop(frame, nil, true)
|
||||
frame:SetBackdropBorderColor(1,.5,.5)
|
||||
frame:SetHeight(50)
|
||||
frame:SetPoint("TOPLEFT", 25, parent.objectCount * -35)
|
||||
@@ -436,7 +437,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
frame.input:SetNormalTexture("")
|
||||
frame.input:SetPushedTexture("")
|
||||
frame.input:SetHighlightTexture("")
|
||||
frame.input:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.utils:CreateBackdrop(frame.input, nil, true)
|
||||
frame.input:SetWidth(14)
|
||||
frame.input:SetHeight(14)
|
||||
frame.input:SetPoint("TOPRIGHT" , 0, -4)
|
||||
@@ -491,7 +492,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
for i,v in ipairs({frame.input:GetRegions()}) do
|
||||
if v.SetTexture then v:Hide() end
|
||||
if v.SetTextColor then v:SetTextColor(.2,1,.8) end
|
||||
if v.SetBackdrop then v:SetBackdrop(pfUI.backdrop) end
|
||||
if v.SetBackdrop then pfUI.utils:CreateBackdrop(v) end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -501,15 +502,14 @@ pfUI:RegisterModule("gui", function ()
|
||||
-- [[ config section ]] --
|
||||
pfUI.gui.deco = CreateFrame("Frame", nil, pfUI.gui)
|
||||
pfUI.gui.deco:ClearAllPoints()
|
||||
pfUI.gui.deco:SetPoint("TOPLEFT", pfUI.gui, "TOPLEFT", 80,0)
|
||||
pfUI.gui.deco:SetPoint("BOTTOMRIGHT", pfUI.gui, "BOTTOMRIGHT", 0,0)
|
||||
pfUI.gui.deco:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.gui.deco:SetBackdropColor(0,0,0,.50)
|
||||
pfUI.gui.deco:SetPoint("TOPLEFT", pfUI.gui, "TOPLEFT", 4*default_border + 100,-2*default_border)
|
||||
pfUI.gui.deco:SetPoint("BOTTOMRIGHT", pfUI.gui, "BOTTOMRIGHT", -2*default_border,2*default_border)
|
||||
pfUI.utils:CreateBackdrop(pfUI.gui.deco, nil, nil, true)
|
||||
|
||||
pfUI.gui.deco.up = CreateFrame("Frame", nil, pfUI.gui.deco)
|
||||
pfUI.gui.deco.up:SetPoint("TOPRIGHT", 0,0)
|
||||
pfUI.gui.deco.up:SetPoint("TOPLEFT", pfUI.gui.deco, "TOPLEFT", 0,0)
|
||||
pfUI.gui.deco.up:SetPoint("TOPRIGHT", pfUI.gui.deco, "TOPRIGHT", 0,0)
|
||||
pfUI.gui.deco.up:SetHeight(16)
|
||||
pfUI.gui.deco.up:SetWidth(400)
|
||||
pfUI.gui.deco.up:SetAlpha(0)
|
||||
pfUI.gui.deco.up.visible = 0
|
||||
pfUI.gui.deco.up.texture = pfUI.gui.deco.up:CreateTexture()
|
||||
@@ -523,16 +523,12 @@ pfUI:RegisterModule("gui", function ()
|
||||
elseif pfUI.gui.deco.up.visible == 0 and pfUI.gui.deco.up:GetAlpha() <= 0 then
|
||||
pfUI.gui.deco.up:Hide()
|
||||
end
|
||||
|
||||
if pfUI.gui.deco.up.visible == 1 and pfUI.gui.deco.up:GetAlpha() > .15 then
|
||||
pfUI.gui.deco.up:SetAlpha(pfUI.gui.deco.up:GetAlpha() - 0.01)
|
||||
end
|
||||
end)
|
||||
|
||||
pfUI.gui.deco.down = CreateFrame("Frame", nil, pfUI.gui.deco)
|
||||
pfUI.gui.deco.down:SetPoint("BOTTOMRIGHT", 0,0)
|
||||
pfUI.gui.deco.down:SetPoint("BOTTOMLEFT", pfUI.gui.deco, "BOTTOMLEFT", 0,0)
|
||||
pfUI.gui.deco.down:SetPoint("BOTTOMRIGHT", pfUI.gui.deco, "BOTTOMRIGHT", 0,0)
|
||||
pfUI.gui.deco.down:SetHeight(16)
|
||||
pfUI.gui.deco.down:SetWidth(400)
|
||||
pfUI.gui.deco.down:SetAlpha(0)
|
||||
pfUI.gui.deco.down.visible = 0
|
||||
pfUI.gui.deco.down.texture = pfUI.gui.deco.down:CreateTexture()
|
||||
@@ -546,16 +542,12 @@ pfUI:RegisterModule("gui", function ()
|
||||
elseif pfUI.gui.deco.down.visible == 0 and pfUI.gui.deco.down:GetAlpha() <= 0 then
|
||||
pfUI.gui.deco.down:Hide()
|
||||
end
|
||||
|
||||
if pfUI.gui.deco.down.visible == 1 and pfUI.gui.deco.down:GetAlpha() > .15 then
|
||||
pfUI.gui.deco.down:SetAlpha(pfUI.gui.deco.down:GetAlpha() - 0.01)
|
||||
end
|
||||
end)
|
||||
|
||||
pfUI.gui.scroll = CreateFrame("ScrollFrame", nil, pfUI.gui)
|
||||
pfUI.gui.scroll:ClearAllPoints()
|
||||
pfUI.gui.scroll:SetPoint("TOPLEFT", pfUI.gui, "TOPLEFT", 80,-10)
|
||||
pfUI.gui.scroll:SetPoint("BOTTOMRIGHT", pfUI.gui, "BOTTOMRIGHT", 0,10)
|
||||
pfUI.gui.scroll:SetPoint("TOPLEFT", pfUI.gui, "TOPLEFT", 2*default_border + 100,-10)
|
||||
pfUI.gui.scroll:SetPoint("BOTTOMRIGHT", pfUI.gui, "BOTTOMRIGHT", -default_border,10)
|
||||
pfUI.gui.scroll:EnableMouseWheel(1)
|
||||
function pfUI.gui.scroll:UpdateScrollState()
|
||||
local current = ceil(pfUI.gui.scroll:GetVerticalScroll())
|
||||
@@ -612,6 +604,19 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Combat Font", pfUI_config.global, "font_combat", "dropdown", values)
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Minimal Cooldown duration (seconds)", pfUI_config.global, "cooldown_min")
|
||||
|
||||
-- appearance
|
||||
pfUI.gui.appearance = pfUI.gui:CreateConfigTab("Appearance")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Background Color", pfUI_config.appearance.border, "background")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Border Color", pfUI_config.appearance.border, "color")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Default Bordersize", pfUI_config.appearance.border, "default")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Actionbar Bordersize", pfUI_config.appearance.border, "actionbars")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "UnitFrame Bordersize", pfUI_config.appearance.border, "unitframes")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "GroupFrame Bordersize", pfUI_config.appearance.border, "groupframes")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "RaidFrame Bordersize", pfUI_config.appearance.border, "raidframes")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Panel Bordersize", pfUI_config.appearance.border, "panels")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Chat Bordersize", pfUI_config.appearance.border, "chat")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.appearance, "Bags Bordersize", pfUI_config.appearance.border, "bags")
|
||||
|
||||
-- modules
|
||||
pfUI.gui.modules = pfUI.gui:CreateConfigTab("Modules")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.modules, "|cffff5555Warning:\n|cffffaaaa Disabling modules is highly experimental.\nDo not disable modules if you don't know how to fix errors.|r", nil, nil, "warning")
|
||||
@@ -633,12 +638,18 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Player width", pfUI_config.unitframes.player, "width")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Player height", pfUI_config.unitframes.player, "height")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Player powerbar height", pfUI_config.unitframes.player, "pheight")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Player powerbar spacing", pfUI_config.unitframes.player, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show PvP Icon", pfUI_config.unitframes.player, "showPVP", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Align PvP Icon to Minimap", pfUI_config.unitframes.player, "showPVPMinimap", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target width", pfUI_config.unitframes.target, "width")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target height", pfUI_config.unitframes.target, "height")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target powerbar height", pfUI_config.unitframes.target, "pheight")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Target powerbar spacing", pfUI_config.unitframes.target, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "TargetTarget powerbar spacing", pfUI_config.unitframes.ttarget, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Pet powerbar spacing", pfUI_config.unitframes.pet, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Group powerbar spacing", pfUI_config.unitframes.group, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Hide group while in raid", pfUI_config.unitframes.group, "hide_in_raid", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Raid powerbar spacing", pfUI_config.unitframes.raid, "pspace")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Invert Raid-healthbar", pfUI_config.unitframes.raid, "invert_healthbar", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Show missing HP on raidframes", pfUI_config.unitframes.raid, "show_missing", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.uf, "Click-cast on Raidframe", pfUI_config.unitframes.raid, "clickcast")
|
||||
@@ -649,7 +660,6 @@ pfUI:RegisterModule("gui", function ()
|
||||
-- actionbar
|
||||
pfUI.gui.bar = pfUI.gui:CreateConfigTab("ActionBar")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.bar, "Icon Size", pfUI_config.bars, "icon_size")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.bar, "Border", pfUI_config.bars, "border")
|
||||
|
||||
-- panels
|
||||
pfUI.gui.panel = pfUI.gui:CreateConfigTab("Panel")
|
||||
|
||||
Reference in New Issue
Block a user