WoWInterface SVN pStats

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 23 to Rev 22
    Reverse comparison

Rev 23 → Rev 22

trunk/pStats/pStats.lua
1,12 → 1,3
local elapsed = 0.5
local addon = CreateFrame('Frame', nil, InterfaceOptionsFrame)
local dataobj = LibStub:GetLibrary('LibDataBroker-1.1'):NewDataObject('Stats', {text = '2.0 MiB', icon = [=[Interface\AddOns\pStats\icon]=]})
local defaults = {
colors = {0, 1, 1},
sorted = true,
hooked = true,
}
 
local function formats(value)
if(value > 999) then
return format('%.1f MiB', value / 1024)
15,6 → 6,8
end
end
 
local dataobj, elapsed = LibStub:GetLibrary('LibDataBroker-1.1'):NewDataObject('Stats', {text = '2.0 MiB', icon = [=[Interface\AddOns\pStats\icon]=]}), 0.5
 
function dataobj.OnLeave()
GameTooltip:SetClampedToScreen(true)
GameTooltip:Hide()
59,6 → 52,10
GameTooltip:Show()
end
 
local function collect(self)
 
end
 
function dataobj.OnClick(self, button)
if(button == "RightButton") then
local collected = collectgarbage('count')
77,7 → 74,7
end
end
 
function OnMouseWheel(self, dir)
local function OnMouseWheel(self, dir)
GameTooltip:SetClampedToScreen(false)
local point, region, pointTo, x, y = GameTooltip:GetPoint()
if(dir > 0) then
87,27 → 84,15
end
end
 
addon:SetScript('OnEvent', function(self, event, addon)
if(addon ~= 'pStats') then return end
MiniMapTrackingButton:EnableMouseWheel()
MiniMapTrackingButton:RegisterForClicks('AnyUp')
MiniMapTrackingButton:SetScript('OnMouseWheel', OnMouseWheel)
MiniMapTrackingButton:SetScript('OnClick', dataobj.OnClick)
MiniMapTrackingButton:SetScript('OnEnter', dataobj.OnEnter)
MiniMapTrackingButton:SetScript('OnLeave', dataobj.OnLeave)
 
pStatsDB = pStatsDB or {}
for k,v in pairs(defaults) do
if(type(pStatsDB[k]) == 'nil') then
pStatsDB[k] = v
end
end
 
if(pStatsDB.hooked) then
MiniMapTrackingButton:EnableMouseWheel()
MiniMapTrackingButton:RegisterForClicks('AnyUp')
MiniMapTrackingButton:SetScript('OnMouseWheel', OnMouseWheel)
MiniMapTrackingButton:SetScript('OnClick', dataobj.OnClick)
MiniMapTrackingButton:SetScript('OnEnter', dataobj.OnEnter)
MiniMapTrackingButton:SetScript('OnLeave', dataobj.OnLeave)
end
end)
 
addon:SetScript('OnUpdate', function(self, al)
local dummy = CreateFrame('Frame', nil, InterfaceOptionsFrame)
dummy:SetScript('OnUpdate', function(self, al)
elapsed = elapsed + al
if(elapsed > 0.5) then
dataobj.text = formats(gcinfo())
115,8 → 100,7
end
end)
 
addon:SetScript('OnShow', function(self) if(not IsAddOnLoaded('pStats_Config')) then LoadAddOn('pStats_Config') end self:SetScript('OnShow', nil) end)
addon:RegisterEvent('ADDON_LOADED')
dummy:SetScript('OnShow', function(self) if(not IsAddOnLoaded('pStats_Config')) then LoadAddOn('pStats_Config') end self:SetScript('OnShow', nil) end)
 
SlashCmdList['PSTATS'] = function()
if(not IsAddOnLoaded('pStats_Config')) then