diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/README.textile b/README.textile old mode 100644 new mode 100755 diff --git a/clock.lua b/clock.lua old mode 100644 new mode 100755 diff --git a/compass.lua b/compass.lua old mode 100644 new mode 100755 diff --git a/coordinates.lua b/coordinates.lua old mode 100644 new mode 100755 diff --git a/license b/license old mode 100644 new mode 100755 diff --git a/media/Border4.tga b/media/Border4.tga old mode 100644 new mode 100755 diff --git a/media/SQUARE.tga b/media/SQUARE.tga old mode 100644 new mode 100755 diff --git a/media/blank.tga b/media/blank.tga old mode 100644 new mode 100755 diff --git a/media/border.tga b/media/border.tga old mode 100644 new mode 100755 diff --git a/media/border2.tga b/media/border2.tga old mode 100644 new mode 100755 diff --git a/media/mail.tga b/media/mail.tga old mode 100644 new mode 100755 diff --git a/media/rounded_square.tga b/media/rounded_square.tga old mode 100644 new mode 100755 diff --git a/rightclick.lua b/rightclick.lua old mode 100644 new mode 100755 diff --git a/tooltip.lua b/tooltip.lua old mode 100644 new mode 100755 index 372ad1b..3fd5382 --- a/tooltip.lua +++ b/tooltip.lua @@ -1,76 +1,76 @@ ------------------------------- --- Localizing some crap -- ------------------------------- - -local MEMTHRESH = 32 -local string_format, math_modf, GetNetStats, GetFramerate, gcinfo = string.format, math.modf, GetNetStats, GetFramerate, gcinfo - -local function ColorGradient(perc, r1, g1, b1, r2, g2, b2, r3, g3, b3) - if perc >= 1 then return r3, g3, b3 elseif perc <= 0 then return r1, g1, b1 end - - local segment, relperc = math_modf(perc*2) - if segment == 1 then r1, g1, b1, r2, g2, b2 = r2, g2, b2, r3, g3, b3 end - return r1 + (r2-r1)*relperc, g1 + (g2-g1)*relperc, b1 + (b2-b1)*relperc -end - -local function formats(value) - if(value > 999) then - return format('%.1f MiB', value / 1024) - else - return format('%.1f KiB', value) - end -end - ------------------------- --- Tooltip! -- ------------------------- - -local onEnter = function(self) - GameTooltip:SetOwner(TimeManagerClockButton, "ANCHOR_BOTTOMRIGHT") - - local fps = GetFramerate() - local r, g, b = ColorGradient(fps/75, 1,0,0, 1,1,0, 0,1,0) - GameTooltip:AddDoubleLine("FPS:", string_format("%.1f", fps), nil,nil,nil, r,g,b) - - local _, _, lag = GetNetStats() - local r, g, b = ColorGradient(lag/1000, 0,1,0, 1,1,0, 1,0,0) - GameTooltip:AddDoubleLine("Lag:", lag.. " ms", nil,nil,nil, r,g,b) - - GameTooltip:AddLine(" ") - - local addons, addon, total = {}, {}, 0 - - for i=1, GetNumAddOns() do - addon = {GetAddOnInfo(i), GetAddOnMemoryUsage(i)} - table.insert(addons, addon) - total = total + GetAddOnMemoryUsage(i) - end - - table.sort(addons, (function(a, b) return a[2] > b[2] end)) - - UpdateAddOnMemoryUsage() - - for i,addons in pairs(addons) do - if addons[2] > MEMTHRESH then - local r, g, b = ColorGradient((addons[2] - MEMTHRESH)/768, 0,1,0, 1,1,0, 1,0,0) - local memstr = addons[2] > 1024 and string_format("%.1f MiB", addons[2]/1024) or string_format("%.1f KiB", addons[2]) - GameTooltip:AddDoubleLine(addons[1], memstr, 1,1,1, r,g,b) - end - end - - GameTooltip:AddLine(" ") - - local r, g, b = ColorGradient(total/(40*1024), 0,1,0, 1,1,0, 1,0,0) - GameTooltip:AddDoubleLine("Addon memory:", string_format("%.2f MiB", total/1024), nil,nil,nil, r,g,b) - - local mem = collectgarbage("count") - local r, g, b = ColorGradient(mem/(20*1024), 0,1,0, 1,1,0, 1,0,0) - GameTooltip:AddDoubleLine("Default UI memory:", string_format("%.2f MiB", (gcinfo()-total)/1024), nil,nil,nil, r,g,b) - - GameTooltip:AddLine(" ") - - GameTooltip:Show() -end - -TimeManagerClockButton:SetScript("OnEnter", onEnter) -TimeManagerClockButton:SetScript("OnLeave", function() GameTooltip:Hide() end) \ No newline at end of file +-- ------------------------------ +-- -- Localizing some crap -- +-- ------------------------------ + +-- local MEMTHRESH = 32 +-- local string_format, math_modf, GetNetStats, GetFramerate, gcinfo = string.format, math.modf, GetNetStats, GetFramerate, gcinfo + +-- local function ColorGradient(perc, r1, g1, b1, r2, g2, b2, r3, g3, b3) +-- if perc >= 1 then return r3, g3, b3 elseif perc <= 0 then return r1, g1, b1 end + +-- local segment, relperc = math_modf(perc*2) +-- if segment == 1 then r1, g1, b1, r2, g2, b2 = r2, g2, b2, r3, g3, b3 end +-- return r1 + (r2-r1)*relperc, g1 + (g2-g1)*relperc, b1 + (b2-b1)*relperc +-- end + +-- local function formats(value) +-- if(value > 999) then +-- return format('%.1f MiB', value / 1024) +-- else +-- return format('%.1f KiB', value) +-- end +-- end + +-- ------------------------ +-- -- Tooltip! -- +-- ------------------------ + +-- local onEnter = function(self) +-- GameTooltip:SetOwner(TimeManagerClockButton, "ANCHOR_BOTTOMRIGHT") + +-- local fps = GetFramerate() +-- local r, g, b = ColorGradient(fps/75, 1,0,0, 1,1,0, 0,1,0) +-- GameTooltip:AddDoubleLine("FPS:", string_format("%.1f", fps), nil,nil,nil, r,g,b) + +-- local _, _, lag = GetNetStats() +-- local r, g, b = ColorGradient(lag/1000, 0,1,0, 1,1,0, 1,0,0) +-- GameTooltip:AddDoubleLine("Lag:", lag.. " ms", nil,nil,nil, r,g,b) + +-- GameTooltip:AddLine(" ") + +-- local addons, addon, total = {}, {}, 0 + +-- for i=1, GetNumAddOns() do +-- addon = {GetAddOnInfo(i), GetAddOnMemoryUsage(i)} +-- table.insert(addons, addon) +-- total = total + GetAddOnMemoryUsage(i) +-- end + +-- table.sort(addons, (function(a, b) return a[2] > b[2] end)) + +-- UpdateAddOnMemoryUsage() + +-- for i,addons in pairs(addons) do +-- if addons[2] > MEMTHRESH then +-- local r, g, b = ColorGradient((addons[2] - MEMTHRESH)/768, 0,1,0, 1,1,0, 1,0,0) +-- local memstr = addons[2] > 1024 and string_format("%.1f MiB", addons[2]/1024) or string_format("%.1f KiB", addons[2]) +-- GameTooltip:AddDoubleLine(addons[1], memstr, 1,1,1, r,g,b) +-- end +-- end + +-- GameTooltip:AddLine(" ") + +-- local r, g, b = ColorGradient(total/(40*1024), 0,1,0, 1,1,0, 1,0,0) +-- GameTooltip:AddDoubleLine("Addon memory:", string_format("%.2f MiB", total/1024), nil,nil,nil, r,g,b) + +-- local mem = collectgarbage("count") +-- local r, g, b = ColorGradient(mem/(20*1024), 0,1,0, 1,1,0, 1,0,0) +-- GameTooltip:AddDoubleLine("Default UI memory:", string_format("%.2f MiB", (gcinfo()-total)/1024), nil,nil,nil, r,g,b) + +-- GameTooltip:AddLine(" ") + +-- GameTooltip:Show() +-- end + +-- TimeManagerClockButton:SetScript("OnEnter", onEnter) +-- TimeManagerClockButton:SetScript("OnLeave", function() GameTooltip:Hide() end) \ No newline at end of file