WoWInterface SVN pStats

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 12 to Rev 13
    Reverse comparison

Rev 12 → Rev 13

trunk/pStats/pStats.lua
7,14 → 7,15
end
 
local function OnEnter(self)
local db = _G.pStatsDB
local db = pStatsDB
local r, g, b = unpack(db.colors)
local down, up, latency = GetNetStats()
local fps = format('%.1f fps', GetFramerate())
local net = format('%d ms', latency)
 
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT', 0, self:GetHeight())
GameTooltip:ClearLines()
GameTooltip:AddDoubleLine(fps, net, db.r, db.g, db.b, db.r, db.g, db.b)
GameTooltip:AddDoubleLine(fps, net, r, g, b, r, g, b)
GameTooltip:AddLine('\n')
 
local addons, entry, total = {}, {}, 0
37,9 → 38,9
end
 
GameTooltip:AddLine('\n')
GameTooltip:AddDoubleLine('User Addon Memory Usage:', formats(total), db.r, db.g, db.b, db.r, db.g, db.b)
GameTooltip:AddDoubleLine('Default UI Memory Usage:', formats(gcinfo() - total), db.r, db.g, db.b, db.r, db.g, db.b)
GameTooltip:AddDoubleLine('Total Memory Usage:', formats(gcinfo()), db.r, db.g, db.b, db.r, db.g, db.b)
GameTooltip:AddDoubleLine('User Addon Memory Usage:', formats(total), r, g, b, r, g, b)
GameTooltip:AddDoubleLine('Default UI Memory Usage:', formats(gcinfo() - total), r, g, b, r, g, b)
GameTooltip:AddDoubleLine('Total Memory Usage:', formats(gcinfo()), r, g, b, r, g, b)
 
GameTooltip:Show()
end
49,7 → 50,7
local collected = collectgarbage('count')
collectgarbage('collect')
OnEnter(self)
GameTooltip:AddLine('')
GameTooltip:AddLine('\n')
GameTooltip:AddDoubleLine('Garbage Collected:', formats(collected - collectgarbage('count')))
GameTooltip:Show()
else
62,38 → 63,33
GameTooltip:SetClampedToScreen(false)
local point, region, pointTo, x, y = GameTooltip:GetPoint()
if(dir > 0) then
if(IsShiftKeyDown()) then
GameTooltip:SetPoint(point, region, pointTo, x, y + 30)
else
GameTooltip:SetPoint(point, region, pointTo, x, y + 15)
end
GameTooltip:SetPoint(point, region, pointTo, x, y + (IsShiftKeyDown() and 30 or 15))
else
if(IsShiftKeyDown()) then
GameTooltip:SetPoint(point, region, pointTo, x, y - 30)
else
GameTooltip:SetPoint(point, region, pointTo, x, y - 15)
end
GameTooltip:SetPoint(point, region, pointTo, x, y - (IsShiftKeyDown() and 30 or 15))
end
end
 
local wotlk = select(4, GetBuildInfo()) >= 3e4
if(wotlk) then
MiniMapTrackingButton:RegisterForClicks('AnyUp')
MiniMapTrackingButton:SetScript('OnClick', OnClick)
if(select(4, GetBuildInfo()) >= 3e4) then
MiniMapTrackingButton:EnableMouseWheel(true)
MiniMapTrackingButton:RegisterForClicks('AnyUp')
MiniMapTrackingButton:RegisterEvent('PLAYER_ENTERING_WORLD')
MiniMapTrackingButton:SetScript('OnEvent', function(self, event, ...) self[event](self, event, ...) end)
MiniMapTrackingButton:SetScript('OnMouseWheel', OnMouseWheel)
MiniMapTrackingButton:SetScript('OnClick', OnClick)
MiniMapTrackingButton:SetScript('OnEnter', OnEnter)
MiniMapTrackingButton:SetScript('OnLeave', function()
GameTooltip:SetClampedToScreen(true)
GameTooltip:Hide()
end)
else
MiniMapTracking:SetScript('OnMouseUp', OnClick)
MiniMapTracking:EnableMouseWheel(true)
MiniMapTracking:RegisterEvent('PLAYER_ENTERING_WORLD')
MiniMapTracking:SetScript('OnEvent', function(self, event, ...) self[event](self, event, ...) end)
MiniMapTracking:SetScript('OnMouseWheel', OnMouseWheel)
MiniMapTracking:SetScript('OnMouseUp', OnClick)
MiniMapTracking:SetScript('OnEnter', OnEnter)
MiniMapTracking:SetScript('OnLeave', function()
GameTooltip:SetClampedToScreen(true)
GameTooltip:FadeOut()
GameTooltip:Hide()
end)
end
\ No newline at end of file
trunk/pStats/pStats.toc
1,13 → 1,13
## Interface: 20400
## Author: p3lim
## Version: Revision wowi:revision
## Version: 20400.wowi:revision
## Title: |cffff6000p|rStats
## Notes: Replaces the tooltip on MinimapTracking with a more informative one
## OptionalDeps: LibSimpleOptions-1.0
## OptionalDeps: LibStub, LibSimpleOptions-1.0
## SavedVariablesPerCharacter: pStatsDB
 
