WoWInterface SVN MultiScreenSupport

[/] [trunk/] [MultiScreenSupport.lua] - Rev 6

Go to most recent revision | Compare with Previous | Blame | View Log

MultiScreenSupport = LibStub("AceAddon-3.0"):NewAddon("MultiScreenSupport", "AceEvent-3.0")
local AceConfigDialog = LibStub("AceConfigDialog-3.0")
local AceConfig = LibStub("AceConfig-3.0")
--local L = LibStub("AceLocale-3.0"):GetLocale("MultiScreenSupport")
local FrameNumber = 0

local self = MultiScreenSupport
function MultiScreenSupport:OnInitialize()
        MultiScreenSupport:RegisterEvent("PLAYER_LOGIN")
end

function MultiScreenSupport:IsNamePlate(obj)
        local Object = obj
        local Name = Object:GetName()
        
        if (Name and Name:match("NamePlate")) then
                return true
        else
                return false
        end
end

function MultiScreenSupport:OnShowPlate()
        if InCombatLockdown() then
                --table.insert(frameUpdateList, self)
                -- return -- TODO: watch this carefully
        else
                frameUpdateList = {}
                self.Bar:SetSize(self.Bar:GetWidth()/_G['multiscreensupportsave']['screen'], self.Bar:GetHeight()/_G['multiscreensupportsave']['screen'])
        end
end

function MultiScreenSupport:PlateTreatement(obj)
        local Plate = obj
        
        Plate.IsMultiScreenSupport = true
        Plate.Bar, Plate.Frame = Plate:GetChildren()
        if _G['multiscreensupportsave']['nameplatesbg'] ~= -1 then
                Plate.Bar:SetBackdrop(
                        {
                                bgFile = "Interface/Tooltips/UI-Tooltip-Background",
                                edgeFile = "",
                                tile = true, tileSize = 1, edgeSize = 0,
                                insets = { left = 0, right = 0, top = 0, bottom = 0 }
                        }
                );
                Plate.Bar:SetBackdropColor(0,0,0,.2);
        end
        
        if _G['multiscreensupportsave']['nameplates'] ~= -1 then
                Plate:HookScript("OnShow", self.OnShowPlate)

                if InCombatLockdown() then
                        --table.insert(frameUpdateList, Plate)
                        -- return -- TODO: watch this carefully
                else
                        frameUpdateList = {}
                        --NP.db.healthBar.width, NP.db.healthBar.height
                        Plate.Bar:SetSize(Plate.Bar:GetWidth()/_G['multiscreensupportsave']['screen'], Plate.Bar:GetHeight()/_G['multiscreensupportsave']['screen'])
                end
        end
end

function MultiScreenSupport:OnUpdate()
        local CurrentFrameNumber = WorldFrame:GetNumChildren()
        
        if (FrameNumber == CurrentFrameNumber) then
                return
        end
        
        for _, Object in pairs({WorldFrame:GetChildren()}) do
                local IsPlate = MultiScreenSupport.IsNamePlate(MultiScreenSupport, Object)
                
                if (not Object.IsMultiScreenSupport and IsPlate) then
                        MultiScreenSupport:PlateTreatement(Object)
                end
        end
        
        FrameNumber = CurrentFrameNumber
end

function MultiScreenSupport:addParentAnchor(frameName)
        if _G[frameName] then
                MultiScreenSupport:setParentAnchor(_G[frameName])
                _G['multiscreensupportsave']['standart'][frameName] = true
        end
end

function MultiScreenSupport:setParentAnchor(frame)
        local point, relativeTo, relativePoint, xOfs, yOfs = frame:GetPoint()
        if relativeTo == nil or relativeTo:GetName() == UIParent:GetName() then
                frame:HookScript("OnUpdate", function(self)
                        local point, relativeTo, relativePoint, xOfs, yOfs = self:GetPoint()
                        if relativeTo == nil or relativeTo:GetName() == UIParent:GetName() then
                                self:ClearAllPoints()
                                self:SetPoint(point, MultiScreenSupportParent, relativePoint, xOfs, yOfs)
                        end
                end)
        end
end

function MultiScreenSupport:setSpecificParentAnchor(frame)
        local point, relativeTo, relativePoint, xOfs, yOfs = frame:GetPoint()
        frame:ClearAllPoints()
        frame:SetPoint(point, MultiScreenSupportParent, relativePoint, xOfs, yOfs)
end

