diff --git a/SVUI_!Core/system/layout.lua b/SVUI_!Core/system/layout.lua
index c1d541e..dd3ad53 100644
--- a/SVUI_!Core/system/layout.lua
+++ b/SVUI_!Core/system/layout.lua
@@ -1,7 +1,7 @@
--[[
##########################################################
S V U I By: Munglunch
-##########################################################
+##########################################################
LOCALIZED LUA FUNCTIONS
##########################################################
]]--
@@ -42,8 +42,8 @@ local ToggleFrame = _G.ToggleFrame;
local ERR_NOT_IN_COMBAT = _G.ERR_NOT_IN_COMBAT;
local RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS;
local CUSTOM_CLASS_COLORS = _G.CUSTOM_CLASS_COLORS;
---[[
-##########################################################
+--[[
+##########################################################
GET ADDON DATA
##########################################################
]]--
@@ -146,14 +146,14 @@ local function SnapStickyFrame(frameA, frameB, left, top, right, bottom)
end
if lA <= (lB + Sticky.rangeX) and lA >= (lB - Sticky.rangeX) then
newX = lB + wA
- if frameB == UIParent or frameB == WorldFrame or frameB == SVUIParent then
+ if frameB == UIParent or frameB == WorldFrame or frameB == SVUIParent then
newX = newX + 4
end
snap = true
end
if rA <= (rB + Sticky.rangeX) and rA >= (rB - Sticky.rangeX) then
newX = rB - wA
- if frameB == UIParent or frameB == WorldFrame or frameB == SVUIParent then
+ if frameB == UIParent or frameB == WorldFrame or frameB == SVUIParent then
newX = newX - 4
end
snap = true
@@ -174,14 +174,14 @@ local function SnapStickyFrame(frameA, frameB, left, top, right, bottom)
end
if tA <= (tB + Sticky.rangeY) and tA >= (tB - Sticky.rangeY) then
newY = tB - hA
- if frameB == UIParent or frameB == WorldFrame or frameB == SVUIParent then
+ if frameB == UIParent or frameB == WorldFrame or frameB == SVUIParent then
newY = newY - 4
end
snap = true
end
if bA <= (bB + Sticky.rangeY) and bA >= (bB - Sticky.rangeY) then
newY = bB + hA
- if frameB == UIParent or frameB == WorldFrame or frameB == SVUIParent then
+ if frameB == UIParent or frameB == WorldFrame or frameB == SVUIParent then
newY = newY + 4
end
snap = true
@@ -244,8 +244,8 @@ local function StickyStopMoving(frame)
end
end
local CurrentFrameTarget, UpdateFrameTarget;
---[[
-##########################################################
+--[[
+##########################################################
LOCAL FUNCTIONS
##########################################################
]]--
@@ -254,33 +254,33 @@ local function Pinpoint(parent)
local screenWidth = GetScreenWidth()
local screenHeight = GetScreenHeight()
local result;
- if not centerX or not centerY then
+ if not centerX or not centerY then
return "CENTER"
- end
+ end
local heightTop = screenHeight * 0.75;
local heightBottom = screenHeight * 0.25;
local widthLeft = screenWidth * 0.25;
local widthRight = screenWidth * 0.75;
- if(((centerX > widthLeft) and (centerX < widthRight)) and (centerY > heightTop)) then
+ if(((centerX > widthLeft) and (centerX < widthRight)) and (centerY > heightTop)) then
result = "TOP"
- elseif((centerX < widthLeft) and (centerY > heightTop)) then
+ elseif((centerX < widthLeft) and (centerY > heightTop)) then
result = "TOPLEFT"
- elseif((centerX > widthRight) and (centerY > heightTop)) then
+ elseif((centerX > widthRight) and (centerY > heightTop)) then
result = "TOPRIGHT"
- elseif(((centerX > widthLeft) and (centerX < widthRight)) and centerY < heightBottom) then
+ elseif(((centerX > widthLeft) and (centerX < widthRight)) and centerY < heightBottom) then
result = "BOTTOM"
- elseif((centerX < widthLeft) and (centerY < heightBottom)) then
+ elseif((centerX < widthLeft) and (centerY < heightBottom)) then
result = "BOTTOMLEFT"
- elseif((centerX > widthRight) and (centerY < heightBottom)) then
+ elseif((centerX > widthRight) and (centerY < heightBottom)) then
result = "BOTTOMRIGHT"
- elseif((centerX < widthLeft) and (centerY > heightBottom) and (centerY < heightTop)) then
+ elseif((centerX < widthLeft) and (centerY > heightBottom) and (centerY < heightTop)) then
result = "LEFT"
- elseif((centerX > widthRight) and (centerY < heightTop) and (centerY > heightBottom)) then
+ elseif((centerX > widthRight) and (centerY < heightTop) and (centerY > heightBottom)) then
result = "RIGHT"
- else
+ else
result = "CENTER"
- end
- return result
+ end
+ return result
end
local function CurrentPosition(frame)
@@ -290,8 +290,8 @@ local function CurrentPosition(frame)
if((not anchor1) or (not anchor2) or (not x) or (not y)) then
anchor1, anchor2, x, y = "TOPLEFT", "TOPLEFT", 160, -80
end
- if(not parent or (parent and (not parent:GetName()))) then
- parentName = "UIParent"
+ if(not parent or (parent and (not parent:GetName()))) then
+ parentName = "UIParent"
else
parentName = parent:GetName()
end
@@ -303,7 +303,7 @@ local function CurrentPosition(frame)
end
local function SaveAnchor(frameName)
- if((not _G[frameName]) or (not Layout.Anchors)) then return end
+ if((not _G[frameName]) or (not Layout.Anchors)) then return end
Layout.Anchors[frameName] = CurrentPosition(_G[frameName])
end
@@ -344,18 +344,18 @@ local function CalculateOffsets(frame)
else
a1 = "BOTTOM"
yOffset = CurrentFrameTarget:GetBottom()
- end
+ end
if xOffset >= screenRight then
a2 = "RIGHT"
- xOffset = (CurrentFrameTarget:GetRight() - right)
+ xOffset = (CurrentFrameTarget:GetRight() - right)
elseif xOffset <= screenLeft then
a2 = "LEFT"
- xOffset = CurrentFrameTarget:GetLeft()
+ xOffset = CurrentFrameTarget:GetLeft()
else
a2 = ""
- xOffset = (xOffset - center)
- end
+ xOffset = (xOffset - center)
+ end
xOffset = parsefloat(xOffset, 0)
yOffset = parsefloat(yOffset, 0)
@@ -367,13 +367,13 @@ end
local function ResetAllAlphas()
for entry,_ in pairs(Layout.Frames) do
local frame = _G[entry]
- if(frame) then
+ if(frame) then
frame:SetAlpha(0.4)
- end
- end
+ end
+ end
end
---[[
-##########################################################
+--[[
+##########################################################
MOVING ANIMATION WIDGET
##########################################################
]]--
@@ -404,7 +404,7 @@ local TheHand_OnUpdate = function(self, elapsed)
local x, y = GetCursorPosition()
local scale = SV.Screen:GetEffectiveScale()
self:SetPoint("CENTER", SV.Screen, "BOTTOMLEFT", (x / scale) + 50, (y / scale) + 50)
- end
+ end
end
function TheHand:Enable()
@@ -412,7 +412,7 @@ function TheHand:Enable()
self.bg:SetTexture([[Interface\AddOns\SVUI_!Core\assets\textures\Doodads\MENTALO-HAND-ON]])
self.energy:Show()
self.flash:Play()
- self:SetScript("OnUpdate", TheHand_OnUpdate)
+ self:SetScript("OnUpdate", TheHand_OnUpdate)
end
function TheHand:Disable()
@@ -423,8 +423,8 @@ function TheHand:Disable()
self.elapsedTime = 0
self:Hide()
end
---[[
-##########################################################
+--[[
+##########################################################
HANDLERS
##########################################################
]]--
@@ -437,7 +437,7 @@ function Layout:Movable_OnMouseUp()
SVUI_LayoutPrecisionSetX.CurrentValue = xOffset;
SVUI_LayoutPrecisionSetX:SetText(xOffset)
-
+
SVUI_LayoutPrecisionSetY.CurrentValue = yOffset;
SVUI_LayoutPrecisionSetY:SetText(yOffset)
@@ -453,17 +453,17 @@ function Layout:Movable_OnUpdate()
local calc2 = rightPos * 0.66;
local calc3 = topPos * 0.5;
local anchor1, anchor2;
- if centerY >= calc3 then
+ if centerY >= calc3 then
anchor1 = "TOP"
anchor2 = "BOTTOM"
- else
+ else
anchor1 = "BOTTOM"
anchor2 = "TOP"
- end
- if centerX >= calc2 then
+ end
+ if centerX >= calc2 then
anchor1 = "RIGHT"
anchor2 = "LEFT"
- elseif centerX <= calc1 then
+ elseif centerX <= calc1 then
anchor1 = "LEFT"
anchor2 = "RIGHT"
end
@@ -475,55 +475,55 @@ function Layout:Movable_OnUpdate()
end
function Layout:Movable_OnSizeChanged()
- if InCombatLockdown()then return end
- if self.dirtyWidth and self.dirtyHeight then
+ if InCombatLockdown()then return end
+ if self.dirtyWidth and self.dirtyHeight then
self.Grip:SetSize(self.dirtyWidth, self.dirtyHeight)
- else
+ else
self.Grip:SetSize(self:GetSize())
- end
+ end
end
function Layout:Movable_OnDragStart()
- if InCombatLockdown() then SV:AddonMessage(ERR_NOT_IN_COMBAT)return end
- if SV.db.general.stickyFrames then
+ if InCombatLockdown() then SV:AddonMessage(ERR_NOT_IN_COMBAT)return end
+ if SV.db.general.stickyFrames then
StickyStartMoving(self, self.snapOffset, -2)
- else
+ else
self:StartMoving()
- end
+ end
UpdateFrameTarget = self;
LayoutUpdateHandler:Show()
LayoutUpdateHandler:SetScript("OnUpdate", Layout.Movable_OnUpdate)
TheHand:Enable()
- TheHand.UserHeld = true
+ TheHand.UserHeld = true
end
function Layout:Movable_OnDragStop()
- if InCombatLockdown()then SV:AddonMessage(ERR_NOT_IN_COMBAT)return end
- if SV.db.general.stickyFrames then
+ if InCombatLockdown()then SV:AddonMessage(ERR_NOT_IN_COMBAT)return end
+ if SV.db.general.stickyFrames then
StickyStopMoving(self)
- else
+ else
self:StopMovingOrSizing()
- end
+ end
local pR, pT, pC = GrabUsableRegions()
local cX, cY = self:GetCenter()
local newAnchor;
- if cY >= (pT * 0.5) then
- newAnchor = "TOP";
+ if cY >= (pT * 0.5) then
+ newAnchor = "TOP";
cY = (-(pT - self:GetTop()))
- else
+ else
newAnchor = "BOTTOM"
cY = self:GetBottom()
- end
- if cX >= (pR * 0.66) then
+ end
+ if cX >= (pR * 0.66) then
newAnchor = newAnchor.."RIGHT"
- cX = self:GetRight() - pR
- elseif cX <= (pR * 0.33) then
+ cX = self:GetRight() - pR
+ elseif cX <= (pR * 0.33) then
newAnchor = newAnchor.."LEFT"
cX = self:GetLeft()
- else
- cX = cX - pC
- end
- if self.positionOverride then
+ else
+ cX = cX - pC
+ end
+ if self.positionOverride then
self.parent:ClearAllPoints()
self.parent:SetPoint(self.positionOverride, self, self.positionOverride)
end
@@ -533,7 +533,7 @@ function Layout:Movable_OnDragStop()
SaveAnchor(self.name)
- if SVUI_LayoutPrecision then
+ if SVUI_LayoutPrecision then
Layout.Movable_OnMouseUp(self)
end
@@ -542,9 +542,9 @@ function Layout:Movable_OnDragStop()
LayoutUpdateHandler:SetScript("OnUpdate", nil)
LayoutUpdateHandler:Hide()
- if(self.postdrag ~= nil and type(self.postdrag) == "function") then
+ if(self.postdrag ~= nil and type(self.postdrag) == "function") then
self:postdrag(Pinpoint(self))
- end
+ end
self:SetUserPlaced(false)
TheHand.UserHeld = false;
TheHand:Disable()
@@ -565,7 +565,7 @@ function Layout:Movable_OnEnter()
TheHand:SetPoint("CENTER", self, "TOP", 0, 0)
TheHand:Show()
if(not SVUI_LayoutPrecision) then return end;
- if CurrentFrameTarget ~= self then
+ if CurrentFrameTarget ~= self then
SVUI_LayoutPrecision:Hide()
self:GetScript("OnMouseUp")(self)
end
@@ -586,9 +586,9 @@ end
function Layout:Movable_OnMouseDown(button)
if button == "RightButton" then
TheHand.UserHeld = false;
- if(SV.db.general.stickyFrames) then
+ if(SV.db.general.stickyFrames) then
StickyStopMoving(self)
- else
+ else
self:StopMovingOrSizing()
end
if(not SVUI_LayoutPrecision) then return end;
@@ -602,26 +602,26 @@ function Layout:Movable_OnMouseDown(button)
end
function Layout:Movable_HasMoved()
- if(Layout.Anchors and Layout.Anchors[self.name]) then
- return true
- else
- return false
- end
+ if(Layout.Anchors and Layout.Anchors[self.name]) then
+ return true
+ else
+ return false
+ end
end
---[[
-##########################################################
+--[[
+##########################################################
CONSTRUCTS
##########################################################
]]--
local function SetNewAnchor(frame, moveName, title, postSizeFunc, postDragFunc, callbackOnEnter)
if((not frame) or (not moveName) or (Layout.Frames[moveName] ~= nil)) then return end
- --print('SetNewAnchor: '..moveName)
+ --print('SetNewAnchor: '..moveName)
Layout.Frames[moveName] = {
text = title,
postsize = postSizeFunc,
postdrag = postDragFunc,
layoutString = CurrentPosition(frame)
- }
+ }
local grip = CreateFrame("Button", moveName, SV.Screen)
grip:SetFrameLevel(frame:GetFrameLevel() + 1)
@@ -633,14 +633,14 @@ local function SetNewAnchor(frame, moveName, title, postSizeFunc, postDragFunc,
grip.textString = title;
grip.postdrag = postDragFunc;
grip.HasMoved = Layout.Movable_HasMoved
- grip.snapOffset = frame.snapOffset or -2;
+ grip.snapOffset = frame.snapOffset or -2;
local anchor1, anchorParent, anchor2, xPos, yPos
- if(Layout.Anchors and Layout.Anchors[moveName] and (type(Layout.Anchors[moveName]) == "string")) then
+ if(Layout.Anchors and Layout.Anchors[moveName] and (type(Layout.Anchors[moveName]) == "string")) then
anchor1, anchorParent, anchor2, xPos, yPos = LayoutParser(Layout.Anchors[moveName])
else
anchor1, anchorParent, anchor2, xPos, yPos = LayoutParser(CurrentPosition(frame))
- end
+ end
local width, height = frame:GetSize()
grip:SetPoint(anchor1, anchorParent, anchor2, xPos, yPos)
@@ -676,21 +676,21 @@ local function SetNewAnchor(frame, moveName, title, postSizeFunc, postDragFunc,
grip:SetMovable(true)
grip:Hide()
- if(postDragFunc and (type(postDragFunc) == "function") and callbackOnEnter) then
+ if(postDragFunc and (type(postDragFunc) == "function") and callbackOnEnter) then
grip:RegisterEvent("PLAYER_ENTERING_WORLD")
grip:SetScript("OnEvent", function(this, event)
local point = Pinpoint(this)
postDragFunc(this, point)
this:UnregisterAllEvents()
end)
- end
+ end
Sticky.Frames[#Sticky.Frames + 1] = grip;
-end
+end
function Layout:Reset(request, bypass)
- if(request == "" or request == nil) then
- for frameName, frameData in pairs(self.Frames) do
+ if(request == "" or request == nil) then
+ for frameName, frameData in pairs(self.Frames) do
local frame = _G[frameName];
if(frameData.layoutString) then
local anchor1, anchorParent, anchor2, xPos, yPos, width, height = LayoutParser(frameData.layoutString)
@@ -703,22 +703,22 @@ function Layout:Reset(request, bypass)
frame:SetSize(width, height)
frameData.postsize(frame)
end
- if(frameData.postdrag and (type(frameData.postdrag) == "function")) then
+ if(frameData.postdrag and (type(frameData.postdrag) == "function")) then
frameData.postdrag(frame, Pinpoint(frame))
end
end
end
- if(self.Anchors and self.Anchors[frameName]) then
- self.Anchors[frameName] = nil
- end
+ if(self.Anchors and self.Anchors[frameName]) then
+ self.Anchors[frameName] = nil
+ end
end
- else
+ else
for frameName, frameData in pairs(self.Frames) do
if(frameData.layoutString and (request == frameData.text)) then
local frame = _G[frameName]
local anchor1, anchorParent, anchor2, xPos, yPos, width, height = LayoutParser(frameData.layoutString)
frame:ClearAllPoints()
- frame:SetPoint(anchor1, anchorParent, anchor2, xPos, yPos)
+ frame:SetPoint(anchor1, anchorParent, anchor2, xPos, yPos)
if(not bypass) then
if(frameData.postsize and (type(frameData.postsize) == "function")) then
if(not width or width == 0) then width = frame:GetWidth() end
@@ -726,17 +726,17 @@ function Layout:Reset(request, bypass)
frame:SetSize(width, height)
frameData.postsize(frame)
end
- if(frameData.postdrag and (type(frameData.postdrag) == "function")) then
+ if(frameData.postdrag and (type(frameData.postdrag) == "function")) then
frameData.postdrag(frame, Pinpoint(frame))
end
end
- if(self.Anchors and self.Anchors[frameName]) then
- self.Anchors[frameName] = nil
+ if(self.Anchors and self.Anchors[frameName]) then
+ self.Anchors[frameName] = nil
end
break
end
- end
- end
+ end
+ end
end
function Layout:Update()
@@ -746,7 +746,7 @@ function Layout:Update()
local frame = _G[frameName];
local anchor1, parent, anchor2, x, y, width, height;
if frame then
- if (self.Anchors and self.Anchors[frameName] and (type(self.Anchors[frameName]) == "string")) then
+ if (self.Anchors and self.Anchors[frameName] and (type(self.Anchors[frameName]) == "string")) then
anchor1, parent, anchor2, x, y, width, height = LayoutParser(self.Anchors[frameName], frameName)
frame:ClearAllPoints()
frame:SetPoint(anchor1, parent, anchor2, x, y)
@@ -756,7 +756,7 @@ function Layout:Update()
frame:SetSize(width, height)
frameData.postsize(frame)
end
- elseif(frameData.layoutString) then
+ elseif(frameData.layoutString) then
anchor1, parent, anchor2, x, y, width, height = LayoutParser(frameData.layoutString, frameName)
frame:ClearAllPoints()
frame:SetPoint(anchor1, parent, anchor2, x, y)
@@ -769,23 +769,23 @@ function Layout:Update()
end
end
end
-end
+end
function Layout:Toggle(isConfigMode)
- if(InCombatLockdown()) then return end
+ if(InCombatLockdown()) then return end
local enabled = false;
- if((isConfigMode ~= nil) and (isConfigMode ~= "")) then
- SV.ConfigurationMode = isConfigMode
- end
+ if((isConfigMode ~= nil) and (isConfigMode ~= "")) then
+ SV.ConfigurationMode = isConfigMode
+ end
if(not SV.ConfigurationMode) then
- if(SV.OptionsLoaded) then
+ if(SV.OptionsLoaded) then
LibStub("AceConfigDialog-1.0"):Close(SV.NameID)
GameTooltip:Hide()
- SV.ConfigurationMode = true
- else
- SV.ConfigurationMode = false
- end
+ SV.ConfigurationMode = true
+ else
+ SV.ConfigurationMode = false
+ end
else
SV.ConfigurationMode = false
end
@@ -797,19 +797,19 @@ function Layout:Toggle(isConfigMode)
enabled = true
end
- for frameName, _ in pairs(self.Frames)do
- if(_G[frameName]) then
- local movable = _G[frameName]
- if(not enabled) then
- movable:Hide()
- else
- movable:Show()
- end
- end
+ for frameName, _ in pairs(self.Frames)do
+ if(_G[frameName]) then
+ local movable = _G[frameName]
+ if(not enabled) then
+ movable:Hide()
+ else
+ movable:Show()
+ end
+ end
end
end
---[[
-##########################################################
+--[[
+##########################################################
ALIGNMENT GRAPH
##########################################################
]]--
@@ -831,9 +831,9 @@ function Graph:UpdateAllReports()
self.CellSize = cellSize
self.Grid = CreateFrame('Frame', nil, UIParent)
- self.Grid:SetAllPoints(SV.Screen)
+ self.Grid:SetAllPoints(SV.Screen)
- local size = 1
+ local size = 1
local width = GetScreenWidth()
local ratio = width / GetScreenHeight()
local height = GetScreenHeight() * ratio
@@ -841,36 +841,36 @@ function Graph:UpdateAllReports()
local wStep = width / cellSize
local hStep = height / cellSize
- for i = 0, cellSize do
- local tx = self.Grid:CreateTexture(nil, 'BACKGROUND')
- if(i == cellSize / 2) then
- tx:SetTexture(0, 1, 0, 0.8)
- else
- tx:SetTexture(0, 0, 0, 0.8)
- end
- tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", i*wStep - (size/2), 0)
- tx:SetPoint('BOTTOMRIGHT', self.Grid, 'BOTTOMLEFT', i*wStep + (size/2), 0)
+ for i = 0, cellSize do
+ local tx = self.Grid:CreateTexture(nil, 'BACKGROUND')
+ if(i == cellSize / 2) then
+ tx:SetTexture(0, 1, 0, 0.8)
+ else
+ tx:SetTexture(0, 0, 0, 0.8)
+ end
+ tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", i*wStep - (size/2), 0)
+ tx:SetPoint('BOTTOMRIGHT', self.Grid, 'BOTTOMLEFT', i*wStep + (size/2), 0)
end
height = GetScreenHeight()
-
+
do
- local tx = self.Grid:CreateTexture(nil, 'BACKGROUND')
+ local tx = self.Grid:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(0, 1, 0, 0.8)
tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2) + (size/2))
tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2 + size/2))
end
-
+
for i = 1, floor((height/2)/hStep) do
- local tx = self.Grid:CreateTexture(nil, 'BACKGROUND')
+ local tx = self.Grid:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(0, 0, 0, 0.8)
-
+
tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2+i*hStep) + (size/2))
tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2+i*hStep + size/2))
-
- tx = self.Grid:CreateTexture(nil, 'BACKGROUND')
+
+ tx = self.Grid:CreateTexture(nil, 'BACKGROUND')
tx:SetTexture(0, 0, 0, 0.8)
-
+
tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2-i*hStep) + (size/2))
tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2-i*hStep + size/2))
end
@@ -881,17 +881,17 @@ end
function Graph:Initialize()
self:UpdateAllReports()
end
---[[
-##########################################################
+--[[
+##########################################################
SCRIPT AND EVENT HANDLERS
##########################################################
]]--
local XML_Layout_OnEvent = function(self)
- if self:IsShown() then
+ if self:IsShown() then
self:Hide()
Layout:Toggle(true)
end
-end
+end
local XML_LayoutGridButton_OnClick = function(self)
local enabled = true
@@ -905,20 +905,20 @@ end
local XML_LayoutLockButton_OnClick = function(self)
Graph:Toggle()
Layout:Toggle(true)
- if(SV.OptionsLoaded) then
+ if(SV.OptionsLoaded) then
LibStub("AceConfigDialog-1.0"):Open(SV.NameID)
- end
+ end
end
local SVUI_LayoutPrecisionResetButton_OnClick = function(self)
if(not CurrentFrameTarget) then return end
local name = CurrentFrameTarget.name
Layout:Reset(name)
-end
+end
local XML_LayoutPrecisionInputX_EnterPressed = function(self)
local current = tonumber(self:GetText())
- if(current) then
+ if(current) then
if(CurrentFrameTarget) then
local xOffset, yOffset, anchor = CalculateOffsets()
yOffset = tonumber(SVUI_LayoutPrecisionSetY.CurrentValue)
@@ -934,7 +934,7 @@ end
local XML_LayoutPrecisionInputY_EnterPressed = function(self)
local current = tonumber(self:GetText())
- if(current) then
+ if(current) then
if(CurrentFrameTarget) then
local xOffset, yOffset, anchor = CalculateOffsets()
xOffset = tonumber(SVUI_LayoutPrecisionSetX.CurrentValue)
@@ -947,8 +947,8 @@ local XML_LayoutPrecisionInputY_EnterPressed = function(self)
self:SetText(floor((self.CurrentValue or 0) + 0.5))
EditBox_ClearFocus(self)
end
---[[
-##########################################################
+--[[
+##########################################################
DRAGGABLES
##########################################################
]]--
@@ -969,7 +969,7 @@ local function SetDraggablePoint(frame, data)
end
local function SaveCurrentPosition(frame)
- if not frame then return end
+ if not frame then return end
local result;
local frameName = frame:GetName()
local anchor1, parent, anchor2, x, y = frame:GetPoint()
@@ -977,8 +977,8 @@ local function SaveCurrentPosition(frame)
result = "TBD";
else
local parentName
- if(not parent or (parent and (not parent:GetName()))) then
- parentName = "UIParent"
+ if(not parent or (parent and (not parent:GetName()))) then
+ parentName = "UIParent"
else
parentName = parent:GetName()
end
@@ -993,7 +993,7 @@ local function SaveCurrentPosition(frame)
end
local DraggerFrame_OnDragStart = function(self)
- if(not self:IsMovable()) then return; end
+ if(not self:IsMovable()) then return; end
self:StartMoving();
local data = UIPanels[self:GetName()];
if(data) then
@@ -1070,14 +1070,14 @@ local DraggerEventHandler = function(self, event, ...)
for frameName, data in pairs(UIPanels) do
if(not self.Frames[frameName] or (self.Frames[frameName] and type(self.Frames[frameName]) ~= 'string')) then
self.Frames[frameName] = 'TBD'
- noMoreChanges = false;
+ noMoreChanges = false;
end
- if(not data.initialized) then
+ if(not data.initialized) then
local frame = _G[frameName]
if(frame) then
frame:EnableMouse(true)
- if(frameName == "LFGDungeonReadyPopup") then
+ if(frameName == "LFGDungeonReadyPopup") then
LFGDungeonReadyDialog:EnableMouse(false)
end
@@ -1130,7 +1130,7 @@ end
--[[METHODS]]--
function Dragger:New(frameName)
- if(not UIPanels[frameName]) then
+ if(not UIPanels[frameName]) then
UIPanels[frameName] = { moving = false, snapped = false, canupdate = false, cansetpoint = false, centered = false };
if(not self.EventsActive) then
self:RegisterEvent("ADDON_LOADED")
@@ -1185,10 +1185,10 @@ function Dragger:Reset()
self.EventsActive = true;
end
- ReloadUI()
+ ReloadUI()
end
---[[
-##########################################################
+--[[
+##########################################################
LOAD BY TRIGGER
##########################################################
]]--
@@ -1273,11 +1273,14 @@ local function InitializeMovables()
SVUI_LayoutPrecisionSetY.CurrentValue = 0;
SVUI_LayoutPrecisionSetY:SetScript("OnEnterPressed", XML_LayoutPrecisionInputY_EnterPressed)
+ SVUI_LayoutPrecisionResetButton:SetStyle("Button")
SVUI_LayoutPrecisionUpButton:SetStyle("Button")
SVUI_LayoutPrecisionDownButton:SetStyle("Button")
SVUI_LayoutPrecisionLeftButton:SetStyle("Button")
SVUI_LayoutPrecisionRightButton:SetStyle("Button")
-
+
+ SVUI_LayoutPrecisionResetButton:SetScript("OnClick", SVUI_LayoutPrecisionResetButton_OnClick)
+
Layout:Update()
if(not SV.private.Draggables) then SV.private.Draggables = {} end
@@ -1307,8 +1310,8 @@ local function InitializeMovables()
end
SV.Events:On("LOAD_ALL_WIDGETS", InitializeMovables);
---[[
-##########################################################
+--[[
+##########################################################
CORE FUNCTIONS
##########################################################
]]--
@@ -1328,7 +1331,7 @@ function SV:ReAnchor(name, ...)
local grip = frame.Grip
grip:SetPoint(...)
SaveAnchor(grip.name)
-end
+end
function SV:MoveAnchors(arg)
Layout:Toggle(arg)
@@ -1343,31 +1346,31 @@ function SV:ResetAnchors(...)
end
function SV:ForceAnchors(forced)
- if(Layout.Frames) then
- for frame,_ in pairs(Layout.Frames) do
- if _G[frame] and _G[frame]:IsShown() then
+ if(Layout.Frames) then
+ for frame,_ in pairs(Layout.Frames) do
+ if _G[frame] and _G[frame]:IsShown() then
forced = true;
_G[frame]:Hide()
- end
- end
+ end
+ end
end
return forced
end
SV.SystemAlert["RESETBLIZZARD_CHECK"] = {
- text = L["Are you sure you want to all draggable Blizzard frames to their original positions? This will reload your UI."],
- button1 = ACCEPT,
- button2 = CANCEL,
- OnAccept = function(a) Dragger:Reset() end,
- timeout = 0,
+ text = L["Are you sure you want to all draggable Blizzard frames to their original positions? This will reload your UI."],
+ button1 = ACCEPT,
+ button2 = CANCEL,
+ OnAccept = function(a) Dragger:Reset() end,
+ timeout = 0,
whileDead = 1
};
SV.SystemAlert["RESETLAYOUT_CHECK"] = {
- text = L["Are you sure you want to all movable frames to their original positions?"],
- button1 = ACCEPT,
- button2 = CANCEL,
- OnAccept = function(a) Layout:Reset() end,
- timeout = 0,
+ text = L["Are you sure you want to all movable frames to their original positions?"],
+ button1 = ACCEPT,
+ button2 = CANCEL,
+ OnAccept = function(a) Layout:Reset() end,
+ timeout = 0,
whileDead = 1
-};
\ No newline at end of file
+};
diff --git a/SVUI_!Core/xml/widgets.xml b/SVUI_!Core/xml/widgets.xml
index 2d64692..474530c 100644
--- a/SVUI_!Core/xml/widgets.xml
+++ b/SVUI_!Core/xml/widgets.xml
@@ -112,7 +112,7 @@
<Frame name="SVUI_RaidMarkFrame" frameStrata="DIALOG" hidden="true" />
<Frame name="SVUI_LayoutPrecision" hidden="true" frameStrata="DIALOG">
- <Size x="130" y="60"/>
+ <Size x="200" y="60"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
@@ -160,7 +160,7 @@
<Size x="50" y="17"/>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBG" relativePoint="CENTER">
- <Offset x="-12" y="3"/>
+ <Offset x="-45" y="3"/>
</Anchor>
</Anchors>
@@ -183,7 +183,7 @@
<Size x="50" y="17"/>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBG" relativePoint="CENTER">
- <Offset x="12" y="3"/>
+ <Offset x="45" y="3"/>
</Anchor>
</Anchors>
<Scripts>
@@ -201,11 +201,23 @@
</Scripts>
</EditBox>
+ <Button name="$parentResetButton" inherits="OptionsButtonTemplate" text="Reset">
+ <Size x="66" y="20"/>
+ <Anchors>
+ <Anchor point="TOP" relativeTo="$parentBG" relativePoint="CENTER" x="0" y="-3" />
+ </Anchors>
+ <Scripts>
+ <OnLoad>
+ self:RegisterForClicks("AnyUp");
+ </OnLoad>
+ </Scripts>
+ </Button>
+
<Button name="$parentUpButton" inherits="UIPanelSquareButton">
<Size x="25" y="20"/>
<Anchors>
- <Anchor point="TOPLEFT" relativeTo="$parentBG" relativePoint="CENTER">
- <Offset x="10" y="-3"/>
+ <Anchor point="LEFT" relativeTo="$parentResetButton" relativePoint="RIGHT">
+ <Offset x="2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
@@ -246,8 +258,8 @@
<Button name="$parentRightButton" inherits="UIPanelSquareButton">
<Size x="25" y="20"/>
<Anchors>
- <Anchor point="RIGHT" relativeTo="$parentUpButton" relativePoint="LEFT">
- <Offset x="-20" y="0"/>
+ <Anchor point="RIGHT" relativeTo="$parentResetButton" relativePoint="LEFT">
+ <Offset x="-2" y="0"/>
</Anchor>
</Anchors>
<Scripts>
diff --git a/SVUI_NamePlates/SVUI_NamePlates.lua b/SVUI_NamePlates/SVUI_NamePlates.lua
index 4f193c6..452e070 100644
--- a/SVUI_NamePlates/SVUI_NamePlates.lua
+++ b/SVUI_NamePlates/SVUI_NamePlates.lua
@@ -185,6 +185,92 @@ local AuraClocks = {};
local ClockIsTicking = false;
local TickTock = 0;
local LastKnownTarget;
+local PLATE_CLASS_COLORS = {};
+do
+ for classToken, colorData in pairs(RAID_CLASS_COLORS) do
+ PLATE_CLASS_COLORS[classToken] = {colorData.r, colorData.g, colorData.b}
+ end
+end
+local PLATE_REACTION_MAP = {
+ --PLAYER
+ {
+ ['T'] = {
+ function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token],1 end end,
+ },
+ ['C'] = {
+ function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token],1 end end,
+ },
+ ['M'] = {
+ function(token) if(not token) then return NPReactPlayerGood else return PLATE_CLASS_COLORS[token],1 end end,
+ }
+ },
+ --TAPPED
+ {
+ ['T'] = {
+ function() return NPReactTap,1 end,
+ },
+ ['C'] = {
+ function() return NPReactTap,1 end,
+ },
+ ['M'] = {
+ function() return NPReactTap,1 end,
+ }
+ },
+ --FRIENDLY
+ {
+ ['T'] = {
+ function() return NPReactNPCGood,1 end,
+ },
+ ['C'] = {
+ function() return NPReactNPCGood,1 end,
+ },
+ ['M'] = {
+ function() return NPReactNPCGood,1 end,
+ }
+ },
+ --NEUTRAL
+ {
+ ['T'] = {
+ function() return NPReactNeutral,NPThreatGS end,
+ function() return NPBadTrans,NPThreatBS end,
+ function() return NPGoodTrans,NPThreatGS end,
+ function() return NPGoodThreat,NPThreatGS end,
+ },
+ ['C'] = {
+ function() return NPReactNeutral,NPThreatGS end,
+ function() return NPGoodTrans,NPThreatGS end,
+ function() return NPBadTrans,NPThreatBS end,
+ function() return NPBadThreat,NPThreatBS end,
+ },
+ ['M'] = {
+ function() return NPReactNeutral,NPThreatGS end,
+ function() return NPGoodTrans,NPThreatGS end,
+ function() return NPBadTrans,NPThreatBS end,
+ function() return NPBadThreat,NPThreatBS end,
+ }
+ },
+ --HOSTILE
+ {
+ ['T'] = {
+ function() if(not NPUseThreat) then return NPReactEnemy else if InCombatLockdown() then return NPBadThreat,NPThreatBS end end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPBadTrans,NPThreatBS end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPGoodTrans,NPThreatGS end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPGoodThreat,NPThreatGS end end,
+ },
+ ['C'] = {
+ function() if(not NPUseThreat) then return NPReactEnemy else if InCombatLockdown() then return NPGoodThreat,NPThreatGS end end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPGoodTrans,NPThreatGS end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPBadTrans,NPThreatBS end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPBadThreat,NPThreatBS end end,
+ },
+ ['M'] = {
+ function() if(not NPUseThreat) then return NPReactEnemy else if InCombatLockdown() then return NPGoodThreat,NPThreatGS end end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPGoodTrans,NPThreatGS end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPBadTrans,NPThreatBS end end,
+ function() if(not NPUseThreat) then return NPReactEnemy else return NPBadThreat,NPThreatBS end end,
+ }
+ },
+};
--[[
##########################################################
UTILITY FRAMES
@@ -606,7 +692,7 @@ function MOD:UpdateAuras(plate)
local guid = plate.guid
local frame = plate.frame
if not guid then
- if RAID_CLASS_COLORS[plate.setting.unitcategory] then
+ if RAID_CLASS_COLORS[plate.setting.classToken] then
local pn = plate.name:GetText()
local name = pn:gsub("%s%(%*%)", "")
guid = AuraByName[name]
@@ -664,20 +750,24 @@ PLATE COLORING
##########################################################
]]--
do
- local function GetPlateThreatReaction(plate)
- if plate.ref.threat:IsShown() then
- local r, g, b = plate.ref.threat:GetVertexColor()
+ local function GetPlateThreatReaction(threat)
+ if threat:IsShown() then
+ local r, g, b = threat:GetVertexColor()
if g + b == 0 then
- return 'FULL_THREAT'
+ plate.ref.reaction = 4
+ return 4
else
- if plate.ref.reaction == 'FULL_THREAT' then
- return 'GAINING_THREAT'
+ if plate.ref.reaction == 4 then
+ plate.ref.reaction = 2
+ return 2
else
- return 'LOSING_THREAT'
+ plate.ref.reaction = 3
+ return 3
end
end
else
- return 'NO_THREAT'
+ plate.ref.reaction = 1
+ return 1
end
end
@@ -685,7 +775,8 @@ do
if plate.guid ~= nil then
local class, classToken, _, _, _, _, _ = GetPlayerInfoByGUID(plate.guid)
if RAID_CLASS_COLORS[classToken] then
- return classToken
+ plate.setting.classToken = classToken
+ return PLATE_REACTION_MAP[1][NPClassRole][1](classToken)
end
end
@@ -700,22 +791,25 @@ do
bb = bb - 0.01
end
if RAID_CLASS_COLORS[classToken].r == r and RAID_CLASS_COLORS[classToken].g == g and RAID_CLASS_COLORS[classToken].b == bb then
- return classToken
+ plate.setting.classToken = classToken
+ return PLATE_REACTION_MAP[1][NPClassRole][1](classToken)
end
end
+ plate.setting.classToken = nil
if (r + b + b) == 1.59 then
- return 'TAPPED_NPC'
+ return PLATE_REACTION_MAP[2][NPClassRole][1]()
elseif g + b == 0 then
- return 'HOSTILE_NPC'
+ local threatReaction = GetPlateThreatReaction(plate.ref.threat)
+ return PLATE_REACTION_MAP[5][NPClassRole][threatReaction]()
elseif r + b == 0 then
- return 'FRIENDLY_NPC'
+ return PLATE_REACTION_MAP[3][NPClassRole][1]()
elseif r + g > 1.95 then
- return 'NEUTRAL_NPC'
+ return PLATE_REACTION_MAP[4][NPClassRole][1]()
elseif r + g == 0 then
- return 'FRIENDLY_PLAYER'
+ PLATE_REACTION_MAP[1][NPClassRole][1]()
else
- return 'HOSTILE_PLAYER'
+ PLATE_REACTION_MAP[1][NPClassRole][1]()
end
end
@@ -723,66 +817,9 @@ do
local unitType = GetPlateReaction(plate)
local scale = 1
- plate.setting.unitcategory = unitType
-
- local latestColor;
-
- if RAID_CLASS_COLORS[unitType] then
- latestColor = {RAID_CLASS_COLORS[unitType].r, RAID_CLASS_COLORS[unitType].g, RAID_CLASS_COLORS[unitType].b}
- elseif unitType == "TAPPED_NPC" then
- latestColor = NPReactTap
- elseif unitType == "HOSTILE_NPC" or unitType == "NEUTRAL_NPC" then
- local threatReaction = GetPlateThreatReaction(plate)
- if (not NPUseThreat) then
- if unitType == "NEUTRAL_NPC" then
- latestColor = NPReactNeutral
- else
- latestColor = NPReactEnemy
- end
- else
- if threatReaction == 'FULL_THREAT' then
- if NPClassRole == 'T' then
- latestColor = NPGoodThreat
- scale = NPThreatGS
- else
- latestColor = NPBadThreat
- scale = NPThreatBS
- end
- elseif threatReaction == 'GAINING_THREAT' then
- if NPClassRole == 'T' then
- latestColor = NPGoodTrans
- else
- latestColor = NPBadTrans
- end
- elseif threatReaction == 'LOSING_THREAT' then
- if NPClassRole == 'T' then
- latestColor = NPBadTrans
- else
- latestColor = NPGoodTrans
- end
- elseif InCombatLockdown() then
- if NPClassRole == 'T' then
- latestColor = NPBadThreat
- scale = NPThreatBS
- else
- latestColor = NPGoodThreat
- scale = NPThreatGS
- end
- else
- if unitType == "NEUTRAL_NPC" then
- latestColor = NPReactNeutral
- else
- latestColor = NPReactEnemy
- end
- end
- end
- plate.ref.reaction = threatReaction
- elseif unitType == "FRIENDLY_NPC" then
- latestColor = NPReactNPCGood
- elseif unitType == "FRIENDLY_PLAYER" then
- latestColor = NPReactPlayerGood
- end
+ plate.setting.classToken = unitType
+ local latestColor, scale = GetPlateReaction(plate);
local r,g,b
if(latestColor) then
r,g,b = unpack(latestColor)
@@ -795,6 +832,7 @@ do
NPGlow:SetBackdropColor(r,g,b,0.5)
NPGlow:SetBackdropBorderColor(r,g,b,0.5)
end
+
--frame.health.elite.bottom:SetVertexColor(r,g,b)
--frame.health.elite.right:SetVertexColor(r,g,b)
--frame.health.elite.left:SetVertexColor(r,g,b)
@@ -1099,7 +1137,7 @@ do
VisiblePlates[plate] = nil
PLATE_REF.reaction = nil
- PLATE_ARGS.unitcategory = nil
+ PLATE_ARGS.classToken = nil
plate.guid = nil
PLATE_ARGS.unit = nil
PLATE_REF.raidicontype = nil
@@ -1403,7 +1441,7 @@ do
if not sourceName then return; end
local SearchFor = split("-", sourceName)
for plate, _ in pairs(VisiblePlates) do
- if plate and plate:IsShown() and plate.ref.nametext == SearchFor and RAID_CLASS_COLORS[plate.setting.unitcategory] then
+ if plate and plate:IsShown() and plate.ref.nametext == SearchFor and RAID_CLASS_COLORS[plate.setting.classToken] then
return plate
end
end