mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-24 08:36:04 +00:00
save position of frames and load them on login
This commit is contained in:
@@ -55,6 +55,7 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
pfUI.bars.pet:Show()
|
||||
pfUI.bars.pet:SetFrameStrata("LOW")
|
||||
pfUI.bars.pet:SetPoint("BOTTOM", pfUI.bars.bottom, "TOP", 0, 5)
|
||||
pfUI.utils:loadPosition(pfUI.bars.pet)
|
||||
pfUI.bars.pet:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bars.pet:SetWidth(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * 10 + pfUI_config.bars.border * 10)
|
||||
pfUI.bars.pet:SetHeight(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * 1 + pfUI_config.bars.border)
|
||||
@@ -101,6 +102,7 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
|
||||
pfUI.bars.shapeshift:SetFrameStrata("LOW")
|
||||
pfUI.bars.shapeshift:SetPoint("BOTTOM", pfUI.bars.bottom, "TOP", 0, 5)
|
||||
pfUI.utils:loadPosition(pfUI.bars.shapeshift)
|
||||
pfUI.bars.shapeshift:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bars.shapeshift:SetWidth(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * shapeshiftbuttons + pfUI_config.bars.border * shapeshiftbuttons)
|
||||
pfUI.bars.shapeshift:SetHeight(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * 1 + pfUI_config.bars.border)
|
||||
@@ -124,6 +126,7 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
pfUI.bars.bottomleft:Show()
|
||||
pfUI.bars.bottomleft:SetFrameStrata("LOW")
|
||||
pfUI.bars.bottomleft:SetPoint("BOTTOMRIGHT", pfUI.bars.bottom, "BOTTOMLEFT", -5, 0)
|
||||
pfUI.utils:loadPosition(pfUI.bars.bottomleft)
|
||||
pfUI.bars.bottomleft:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bars.bottomleft:SetWidth(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * 6 + pfUI_config.bars.border * 6)
|
||||
pfUI.bars.bottomleft:SetHeight(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * 2 + pfUI_config.bars.border * 2)
|
||||
@@ -154,6 +157,7 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
pfUI.bars.bottomright:Show()
|
||||
pfUI.bars.bottomright:SetFrameStrata("LOW")
|
||||
pfUI.bars.bottomright:SetPoint("BOTTOMLEFT", pfUI.bars.bottom, "BOTTOMRIGHT", 5, 0)
|
||||
pfUI.utils:loadPosition(pfUI.bars.bottomright)
|
||||
pfUI.bars.bottomright:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bars.bottomright:SetWidth(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * 6 + pfUI_config.bars.border * 6)
|
||||
pfUI.bars.bottomright:SetHeight(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * 2 + pfUI_config.bars.border * 2)
|
||||
@@ -184,6 +188,7 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
pfUI.bars.vertical:Show()
|
||||
pfUI.bars.vertical:SetFrameStrata("LOW")
|
||||
pfUI.bars.vertical:SetPoint("RIGHT", -5, 0)
|
||||
pfUI.utils:loadPosition(pfUI.bars.vertical)
|
||||
pfUI.bars.vertical:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.bars.vertical:SetWidth(pfUI_config.bars.border*4 + pfUI_config.bars.icon_size)
|
||||
pfUI.bars.vertical:SetHeight(pfUI_config.bars.border*3 + pfUI_config.bars.icon_size * 12 + pfUI_config.bars.border * 12)
|
||||
@@ -209,6 +214,7 @@ pfUI:RegisterModule("actionbar", function ()
|
||||
pfUI.bars.bottom = CreateFrame("Frame", "pfBarBottom", UIParent)
|
||||
pfUI.bars.bottom:SetFrameStrata("LOW")
|
||||
pfUI.bars.bottom:SetPoint("BOTTOM", 0, 5)
|
||||
pfUI.utils:loadPosition(pfUI.bars.bottom)
|
||||
pfUI.bars.bottom:SetBackdrop(pfUI.backdrop)
|
||||
|
||||
ActionButton1:SetParent(pfUI.bars.bottom)
|
||||
|
||||
@@ -6,6 +6,7 @@ pfUI:RegisterModule("chat", function ()
|
||||
pfUI.chat.left:SetWidth(350)
|
||||
pfUI.chat.left:SetHeight(150)
|
||||
pfUI.chat.left:SetPoint("BOTTOMLEFT", 5,5)
|
||||
pfUI.utils:loadPosition(pfUI.chat.left)
|
||||
pfUI.chat.left:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.chat.left:SetBackdropColor(0,0,0,.75)
|
||||
|
||||
@@ -22,6 +23,7 @@ pfUI:RegisterModule("chat", function ()
|
||||
pfUI.chat.right:SetWidth(350)
|
||||
pfUI.chat.right:SetHeight(150)
|
||||
pfUI.chat.right:SetPoint("BOTTOMRIGHT", -5,5)
|
||||
pfUI.utils:loadPosition(pfUI.chat.right)
|
||||
pfUI.chat.right:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.chat.right:SetBackdropColor(0,0,0,.75)
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
|
||||
frame.input:SetScript("OnEditFocusLost", function(self)
|
||||
this:GetParent().category[this:GetParent().config] = this:GetText()
|
||||
pfUI.gui.settingChanged = true
|
||||
end)
|
||||
|
||||
return frame
|
||||
@@ -119,16 +120,26 @@ pfUI:RegisterModule("gui", function ()
|
||||
|
||||
frame.drag:SetScript("OnMouseUp",function()
|
||||
frame:StopMovingOrSizing()
|
||||
_, _, _, xpos, ypos = frame:GetPoint()
|
||||
|
||||
if not pfUI_config.position[frame:GetName()] then
|
||||
pfUI_config.position[frame:GetName()] = {}
|
||||
end
|
||||
|
||||
pfUI_config.position[frame:GetName()]["xpos"] = xpos
|
||||
pfUI_config.position[frame:GetName()]["ypos"] = ypos
|
||||
end)
|
||||
|
||||
if pfUI.gitter:IsShown() then
|
||||
frame:SetMovable(true)
|
||||
frame.drag:EnableMouse(true)
|
||||
frame.drag:Show()
|
||||
pfUI.gui.unlockFrames.text:SetText("Lock Frames")
|
||||
else
|
||||
frame:SetMovable(false)
|
||||
frame.drag:EnableMouse(false)
|
||||
frame.drag:Hide()
|
||||
pfUI.gui.unlockFrames.text:SetText("Unlock Frames")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -324,6 +335,24 @@ pfUI:RegisterModule("gui", function ()
|
||||
|
||||
pfUI.gui.CreateConfig(pfUI.gui.tooltip, "Tooltip Position:", pfUI_config.tooltip, "position")
|
||||
|
||||
-- Reset Frames
|
||||
pfUI.gui.resetFrames = CreateFrame("Button", nil, pfUI.gui)
|
||||
pfUI.gui.resetFrames:ClearAllPoints()
|
||||
pfUI.gui.resetFrames:SetWidth(80)
|
||||
pfUI.gui.resetFrames:SetHeight(20)
|
||||
pfUI.gui.resetFrames:SetPoint("BOTTOMLEFT", 0, 40)
|
||||
pfUI.gui.resetFrames:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.gui.resetFrames.text = pfUI.gui.resetFrames:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||
pfUI.gui.resetFrames.text:SetFont("Interface\\AddOns\\pfUI\\fonts\\arial.ttf", 9, "OUTLINE")
|
||||
pfUI.gui.resetFrames.text:ClearAllPoints()
|
||||
pfUI.gui.resetFrames.text:SetAllPoints(pfUI.gui.resetFrames)
|
||||
pfUI.gui.resetFrames.text:SetPoint("CENTER", 0, 0)
|
||||
pfUI.gui.resetFrames.text:SetFontObject(GameFontWhite)
|
||||
pfUI.gui.resetFrames.text:SetText("Reset Frames")
|
||||
pfUI.gui.resetFrames:SetScript("OnClick", function()
|
||||
pfUI_config["position"] = {}
|
||||
pfUI.gui.reloadDialog:Show()
|
||||
end)
|
||||
|
||||
-- Unlock Frames
|
||||
pfUI.gui.unlockFrames = CreateFrame("Button", nil, pfUI.gui)
|
||||
@@ -358,9 +387,47 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui.hideGUI.text:SetFontObject(GameFontWhite)
|
||||
pfUI.gui.hideGUI.text:SetText("Close")
|
||||
pfUI.gui.hideGUI:SetScript("OnClick", function()
|
||||
if pfUI.gui.settingChanged then
|
||||
pfUI.gui.reloadDialog:Show()
|
||||
end
|
||||
pfUI.gui:Hide()
|
||||
end)
|
||||
|
||||
-- Switch to default View: global
|
||||
pfUI.gui.SwitchTab(pfUI.gui.global)
|
||||
|
||||
|
||||
pfUI.gui.reloadDialog = CreateFrame("Frame","pfReloadDiag",UIParent)
|
||||
pfUI.gui.reloadDialog:SetFrameStrata("TOOLTIP")
|
||||
pfUI.gui.reloadDialog:SetWidth(300)
|
||||
pfUI.gui.reloadDialog:SetHeight(100)
|
||||
pfUI.gui.reloadDialog:Hide()
|
||||
tinsert(UISpecialFrames, "pfReloadDiag")
|
||||
|
||||
pfUI.gui.reloadDialog:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.gui.reloadDialog:SetPoint("CENTER",0,0)
|
||||
|
||||
pfUI.gui.reloadDialog.text = pfUI.gui.reloadDialog:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||
pfUI.gui.reloadDialog.text:SetFontObject(GameFontWhite)
|
||||
pfUI.gui.reloadDialog.text:SetPoint("TOP", 0, -15)
|
||||
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.gui.reloadDialog.yes:SetWidth(100)
|
||||
pfUI.gui.reloadDialog.yes:SetHeight(20) -- width, height
|
||||
pfUI.gui.reloadDialog.yes:SetPoint("BOTTOMLEFT", 20,15)
|
||||
pfUI.gui.reloadDialog.yes:SetText("Yes")
|
||||
pfUI.gui.reloadDialog.yes:SetScript("OnClick", function()
|
||||
pfUI.gui.settingChanged = nil
|
||||
ReloadUI();
|
||||
end)
|
||||
pfUI.gui.reloadDialog.no = CreateFrame("Button", "pfReloadNo", pfUI.gui.reloadDialog, "UIPanelButtonTemplate")
|
||||
pfUI.gui.reloadDialog.no:SetWidth(100)
|
||||
pfUI.gui.reloadDialog.no:SetHeight(20) -- width, height
|
||||
pfUI.gui.reloadDialog.no:SetPoint("BOTTOMRIGHT", -20,15)
|
||||
pfUI.gui.reloadDialog.no:SetText("No")
|
||||
pfUI.gui.reloadDialog.no:SetScript("OnClick", function()
|
||||
pfUI.gui.reloadDialog:Hide()
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -18,6 +18,7 @@ pfUI:RegisterModule("minimap", function ()
|
||||
pfUI.minimap:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.minimap:SetBackdropColor(0,0,0,0)
|
||||
pfUI.minimap:SetPoint("TOPRIGHT", UIParent, -5, -5)
|
||||
pfUI.utils:loadPosition(pfUI.minimap)
|
||||
pfUI.minimap:SetWidth(Minimap:GetWidth())
|
||||
pfUI.minimap:SetHeight(Minimap:GetHeight())
|
||||
pfUI.minimap:SetFrameStrata("BACKGROUND")
|
||||
|
||||
@@ -305,6 +305,7 @@ pfUI:RegisterModule("panel", function ()
|
||||
pfUI.panel.minimap = CreateFrame("Frame", "pfPanelMinimap", UIParent)
|
||||
pfUI.panel.minimap:SetBackdrop(pfUI.backdrop)
|
||||
pfUI.panel.minimap:SetPoint("TOPRIGHT",UIParent, -5, -7 - Minimap:GetHeight())
|
||||
pfUI.utils:loadPosition(pfUI.panel.minimap)
|
||||
pfUI.panel.minimap:SetHeight(20)
|
||||
pfUI.panel.minimap:SetWidth(Minimap:GetWidth())
|
||||
pfUI.panel.minimap:SetFrameStrata("BACKGROUND")
|
||||
|
||||
@@ -6,6 +6,7 @@ pfUI:RegisterModule("pet", function ()
|
||||
pfUI.uf.pet:ClearAllPoints()
|
||||
pfUI.uf.pet:SetPoint("TOPLEFT", pfUI.uf.player.hp , "TOPRIGHT", 0, 0)
|
||||
pfUI.uf.pet:SetPoint("BOTTOMRIGHT", pfUI.uf.target.hp, "BOTTOMLEFT", 0, 0)
|
||||
pfUI.utils:loadPosition(pfUI.uf.pet)
|
||||
|
||||
pfUI.uf.pet:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
pfUI.uf.pet:SetScript("OnClick", function ()
|
||||
|
||||
@@ -6,6 +6,7 @@ pfUI:RegisterModule("player", function ()
|
||||
pfUI.uf.player:SetWidth(pfUI_config.unitframes.player.width)
|
||||
pfUI.uf.player:SetHeight(pfUI_config.unitframes.player.height+pfUI_config.unitframes.player.pheight)
|
||||
pfUI.uf.player:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOM", -75, 125)
|
||||
pfUI.utils:loadPosition(pfUI.uf.player)
|
||||
pfUI.uf.player:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
pfUI.uf.player:SetScript("OnClick", function ()
|
||||
if arg1 == "RightButton" then
|
||||
|
||||
@@ -20,6 +20,8 @@ pfUI:RegisterModule("skin", function ()
|
||||
"StaticPopup1Button2",
|
||||
"StaticPopup2Button1",
|
||||
"StaticPopup2Button2",
|
||||
"pfReloadYes",
|
||||
"pfReloadNo",
|
||||
}
|
||||
local boxes = {
|
||||
"StaticPopup1",
|
||||
|
||||
@@ -20,6 +20,8 @@ pfUI:RegisterModule("target", function ()
|
||||
pfUI.uf.target:SetWidth(pfUI_config.unitframes.target.width)
|
||||
pfUI.uf.target:SetHeight(pfUI_config.unitframes.target.height+pfUI_config.unitframes.target.pheight)
|
||||
pfUI.uf.target:SetPoint("BOTTOMLEFT", UIParent, "BOTTOM", 75, 125)
|
||||
pfUI.utils:loadPosition(pfUI.uf.target)
|
||||
|
||||
|
||||
pfUI.uf.target:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
pfUI.uf.target:SetScript("OnClick", function ()
|
||||
|
||||
@@ -10,6 +10,7 @@ pfUI:RegisterModule("targettarget", function ()
|
||||
pfUI.uf.targettarget:SetWidth(100)
|
||||
pfUI.uf.targettarget:SetHeight(25)
|
||||
pfUI.uf.targettarget:SetPoint("BOTTOM", UIParent , "BOTTOM", 0, 125)
|
||||
pfUI.utils:loadPosition(pfUI.uf.targettarget)
|
||||
pfUI.uf.targettarget:SetBackdrop(pfUI.backdrop)
|
||||
|
||||
pfUI.uf.targettarget:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
|
||||
@@ -103,8 +103,19 @@ pfUI_config = {
|
||||
["tooltip"] = {
|
||||
position = "bottom"
|
||||
},
|
||||
["position"] = {
|
||||
}
|
||||
}
|
||||
|
||||
pfUI.utils = CreateFrame("Frame",nil,UIParent)
|
||||
|
||||
function pfUI.utils:loadPosition(frame)
|
||||
if pfUI_config["position"][frame:GetName()] then
|
||||
frame:ClearAllPoints()
|
||||
frame:SetPoint("TOPLEFT", pfUI_config["position"][frame:GetName()].xpos, pfUI_config["position"][frame:GetName()].ypos)
|
||||
end
|
||||
end
|
||||
|
||||
message = function (msg)
|
||||
DEFAULT_CHAT_FRAME:AddMessage("|cffcccc33INFO: |cffffff55"..msg)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user