self.OnMACreateVM = function(self)
self:ClearAllPoints()
self:SetPoint("BOTTOMRIGHT", "UIParent", "BOTTOMRIGHT", -90, 125)
self.realID = self:GetID()
if self:GetName() == "KeyRingFrame" then
self.realID = KEYRING_CONTAINER
end
if self.realID == KEYRING_CONTAINER then
self.size = GetKeyRingSize()
else
self.size = GetContainerNumSlots(self.realID)
end
MovAny:SetBag(self.realID, self)
end
self.OnMAHook = function(self)
if self.size == 0 and self.realID ~= KEYRING_CONTAINER then
self.size = GetContainerNumSlots(self.realID)
end
local conSettings = self.realID == 0 and MovAny.CONTAINER_FRAME_TABLE[0] or MovAny.CONTAINER_FRAME_TABLE[self.size ~= 0 and self.size or 20]
self:SetWidth(CONTAINER_WIDTH)
self:SetHeight(conSettings[4])
local container = MovAny:GetContainerFrame(self.realID)
if container then
self:SetWidth(container:GetWidth())
self:SetHeight(container:GetHeight())
container:SetParent(_G.UIParent)
self:ClearAllPoints()
self:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", container:GetLeft(), container:GetBottom())
MovAny:GrabContainerFrame(container, self)
container.MAParent = self
end
end
local posFunc = function(self)
local container = MovAny:GetContainerFrame(self.realID)
if container then
MovAny:UnlockPoint(container)
container:ClearAllPoints()
container:SetPoint("CENTER", self, "CENTER", 0, 0)
MovAny:LockPoint(container)
end
end
self.OnMAPosition = posFunc
self.OnMAPreReset = posFunc
self.OnMAPostReset = function(self, readOnly)
local container = MovAny:GetContainerFrame(self.realID)
if container then
MovAny:UnlockPoint(container)
MovAny:UnlockScale(container)
container:ClearAllPoints()
end
if readOnly then
return
end
local mover = _G.BagsMover
if mover then
if mover.attachedChildren then
table.wipe(mover.attachedChildren)
end
mover:MAScanForChildren()
--mover:FoundChild(self.realID, self)
end
UpdateContainerFrameAnchors()
end
self.OnMAAttach = function(self)
local container = MovAny:GetContainerFrame(self.realID)
if container then
local mover = _G.BagsMover
if mover then
if mover.attachedChildren then
mover:ReleaseChildByName(container:GetName())
end
end
MovAny:UnlockPoint(container)
MovAny:UnlockScale(container)
if MovAny:IsModified(self, "scale") then
container:SetScale(self:GetScale())
else
container:SetScale(1)
end
MovAny:LockScale(container)
end
--updateContainerFrameAnchors()
end
self.OnMAPostAttach = function(self)
posFunc(self)
--[[local mover = _G.BagsMover
if mover then
if mover.attachedChildren then
table.wipe(mover.attachedChildren)
end
mover:MAScanForChildren()
end]]
UpdateContainerFrameAnchors()
end
self.OnMAAlpha = function(ref, alpha)
local con = MovAny:GetContainerFrame(ref.realID)
if con then
con:SetAlpha(alpha)
end
end
self.OnMAScale = function(ref, scale)
if scale and scale >= 0 then
local con = MovAny:GetContainerFrame(ref.realID)
if con then
MovAny:UnlockScale(con)
con:SetScale(scale)
MovAny:LockScale(con)
posFunc(ref)
end
end
end
self.neverShowTooltip = true
self.background = CreateFrame("Frame", self:GetName().."Backdrop", self, "BackdropTemplate")
self.background:SetBackdropColor(.8, .8, .8, .7)
self.background:SetBackdropBorderColor(1, 1, 1, 1)
if self.tagged and self.infoShown and self.moving then
local f = self.tagged
local str = MANumFor(f:GetLeft()).." , "..MANumFor(f:GetBottom())
local label = _G[self:GetName().."BackdropInfoLabel"]
label:Show()
label:SetText(str)
if self == MovAny.currentMover then
_G["MANudgerInfoLabel"]:Show()
_G["MANudgerInfoLabel"]:SetText(str)
end
end
local button = GetMouseButtonClicked()
if self.tagged then
if not IsControlKeyDown() then
local f = self.tagged
self.moving = true
if not self.MAE.noMove then
if not MovAny:IsProtected(f) or not InCombatLockdown() then
MovAny:UnlockPoint(f)
f:ClearAllPoints()
if f.MASetPoint then
f:MASetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, 0)
else
f:SetPoint("BOTTOMLEFT", self, "BOTTOMLEFT", 0, 0)
end
MovAny:LockPoint(f)
end
if button == "LeftButton" then
local str = MANumFor(f:GetLeft()).." , "..MANumFor(f:GetBottom())
_G[self:GetName().."BackdropInfoLabel"]:SetText(str)
if self == MovAny.currentMover then
_G["MANudgerInfoLabel"]:SetText(str)
_G["MANudgerInfoLabel"]:Show()
end
self.infoShown = true
if f.OnMAPosition then
f:OnMAPosition()
end
end
end
if button == "LeftButton" then
self:SetMovable(true)
self:StartMoving()
end
end
end
self.moving = nil
local button = GetMouseButtonClicked()
if self.tagged then
if not self.MAE.noMove then
MovAny:MoverUpdatePosition(self)
end
self:StopMovingOrSizing()
end
if IsControlKeyDown() then
MovAny:FrameEditor(self.tagged:GetName())
else
if button == "RightButton" and self.tagged and not MovAny:ErrorNotInCombat(self.tagged) then
if IsShiftKeyDown() then
local t = _G[self:GetName().."Backdrop"]
if t:IsVisible() then
t:Hide()
else
t:Show()
end
else
MovAny:StopMoving(self.tagged:GetName())
end
end
end
MovAny:MoverOnSizeChanged(self)
MovAny:MoverOnShow(self)
MovAny:MoverOnHide()
if self == MovAny.currentMover then
_G[ "MANudgerInfoLabel"]:Hide()
end
if self.tagged then
if self.alwaysShowTooltip or (self.neverShowTooltip and IsShiftKeyDown()) or (MADB.tooltips and not IsShiftKeyDown() and not self.neverShowTooltip) or (not MADB.tooltips and IsShiftKeyDown()) then
self.tooltipLines = MovAny:GetFrameTooltipLines(self.tagged:GetName())
MovAny:TooltipShowMultiline(self)
end
end
GameTooltip:Hide()
self.background = CreateFrame("Frame", nil, self, "BackdropTemplate")
self.background:SetAllPoints()
self.background:SetBackdrop(
{
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 8,
insets = { left = 3, right = 3, top = 3, bottom = 3, },
})
self.background = CreateFrame("Frame", nil, self, "BackdropTemplate")
self.background:SetAllPoints()
self.background:SetBackdrop(
{
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 12,
insets = { left = 2, right = 2, top = 2, bottom = 2, },
})
self.background:SetFrameLevel(self:GetFrameLevel())
self.background:SetBackdropColor(.03, .03, .03)
self.background:SetBackdropBorderColor(.4, .4, .4)
MovAny:RowTitleClicked(self)
MovAny:OnMoveCheck(self)
MovAny:OnHideCheck(self)
_G[self:GetName().."Text"]:SetText("FE")
self.tooltipText = "Toggle visibility on frame editors"
if IsShiftKeyDown() then
for i, fe in pairs(MovAny.frameEditors) do
fe:CloseDialog()
end
end
if MovAny.ToggleFrameEditors then
MovAny:ToggleFrameEditors()
end
_G[self:GetName().."Text"]:SetText("M")
self.tooltipText = "Toggles all movers"
if IsShiftKeyDown() then
table.wipe(MovAny.minimizedMovers)
end
MovAny:ToggleMovers()
_G[self:GetName().."Text"]:SetText("MF")
self.tooltipText = "Show only modified frames"
MovAny:OnCheckToggleModifiedFramesOnly(self)
_G[self:GetName().."Text"]:SetText("CE")
self.tooltipText = "Toggle all categories"
MovAny:OnCheckToggleCategories(self)
_G[self:GetName().."Text"]:SetText("FS")
self.tooltipText = "Toggle Blizzard's framestack tooltip\n\n A very helpful tool for finding frame names for use with /move or /hide"
UIParentLoadAddOn("Blizzard_DebugTools")
FrameStackTooltip_Toggle()
self:SetText(MOVANY.SEARCH_TEXT)
self:HighlightText(0, 0)
if self:GetText() == MOVANY.SEARCH_TEXT then
self:SetText("")
end
self:HighlightText(0, 0)
if self:GetText() == "" or self:GetText() == nil then
self:SetText(MOVANY.SEARCH_TEXT)
end
MovAny:Search(self:GetText())
self:ClearFocus()
MovAny:Search(self:GetText())
self:ClearFocus()
if self:GetText() ~= MOVANY.SEARCH_TEXT then
MovAny:Search(self:GetText())
end
if self:GetText() == "" or self:GetText() == nil then
self:SetText(MOVANY.SEARCH_TEXT)
elseif self:GetText() ~= MOVANY.SEARCH_TEXT then
MovAny:Search(self:GetText())
end
self:ClearFocus()
FauxScrollFrame_OnVerticalScroll(self, offset, MovAny.SCROLL_HEIGHT, MovAny.UpdateGUI)
self.background = CreateFrame("Frame", nil, self, "BackdropTemplate")
self.background:SetAllPoints()
self.background:SetBackdrop(
{
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 12,
insets = { left = 2, right = 2, top = 2, bottom = 2, },
})
self.background:SetFrameLevel(self:GetFrameLevel())
self.background:SetBackdropColor(.1, .1, .1)
self.background:SetBackdropBorderColor(.4, .4, .4)
self.background = CreateFrame("Frame", nil, self, "BackdropTemplate")
self.background:SetAllPoints()
self.background:SetBackdrop(
{
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 11, right = 12, top = 12, bottom = 11, },
})
self.background:SetFrameLevel(self:GetFrameLevel())
self:EnableMouse(true)
self:SetMovable(true)
self:RegisterForDrag("LeftButton")
self:RegisterEvent("ADDON_LOADED")
self:RegisterEvent("PLAYER_LOGOUT")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("GROUP_ROSTER_UPDATE")
if WOW_PROJECT_ID ~= WOW_PROJECT_CLASSIC then
self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
self:RegisterEvent("PLAYER_FOCUS_CHANGED")
end
MovAny:OnShow()
MovAny:OnHide()
self:StartMoving()
self:StopMovingOrSizing()