Quantcast

* Stop embedding LibTransition-1.0 since I'm not willing to fix its bugs. No time.

Scott Sibley [07-30-11 - 09:57]
* Stop embedding LibTransition-1.0 since I'm not willing to fix its bugs. No time.
* Modified local copy of libqtip so I have a global frame I can reference. _G["StarTipTooltipMain"].. I didn't realize I already did _G["StarTipTooltipMain"] = tooltip ;).. At any rate, the local copy will recycle tooltip frames if for some reason you drop and reaquire a tooltip with the same key.
* Histograms are broken.
* There's a new option "unitOverride" -- use this to force a particular unit, as opposed to what GameTooltip:GetUnit() returns.
* Made some changes to Target line to make better use of unitOverride. It's not finished.
* By the way, this commit is broken. :)
Filename
.pkgmeta
LibQTip-1.0.lua
Modules/Histograms/Histograms.lua
Modules/UnitTooltip/UnitTooltip.lua
StarTip.lua
embeds.xml
diff --git a/.pkgmeta b/.pkgmeta
index f436b83..9b8154a 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -71,8 +71,6 @@ externals:
         url: svn://svn.wowace.com/wow/libfail-2-0/mainline/trunk
     Libs/LibNameplate-1.0:
         url: svn://svn.wowace.com/wow/libnameplate-1-0/mainline/trunk/LibNameplate-1.0
-    Libs/LibTransition-1.0:
-        url: svn://svn.wowace.com/wow/libtransition-1-0/mainline/trunk
     Libs/LibAlts-1.0:
         url: svn://svn.wowace.com/wow/libalts-1-0/mainline/trunk
     Libs/LibLocalizedEJBosses-1.0: svn://svn.wowace.com/wow/liblocalizedejbosses-1-0/mainline/trunk
diff --git a/LibQTip-1.0.lua b/LibQTip-1.0.lua
index a0fdc62..2d08d75 100644
--- a/LibQTip-1.0.lua
+++ b/LibQTip-1.0.lua
@@ -99,7 +99,7 @@ function lib:Acquire(key, ...)
 	local tooltip = activeTooltips[key]

 	if not tooltip then
-		tooltip = AcquireTooltip()
+		tooltip = AcquireTooltip(tostring(key))
 		InitializeTooltip(tooltip, key)
 		activeTooltips[key] = tooltip
 	end
@@ -311,12 +311,28 @@ function labelPrototype:GetPosition() return self._line, self._column end
 ------------------------------------------------------------------------------
 local tooltipHeap = lib.tooltipHeap

+local trunk = {}
+
+local function newFrame(name)
+	for frame in pairs(trunk) do
+		if frame:GetName() == name then
+			trunk[frame] = nil
+			return frame
+		end
+	end
+	return CreateFrame("Frame", name, UIParent)
+end
+
+local function delFrame(frame)
+	trunk[frame] = true
+end
+
 -- Returns a tooltip
-function AcquireTooltip()
+function AcquireTooltip(name)
 	local tooltip = tremove(tooltipHeap)

 	if not tooltip then
-		tooltip = CreateFrame("Frame", nil, UIParent)
+		tooltip = newFrame(name) --CreateFrame("Frame", name, UIParent)

 		local scrollFrame = CreateFrame("ScrollFrame", nil, tooltip)
 		scrollFrame:SetPoint("TOP", tooltip, "TOP", 0, -TOOLTIP_PADDING)
@@ -379,6 +395,7 @@ function ReleaseTooltip(tooltip)

 	layoutCleaner.registry[tooltip] = nil
 	tinsert(tooltipHeap, tooltip)
+	delFrame(tooltip)
 	--@debug@
 	usedTooltips = usedTooltips - 1
 	--@end-debug@
diff --git a/Modules/Histograms/Histograms.lua b/Modules/Histograms/Histograms.lua
index 15c87b7..d728e2a 100644
--- a/Modules/Histograms/Histograms.lua
+++ b/Modules/Histograms/Histograms.lua
@@ -255,7 +255,7 @@ local function clearHistogram(obj)
 		del(v)
 		v:Hide()
 	end