function MultiScreenSupport:tableMerge(first_table, second_table)
        for k,v in pairs(second_table) do first_table[k] = v end
        return first_table
end

function MultiScreenSupport:initSettings()
        --[[MacroFrame_LoadUI()
        TalentFrame_LoadUI()
        GuildFrame_LoadUI()
        Garrison_LoadUI()
        GuildBankFrame_LoadUI()
        AuctionFrame_LoadUI()
        CollectionsJournal_LoadUI()
        BlackMarket_LoadUI()
        Calendar_LoadUI()
        EncounterJournal_LoadUI()
        LookingForGuildFrame_LoadUI()
        ItemAlteration_LoadUI()
        ItemUpgrade_LoadUI()
        ArchaeologyFrame_LoadUI()
        VoidStorage_LoadUI()
        BarberShopFrame_LoadUI()
        ItemSocketingFrame_LoadUI()
        TradeSkillFrame_LoadUI()
        InspectFrame_LoadUI()
        ClassTrainerFrame_LoadUI()]]
        --BattlefieldMinimap_LoadUI() --CAN'T be move correctly anyway
        
        local MSSVersion = GetAddOnMetadata("MultiScreenSupport", "Version");

        if type(_G['multiscreensupportsave']) ~= "table" or not(_G['multiscreensupportsave']['MSSVersion']) or _G['multiscreensupportsave']['MSSVersion'] < '2.0' then
                _G['multiscreensupportsave'] = {
                        standart = {
                                ["PVEFrame"] = true,
                                ["CharacterFrame"] = true,
                                ["PlayerTalentFrame"] = true,
                                ["SpellBookFrame"] = true,
                                ["AchievementFrame"] = true,
                                ["FriendsFrame"] = true,
                                ["TradeSkillFrame"] = true,
                                ["GuildFrame"] = true,
                                ["CollectionsJournal"] = true,
                                ["MerchantFrame"] = true,
                                ["GossipFrame"] = true,
                                ["MailFrame"] = true,
                                --["EventTraceFrame"] = true, MOVABLE
                                ["GarrisonCapacitiveDisplayFrame"] = true,
                                ["GarrisonRecruiterFrame"] = true,
                                ["AuctionFrame"] = true,
                                ["BlackMarketFrame"] = true,
                                ["QuestFrame"] = true,
                                ["MacroFrame"] = true,
                                ["TimeManagerFrame"] = true,
                                ["CalendarFrame"] = true,
                                ["GarrisonLandingPage"] = true,
                                ["EncounterJournal"] = true,
                                ["LookingForGuildFrame"] = true,
                                ["TransmogrifyFrame"] = true,
                                ["ItemUpgradeFrame"] = true,
                                ["ArchaeologyFrame"] = true,
                                ["VoidStorageFrame"] = true,
                                ["BarberShopFrame"] = true,
                                ["ItemSocketingFrame"] = true,
                                ["InspectFrame"] = true,
                                ["GuildBankFrame"] = true,
                                ["QuestLogPopupDetailFrame"] = true,
                                ["ClassTrainerFrame"] = true,
                        },
                        specific = {
                                ["WorldMapScreenAnchor"] = true,
                                ["MinimapCluster"] = true,
                        }
                }
        end
        if not(_G['multiscreensupportsave']['MSSVersion']) or _G['multiscreensupportsave']['MSSVersion'] < '2.2' then
                _G['multiscreensupportsave']['standart']["DressUpFrame"] = true
        end
        
        _G['multiscreensupportsave']["MSSVersion"] = MSSVersion
end

