WoWInterface SVN pStats

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 8 to Rev 9
    Reverse comparison

Rev 8 → Rev 9

trunk/pStats/pStats.lua
1,3 → 1,4
local wotlk = select(4, GetBuildInfo()) >= 3e4
local function compare(a, b) return a.mem > b.mem end
local function formats(num)
if(num > 999) then
7,19 → 8,13
end
end
 
local function GarbageTooltip_Show(self)
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT", 0, self:GetHeight())
GameTooltip:AddLine("Garbage collected!")
GameTooltip:Show()
end
 
local function OnMouseUp(self, button)
if(GameTooltip:GetOwner() == self) then GameTooltip:Hide() end
local function OnClick(self, button)
if(wotlk and GameTooltip:GetOwner() == self) then GameTooltip:Hide() end
if(button == "RightButton") then
GarbageTooltip_Show(self)
collectgarbage("collect")
elseif(button == "MiddleButton") then
GameTimeFrame_OnClick()
GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT", 0, self:GetHeight())
GameTooltip:AddLine("Garbage collected!")
GameTooltip:Show()
else
ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, "MiniMapTracking", 0, self:GetHeight())
end
49,24 → 44,23
table.sort(addons, compare)
end
 
for _,entry in pairs(addons) do
for _,entry in pairs(addons) do -- the following coloring seems to be broken in wotlk, lib issue
GameTooltip:AddDoubleLine(entry.name, format("|cff%s%s|r", LibStub("LibCrayon-3.0"):GetThresholdHexColor(entry.mem, 1024, 640, 320, 180, 0), formats(entry.mem)), 1, 1, 1)
end
 
GameTooltip:AddLine("\n")
GameTooltip:AddDoubleLine("Total", formats(total), db.r, db.g, db.b, db.r, db.g, db.b)
GameTooltip:AddDoubleLine("Total w/Blizzard", formats(gcinfo()), db.r, db.g, db.b, db.r, db.g, db.b)
GameTooltip:AddDoubleLine("Total + Blizzard", formats(gcinfo()), db.r, db.g, db.b, db.r, db.g, db.b)
 
if(db.help) then
GameTooltip:AddLine("\n")
GameTooltip:AddLine("Middle-Click to toggle time settings")
GameTooltip:AddLine("Right-Click to force garbage collection")
GameTooltip:AddLine("Left-Click to choose tracking type")
end
 
GameTooltip:Show()
end
 
-- hijack the MiniMapTracking frame
MiniMapTracking:SetScript("OnMouseUp", OnMouseUp)
MiniMapTracking:SetScript("OnEnter", OnEnter)
\ No newline at end of file +if(wotlk) then + MiniMapTrackingButton:RegisterForClicks("AnyUp") + MiniMapTrackingButton:SetScript("OnClick", OnClick) + MiniMapTrackingButton:SetScript("OnEnter", OnEnter) +else + MiniMapTracking:SetScript("OnMouseUp", OnClick) + MiniMapTracking:SetScript("OnEnter", OnEnter) +end \ No newline at end of file
trunk/pStats/pStatsConfig.lua
11,13 → 11,6
'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 predefined = self:MakeDropDown(
'name', "Pre-defined colors",
'description', "Set the text color based on a list of pre-defined colors",
'values', {},
'setFunc', function(value) end)
predefined:SetPoint("TOPLEFT", class, "BOTTOMLEFT", 0, -8)]]
 
local custom = self:MakeColorPicker(
'name', "Custom Color",
'description', "Set custom text colors with a palette",
29,14 → 22,6
'setFunc', function(r, g, b) db.r = r db.g = g db.b = b end)
custom:SetPoint("TOPLEFT", class, "BOTTOMLEFT", 0, -8)
 
local help = self:MakeToggle(
'name', "Toggle Help Lines",
'description', "Set whether the 3 help lines in the tooltip are shown or not",
'default', true,
'current', db.help,
'setFunc', function(value) db.help = value end)
help:SetPoint("TOPLEFT", custom, "BOTTOMLEFT", 0, -8)
 
local sortcheck = self:MakeToggle(
'name', "Toggle sorting method",
'description', "Check to sort by memory.\nUn-check to sort by name",
50,7 → 35,7
if(name == "pStats") then
db = _G.pStatsDB
if(not db) then
db = { r = 0, g = 1, b = 1, help = true, sorted = true }
db = { r = 0, g = 1, b = 1, sorted = true }
_G.pStatsDB = db
end