diff --git a/Interface/AddOns/SVUI/SVUI.lua b/Interface/AddOns/SVUI/SVUI.lua index d37988e..0ffd426 100644 --- a/Interface/AddOns/SVUI/SVUI.lua +++ b/Interface/AddOns/SVUI/SVUI.lua @@ -149,6 +149,7 @@ end local messagePattern = "|cffFF2F00%s:|r"; local debugPattern = "|cffFF2F00%s|r [|cff992FFF%s|r]|cffFF2F00:|r"; +local errorPattern = "|cffff0000Error -- |r|cffff9900Required addon '|r|cffffff00%s|r|cffff9900' is %s.|r" local function _sendmessage(msg, prefix) if(type(msg) == "table") then @@ -218,22 +219,23 @@ local Core_ToggleConfig = function(self) self.UIParent:RegisterEvent('PLAYER_REGEN_ENABLED') return end - if not IsAddOnLoaded("SVUI_ConfigOMatic") then - local _,_,_,_,_,state = GetAddOnInfo("SVUI_ConfigOMatic") + if not IsAddOnLoaded(self.ConfigID) then + local _,_,_,_,_,state = GetAddOnInfo(self.ConfigID) if state ~= "MISSING" and state ~= "DISABLED" then - LoadAddOn("SVUI_ConfigOMatic") - local config_version = GetAddOnMetadata("SVUI_ConfigOMatic", "Version") + LoadAddOn(self.ConfigID) + local config_version = GetAddOnMetadata(self.ConfigID, "Version") if(tonumber(config_version) < 4) then self:StaticPopup_Show("CLIENT_UPDATE_REQUEST") end - else - self:AddonMessage("|cffff0000Error -- Addon 'SVUI_ConfigOMatic' not found or is disabled.|r") + else + local errorMessage = (errorPattern):format(self.ConfigID, state) + self:AddonMessage(errorMessage) return end end local aceConfig = LibStub("AceConfigDialog-3.0") - local switch = not aceConfig.OpenFrames["SVUI"] and "Open" or "Close" - aceConfig[switch](aceConfig, "SVUI") + local switch = not aceConfig.OpenFrames[self.NameID] and "Open" or "Close" + aceConfig[switch](aceConfig, self.NameID) GameTooltip:Hide() end @@ -262,6 +264,8 @@ end -- has no method for parsing them in LUA. local SVUI = SVLib:NewCore("SVUI_Global", "SVUI_Profile", "SVUI_Cache") +SVUI.ConfigID = "SVUI_ConfigOMatic"; + SVUI.Media = {} SVUI.DisplayAudit = {} SVUI.DynamicOptions = {} diff --git a/Interface/AddOns/SVUI/configs/configs.lua b/Interface/AddOns/SVUI/configs/configs.lua index eabfda7..655ef10 100644 --- a/Interface/AddOns/SVUI/configs/configs.lua +++ b/Interface/AddOns/SVUI/configs/configs.lua @@ -645,46 +645,47 @@ SV.configs = { [safename(86659)] = {0.98, 0.57, 0.11}, --Guardian of Ancient Kings } } - }, - ["filter"] = { - ["CC"] = {}, - ["Shield"] = {}, - ["Player"] = {}, - ["Blocked"] = {}, - ["Allowed"] = {}, - ["Strict"] = {}, - ["Raid"] = {}, - ["BuffWatch"] = BUFFWATCH_BY_CLASS[filterClass], - ["PetBuffWatch"] = { - {-- Frenzy - ["enabled"] = true, - ["id"] = 19615, - ["point"] = "TOPLEFT", - ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, - ["anyUnit"] = true, - ["onlyShowMissing"] = false, - ['style'] = 'coloredIcon', - ['displayText'] = false, - ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, - ['textThreshold'] = -1, - ['xOffset'] = 0, - ['yOffset'] = 0 - }, - {-- Mend Pet - ["enabled"] = true, - ["id"] = 136, - ["point"] = "TOPRIGHT", - ["color"] = {["r"] = 0.2, ["g"] = 0.8, ["b"] = 0.2}, - ["anyUnit"] = true, - ["onlyShowMissing"] = false, - ['style'] = 'coloredIcon', - ['displayText'] = false, - ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, - ['textThreshold'] = -1, - ['xOffset'] = 0, - ['yOffset'] = 0 - }, - } + } +} + +local FILTERS = { + ["CC"] = {}, + ["Shield"] = {}, + ["Player"] = {}, + ["Blocked"] = {}, + ["Allowed"] = {}, + ["Strict"] = {}, + ["Raid"] = {}, + ["BuffWatch"] = BUFFWATCH_BY_CLASS[filterClass], + ["PetBuffWatch"] = { + {-- Frenzy + ["enabled"] = true, + ["id"] = 19615, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Mend Pet + ["enabled"] = true, + ["id"] = 136, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.2, ["g"] = 0.8, ["b"] = 0.2}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, } } @@ -703,9 +704,11 @@ for k, x in pairs(FilterIDs) do src[n] = saved end end - SV.configs.filter[k] = src + FILTERS[k] = src end +SV.configs["filter"] = FILTERS + SV.configs["SVBar"] = { ["enable"] = true, ["font"] = "Roboto", diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua index 5f516e4..17e1654 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua @@ -1377,17 +1377,17 @@ function MOD:KillBlizzardRaidFrames() end end -function MOD:GROUP_ROSTER_UPDATE() - self:KillBlizzardRaidFrames() - if(IsInGroup()) then - if(not self:IsEventRegistered("ZONE_CHANGED_NEW_AREA")) then - self:ZONE_CHANGED_NEW_AREA() - self:RegisterEvent("ZONE_CHANGED_NEW_AREA") - end - else - self:UnregisterEvent("ZONE_CHANGED_NEW_AREA") - end; -end +-- function MOD:GROUP_ROSTER_UPDATE() +-- self:KillBlizzardRaidFrames() +-- if(IsInGroup()) then +-- if(not self:IsEventRegistered("ZONE_CHANGED_NEW_AREA")) then +-- self:ZONE_CHANGED_NEW_AREA() +-- self:RegisterEvent("ZONE_CHANGED_NEW_AREA") +-- end +-- else +-- self:UnregisterEvent("ZONE_CHANGED_NEW_AREA") +-- end; +-- end function MOD:PLAYER_REGEN_DISABLED() for _,frame in pairs(self.Headers) do diff --git a/Interface/AddOns/SVUI/packages/unit/frames.lua b/Interface/AddOns/SVUI/packages/unit/frames.lua index 06a2194..12111d7 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames.lua @@ -44,7 +44,7 @@ if(not MOD) then return end LOCAL DATA ########################################################## ]]-- -local CONSTRUCTORS, GROUP_UPDATES, PROXY_UPDATES = {}, {}, {} +local CONSTRUCTORS, GROUP_UPDATES = {}, {} local lastArenaFrame, lastBossFrame local sortMapping = { ["DOWN_RIGHT"] = {[1]="TOP",[2]="TOPLEFT",[3]="LEFT",[4]="RIGHT",[5]="LEFT",[6]=1,[7]=-1,[8]=false}, @@ -1212,8 +1212,8 @@ GROUP_UPDATES["raid10"] = function(self) frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0) SV.Mentalo:Add(frame, L["Raid 10 Frames"], nil, nil, nil, "ALL, RAID"..10) frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") frame:SetScript("OnEvent", Raid10Visibility) - PROXY_UPDATES["raid10"] = function() Raid10Visibility(frame) end; frame.positioned = true end Raid10Visibility(frame) @@ -1241,8 +1241,8 @@ GROUP_UPDATES["raid25"] = function(self) frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0) SV.Mentalo:Add(frame, L["Raid 25 Frames"], nil, nil, nil, "ALL, RAID"..25) frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") frame:SetScript("OnEvent", Raid25Visibility) - PROXY_UPDATES["raid25"] = function() Raid25Visibility(frame) end; frame.positioned = true end Raid25Visibility(frame) @@ -1270,8 +1270,8 @@ GROUP_UPDATES["raid40"] = function(self) frame:Point("LEFT", SV.UIParent, "LEFT", 4, 0) SV.Mentalo:Add(frame, L["Raid 40 Frames"], nil, nil, nil, "ALL, RAID"..40) frame:RegisterEvent("PLAYER_ENTERING_WORLD") + frame:RegisterEvent("ZONE_CHANGED_NEW_AREA") frame:SetScript("OnEvent", Raid40Visibility) - PROXY_UPDATES["raid40"] = function() Raid40Visibility(frame) end; frame.positioned = true end Raid40Visibility(frame) @@ -1403,8 +1403,8 @@ GROUP_UPDATES["raidpet"] = function(self) raidPets:Point("BOTTOMLEFT", SV.UIParent, "BOTTOMLEFT", 4, 433) SV.Mentalo:Add(raidPets, L["Raid Pet Frames"], nil, nil, nil, "ALL, RAID10, RAID25, RAID40") raidPets:RegisterEvent("PLAYER_ENTERING_WORLD") + raidPets:RegisterEvent("ZONE_CHANGED_NEW_AREA") raidPets:SetScript("OnEvent", RaidPetVisibility) - PROXY_UPDATES["raidpet"] = function() RaidPetVisibility(raidPets) end; raidPets.positioned = true; end RaidPetVisibility(raidPets) @@ -1547,8 +1547,8 @@ GROUP_UPDATES["party"] = function(self) group:Point("LEFT",SV.UIParent,"LEFT",40,0) SV.Mentalo:Add(group, L['Party Frames'], nil, nil, nil, 'ALL,PARTY,ARENA'); group:RegisterEvent("PLAYER_ENTERING_WORLD") + group:RegisterEvent("ZONE_CHANGED_NEW_AREA") group:SetScript("OnEvent", PartyVisibility) - PROXY_UPDATES["party"] = function() PartyVisibility(group) end; group.positioned = true; end PartyVisibility(group) @@ -2027,22 +2027,6 @@ end LOAD/UPDATE METHOD ########################################################## ]]-- -function MOD:ZONE_CHANGED_NEW_AREA() - if(not IsInGroup()) then return end; - if(IsInRaid()) then - local members = GetNumGroupMembers() - if(members > 25) then - PROXY_UPDATES["raid40"]() - elseif(members > 10) then - PROXY_UPDATES["raid25"]() - else - PROXY_UPDATES["raid10"]() - end - PROXY_UPDATES["raidpet"]() - elseif(IsInParty()) then - PROXY_UPDATES["party"]() - end; -end function MOD:SetGroupFrame(key, filter, template1, forceUpdate, template2) if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end diff --git a/Interface/AddOns/SVUI/system/load.lua b/Interface/AddOns/SVUI/system/load.lua index 9c597e7..5e86297 100644 --- a/Interface/AddOns/SVUI/system/load.lua +++ b/Interface/AddOns/SVUI/system/load.lua @@ -96,7 +96,6 @@ function SV:Load() local gxWidth = tonumber(match(rez,"(%d+)x%d+")); SVLib:Initialize() - self.Mentalo:Initialize() self.DisplaySettings = SVLib:NewCache("Display") if(not self.DisplaySettings.screenheight or (self.DisplaySettings.screenheight and type(self.DisplaySettings.screenheight) ~= "number")) then @@ -120,8 +119,7 @@ function SV:Launch() self:ScreenCalibration("PLAYER_LOGIN"); self:DefinePlayerRole(); - self.Mentalo:Launch() - self.Mentalo:SetPositions() + self.Mentalo:Initialize() self:VersionCheck() @@ -210,11 +208,11 @@ local SVUISystem_OnEvent = function(self, event, arg, ...) SV:TaintHandler(arg, ...) elseif(event == "PLAYER_REGEN_DISABLED") then local forceClosed = false; - if IsAddOnLoaded("SVUI_ConfigOMatic") then + if IsAddOnLoaded(SV.ConfigID) then local aceConfig=LibStub("AceConfigDialog-3.0") - if aceConfig.OpenFrames["SVUI"] then + if aceConfig.OpenFrames[SV.NameID] then self:RegisterEvent('PLAYER_REGEN_ENABLED') - aceConfig:Close("SVUI") + aceConfig:Close(SV.NameID) forceClosed = true end end diff --git a/Interface/AddOns/SVUI/system/mentalo.lua b/Interface/AddOns/SVUI/system/mentalo.lua index f432a8f..3f3e9a1 100644 --- a/Interface/AddOns/SVUI/system/mentalo.lua +++ b/Interface/AddOns/SVUI/system/mentalo.lua @@ -41,9 +41,8 @@ local Mentalo = {} Mentalo.Frames = {} Mentalo.Anchors = {} -Mentalo.Blizzard = {} -local MentaloEventHandler = CreateFrame("Frame", nil) +local MentaloUpdateHandler = CreateFrame("Frame", nil) local Sticky = {}; Sticky.Frames = {}; @@ -182,8 +181,7 @@ end LOCAL VARS ########################################################## ]]-- -local CurrentFrameTarget = false; -local UpdateFrameTarget = false; +local CurrentFrameTarget, UpdateFrameTarget; --[[ ########################################################## LOCAL FUNCTIONS @@ -276,9 +274,19 @@ local function CalculateOffsets(frame) xOffset = parsefloat(xOffset, 0) yOffset = parsefloat(yOffset, 0) anchor = ("%s%s"):format(a1,a2) + return xOffset, yOffset, anchor end +local function ResetAllAlphas() + for entry,_ in pairs(Mentalo.Frames) do + local frame = _G[entry] + if(frame) then + frame:SetAlpha(0.4) + end + end +end + --[[ /$$$$$$$$/$$ /$$ /$$$$$$$$ /$$ /$$ /$$$$$$ /$$ /$$ /$$$$$$$ |__ $$__/ $$ | $$| $$_____/ | $$ | $$ /$$__ $$| $$$ | $$| $$__ $$ @@ -344,12 +352,49 @@ HANDLERS local Movable_OnMouseUp = function(self) CurrentFrameTarget = self; local xOffset, yOffset, anchor = CalculateOffsets() - SVUI_MentaloPrecisionSetX:SetText(xOffset) - SVUI_MentaloPrecisionSetY:SetText(yOffset) + SVUI_MentaloPrecisionSetX.CurrentValue = xOffset; + SVUI_MentaloPrecisionSetX:SetText(xOffset) + SVUI_MentaloPrecisionSetY.CurrentValue = yOffset; + SVUI_MentaloPrecisionSetY:SetText(yOffset) + SVUI_MentaloPrecision.Title:SetText(self.textString) -end +end + +local Movable_OnUpdate = function(self) + local frame = UpdateFrameTarget; + if not frame then return end + local rightPos, topPos, centerPos = GrabUsableRegions() + local centerX, centerY = frame:GetCenter() + local calc1 = rightPos * 0.33; + local calc2 = rightPos * 0.66; + local calc3 = topPos * 0.5; + local anchor1, anchor2; + if centerY >= calc3 then + anchor1 = "TOP" + anchor2 = "BOTTOM" + centerY = -4 + else + anchor1 = "BOTTOM" + anchor2 = "TOP" + centerY = 4 + end + if centerX >= calc2 then + anchor1 = "RIGHT" + anchor2 = "LEFT" + centerX = -4 + elseif centerX <= calc1 then + anchor1 = "LEFT" + anchor2 = "RIGHT" + centerX = 4 + else + centerX = 0 + end + SVUI_MentaloPrecision:ClearAllPoints() + SVUI_MentaloPrecision:SetPoint(anchor1, frame, anchor2, centerX, centerY) + Movable_OnMouseUp(frame) +end local Movable_OnSizeChanged = function(self) if InCombatLockdown()then return end @@ -368,7 +413,8 @@ local Movable_OnDragStart = function(self) self:StartMoving() end UpdateFrameTarget = self; - MentaloEventHandler:Show() + MentaloUpdateHandler:Show() + MentaloUpdateHandler:SetScript("OnUpdate", Movable_OnUpdate) TheHand:Enable() TheHand.UserHeld = true end @@ -408,14 +454,17 @@ local Movable_OnDragStop = function(self) self:ClearAllPoints() self:Point(newAnchor, SV.UIParent, newAnchor, cX, cY) - Mentalo:SaveMovable(moveName) + Mentalo:SaveMovable(self.name) if SVUI_MentaloPrecision then Movable_OnMouseUp(self) end UpdateFrameTarget = nil; - MentaloEventHandler:Hide() + + MentaloUpdateHandler:SetScript("OnUpdate", nil) + MentaloUpdateHandler:Hide() + if(dragStopFunc ~= nil and type(dragStopFunc) == "function") then dragStopFunc(self, Pinpoint(self)) end @@ -424,11 +473,11 @@ local Movable_OnDragStop = function(self) end local Movable_OnEnter = function(self) - if TheHand.UserHeld then return end + if TheHand.UserHeld then return end + ResetAllAlphas() self:SetAlpha(1) self.text:SetTextColor(1, 1, 1) UpdateFrameTarget = self; - MentaloEventHandler:GetScript("OnUpdate")(MentaloEventHandler) SVUI_Mentalo.Avatar:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\MENTALO-ON]]) TheHand:SetPoint("CENTER", self, "TOP", 0, 0) TheHand:Show() @@ -439,17 +488,24 @@ local Movable_OnEnter = function(self) end local Movable_OnLeave = function(self) - if TheHand.UserHeld then return end - self:SetAlpha(0.4) + if TheHand.UserHeld then return end self.text:SetTextColor(0.1, 0.8, 0.8) SVUI_Mentalo.Avatar:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\MENTALO-OFF]]) TheHand:Hide() + if(CurrentFrameTarget ~= self and not SVUI_MentaloPrecision:IsShown()) then + self:SetAlpha(0.4) + end end local Movable_OnMouseDown = function(self, arg) if arg == "RightButton"then TheHand.UserHeld = false; - SVUI_MentaloPrecision:Show() + if(CurrentFrameTarget == self and not SVUI_MentaloPrecision:IsShown()) then + Movable_OnUpdate() + SVUI_MentaloPrecision:Show() + else + SVUI_MentaloPrecision:Hide() + end if SV.db.general.stickyFrames then Sticky:StopMoving(self) else @@ -593,13 +649,13 @@ function Mentalo:Add(frame, title, raised, snapOffset, dragStopFunc, movableGrou self:New(frame, moveName, title, raised, snapOffset, dragStopFunc) - local ghost; - for entry,_ in pairs(self.Frames) do - ghost = _G[entry] - if(ghost) then - ghost:SetAlpha(0.5) - end - end + -- local ghost; + -- for entry,_ in pairs(self.Frames) do + -- ghost = _G[entry] + -- if(ghost) then + -- ghost:SetAlpha(0.5) + -- end + -- end end function Mentalo:Reset(request) @@ -659,27 +715,7 @@ function Mentalo:SetPositions() end end end -end - -function Mentalo:Initialize() - for name, _ in pairs(self.Frames)do - local parent, text, overlay, snapoffset, postdrag; - for key, value in pairs(self.Frames[name])do - if(key == "parent") then - parent = value - elseif(key == "text") then - text = value - elseif(key == "overlay") then - overlay = value - elseif(key == "snapoffset") then - snapoffset = value - elseif(key == "postdrag") then - postdrag = value - end - end - self:New(parent, name, text, overlay, snapoffset, postdrag) - end -end +end function Mentalo:Toggle(isConfigMode, configType) if(InCombatLockdown()) then return end @@ -689,8 +725,8 @@ function Mentalo:Toggle(isConfigMode, configType) end if(not self.ConfigurationMode) then - if IsAddOnLoaded("SVUI_ConfigOMatic")then - LibStub("AceConfigDialog-3.0"):Close("SVUI") + if IsAddOnLoaded(SV.ConfigID)then + LibStub("AceConfigDialog-3.0"):Close(SV.NameID) GameTooltip:Hide() self.ConfigurationMode = true else @@ -725,128 +761,114 @@ function Mentalo:Toggle(isConfigMode, configType) end end end -end - -function Mentalo:Focus() - local frame = CurrentFrameTarget; - local xOffset, yOffset, anchor = CalculateOffsets() - frame:ClearAllPoints() - frame:Point(anchor, SV.UIParent, anchor, xOffset, yOffset) - self:SaveMovable(frame.name) end - -function Mentalo:Launch() - SVUI_Mentalo:SetFixedPanelTemplate("Component") - SVUI_Mentalo:SetPanelColor("yellow") - SVUI_MentaloPrecision:SetPanelTemplate("Transparent") - - self.Anchors = SVLib:NewCache("Anchors") -end - -SV.Mentalo = Mentalo --[[ ########################################################## -XML FRAME SCRIPT HANDLERS +SCRIPT AND EVENT HANDLERS ########################################################## ]]-- -function SVUI_Mentalo_OnLoad(self) - self:RegisterEvent("PLAYER_REGEN_DISABLED") - self:RegisterForDrag("LeftButton"); - self:SetButtonTemplate() -end - -function SVUI_Mentalo_OnEvent(self) +local XML_Mentalo_OnEvent = function(self) if self:IsShown() then self:Hide() - SV.Mentalo:Toggle(true) + Mentalo:Toggle(true) end end -function SVUI_MentaloLockButton_OnClick() - SV.Mentalo:Toggle(true) - if IsAddOnLoaded("SVUI_ConfigOMatic")then - LibStub("AceConfigDialog-3.0"):Open("SVUI") +local XML_MentaloLockButton_OnClick = function(self) + Mentalo:Toggle(true) + if IsAddOnLoaded(SV.ConfigID)then + LibStub("AceConfigDialog-3.0"):Open(SV.NameID) end end -function SVUI_MentaloPrecisionResetButton_OnClick() +local SVUI_MentaloPrecisionResetButton_OnClick = function(self) + if(not CurrentFrameTarget) then return end local name = CurrentFrameTarget.name - SV.Mentalo:Reset(name) -end - -function SVUI_MentaloPrecisionInput_EscapePressed(self) - self:SetText(parsefloat(self.CurrentValue)) - EditBox_ClearFocus(self) + Mentalo:Reset(name) end -function SVUI_MentaloPrecisionInput_EnterPressed(self) - local txt = tonumber(self:GetText()) - if(txt) then - self.CurrentValue = txt; - SV.Mentalo:Focus() - end - self:SetText(parsefloat(self.CurrentValue)) +local XML_MentaloPrecisionInputX_EnterPressed = function(self) + local current = tonumber(self:GetText()) + if(current) then + if(CurrentFrameTarget) then + local xOffset, yOffset, anchor = CalculateOffsets() + yOffset = tonumber(SVUI_MentaloPrecisionSetY.CurrentValue) + CurrentFrameTarget:ClearAllPoints() + CurrentFrameTarget:Point(anchor, SVUIParent, anchor, current, yOffset) + Mentalo:SaveMovable(CurrentFrameTarget.name) + end + self.CurrentValue = current + end + self:SetText(floor((self.CurrentValue or 0) + 0.5)) EditBox_ClearFocus(self) -end - -function SVUI_MentaloPrecisionInput_FocusLost(self) - self:SetText(parsefloat(self.CurrentValue)) -end +end -function SVUI_MentaloPrecisionInput_OnShow(self) +local XML_MentaloPrecisionInputY_EnterPressed = function(self) + local current = tonumber(self:GetText()) + if(current) then + if(CurrentFrameTarget) then + local xOffset, yOffset, anchor = CalculateOffsets() + xOffset = tonumber(SVUI_MentaloPrecisionSetX.CurrentValue) + CurrentFrameTarget:ClearAllPoints() + CurrentFrameTarget:Point(anchor, SVUIParent, anchor, xOffset, current) + Mentalo:SaveMovable(CurrentFrameTarget.name) + end + self.CurrentValue = current + end + self:SetText(floor((self.CurrentValue or 0) + 0.5)) EditBox_ClearFocus(self) - self:SetText(parsefloat(self.CurrentValue or 0)) -end - -function SVUI_MentaloPrecision_OnLoad() - _G["SVUI_MentaloPrecisionSetX"].CurrentValue = 0; - _G["SVUI_MentaloPrecisionSetY"].CurrentValue = 0; - _G["SVUI_MentaloPrecision"]:EnableMouse(true) - _G["SVUI_MentaloPrecisionSetX"]:SetEditboxTemplate() - _G["SVUI_MentaloPrecisionSetY"]:SetEditboxTemplate() - _G["SVUI_MentaloPrecisionUpButton"]:SetButtonTemplate() - _G["SVUI_MentaloPrecisionDownButton"]:SetButtonTemplate() - _G["SVUI_MentaloPrecisionLeftButton"]:SetButtonTemplate() - _G["SVUI_MentaloPrecisionRightButton"]:SetButtonTemplate() - CurrentFrameTarget = false; end --[[ ########################################################## -EVENT HANDLER +Initialize ########################################################## ]]-- -local MentaloEventHandler_OnUpdate = function(self) - local frame = UpdateFrameTarget; - if not frame then return end - local rightPos, topPos, centerPos = GrabUsableRegions() - local centerX, centerY = frame:GetCenter() - local calc1 = rightPos / 3; - local calc2 = ((rightPos * 2) / 3); - local calc3 = topPos / 2; - local anchor1, anchor2; - if centerY >= calc3 then - anchor1 = "TOP" - anchor2 = "BOTTOM" - centerY = -(topPos - frame:GetTop()) - else - anchor1 = "BOTTOM" - anchor2 = "TOP" - centerY = frame:GetBottom() - end - if centerX >= calc2 then - anchor1 = "RIGHT" - anchor2 = "LEFT" - centerX = (frame:GetRight() - rightPos) - elseif centerX <= calc1 then - anchor1 = "LEFT" - anchor2 = "RIGHT" - centerX = frame:GetLeft() - else - centerX = (centerX - centerPos) - end - SVUI_MentaloPrecision:ClearAllPoints() - SVUI_MentaloPrecision:SetPoint(anchor1, frame, anchor2, 0, 0) - Movable_OnMouseUp(frame) +function Mentalo:Initialize() + SVUI_Mentalo:SetFixedPanelTemplate("Component") + SVUI_Mentalo:SetPanelColor("yellow") + SVUI_Mentalo:RegisterForDrag("LeftButton") + SVUI_Mentalo:RegisterEvent("PLAYER_REGEN_DISABLED") + SVUI_Mentalo:SetScript("OnEvent", XML_Mentalo_OnEvent) + + SVUI_MentaloLockButton:SetScript("OnClick", XML_MentaloLockButton_OnClick) + + SVUI_MentaloPrecision:SetPanelTemplate("Transparent") + SVUI_MentaloPrecision:EnableMouse(true) + + SVUI_MentaloPrecisionSetX:SetEditboxTemplate() + SVUI_MentaloPrecisionSetX.CurrentValue = 0; + SVUI_MentaloPrecisionSetX:SetScript("OnEnterPressed", XML_MentaloPrecisionInputX_EnterPressed) + + SVUI_MentaloPrecisionSetY:SetEditboxTemplate() + SVUI_MentaloPrecisionSetY.CurrentValue = 0; + SVUI_MentaloPrecisionSetY:SetScript("OnEnterPressed", XML_MentaloPrecisionInputY_EnterPressed) + + SVUI_MentaloPrecisionUpButton:SetButtonTemplate() + SVUI_MentaloPrecisionDownButton:SetButtonTemplate() + SVUI_MentaloPrecisionLeftButton:SetButtonTemplate() + SVUI_MentaloPrecisionRightButton:SetButtonTemplate() + + self.Anchors = SVLib:NewCache("Anchors") + + for name, _ in pairs(self.Frames)do + local parent, text, overlay, snapoffset, postdrag; + for key, value in pairs(self.Frames[name])do + if(key == "parent") then + parent = value + elseif(key == "text") then + text = value + elseif(key == "overlay") then + overlay = value + elseif(key == "snapoffset") then + snapoffset = value + elseif(key == "postdrag") then + postdrag = value + end + end + self:New(parent, name, text, overlay, snapoffset, postdrag) + end + + self:SetPositions() end -MentaloEventHandler:SetScript("OnUpdate", MentaloEventHandler_OnUpdate) \ No newline at end of file +SV.Mentalo = Mentalo \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/mentalo.xml b/Interface/AddOns/SVUI/system/mentalo.xml index ab55fac..74b23b0 100644 --- a/Interface/AddOns/SVUI/system/mentalo.xml +++ b/Interface/AddOns/SVUI/system/mentalo.xml @@ -1,6 +1,4 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file="mentalo.lua"/> - <Frame name="SVUI_MentaloPrecision" inherits="SVUI_PanelTemplate" hidden="true" frameStrata="DIALOG"> <Size x="130" y="60"/> <Anchors> @@ -42,11 +40,16 @@ </Anchors> <Scripts> - <OnEscapePressed function="SVUI_MentaloPrecisionInput_EscapePressed"/> - <OnEnterPressed function="SVUI_MentaloPrecisionInput_EnterPressed"/> - <OnEditFocusLost function="SVUI_MentaloPrecisionInput_FocusLost"/> + <OnEscapePressed> + self:SetText(math.floor((self.CurrentValue or 0) + 0.5)) + EditBox_ClearFocus(self) + </OnEscapePressed> + <OnEditFocusLost> + self:SetText(math.floor((self.CurrentValue or 0) + 0.5)) + </OnEditFocusLost> <OnShow> - SVUI_MentaloPrecisionInput_OnShow(self) + EditBox_ClearFocus(self) + self:SetText(math.floor((self.CurrentValue or 0) + 0.5)) </OnShow> </Scripts> </EditBox> @@ -59,10 +62,17 @@ </Anchor> </Anchors> <Scripts> - <OnEscapePressed function="SVUI_MentaloPrecisionInput_EscapePressed"/> - <OnEnterPressed function="SVUI_MentaloPrecisionInput_EnterPressed"/> - <OnEditFocusLost function="SVUI_MentaloPrecisionInput_FocusLost"/> - <OnShow function="SVUI_MentaloPrecisionInput_OnShow"/> + <OnEscapePressed> + self:SetText(math.floor((self.CurrentValue or 0) + 0.5)) + EditBox_ClearFocus(self) + </OnEscapePressed> + <OnEditFocusLost> + self:SetText(math.floor((self.CurrentValue or 0) + 0.5)) + </OnEditFocusLost> + <OnShow> + EditBox_ClearFocus(self) + self:SetText(math.floor((self.CurrentValue or 0) + 0.5)) + </OnShow> </Scripts> </EditBox> @@ -80,7 +90,8 @@ </OnLoad> <OnClick> local frame = _G["SVUI_MentaloPrecisionSetY"]; - frame:SetText(frame.CurrentValue + 1) + frame.CurrentValue = frame.CurrentValue + 1 + frame:SetText(frame.CurrentValue) frame:GetScript('OnEnterPressed')(frame) </OnClick> </Scripts> @@ -100,7 +111,8 @@ </OnLoad> <OnClick> local frame = _G["SVUI_MentaloPrecisionSetY"]; - frame:SetText(frame.CurrentValue - 1) + frame.CurrentValue = frame.CurrentValue - 1 + frame:SetText(frame.CurrentValue) frame:GetScript('OnEnterPressed')(frame) </OnClick> </Scripts> @@ -120,7 +132,8 @@ </OnLoad> <OnClick> local frame = _G["SVUI_MentaloPrecisionSetX"]; - frame:SetText(frame.CurrentValue + 1) + frame.CurrentValue = frame.CurrentValue + 1 + frame:SetText(frame.CurrentValue) frame:GetScript('OnEnterPressed')(frame) </OnClick> </Scripts> @@ -140,15 +153,13 @@ </OnLoad> <OnClick> local frame = _G["SVUI_MentaloPrecisionSetX"]; - frame:SetText(frame.CurrentValue - 1) + frame.CurrentValue = frame.CurrentValue - 1 + frame:SetText(frame.CurrentValue) frame:GetScript('OnEnterPressed')(frame) </OnClick> </Scripts> </Button> </Frames> - <Scripts> - <OnLoad function="SVUI_MentaloPrecision_OnLoad"/> - </Scripts> </Frame> <Frame name="SVUI_Mentalo" movable="true" hidden="true" frameStrata="DIALOG"> @@ -207,26 +218,22 @@ <Offset x="-4" y="0"/> </Anchor> </Anchors> - <Scripts> - <OnClick function="SVUI_MentaloLockButton_OnClick"/> - </Scripts> </Button> </Frames> <Scripts> - <OnLoad function="SVUI_Mentalo_OnLoad"/> - <OnEvent function="SVUI_Mentalo_OnEvent"/> <OnHide> - local frame = _G["SVUI_MentaloPrecision"]; - frame:Hide(); + _G["SVUI_MentaloPrecision"]:Hide(); </OnHide> <OnDragStart> - _G["SVUI_Mentalo"].moving = true; - _G["SVUI_Mentalo"]:StartMoving(); + self.moving = true; + self:StartMoving(); </OnDragStart> <OnDragStop> - _G["SVUI_Mentalo"].moving = nil; - _G["SVUI_Mentalo"]:StopMovingOrSizing(); + self.moving = nil; + self:StopMovingOrSizing(); </OnDragStop> </Scripts> </Frame> + + <Script file="mentalo.lua"/> </Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/system/moveable.lua b/Interface/AddOns/SVUI/system/moveable.lua index 00c384a..35152cb 100644 --- a/Interface/AddOns/SVUI/system/moveable.lua +++ b/Interface/AddOns/SVUI/system/moveable.lua @@ -38,7 +38,8 @@ local SVLib = LibStub("LibSuperVillain-1.0") local L = SVLib:Lang(); local Movable = CreateFrame("Frame", nil) -Movable.Frames = {} +local MovableFrames = {} +MovableFrames["GameMenuFrame"] = {} --[[ ########################################################## LOCAL VARS @@ -107,16 +108,15 @@ local BlizzardFrame_OnUpdate = function(self) if self.IsMoving then return end self:ClearAllPoints() if self:GetName() == "QuestFrame" then - if Movable.Frames["GossipFrame"].Points ~= nil then - self:SetPoint(unpack(Movable.Frames["GossipFrame"].Points)) + if MovableFrames["GossipFrame"].Points ~= nil then + self:SetPoint(unpack(MovableFrames["GossipFrame"].Points)) end - elseif Movable.Frames[self:GetName()].Points ~= nil then - self:SetPoint(unpack(Movable.Frames[self:GetName()].Points)) + elseif MovableFrames[self:GetName()].Points ~= nil then + self:SetPoint(unpack(MovableFrames[self:GetName()].Points)) end end local BlizzardFrame_OnDragStart = function(self) - print(self:GetName()) if not self:IsMovable() then return end self:StartMoving() self.IsMoving = true @@ -132,9 +132,9 @@ local BlizzardFrame_OnDragStop = function(self) self:ClearAllPoints() self:SetPoint(anchor1, parent, anchor2, x, y) if self:GetName() == "QuestFrame" then - Movable.Frames["GossipFrame"].Points = {anchor1, parent, anchor2, x, y} + MovableFrames["GossipFrame"].Points = {anchor1, parent, anchor2, x, y} else - Movable.Frames[self:GetName()].Points = {anchor1, parent, anchor2, x, y} + MovableFrames[self:GetName()].Points = {anchor1, parent, anchor2, x, y} end end @@ -142,7 +142,7 @@ local Movable_OnEvent = function(self) for _, frameName in pairs(DraggableFrames) do local frame = _G[frameName] if(frame) then - if(frameName ~= "LossOfControlFrame" and (not Movable.Frames[frameName])) then + if(frameName ~= "LossOfControlFrame" and (not MovableFrames[frameName])) then frame:EnableMouse(true) if(frameName == "LFGDungeonReadyPopup") then @@ -155,13 +155,11 @@ local Movable_OnEvent = function(self) frame:HookScript("OnUpdate", BlizzardFrame_OnUpdate) frame:SetScript("OnDragStart", BlizzardFrame_OnDragStart) frame:SetScript("OnDragStop", BlizzardFrame_OnDragStop) - Movable.Frames[frameName] = {} + MovableFrames[frameName] = {} end end end - if(not Movable.Frames["GameMenuFrame"]) then - Movable.Frames["GameMenuFrame"] = {} - end + collectgarbage("collect") end Movable:RegisterEvent("PLAYER_LOGIN") diff --git a/Interface/AddOns/SVUI/system/setup.lua b/Interface/AddOns/SVUI/system/setup.lua index 83f638e..3c4ffe0 100644 --- a/Interface/AddOns/SVUI/system/setup.lua +++ b/Interface/AddOns/SVUI/system/setup.lua @@ -1634,7 +1634,7 @@ local function SetupBarLayout(style, preserve) end end -local function SetupAuralayout(self, style, preserve) +local function SetupAuralayout(style, preserve) style = style or "default"; local presets = LoadPresetData("auras", style) diff --git a/Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua b/Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua index 34eaa9b..7a9f217 100644 --- a/Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua +++ b/Interface/AddOns/SVUI_AnsweringService/SVUI_AnsweringService.lua @@ -691,7 +691,7 @@ do if(not outbound) then outbound = PhraseSearch(sInput, mapkey, data) end - if(self.db.prefix == true) then + if(PLUGIN.db.prefix == true) then return ("%s's Answering Service: %s"):format(PlayersName, outbound) else return outbound diff --git a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua index e95bf49..842198d 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua @@ -33,8 +33,8 @@ local SV = SVUI; local L = LibStub("LibSuperVillain-1.0"):Lang(); local Ace3Config = LibStub("AceConfig-3.0"); local Ace3ConfigDialog = LibStub("AceConfigDialog-3.0"); -Ace3Config:RegisterOptionsTable("SVUI", SV.Options); -Ace3ConfigDialog:SetDefaultSize("SVUI", 890, 651); +Ace3Config:RegisterOptionsTable(SV.NameID, SV.Options); +Ace3ConfigDialog:SetDefaultSize(SV.NameID, 890, 651); local AceGUI = LibStub("AceGUI-3.0", true); local posOpts = {TOPLEFT='TOPLEFT',LEFT='LEFT',BOTTOMLEFT='BOTTOMLEFT',RIGHT='RIGHT',TOPRIGHT='TOPRIGHT',BOTTOMRIGHT='BOTTOMRIGHT',CENTER='CENTER',TOP='TOP',BOTTOM='BOTTOM'}; local GEAR = SV.SVGear; @@ -53,8 +53,6 @@ local function CommonFontSizeUpdate() SV.db.SVBar.fontSize = smallfont; SV.db.SVPlate.fontSize = smallfont; - - SV.db.SVLaborer.fontSize = largefont; SV.db.SVUnit.player.health.fontSize = largefont; SV.db.SVUnit.player.power.fontSize = largefont; @@ -489,8 +487,8 @@ SV.Options.args.common = { order = 2, type = "group", name = L["Media"], - get = function(j)return SV.db[j[#j]]end, - set = function(j, value)SV.db[j[#j]] = value end, + get = function(j)return SV.db[j[#j]] end, + set = function(j, value) SV.db[j[#j]] = value end, args = { texture = { order = 1, @@ -536,7 +534,10 @@ SV.Options.args.common = { min = 6, max = 22, step = 1, - set = function(j,value)SV.db.media.fonts[j[#j]] = value;CommonFontSizeUpdate()end + get = function(key) + return SV.db.media.fonts[key[#key]] + end, + set = function(key,value)SV.db.media.fonts[key[#key]] = value; CommonFontSizeUpdate() end }, unicodeSize = { order = 2, @@ -547,7 +548,10 @@ SV.Options.args.common = { min = 6, max = 22, step = 1, - set = function(j,value)SV.db.media.fonts[j[#j]] = value;CommonFontSizeUpdate()end + get = function(key) + return SV.db.media.fonts[key[#key]] + end, + set = function(key,value)SV.db.media.fonts[key[#key]] = value; CommonFontSizeUpdate() end }, fontSpacer1 = { order = 3, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua index add8ab7..4df6d33 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua @@ -777,5 +777,5 @@ SV.Options.args.filters = { function ns:SetToFilterConfig(newFilter) filterType = newFilter or "BuffWatch" generateFilterOptions() - LibStub("AceConfigDialog-3.0"):SelectGroup("SVUI", "filters") + LibStub("AceConfigDialog-3.0"):SelectGroup(SV.NameID, "filters") end \ No newline at end of file diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua index 4e64969..8a100f8 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua @@ -587,7 +587,7 @@ function ns:SetHealthConfigGroup(partyRaid, updateFunction, unitName, count) width = "full", name = L["Coloring"], type = "execute", - func = function()ACD:SelectGroup("SVUI", "SVUnit", "common", "allColorsGroup", "healthGroup")end + func = function() ACD:SelectGroup(SV.NameID, "SVUnit", "common", "allColorsGroup", "healthGroup") end }, xOffset = {order = 5, type = "range", width = "full", name = L["Text xOffset"], desc = L["Offset position for text."], min = -300, max = 300, step = 1}, yOffset = {order = 6, type = "range", width = "full", name = L["Text yOffset"], desc = L["Offset position for text."], min = -300, max = 300, step = 1}, @@ -676,7 +676,7 @@ function ns:SetPowerConfigGroup(playerTarget, updateFunction, unitName, count) name = L["Coloring"], width = "full", type = "execute", - func = function()ACD:SelectGroup("SVUI", "SVUnit", "common", "allColorsGroup", "powerGroup")end + func = function()ACD:SelectGroup(SV.NameID, "SVUnit", "common", "allColorsGroup", "powerGroup")end }, height = { type = "range", @@ -1207,7 +1207,7 @@ function ns:SetAurabarConfigGroup(custom, updateFunction, unitName) configureButton1 = { order = 1, name = L["Coloring"], - type = "execute", func = function()ACD:SelectGroup("SVUI", "SVUnit", "common", "allColorsGroup", "auraBars")end + type = "execute", func = function()ACD:SelectGroup(SV.NameID, "SVUnit", "common", "allColorsGroup", "auraBars")end }, configureButton2 = { order = 2, diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/supervillain.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/supervillain.lua index da9b217..fb2bd0f 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/supervillain.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/supervillain.lua @@ -94,7 +94,7 @@ AceGUI STYLE ########################################################## ]]-- local function StyleAceGUI(event, addon) - assert((LibStub("AceGUI-3.0") and (addon == "SVUI_ConfigOMatic")), "Addon Not Loaded") + assert((LibStub("AceGUI-3.0") and (addon == SV.ConfigID)), "Addon Not Loaded") local AceGUI = LibStub("AceGUI-3.0") local regWidget = AceGUI.RegisterAsWidget; diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua index 4153b19..7de7600 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/Altoholic.lua @@ -41,9 +41,7 @@ local function ColorAltoBorder(self) if self.border then local r, g, b = self.border:GetVertexColor() local Backdrop = self.backdrop or self.Backdrop - if Backdrop then - Backdrop:SetBackdropBorderColor(r, g, b, 1) - end + Backdrop:SetBackdropBorderColor(r, g, b, 1) end end diff --git a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/BigWigs.lua b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/BigWigs.lua index adb34f8..f6d2614 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/BigWigs.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/addons/thirdparty/BigWigs.lua @@ -123,10 +123,11 @@ end local function StyleBigWigs(event, addon) assert(BigWigs, "AddOn Not Loaded") if (IsAddOnLoaded('BigWigs_Plugins') or event == "ADDON_LOADED" and addon == 'BigWigs_Plugins') then + local styleName = SV.NameID local BigWigsBars = BigWigs:GetPlugin('Bars') if BigWigsLoaded then return end BigWigsLoaded = true - BigWigsBars:RegisterBarStyle("SVUI", { + BigWigsBars:RegisterBarStyle(styleName, { apiVersion = 1, version = 1, GetSpacing = function(bar) @@ -134,9 +135,9 @@ local function StyleBigWigs(event, addon) end, ApplyStyle = applystyle, BarStopped = freestyle, - GetStyleName = function() return "SVUI" end, + GetStyleName = function() return styleName end, }) - BigWigsBars:SetBarStyle("SVUI") + BigWigsBars:SetBarStyle(styleName) STYLE:SafeEventRemoval("BigWigs", "ADDON_LOADED") STYLE:SafeEventRemoval("BigWigs", "PLAYER_ENTERING_WORLD") end