function MultiScreenSupport:PLAYER_LOGIN(event)
        local allActiveFramesOrder = {}
        local allFramesOrder = {}
        local j
        local Resolution = GetCVar("gxResolution")
        local ScreenHeight = tonumber(string.match(Resolution, "%d+x(%d+)"))
        local ScreenWidth = tonumber(string.match(Resolution, "(%d+)x+%d"))

        if (ScreenWidth > 3840) or (UIParent:GetWidth() + 1 > ScreenWidth) then
                local width = ScreenWidth
                local height = ScreenHeight
                
                -- because some user enable bezel compensation, we need to find the real width of a single monitor.
                -- I don't know how it really work, but i'm assuming they add pixel to width to compensate the bezel. :P
                
                -- HQ resolution
                if width >= 9840 then width = 3280 end                                          -- WQSXGA
                if width >= 7680 and width < 9840 then width = 2560 end                     -- WQXGA
                if width >= 5760 and width < 7680 then width = 1920 end                         -- WUXGA & HDTV
                if width >= 5040 and width < 5760 then width = 1680 end                         -- WSXGA+
                
                -- adding height condition here to be sure it work with bezel compensation because WSXGA+ and UXGA/HD+ got approx same width
                if width >= 4800 and width < 5760 and height == 900 then width = 1600 end   -- UXGA & HD+
                
                -- low resolution screen
                if width >= 4320 and width < 4800 then width = 1440 end                         -- WSXGA
                if width >= 4080 and width < 4320 then width = 1360 end                         -- WXGA
                if width >= 3840 and width < 4080 then width = 1224 end                         -- SXGA & SXGA (UVGA) & WXGA & HDTV
                
                -- register a constant, we will need it later for launch.lua
                eyefinity = width
        end
        
        if not eyefinity then
                print('ERROR WITH THE DETECTION OF SURROUND GAMING / EYEFINITY, MultiSreenSupport WILL NOT WORK');
                return
        end
        local width = eyefinity
        local height = ScreenHeight
        
        --TEST
        --width = 1280
        --height = 720
        
        MultiScreenSupport:initSettings()
        
        MultiScreenSupportParent = CreateFrame('Frame', 'MultiScreenSupportParent', UIParent)
        MultiScreenSupportParent:SetFrameLevel(UIParent:GetFrameLevel())
        MultiScreenSupportParent:SetPoint('CENTER', UIParent, 'CENTER')
        MultiScreenSupportParent:SetSize(width, height)
        --MultiScreenSupportParent:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", 
    --                                        edgeFile = "Interface/Tooltips/UI-Tooltip-Border", 
    --                                        tile = true, tileSize = 16, edgeSize = 1, 
    --                                        insets = { left = 1, right = 1, top = 1, bottom = 1 }})

        local setting = {}
        local specificSetting = {}
        
        _G['MultiScreenSupportChildren'] = {}
        
        local childs = { UIParent:GetChildren() }
        i = 2
        for _, child in ipairs(childs) do
                if not child:IsForbidden() then
                        local childname = child:GetName()
                        if childname ~= 'MultiScreenSupportParent' then
                                if childname ~= nil then
                                        local point, relativeTo, relativePoint, xOfs, yOfs = child:GetPoint()
                                        if relativeTo == nil or relativeTo:GetName() == UIParent:GetName() then
                                                setting[childname] = {
                                                        order = i,
                                                        name = childname,
                                                        desc = childname,
                                                        type = "toggle",
                                                        set = function(info,val)
                                                                if val then
                                                                        MultiScreenSupport:setParentAnchor(child)
                                                                else
                                                                        print('Reload UI is needed to reset a frame ankor')
                                                                end
                                                                _G['multiscreensupportsave']['standart'][childname] = val
                                                        end,
                                                        get = function(info) 
                                                                if _G['multiscreensupportsave']['standart'][childname] == nil then
                                                                        _G['multiscreensupportsave']['standart'][childname] = false
                                                                end
                                                                return _G['multiscreensupportsave']['standart'][childname]
                                                        end
                                                }
                                                _G['MultiScreenSupportChildren'][childname] = true
                                                if _G['multiscreensupportsave']['standart'][childname] then
                                                        table.insert(allActiveFramesOrder, childname)
                                                else
                                                        table.insert(allFramesOrder, childname)
                                                end
                                                i = i+1
                                        end
                                end
                        end
                end
        end
        
        table.sort(allActiveFramesOrder)
        table.sort(allFramesOrder)
        j=2
        table.foreach(allActiveFramesOrder, function(k,v)
                setting[v].order = j
                j=j+1
        end)
        if j > 2 then
                setting['enabled'] = {
                        order = 1,
                        name = "Enabled",
                        type = "header"
                }
                j=j+1
                setting['available'] = {
                        order = j,
                        name = "Available",
                        type = "header"
                }
                j=j+1
        end
        table.foreach(allFramesOrder, function(k,v)
                setting[v].order = j
                j=j+1
        end)
        
        local standartconfig = {
                name = "MultiScreenSupport Standard options",
                handler = MultiScreenSupport,
                type = "group",
                args = setting
        }
        
        
        local childs = { WorldMapScreenAnchor, MinimapCluster }
        i = 2
        for _, child in ipairs(childs) do
                if not child:IsForbidden() then
                        local childname = child:GetName()
                        specificSetting[childname] = {
                                order = i,
                                name = childname,
                                desc = childname,
                                type = "toggle",
                                set = function(info,val)
                                        if val then
                                                MultiScreenSupport:setSpecificParentAnchor(child)
                                        else
                                                print('Reload UI is needed to reset a frame ankor')
                                        end
                                        _G['multiscreensupportsave']['specific'][childname] = val
                                end,
                                get = function(info) 
                                        if _G['multiscreensupportsave']['specific'][childname] == nil then
                                                _G['multiscreensupportsave']['specific'][childname] = false
                                        end
                                        return _G['multiscreensupportsave']['specific'][childname]
                                end
                        }
                        i = i+1
                end
        end
        
        local specificconfig = {
                name = "MultiScreenSupport Specific options",
                handler = MultiScreenSupport,
                type = "group",
                args = specificSetting
        }
        
        
        
        local config = {
                name = "MultiScreenSupport",
                handler = MultiScreenSupport,
                type = "group",
                args = {
                        Description = {
                                order = 0,
                                name = "Nameplates hacking try to resize nameplates to match correct size. It only works out of combat. To help targeting the right nameplate when in combat a additional background is displayed to show you the current click-able area. This option does not work well with default nameplates.",
                                fontSize = "medium",
                                type = "description"
                        },
                        NamePlates = {--NamePlates
                                order = 2,
                                name = "Enable Nameplates hacking",
                                --desc = "Enable Nameplates hacking",
                                type = "toggle",
                                set = function(info,val)
                                        if not val then
                                                _G['multiscreensupportsave']['nameplates'] = -1
                                                print("To disable nameplates hacking you should reload your UI")
                                        else
                                                _G['multiscreensupportsave']['nameplates'] = val
                                        end
                                end,
                                get = function(info)
                                        if not _G['multiscreensupportsave']['nameplates'] then
                                                _G['multiscreensupportsave']['nameplates'] = true
                                        end
                                        if _G['multiscreensupportsave']['nameplates'] == -1 then
                                                return false
                                        end
                                        return _G['multiscreensupportsave']['nameplates']
                                end
                        },
                        Screens = {--Number of screens
                                order = 3,
                                name = "Number of screen",
                                --desc = "Number of screen",
                                type = "range",
                                min = 2,
                                max = 9,
                                step = 1,
                                bigStep = 1,
                                set = function(info,val)
                                        _G['multiscreensupportsave']['screen'] = val
                                end,
                                get = function(info)
                                        if not _G['multiscreensupportsave']['screen'] then
                                                _G['multiscreensupportsave']['screen'] = 3
                                        end
                                        return _G['multiscreensupportsave']['screen']
                                end,
                                isPercent = false
                        },
                        NamePlatesBG = {--NamePlates
                                order = 4,
                                name = "Enable Nameplates background",
                                --desc = "Enable Nameplates background",
                                type = "toggle",
                                set = function(info,val)
                                        _G['multiscreensupportsave']['nameplatesbg'] = val
                                        if not val then
                                                _G['multiscreensupportsave']['nameplatesbg'] = -1
                                                print("To disable nameplates background you should reload your UI")
                                        else
                                                _G['multiscreensupportsave']['nameplatesbg'] = val
                                        end
                                end,
                                get = function(info) 
                                        if not _G['multiscreensupportsave']['nameplatesbg'] then
                                                _G['multiscreensupportsave']['nameplatesbg'] = true
                                        end
                                        if _G['multiscreensupportsave']['nameplatesbg'] == -1 then
                                                return false
                                        end
                                        return _G['multiscreensupportsave']['nameplatesbg']
                                end
                        },
                }
        }
        
        AceConfig:RegisterOptionsTable("MultiScreenSupport", config)
        AceConfig:RegisterOptionsTable("MultiScreenSupport_standart", standartconfig)
        AceConfig:RegisterOptionsTable("MultiScreenSupport_specific", specificconfig)
        
        local SetDefaultOpttion = AceConfigDialog:AddToBlizOptions("MultiScreenSupport","MultiScreenSupport ".._G['multiscreensupportsave']["MSSVersion"])
        SetDefaultOpttion.default = function() _G['multiscreensupportsave'] = { standart = {}, specific = {} } end
        
        SetDefaultOpttion = AceConfigDialog:AddToBlizOptions("MultiScreenSupport_standart","MultiScreenSupport standard frame","MultiScreenSupport ".._G['multiscreensupportsave']["MSSVersion"])
        SetDefaultOpttion.default = function() _G['multiscreensupportsave'] = { standart = {}, specific = {} } end
        
        SetDefaultOpttion = AceConfigDialog:AddToBlizOptions("MultiScreenSupport_specific","MultiScreenSupport specific frame","MultiScreenSupport ".._G['multiscreensupportsave']["MSSVersion"])
        SetDefaultOpttion.default = function() _G['multiscreensupportsave'] = { standart = {}, specific = {} } end
        
        table.foreach(_G['multiscreensupportsave']['standart'], function(k,v)
                if v and _G[k] then
                        MultiScreenSupport:setParentAnchor(_G[k])
                end
        end)
        
        table.foreach(_G['multiscreensupportsave']['specific'], function(k,v)
                if v then
                        MultiScreenSupport:setSpecificParentAnchor(_G[k])
                end
        end)
        
        --to add specific addon frame like blizzard one.
        MultiScreenSupport:RegisterEvent("ADDON_LOADED")
        
        --NAMEPLATES Hacking
        if not _G['multiscreensupportsave']['screen'] then
                _G['multiscreensupportsave']['screen'] = 3
        end
        if _G['multiscreensupportsave']['nameplatesbg'] ~= -1 or _G['multiscreensupportsave']['nameplates'] ~= -1 then
                local Plates = CreateFrame("Frame", nil, WorldFrame)
                Plates:SetScript("OnUpdate",function () MultiScreenSupport:OnUpdate() end)
        end