-	obj:Del()
+	--obj:Del()
 end

 function mod:ClearHistograms()
@@ -384,7 +384,6 @@ function mod:OnEnable()
 	StarTip:SetOptionsDisabled(options, false)
 	if StarTip.db.profile.intersectRate > 0 then
 		self.intersectTimer = self.intersectTimer or LibTimer:New("Texts.intersectTimer", self.db.profile.intersectRate or 500, true, intersectUpdate)
-		self.intersectTimer:Start()
 	end
 	self:ClearHistograms()
 	self:CreateHistograms()
diff --git a/Modules/UnitTooltip/UnitTooltip.lua b/Modules/UnitTooltip/UnitTooltip.lua
index 96941c5..582ada7 100644
--- a/Modules/UnitTooltip/UnitTooltip.lua
+++ b/Modules/UnitTooltip/UnitTooltip.lua
@@ -114,7 +114,10 @@ return texture .. Colorize((Name(unit, true) or Name(unit)) .. afk , r, g, b)
 -- Example: return "\\ FOO \\"
 -- Would print "\ FOO \"

-if not UnitExists(unit) then return L["None"] end
+self.unitOverride = unit .. "mouseover"
+self.clearOverride = true
+
+if not UnitExists(self.unitOverride) then return L["None"] end

 local dt = '\
 [IsUnit("player") and "<YOU>":ClassColor or Color(Name, %f, %f, %f ) \
@@ -123,22 +126,22 @@ local dt = '\
 end)]'

 local r, g, b
-if UnitIsPlayer(unit) then
+if UnitIsPlayer(self.unitOverride) then
     r, g, b = ClassColor(unit)
 else
-    r, g, b = UnitSelectionColor(unit)
+    r, g, b = UnitSelectionColor(self.unitOverride)
 end

-if UnitIsUnit(unit, "player") then
+if UnitIsUnit(self.unitOverride, "player") then
 	self.speed = 200
 	self.align = WidgetText.ALIGN_LEFT
 	self.direction = WidgetText.SCROLL_RIGHT
 	self.width = 500
 end

+
 return dt:format(r, g, b)
 ]],
-	unitOverride = "mouseovertarget",
         rightUpdating = true,
 	leftUpdating = true,
         update = 500,
