diff --git a/Modules/Debug.lua b/Modules/Debug.lua index 1582420..224f5ff 100644 --- a/Modules/Debug.lua +++ b/Modules/Debug.lua @@ -40,7 +40,7 @@ function mod:OnInitialize() end local function new1() - return LibBuffer:New("Debug buffer", random(50), " ") + return LibBuffer:New("Debug buffer", random(1000), " ") end local function updateText(widget) @@ -65,7 +65,7 @@ local function update() wipe(objects) ResourceServer.Update() local mem1, percent1, memdiff1, totalMem1, totaldiff1 = ResourceServer.GetMemUsage("StarTip") - for j = 1, random(50) do + for j = 1, 5 do local object = new1() tinsert(objects, object) end diff --git a/Modules/Histograms.lua b/Modules/Histograms.lua index 1d34c56..779877c 100644 --- a/Modules/Histograms.lua +++ b/Modules/Histograms.lua @@ -373,7 +373,7 @@ end function mod:OnInitialize() self.db = StarTip.db:RegisterNamespace(self:GetName(), defaults) - self:ReInit() + --self:ReInit() self.core = LibCore:New(mod, environment, "StarTip.Histograms", {["StarTip.Histograms"] = {}}, nil, StarTip.db.profile.errorLevel) @@ -404,7 +404,9 @@ function mod:GetOptions() return options end +local plugin = LibStub("StarLibPluginString-1.0") function mod:SetUnit() + GameTooltipStatusBar:Hide() self.offset = 0 createHistograms() @@ -417,6 +419,7 @@ function mod:SetUnit() if self.intersectTimer then self.intersectTimer:Start() end + end function mod:SetItem() diff --git a/Modules/UnitTooltip.lua b/Modules/UnitTooltip.lua index c7affa0..9aaa030 100644 --- a/Modules/UnitTooltip.lua +++ b/Modules/UnitTooltip.lua @@ -444,8 +444,32 @@ end local PluginResources = ResourceServer or LibStub("StarLibPluginResourceTools-1.0") local plugin = {} LibStub("StarLibPluginString-1.0"):New(plugin) + +local mem2, percent2, memdiff2, totalMem2, totaldiff2 + +local debugging = true --@end-debug@ +local function debug1() + --@debug@ + if debugging then + PluginResources.Update() + mem, percent, memdiff, totalMem, totaldiff = PluginResources.GetMemUsage("StarTip") + end + --@end-debug@ +end + +local function debug2(num) + --@debug@ + if debugging then + if not num then num = 1 end + PluginResources.Update() + mem, percent, memdiff, totalMem, totaldiff = PluginResources.GetMemUsage("StarTip") + StarTip:Print(num .. ": UnitTooltip... Memory: ", plugin.memshort(mem), plugin.memshort(memdiff)) + end + --@end-debug@ +end + function mod:ClearLines() for k, v in pairs(lines) do if v.leftObj then @@ -471,12 +495,7 @@ function mod:CreateLines() end self:ClearLines() lines = setmetatable(llines, {__call=function(self) - --@debug@ - if debugging then - PluginResources.Update() - local mem, percent, memdiff, totalMem, totaldiff = PluginResources.GetMemUsage("StarTip") - end - --@end-debug@ + if debuging then debug1() end local lineNum = 0 GameTooltip:ClearLines() for i, v in ipairs(self) do @@ -488,7 +507,6 @@ function mod:CreateLines() right = mod.evaluator.ExecuteCode(environment, v.name .. " right", v.right) left = mod.evaluator.ExecuteCode(environment, v.name .. " left", v.left) if right == "" then right = "nil" end - else right = '' left = mod.evaluator.ExecuteCode(environment, v.name .. " left", v.left) @@ -500,21 +518,21 @@ function mod:CreateLines() if v.right then GameTooltip:AddDoubleLine(' ', ' ', mod.db.profile.color.r, mod.db.profile.color.g, mod.db.profile.color.b, mod.db.profile.color.r, mod.db.profile.color.g, mod.db.profile.color.b) - if not v.leftObj or v.lineNum ~= lineNum then + --if not v.leftObj or v.lineNum ~= lineNum then v.config.value = v.left local tmp = v.update if not v.leftUpdating then v.update = 0 end v.leftObj = v.leftObj or WidgetText:New(mod.core, v.name .. "left", copy(v.config), 0, 0, v.layer or 0, StarTip.db.profile.errorLevel, updateWidget) v.update = tmp - end - if not v.rightObj or v.lineNum ~= lineNum then + --end + --if not v.rightObj or v.lineNum ~= lineNum then v.config.value = v.right local tmp = v.update if not v.rightUpdating then v.update = 0 end v.rightObj = v.rightObj or WidgetText:New(mod.core, v.name .. "right", copy(v.config), 0, 0, v.layer or 0, StarTip.db.profile.errorLevel, updateWidget) v.update = tmp - end + --end v.leftObj.fontString = mod.leftLines[lineNum] v.rightObj.fontString = mod.rightLines[lineNum] else @@ -541,14 +559,8 @@ function mod:CreateLines() end end + if debugging then debug2(2) end mod.NUM_LINES = lineNum - --@debug@ - if debugging then - PluginResources.Update() - local mem2, percent2, memdiff2, totalMem2, totaldiff2 = PluginResources.GetMemUsage("StarTip") - StarTip:Print("Memory: ", plugin.memshort(mem2 - mem)) - end - --@end-debug@ draw() GameTooltip:Show() end}) @@ -984,8 +996,15 @@ function mod:RebuildOpts() end end +local plugin = LibStub("StarLibPluginString-1.0") local ff = CreateFrame("Frame") function mod:SetUnit() + + if debugging then + ResourceServer.Update() + local mem1, percent1, memdiff1, totalMem1, totaldiff1 = ResourceServer.GetMemUsage("StarTip") + end + if ff:GetScript("OnUpdate") then ff:SetScript("OnUpdate", nil) end environment.unitName, environment.unitGuild, environment.unitLocation = UnitTooltipStats.GetUnitTooltipStats("mouseover") @@ -1055,13 +1074,10 @@ function mod:SetUnit() self:RefixEndLines() - local hide = 1 - for i = 1, GameTooltip:NumLines() do - if string.trim(self.leftLines[i]:GetText() or "") == "" and string.trim(self.rightLines[i]:GetText() or "") == "" then hide = hide + 1 end - end - - if hide >= GameTooltip:NumLines() then - GameTooltip:Hide() + if debugging then + ResourceServer.Update() + local mem2, percent2, memdiff2, totalMem2, totaldiff2 = ResourceServer.GetMemUsage("StarTip") + --StarTip:Print("UnitTooltip Memory", plugin.memshort(mem2), plugin.memshort(mem2 - mem1), plugin.memshort(memdiff2)) end end diff --git a/StarTip.lua b/StarTip.lua index 49df5a7..865fd99 100644 --- a/StarTip.lua +++ b/StarTip.lua @@ -613,6 +613,7 @@ function StarTip:OpenConfig() end function StarTip.GameTooltipAddLine(...) + do return end if StarTip.addingLine then return ... end local mod = StarTip:GetModule("UnitTooltip") mod.NUM_LINES = mod.NUM_LINES + 1 @@ -621,6 +622,7 @@ end local hideTimer local function hideTooltip() + do return end local mod = StarTip:GetModule("UnitTooltip") if GameTooltip:GetAlpha() < 1 then GameTooltip:Hide(); StarTip.unit = false; return end if GameTooltip:NumLines() > mod.NUM_LINES then GameTooltip:Hide(); StarTip.unit = false; return end diff --git a/modules.xml b/modules.xml index 2f8964e..992d8d4 100644 --- a/modules.xml +++ b/modules.xml @@ -7,13 +7,12 @@ <Script file = "Modules\PvP.lua"/> <Script file = "Modules\RaidIcon.lua"/> <Script file = "Modules\Targeting.lua"/> -<Script file = "Modules\DeadlyAnnounce.lua"/> + <Script file = "Modules\Text.lua"/> <Script file = "Modules\Bars.lua"/> <Script file = "Modules\Histograms.lua"/> <Script file = "Modules\UnitTooltip.lua"/> -<Script file = "Modules\Debug.lua"/> - -<!--<Script file = "Modules\LCDDisplay.lua"/>--> +<!--<Script file = "Modules\Debug.lua"/> +--> </Ui>