public
Description: WoW Addon - Crowd control assistance
Homepage: http://www.tekkub.net
Clone URL: git://github.com/tekkub/controlfreak.git
Click here to lend your support to: controlfreak and make a donation at www.pledgie.com !
ControlFreak - Move tooltip code into the block's file

git-svn-id: http://tekkub-wow.googlecode.com/svn/trunk/ControlFreak@680 
86fe6d9a-1522-0410-a387-bf9db416f0a0
tekkub (author)
Sun Nov 11 03:51:11 -0800 2007
commit  a22d1cfaf2bd7510f37e7ad347e350fb31ce02bd
tree    27322033559bb43511a53936c938f413bb031d12
parent  8922eab6b771ea1fe65fc36f1ee00d5275cb12ee
...
65
66
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
0
@@ -65,3 +65,25 @@ function frame:Resize()
0
   frame:SetWidth(text:GetStringWidth() + 8)
0
 end
0
 
0
+
0
+-----------------------
0
+-- Tooltip --
0
+-----------------------
0
+
0
+local tiptext
0
+function frame:SetTooltip(tip)
0
+ tiptext = tip
0
+end
0
+
0
+
0
+frame:SetScript("OnLeave", function() GameTooltip:Hide() end)
0
+frame:SetScript("OnEnter", function(self)
0
+ if not ControlFreak.db.char.showtooltip or not tiptext then return end
0
+ local sx, sy, x, y = GetScreenHeight(), GetScreenWidth(), self:GetCenter()
0
+ local x1, y1, y2 = "RIGHT", "TOP", "BOTTOM"
0
+ if x < (sx/2) then x1 = "LEFT" end
0
+ if y < (sy/2) then y1, y2 = y2, y1 end
0
+ GameTooltip:SetOwner(self, "ANCHOR_NONE")
0
+ GameTooltip:SetPoint(y1..x1, self, y2..x1)
0
+ GameTooltip:SetText(tiptext)
0
+end)
...
87
88
89
90
 
91
92
93
94
95
96
97
98
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
...
248
249
250
251
 
252
253
254
 
255
256
257
...
87
88
89
 
90
91
92
93
 
 
94
95
96
...
107
108
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
111
112
...
229
230
231
 
232
233
234
 
235
236
237
238
0
@@ -87,12 +87,10 @@ function ControlFreak:Enable()
0
   lego:Resize()
0
   lego:SetDB(self.db.char.frameopts)
0
 
0
- lego.tooltiptext = L["Click to set focus\n"]..L["Type /freak or right-click to open config"]
0
+ lego:SetTooltip(L["Click to set focus\n"]..L["Type /freak or right-click to open config"])
0
   lego:SetText("Control Freak")
0
   lego:SetAttribute("type", "macro")
0
   lego:SetAttribute("macrotext", self.db.profile.macrotext)
0
- lego:SetScript("OnEnter", self.OnEnter)
0
- lego:SetScript("OnLeave", self.OnLeave)
0
 
0
   self:ParseDebuffs(string.split(",", self.db.profile.spellname))
0
 
0
@@ -109,23 +107,6 @@ function ControlFreak:ParseDebuffs(...)
0
 end
0
 
0
 
0
-function ControlFreak:OnEnter()
0
- if not ControlFreak.db.char.showtooltip then return end
0
- local sx, sy, x, y = GetScreenHeight(), GetScreenWidth(), self:GetCenter()
0
- local x1, y1, y2 = "RIGHT", "TOP", "BOTTOM"
0
- if x < (sx/2) then x1 = "LEFT" end
0
- if y < (sy/2) then y1, y2 = y2, y1 end
0
- GameTooltip:SetOwner(self, "ANCHOR_NONE")
0
- GameTooltip:SetPoint(y1..x1, self, y2..x1)
0
- GameTooltip:SetText(self.tooltiptext)
0
-end
0
-
0
-
0
-function ControlFreak:OnLeave()
0
- GameTooltip:Hide()
0
-end
0
-
0
-
0
 function ControlFreak:StartTimer()
0
   updateframe:Show()
0
   updating = true
0
@@ -248,10 +229,10 @@ function ControlFreak:OnUpdate(elapsed)
0
   local casttarget = InCombatLockdown() and (not focusexists or focusdead) and targetexists
0
   local clearfocus1 = focusexists and focusdead and not (InCombatLockdown() and targetexists and not targetdead)
0
   local clearfocus2 = focusexists and not focusdead
0
- lego.tooltiptext = (setfocus and L["Click to set focus\n"] or "")..
0
+ lego:SetTooltip((setfocus and L["Click to set focus\n"] or "")..
0
     (castfocus and L["Click to cast on focus\n"] or "").. (casttarget and L["Click to cast on target\n"] or "")..
0
     (clearfocus1 and L["Click to clear focus\n"] or "").. (clearfocus2 and L["Shift-click to clear focus\n"] or "")..
0
- L["Type /freak or right-click to open config"]
0
+ L["Type /freak or right-click to open config"])
0
 
0
   lego:SetAlpha(alpha)
0
   lego:SetBackdropBorderColor(unpack(colors[color]))

Comments

    No one has commented yet.