diff --git a/StarTip.lua b/StarTip.lua
index f378319..5280072 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -181,6 +181,7 @@ local defaults = {
 		modules = {},
 		timers = {},
 		minimap = {hide=true},
+		widgetMain = {frameName="ChatFrame1", frameParent="StarTipTooltipMain", strata=1, level=1, alwaysShown=false, intersect=true, intersectxPad1 = 0, intersectyPad1 = 0, intersectxPad2 = 0, intersectyPad2 = 0, insersectPad = 0, minStrata=5},
 		modifier = 1,
 		unitShow = 1,
 		objectShow = 1,
@@ -494,7 +495,9 @@ function StarTip:OnInitialize()
 	GameTooltip:Show()
 	GameTooltip:Hide()

-	self.intersectTimer = LibTimer:New("IntersectTimer", self.db.profile.intersectRate, false, LibWidget.IntersectUpdate, StarTip.tooltipMain)
+	self.intersectTimer = LibTimer:New("IntersectTimer", self.db.profile.intersectRate, true, LibWidget.IntersectUpdate, nil, self.db.profile.errorLevel)
+	StarTip.tooltipMain.widget = LibWidget:New(StarTip.tooltipMain, StarTip, "tooltipMain", StarTip.copy(self.db.profile.widgetMain), 0, 0, 0, {"generic"}, self.db.profile.errorLevel, StarTip.tooltipMain)
+	self.intersectTimer.data = StarTip.tooltipMain.widget
 end

 StarTip.cellProvider, StarTip.cellPrototype = LQT:CreateCellProvider()
@@ -504,7 +507,7 @@ function StarTip.cellPrototype:InitializeCell()
 	self.fontString:SetAllPoints(self)
 	self.fontString:SetFontObject(GameTooltipText)
 	self.r, self.g, self.b = 1, 1, 1
-	local x, y = self:GetPosition()
+	local y, x = self:GetPosition()
 	if not StarTip.qtipLines[y] then
 		StarTip.qtipLines[y] = {}
 	end
@@ -526,10 +529,10 @@ function StarTip.cellPrototype:ReleaseCell()
 	self.r, self.g, self.b = 1, 1, 1
 end

-StarTip.tooltipMain = LQT:Acquire("StarTipQTipMain", 2)
+StarTip.tooltipMain = LQT:Acquire("StarTipTooltipMain", 2)
 --StarTip.tooltipMain:SetDefaultProvider(StarTip.cellProvider)
+_G["StarTipTooltipMain"] = StarTip.tooltipMain
 StarTip.tooltipMain:SetParent(UIParent)
-_G["StarTipQTipMain"] = StarTip.tooltipMain
 StarTip.tooltipMain:ClearAllPoints()
 StarTip.tooltipMain:SetPoint("CENTER")
 StarTip.tooltipMain.flash = LibFlash:New(StarTip.tooltipMain)
@@ -539,14 +542,12 @@ StarTip.tooltipMain.Show = function()
 	StarTip.tooltipMain:ShowReal()
 	StarTip.tooltipMain:SetAlpha(1)
 	StarTip.intersectTimer:Start()
-	StarTip:Print("ok wtf")
 end
 StarTip.tooltipMain.HideReal = StarTip.tooltipMain.Hide
 StarTip.tooltipMain.Hide = function()
 	StarTip.tooltipMain.flash:Stop()
 	StarTip.tooltipMain:HideReal()
 	StarTip.intersectTimer:Stop()
-	StarTip:Print("hmmmmm")
 end
 StarTip.tooltipMain.FadeOut = function()
 	if StarTip.tooltipMain:IsShown() and StarTip.tooltipMain:GetAlpha() > 0 then
@@ -581,7 +582,7 @@ function StarTip:TrunkClear()
 end

 StarTip.trunk = trunk
-StarTip.trunkTimer = LibTimer:New("Trunk Timer", 100, false, trunkUpdate)
+StarTip.trunkTimer = LibTimer:New("Trunk Timer", 300, false, trunkUpdate)

 function StarTip:OnEnable()
 	if self.db.profile.minimap.hide then
@@ -618,8 +619,6 @@ function StarTip:OnEnable()
 	if self.db.profile.message then
 		ChatFrame1:AddMessage(plugin.Colorize(L["Welcome to "] .. StarTip.name, 0, 1, 1) .. plugin.Colorize(L[" Type /startip to open config. Alternatively you could press escape and choose the addons menu. Or you can choose to show a minimap icon. You can turn off this message under Settings."], 1, 1, 0))
 	end
-	StarTip.widgetMain = LibWidget:New(StarTip.tooltipMain, StarTip, "tooltipMain", {}, 0, 0, 0, {"generic"}, self.db.profile.errorLevel)
-	StarTip.widgetMain.frame = StarTip.tooltipMain
 end

 function StarTip:OnDisable()
diff --git a/embeds.xml b/embeds.xml
index be06d3f..21318b5 100644
--- a/embeds.xml
+++ b/embeds.xml
@@ -29,7 +29,6 @@
 <Script file = "Libs\LibMouseGestures-1.0\LibMouseGestures-1.0.lua"/>
 <Script file = "Libs\LibUnitControl-1.0\LibUnitControl-1.0.lua"/>
 <Script file = "Libs\LibNameplate-1.0\LibNameplate-1.0.lua"/>
-<Script file = "Libs\LibTransition-1.0\LibTransition-1.0.lua"/>
 <Script file = "Libs\LibAlts-1.0\LibAlts-1.0.lua"/>
 <Include file = "Libs\LibLinq-1.0\lib.xml"/>
 <Include file = "Libs\LibBossIDs-1.0\lib.xml"/>