end

function MultiScreenSupport:ADDON_LOADED(event, addon)
        --[[local addons = {
                ['Blizzard_MacroUI'] = true,            
        }
        if addons[addon] then
                print(addon)
        end]]
        local allActiveFramesOrder = {}
        local allFramesOrder = {}
        local setting = {}
        local childs = { UIParent:GetChildren() }
        i = 2
        for _, child in ipairs(childs) do
                if not child:IsForbidden() then
                        local childname = child:GetName()
                        if childname ~= 'MultiScreenSupportParent' and childname ~= nil and _G['MultiScreenSupportChildren'][childname] == nil then
                                local point, relativeTo, relativePoint, xOfs, yOfs = child:GetPoint()
                                if relativeTo == nil or relativeTo:GetName() == UIParent:GetName() then
                                        setting[childname] = {
                                                order = i,
                                                name = childname,
                                                desc = childname,
                                                type = "toggle",
                                                set = function(info,val)
                                                        if val then
                                                                MultiScreenSupport:setParentAnchor(child)
                                                        else
                                                                print('Reload UI is needed to reset a frame ankor')
                                                        end
                                                        _G['multiscreensupportsave']['standart'][childname] = val
                                                end,
                                                get = function(info) 
                                                        if _G['multiscreensupportsave']['standart'][childname] == nil then
                                                                _G['multiscreensupportsave']['standart'][childname] = false
                                                        end
                                                        return _G['multiscreensupportsave']['standart'][childname]
                                                end
                                        }
                                        _G['MultiScreenSupportChildren'][childname] = true
                                        if _G['multiscreensupportsave']['standart'][childname] then
                                                table.insert(allActiveFramesOrder, childname)
                                        else
                                                table.insert(allFramesOrder, childname)
                                        end
                                        i = i+1
                                end
                        end
                end
        end
        
        table.sort(allActiveFramesOrder)
        table.sort(allFramesOrder)
        j=2
        table.foreach(allActiveFramesOrder, function(k,v)
                setting[v].order = j
                j=j+1
        end)
        if j > 2 then
                setting['enabled'] = {
                        order = 1,
                        name = "Enabled",
                        type = "header"
                }
                j=j+1
                setting['available'] = {
                        order = j,
                        name = "Available",
                        type = "header"
                }
                j=j+1
        end
        table.foreach(allFramesOrder, function(k,v)
                setting[v].order = j
                j=j+1
        end)
        
        local addonconfig = {
                name = "MultiScreenSupport Specific options",
                handler = MultiScreenSupport,
                type = "group",
                args = setting
        }
        
        if j > 2 then
                AceConfig:RegisterOptionsTable("MultiScreenSupport_"..addon, addonconfig)
                
                SetDefaultOpttion = AceConfigDialog:AddToBlizOptions("MultiScreenSupport_"..addon, addon, "MultiScreenSupport ".._G['multiscreensupportsave']["MSSVersion"])
                SetDefaultOpttion.default = function() _G['multiscreensupportsave'] = { standart = {}, specific = {} } end
                
                table.foreach(_G['multiscreensupportsave']['standart'], function(k,v)
                        if v and _G[k] then
                                MultiScreenSupport:setParentAnchor(_G[k])
                        end
                end)
        end
        --print(addon..' LOADED')
