gui: rewrite of the configuration interface

This commit is contained in:
shagu
2017-06-16 14:45:52 +02:00
parent 603ecbc5ff
commit 51f4bab41f
8 changed files with 1450 additions and 1122 deletions
+3 -3
View File
@@ -216,12 +216,12 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
pfUI.uf:RefreshUnit(this, "all")
end
if UnitIsConnected(this.label .. this.id) or ( pfUI.gitter and pfUI.gitter:IsShown()) then
if UnitIsConnected(this.label .. this.id) or ( pfUI.unlock and pfUI.unlock:IsShown()) then
if not this.cache then return end
if not this.cache.hp or not this.cache.power then return end
if this.config.faderange == "1" then
if pfUI.api.UnitInRange(this.label .. this.id, 4) or (pfUI.gitter and pfUI.gitter:IsShown()) then
if pfUI.api.UnitInRange(this.label .. this.id, 4) or (pfUI.unlock and pfUI.unlock:IsShown()) then
if this:GetAlpha() ~= 1 then
this:SetAlpha(1)
if this.config.portrait == "bar" then
@@ -559,7 +559,7 @@ function pfUI.uf:RefreshUnit(unit, component)
unit.lastUnit = UnitName(unit.label .. unit.id)
end
if not ( pfUI.gitter and pfUI.gitter:IsShown() ) then
if not ( pfUI.unlock and pfUI.unlock:IsShown() ) then
if UnitName(unit.label .. unit.id) or unit.unitname then
if pfUI_config["unitframes"]["group"]["hide_in_raid"] == "1" and strsub(unit.label,0,5) == "party" and UnitInRaid("player") then
unit:Hide()
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -40,7 +40,7 @@ pfUI:RegisterModule("group", function ()
pfUI.uf.partytargetScanner = CreateFrame("Button",nil,UIParent)
pfUI.uf.partytargetScanner:SetScript("OnUpdate", function()
for i=1, 4 do
if UnitExists("party" .. i .. "target") or (pfUI.gitter and pfUI.gitter:IsShown()) then
if UnitExists("party" .. i .. "target") or (pfUI.unlock and pfUI.unlock:IsShown()) then
pfUI.uf.group[i].target:Show()
else
pfUI.uf.group[i].target:Hide()
+1124 -1115
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -16,6 +16,7 @@ pfUI:RegisterModule("hoverbind", function ()
}
pfUI.hoverbind = CreateFrame("Frame","pfKeyBindingFrame",UIParent)
pfUI.hoverbind:Hide()
pfUI.hoverbind:RegisterEvent("PLAYER_REGEN_DISABLED")
pfUI.hoverbind:EnableMouse(true)
pfUI.hoverbind.edit = CreateFrame("Button", "pfKeyBindingFrameEdit", pfUI.hoverbind)
@@ -33,6 +34,7 @@ pfUI:RegisterModule("hoverbind", function ()
end)
pfUI.hoverbind:SetScript("OnShow", function()
pfUI.gui:Hide()
pfUI.hoverbind.edit:Show()
pfUI.info:ShowInfoBox("|cff33ffccKeybind Mode|r\n" ..
@@ -44,6 +46,7 @@ pfUI:RegisterModule("hoverbind", function ()
pfUI.hoverbind:SetScript("OnHide",function()
pfUI.hoverbind.edit:Hide()
pfUI.gui:Show()
end)
pfUI.hoverbind:EnableKeyboard(true)
@@ -73,7 +76,6 @@ pfUI:RegisterModule("hoverbind", function ()
SaveBindings(GetCurrentBindingSet())
end
end)
pfUI.hoverbind:Hide()
function pfUI.hoverbind:GetBinding(button_name)
local found,_,buttontype,buttonindex = string.find(button_name,"^(%a+)(%d+)$")
+1 -1
View File
@@ -4,7 +4,7 @@ pfUI:RegisterModule("targettarget", function ()
pfUI.uf.targettargetScanner = CreateFrame("Button",nil,UIParent)
pfUI.uf.targettargetScanner:SetScript("OnUpdate", function()
if UnitExists("targettarget") or (pfUI.gitter and pfUI.gitter:IsShown()) then
if UnitExists("targettarget") or (pfUI.unlock and pfUI.unlock:IsShown()) then
pfUI.uf.targettarget:Show()
else
pfUI.uf.targettarget:Hide()
+316
View File
@@ -0,0 +1,316 @@
pfUI:RegisterModule("unlock", function ()
pfUI.unlock = CreateFrame("Button", "pfUIUnlockMode", UIParent)
pfUI.unlock:Hide()
pfUI.unlock:SetAllPoints(WorldFrame)
pfUI.unlock:SetFrameStrata("BACKGROUND")
pfUI.unlock:SetScript("OnClick", function()
this:Hide()
end)
table.insert(UISpecialFrames, "pfUIUnlockMode")
pfUI.unlock:SetScript("OnShow", function()
if not this.setup then
local size = 1
local width = GetScreenWidth()
local ratio = width / GetScreenHeight()
local height = GetScreenHeight() * ratio
local wStep = width / 128
local hStep = height / 128
for i = 0, 128 do
local tx = pfUI.unlock:CreateTexture(nil, 'BACKGROUND')
if i == 128 / 2 then
tx:SetTexture(.1, .5, .4)
else
tx:SetTexture(0, 0, 0)
end
tx:SetPoint("TOPLEFT", pfUI.unlock, "TOPLEFT", i*wStep - (size/2), 0)
tx:SetPoint('BOTTOMRIGHT', pfUI.unlock, 'BOTTOMLEFT', i*wStep + (size/2), 0)
end
local height = GetScreenHeight()
for i = 0, 128 do
local tx = pfUI.unlock:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(.1, .5, .4)
tx:SetPoint("TOPLEFT", pfUI.unlock, "TOPLEFT", 0, -(height/2) + (size/2))
tx:SetPoint('BOTTOMRIGHT', pfUI.unlock, 'TOPRIGHT', 0, -(height/2 + size/2))
end
for i = 1, floor((height/2)/hStep) do
local tx = pfUI.unlock:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(0, 0, 0)
tx:SetPoint("TOPLEFT", pfUI.unlock, "TOPLEFT", 0, -(height/2+i*hStep) + (size/2))
tx:SetPoint('BOTTOMRIGHT', pfUI.unlock, 'TOPRIGHT', 0, -(height/2+i*hStep + size/2))
tx = pfUI.unlock:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(0, 0, 0)
tx:SetPoint("TOPLEFT", pfUI.unlock, "TOPLEFT", 0, -(height/2-i*hStep) + (size/2))
tx:SetPoint('BOTTOMRIGHT', pfUI.unlock, 'TOPRIGHT', 0, -(height/2-i*hStep + size/2))
end
this.setup = true
end
for _,frame in pairs(pfUI.movables) do
local frame = _G[frame]
if frame then
if not frame:IsShown() then
frame.hideLater = true
end
if not frame.drag then
frame.drag = CreateFrame("Frame", nil, frame)
frame.drag:SetAllPoints(frame)
frame.drag:SetFrameStrata("DIALOG")
CreateBackdrop(frame.drag, nil, nil, .8)
frame.drag.backdrop:SetBackdropBorderColor(.2, 1, .8)
frame.drag:EnableMouseWheel(1)
frame.drag.text = frame.drag:CreateFontString("Status", "LOW", "GameFontNormal")
frame.drag.text:SetFont(pfUI.font_default, C.global.font_size, "OUTLINE")
frame.drag.text:ClearAllPoints()
frame.drag.text:SetAllPoints(frame.drag)
frame.drag.text:SetPoint("CENTER", 0, 0)
frame.drag.text:SetFontObject(GameFontWhite)
local label = (strsub(frame:GetName(),3))
if frame.drag:GetHeight() > (2 * frame.drag:GetWidth()) then
label = strvertical(label)
end
frame.drag.text:SetText(label)
frame.drag:SetAlpha(1)
frame.drag:SetScript("OnMouseWheel", function()
local scale = round(frame:GetScale() + arg1/10, 1)
if IsShiftKeyDown() and strsub(frame:GetName(),0,7) == "pfCombo" then
for i=1,5 do
local frame = _G["pfCombo" .. i]
pfUI.unlock:SaveScale(frame, scale)
end
elseif IsShiftKeyDown() and strsub(frame:GetName(),0,6) == "pfRaid" then
for i=1,40 do
local frame = _G["pfRaid" .. i]
pfUI.unlock:SaveScale(frame, scale)
end
elseif IsShiftKeyDown() and strsub(frame:GetName(),0,7) == "pfGroup" then
for i=1,4 do
local frame = _G["pfGroup" .. i]
pfUI.unlock:SaveScale(frame, scale)
end
elseif IsShiftKeyDown() and strsub(frame:GetName(),0,15) == "pfLootRollFrame" then
for i=1,4 do
local frame = _G["pfLootRollFrame" .. i]
pfUI.unlock:SaveScale(frame, scale)
end
else
pfUI.unlock:SaveScale(frame, scale)
end
-- repaint hackfix for panels
if pfUI.panel and pfUI.chat then
pfUI.panel.left:SetScale(pfUI.chat.left:GetScale())
pfUI.panel.right:SetScale(pfUI.chat.right:GetScale())
end
if frame.OnMove then frame:OnMove() end
end)
frame.drag:SetScript("OnMouseDown",function()
if IsShiftKeyDown() then
if strsub(frame:GetName(),0,7) == "pfCombo" then
for i=1,5 do
local cframe = _G["pfCombo" .. i]
cframe:StartMoving()
cframe:StopMovingOrSizing()
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
end
end
if strsub(frame:GetName(),0,6) == "pfRaid" then
for i=1,40 do
local cframe = _G["pfRaid" .. i]
cframe:StartMoving()
cframe:StopMovingOrSizing()
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
end
end
if strsub(frame:GetName(),0,7) == "pfGroup" then
for i=1,4 do
local cframe = _G["pfGroup" .. i]
cframe:StartMoving()
cframe:StopMovingOrSizing()
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
end
end
if strsub(frame:GetName(),0,15) == "pfLootRollFrame" then
for i=1,4 do
local cframe = _G["pfLootRollFrame" .. i]
cframe:StartMoving()
cframe:StopMovingOrSizing()
cframe.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
end
end
_, _, _, xpos, ypos = frame:GetPoint()
frame.oldPos = { xpos, ypos }
else
frame.oldPos = nil
end
frame.drag.backdrop:SetBackdropBorderColor(1,1,1,1)
frame:StartMoving()
if frame.OnMove then frame:OnMove() end
end)
frame.drag:SetScript("OnMouseUp",function()
frame:StopMovingOrSizing()
_, _, _, xpos, ypos = frame:GetPoint()
frame.drag.backdrop:SetBackdropBorderColor(.2,1,.8,1)
if frame.oldPos then
local diffxpos = frame.oldPos[1] - xpos
local diffypos = frame.oldPos[2] - ypos
if strsub(frame:GetName(),0,7) == "pfCombo" then
for i=1,5 do
local cframe = _G["pfCombo" .. i]
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)
local _, _, _, xpos, ypos = cframe:GetPoint()
if not C.position[cframe:GetName()] then
C.position[cframe:GetName()] = {}
end
C.position[cframe:GetName()]["xpos"] = xpos
C.position[cframe:GetName()]["ypos"] = ypos
end
end
elseif strsub(frame:GetName(),0,6) == "pfRaid" then
for i=1,40 do
local cframe = _G["pfRaid" .. i]
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)
local _, _, _, xpos, ypos = cframe:GetPoint()
if not C.position[cframe:GetName()] then
C.position[cframe:GetName()] = {}
end
C.position[cframe:GetName()]["xpos"] = xpos
C.position[cframe:GetName()]["ypos"] = ypos
end
end
elseif strsub(frame:GetName(),0,7) == "pfGroup" then
for i=1,4 do
local cframe = _G["pfGroup" .. i]
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)
local _, _, _, xpos, ypos = cframe:GetPoint()
if not C.position[cframe:GetName()] then
C.position[cframe:GetName()] = {}
end
C.position[cframe:GetName()]["xpos"] = xpos
C.position[cframe:GetName()]["ypos"] = ypos
end
end
elseif strsub(frame:GetName(),0,15) == "pfLootRollFrame" then
for i=1,4 do
local cframe = _G["pfLootRollFrame" .. i]
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)
local _, _, _, xpos, ypos = cframe:GetPoint()
if not C.position[cframe:GetName()] then
C.position[cframe:GetName()] = {}
end
C.position[cframe:GetName()]["xpos"] = xpos
C.position[cframe:GetName()]["ypos"] = ypos
end
end
end
end
if not C.position[frame:GetName()] then
C.position[frame:GetName()] = {}
end
C.position[frame:GetName()]["xpos"] = xpos
C.position[frame:GetName()]["ypos"] = ypos
pfUI.unlock.settingChanged = true
end)
end
frame:SetMovable(true)
frame.drag:EnableMouse(true)
frame.drag:Show()
frame:Show()
end
end
end)
pfUI.unlock:SetScript("OnHide", function()
for _,frame in pairs(pfUI.movables) do
local frame = _G[frame]
if frame then
frame:SetMovable(false)
frame.drag:EnableMouse(false)
frame.drag:Hide()
if frame.hideLater == true then
frame:Hide()
end
end
end
pfUI.unlock:Hide()
pfUI.gui:Show()
end)
function pfUI.unlock:SaveScale(frame, scale)
frame:SetScale(scale)
if not C.position[frame:GetName()] then
C.position[frame:GetName()] = {}
end
C.position[frame:GetName()]["scale"] = scale
frame.drag.text:SetText("Scale: " .. scale)
frame.drag.text:SetAlpha(1)
frame.drag:SetScript("OnUpdate", function()
this.text:SetAlpha(this.text:GetAlpha() -0.05)
if this.text:GetAlpha() < 0.1 then
this.text:SetText(strsub(this:GetParent():GetName(),3))
this.text:SetAlpha(1)
this:SetScript("OnUpdate", function() return end)
end
end)
end
function pfUI.unlock:UnlockFrames()
pfUI.info:ShowInfoBox("|cff33ffccUnlock Mode|r\n" ..
"This mode allows you to move frames by dragging them using the mouse cursor. " ..
"Frames can be scaled by scrolling up and down.\nTo scale multiple frames at once (eg. raidframes), " ..
"hold down the shift key while scrolling. Click into an empty space to go back to the pfUI menu.", 15, pfUI.unlock)
pfUI.unlock:Show()
pfUI.gui:Hide()
end
end)
+2 -1
View File
@@ -2,7 +2,7 @@
## Title: |cff33ffccpf|cffffffffUI
## Author: Shagu
## Notes: A complete user interface replacement.
## Version: 2.5
## Version: 2.9.9
## SavedVariables: pfUI_profiles
## SavedVariablesPerCharacter: pfUI_config, pfUI_init, pfUI_playerDB
@@ -30,6 +30,7 @@ env\fonts.lua
# modules
modules\firstrun.lua
modules\gui.lua
modules\unlock.lua
modules\pixelperfect.lua
modules\hoverbind.lua
modules\actionbar.lua