LibSimpleOptions-1.0\LibStub\LibStub.lua
LibSimpleOptions-1.0\lib.xml
LibSimpleOptions-1.0\LibSimpleOptions-1.0.lua
 
pStats.lua
pStatsConfig.lua
\ No newline at end of file
trunk/pStats/pStatsConfig.lua
1,52 → 1,46
local db
local _G = getfenv(0)
local c = RAID_CLASS_COLORS[select(2, UnitClass("player"))]
local function CreateOptions(self, db)
local title, sub = self:MakeTitleTextAndSubText('pStats', 'These options allow you to customize the looks of pStats.')
 
self:MakeButton(
'name', 'Class Color',
'description', 'Set text color based on player class',
'func', function()
local l, class = UnitClass('player')
local c = RAID_CLASS_COLORS[class]
db.colors[1], db.colors[2], db.colors[3] = c.r, c.g, c.b
self:Refresh()
end
):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -16)
 
local function Options(self)
local title, subText = self:MakeTitleTextAndSubText("pStats", "These options allow you to change the looks of pStats")
 
local class = self:MakeButton(
'name', "Class Color",
'description', "Set text color based on player class",
'func', function() db.r = c.r db.g = c.g db.b = c.b self:Refresh() end)
class:SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -8)
 
local custom = self:MakeColorPicker(
'name', "Custom Color",
'description', "Set custom text colors with a palette",
self:MakeColorPicker(
'name', 'Custom Color',
'description', 'Set custom text colors with a palette',
'hasAlpha', false,
'defaultR', 0,
'defaultG', 1,
'defaultB', 1,
'getFunc', function() return db.r, db.g, db.b end,
'setFunc', function(r, g, b) db.r = r db.g = g db.b = b end)
custom:SetPoint("TOPLEFT", class, "BOTTOMLEFT", 0, -8)
'defaultR', 0, 'defaultG', 1, 'defaultB', 1,
'getFunc', function() return unpack(db.colors) end,
'setFunc', function(r, g, b)
db.colors[1], db.colors[2], db.colors[3] = r, g, b
end
):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -46)
 
local sortcheck = self:MakeToggle(
'name', "Toggle sorting method",
'description', "Check to sort by memory.\nUn-check to sort by name",
self:MakeToggle(
'name', 'Toggle sorting method',
'description', 'Check to sort by memory.\nUn-check to sort by name',
'default', true,
'current', db.sorted,
'setFunc', function(value) db.sorted = value end)
sortcheck:SetPoint("TOPLEFT", custom, "BOTTOMLEFT", 0, -8)
'setFunc', function(value)
db.sorted = value
end
):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -76)
end
 
local function OnEvent(self, name)
if(name == "pStats") then
db = _G.pStatsDB
if(not db) then
db = { r = 0, g = 1, b = 1, sorted = true }
_G.pStatsDB = db
end
function MiniMapTracking:PLAYER_ENTERING_WORLD(event)
local db = pStatsDB or {colors = {0, 1, 1}, sorted = true}
 
-- setup options
LibStub("LibSimpleOptions-1.0").AddOptionsPanel("pStats", Options)
LibStub("LibSimpleOptions-1.0").AddSlashCommand("pStats", "/pstats")
LibStub('LibSimpleOptions-1.0').AddOptionsPanel('pStats', function(self) CreateOptions(self, db) end)
LibStub('LibSimpleOptions-1.0').AddSlashCommand('pStats', '/pstats')
 
self:UnregisterEvent("ADDON_LOADED")
end
end
self:UnregisterEvent(event)
 
local event = CreateFrame("Frame")
event:RegisterEvent("ADDON_LOADED")
event:SetScript("OnEvent", function(self, event, ...) OnEvent(self, ...) end)
\ No newline at end of file + pStatsDB = db +end \ No newline at end of file