end




SLASH_MULTISCREENSUPPORT1 = "/MultiScreenSupport"
SLASH_MULTISCREENSUPPORT2 = "/MSS"
SlashCmdList["MULTISCREENSUPPORT"] = function(msg)
        if msg then
                local command2 = msg--string.lower(msg);
                local command, rest2 = command2:match("^(%S*)%s*(.-)$")
                if command == 'add' and rest2 and _G[rest2] then
                        print('add '..rest2)
                        MultiScreenSupport:addParentAnchor(_G[rest2])
                end
                if command == 'remove' and rest2 and _G['multiscreensupportsave']['standart'][rest2] then
                        _G['multiscreensupportsave']['standart'][rest2] = false
                end
                if command == 'frame' then
                        if rest2  ~= "" then
                                arg = _G[rest2]
                        else
                                arg = GetMouseFocus()
                        end
                        if arg ~= nil and arg:GetName() ~= nil then
                                local point, relativeTo, relativePoint, xOfs, yOfs = arg:GetPoint()
                                ChatFrame1:AddMessage("|cffCC0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
                                ChatFrame1:AddMessage("Name: |cffFFD100"..arg:GetName())
                                if arg:GetParent() and arg:GetParent():GetName() then
                                        ChatFrame1:AddMessage("Parent: |cffFFD100"..arg:GetParent():GetName())
                                end
                 
                                ChatFrame1:AddMessage("Width: |cffFFD100"..format("%.2f",arg:GetWidth()))
                                ChatFrame1:AddMessage("Height: |cffFFD100"..format("%.2f",arg:GetHeight()))
                                ChatFrame1:AddMessage("Strata: |cffFFD100"..arg:GetFrameStrata())
                                ChatFrame1:AddMessage("Level: |cffFFD100"..arg:GetFrameLevel())
                 
                                if xOfs then
                                        ChatFrame1:AddMessage("X: |cffFFD100"..format("%.2f",xOfs))
                                end
                                if yOfs then
                                        ChatFrame1:AddMessage("Y: |cffFFD100"..format("%.2f",yOfs))
                                end
                                if relativeTo and relativeTo:GetName() then
                                        ChatFrame1:AddMessage("Point: |cffFFD100"..point.."|r anchored to "..relativeTo:GetName().."'s |cffFFD100"..relativePoint)
                                end
                                ChatFrame1:AddMessage("|cffCC0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
                        elseif arg ~= nil then
                                local point, relativeTo, relativePoint, xOfs, yOfs = arg:GetPoint()
                                ChatFrame1:AddMessage("|cffCC0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
                                if arg:GetParent() and arg:GetParent():GetName() then
                                        ChatFrame1:AddMessage("Parent: |cffFFD100"..arg:GetParent():GetName())
                                end
                 
                                ChatFrame1:AddMessage("Width: |cffFFD100"..format("%.2f",arg:GetWidth()))
                                ChatFrame1:AddMessage("Height: |cffFFD100"..format("%.2f",arg:GetHeight()))
                                ChatFrame1:AddMessage("Strata: |cffFFD100"..arg:GetFrameStrata())
                                ChatFrame1:AddMessage("Level: |cffFFD100"..arg:GetFrameLevel())
                 
                                if xOfs then
                                        ChatFrame1:AddMessage("X: |cffFFD100"..format("%.2f",xOfs))
                                end
                                if yOfs then
                                        ChatFrame1:AddMessage("Y: |cffFFD100"..format("%.2f",yOfs))
                                end
                                if relativeTo and relativeTo:GetName() then
                                        ChatFrame1:AddMessage("Point: |cffFFD100"..point.."|r anchored to "..relativeTo:GetName().."'s |cffFFD100"..relativePoint)
                                end
                                ChatFrame1:AddMessage("|cffCC0000~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
                        elseif arg == nil then
                                ChatFrame1:AddMessage("Invalid frame name")
                        else
                                ChatFrame1:AddMessage("Could not find frame info")
                        end
                end
        else
                print('error')
        end
end

Go to most recent revision | Compare with Previous | Blame