vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | |
2 | assert(BigWigs, "BigWigs not found!") |
||
3 | |||
4 | ------------------------------ |
||
5 | -- Are you local? -- |
||
6 | ------------------------------ |
||
7 | |||
8 | local L = AceLibrary("AceLocale-2.2"):new("BigWigsMessages") |
||
9 | local paint = AceLibrary("PaintChips-2.0") |
||
10 | |||
11 | ---------------------------- |
||
12 | -- Localization -- |
||
13 | ---------------------------- |
||
14 | |||
15 | L:RegisterTranslations("enUS", function() return { |
||
16 | ["Messages"] = true, |
||
17 | |||
18 | ["msg"] = true, |
||
19 | ["anchor"] = true, |
||
20 | ["rw"] = true, |
||
21 | ["color"] = true, |
||
22 | ["scale"] = true, |
||
23 | |||
24 | ["Options for the message frame."] = true, |
||
25 | ["Anchor"] = true, |
||
26 | ["Show the message anchor frame."] = true, |
||
27 | ["Use RaidWarning"] = true, |
||
28 | ["Toggle sending messages to the RaidWarnings frame."] = true, |
||
29 | ["Use colors"] = true, |
||
30 | ["Toggles white only messages ignoring coloring."] = true, |
||
31 | ["Message frame scale"] = true, |
||
32 | |||
33 | ["Message frame"] = true, |
||
34 | ["Show anchor"] = true, |
||
35 | ["Send messages to RaidWarning frame"] = true, |
||
36 | ["Set the message frame scale."] = true, |
||
37 | ["Colorize messages"] = true, |
||
38 | ["Scale"] = true, |
||
39 | |||
40 | ["|cffff0000Co|cffff00fflo|cff00ff00r|r"] = true, |
||
41 | ["White"] = true, |
||
42 | ["BigWigs frame"] = true, |
||
43 | ["RaidWarning frame"] = true, |
||
44 | ["Scale is set to %s"] = true, |
||
45 | ["Messages are now sent to the %2$s"] = true, |
||
46 | ["Messages are currently sent to the %2$s"] = true, |
||
47 | |||
48 | ["display"] = true, |
||
49 | ["Display"] = true, |
||
50 | ["Set where messages are displayed."] = true, |
||
51 | ["Display is now set to %2$s"] = true, |
||
52 | ["Display is currently set to %2$s"] = true, |
||
53 | |||
54 | ["Mik's Scrolling Battle Text"] = true, |
||
55 | ["Scrolling Combat Text"] = true, |
||
56 | ["Floating Combat Text"] = true, |
||
57 | |||
58 | ["Test"] = true, |
||
59 | ["Close"] = true, |
||
60 | } end) |
||
61 | |||
62 | |||
63 | L:RegisterTranslations("koKR", function() return { |
||
64 | ["Messages"] = "메세지", |
||
65 | |||
66 | -- ["msg"] = "메시지", |
||
67 | -- ["anchor"] = "위치", |
||
68 | -- ["rw"] = "공대경고", |
||
69 | -- ["color"] = "색상", |
||
70 | -- ["scale"] = "크기", |
||
71 | |||
72 | ["Options for the message frame."] = "메시지 창 옵션.", |
||
73 | ["Anchor"] = "위치", |
||
74 | ["Show the message anchor frame."] = "메시지 위치 조정 프레임 보이기.", |
||
75 | ["Use RaidWarning"] = "공격대 경고 사용", |
||
76 | ["Toggle sending messages to the RaidWarnings frame."] = "공대경고 창으로 메시지 보내기.", |
||
77 | ["Use colors"] = "색상 사용", |
||
78 | ["Toggles white only messages ignoring coloring."] = "메시지를 하얀 색으로 변경.", |
||
79 | ["Message frame scale"] = "메세지 창 크기", |
||
80 | |||
81 | ["Message frame"] = "메시지 창", |
||
82 | ["Show anchor"] = "앵커 보이기", |
||
83 | ["Send messages to RaidWarning frame"] = "공대경고 창으로 메시지 보내기", |
||
84 | ["Set the message frame scale."] = "메세지 창 크기 설정", |
||
85 | ["Colorize messages"] = "컬러 메시지", |
||
86 | ["Scale"] = "크기", |
||
87 | |||
88 | ["|cffff0000Co|cffff00fflo|cff00ff00r|r"] = "|cffff0000색|cffff00ff상|r", |
||
89 | ["White"] = "화이트", |
||
90 | ["BigWigs frame"] = "BigWigs 창", |
||
91 | ["RaidWarning frame"] = "공격대경고 창", |
||
92 | -- ["Scale is set to %s"] = true, |
||
93 | -- ["Messages are now sent to the %2$s"] = true, |
||
94 | -- ["Messages are currently sent to the %2$s"] = true, |
||
95 | |||
96 | ["display"] = "디스플레이", |
||
97 | ["Display"] = "디스플레이", |
||
98 | ["Set where messages are displayed."] = "메세지 디스플레이 설정", |
||
99 | ["Display is now set to %2$s"] = "디스플레이를 %2$s 로 설정 하였습니다.", |
||
100 | ["Display is currently set to %2$s"] = "디스플레이 현재 설정 : %2$s", |
||
101 | |||
102 | ["Mik's Scrolling Battle Text"] = "MSBT", |
||
103 | ["Scrolling Combat Text"] = "SCT", |
||
104 | ["Floating Combat Text"] = "FCT", |
||
105 | } end) |
||
106 | |||
107 | L:RegisterTranslations("zhCN", function() return { |
||
108 | ["Messages"] = "信息", |
||
109 | |||
110 | ["msg"] = "信息", |
||
111 | ["anchor"] = "锚点", |
||
112 | ["rw"] = "团队警报", |
||
113 | ["color"] = "颜色", |
||
114 | ["scale"] = "大小", |
||
115 | |||
116 | ["Options for the message frame."] = "信息框体设置。", |
||
117 | ["Anchor"] = "锚点", |
||
118 | ["Show the message anchor frame."] = "显示信息框体锚点。", |
||
119 | ["Use RaidWarning"] = "使用团队警告", |
||
120 | ["Toggle sending messages to the RaidWarnings frame."] = "切换是否通过团队警告框体发送信息。", |
||
121 | ["Use colors"] = "发送彩色信息", |
||
122 | ["Toggles white only messages ignoring coloring."] = "切换是否只发送单色信息。", |
||
123 | ["Message frame scale"] = "信息框体缩放", |
||
124 | |||
125 | ["Message frame"] = "信息框体", |
||
126 | ["Show anchor"] = "显示锚点", |
||
127 | ["Send messages to RaidWarning frame"] = "通过团队警告框体发送信息", |
||
128 | ["Set the message frame scale."] = "设置信息框体缩放比例", |
||
129 | ["Colorize messages"] = "彩色信息", |
||
130 | ["Scale"] = "缩放", |
||
131 | |||
132 | ["|cffff0000Co|cffff00fflo|cff00ff00r|r"] = "|cffff0000颜|cffff00ff色|r", |
||
133 | ["White"] = "白色", |
||
134 | ["BigWigs frame"] = "BigWigs框体", |
||
135 | ["RaidWarning frame"] = "团队警告框体", |
||
136 | ["Scale is set to %s"] = "缩放比例设置为%s", |
||
137 | ["Messages are now sent to the %2$s"] = "信息设置为发送到%2$s", |
||
138 | ["Messages are currently sent to the %2$s"] = "信息当前设置为发送到%2$s", |
||
139 | |||
140 | ["display"] = "显示", |
||
141 | ["Display"] = "显示", |
||
142 | ["Set where messages are displayed."] = "选择信息显示的位置", |
||
143 | ["Display is now set to %2$s"] = "显示设置到%2$s", |
||
144 | ["Display is currently set to %2$s"] = "显示目前设置到%2$s", |
||
145 | |||
146 | ["Mik's Scrolling Battle Text"] = "Mik's滚动战斗信息", |
||
147 | ["Scrolling Combat Text"] = "滚动战斗信息", |
||
148 | ["Floating Combat Text"] = "浮动战斗信息", |
||
149 | |||
150 | ["Test"] = "测试", |
||
151 | ["Close"] = "关闭", |
||
152 | |||
153 | } end) |
||
154 | |||
155 | L:RegisterTranslations("zhTW", function() return { |
||
156 | ["Messages"] = "訊息", |
||
157 | |||
158 | ["msg"] = "訊息", |
||
159 | ["anchor"] = "錨點", |
||
160 | ["rw"] = "團隊警報", |
||
161 | ["color"] = "顏色", |
||
162 | ["scale"] = "大小", |
||
163 | |||
164 | ["Options for the message frame."] = "訊息框架設置。", |
||
165 | ["Anchor"] = "錨點", |
||
166 | ["Show the message anchor frame."] = "顯示訊息訊息框架錨點。", |
||
167 | ["Use RaidWarning"] = "使用團隊警告", |
||
168 | ["Toggle sending messages to the RaidWarnings frame."] = "切換是否通過團隊警告框架發送訊息。", |
||
169 | ["Use colors"] = "發送彩色訊息", |
||
170 | ["Toggles white only messages ignoring coloring."] = "切換是否只發送單色訊息。", |
||
171 | ["Message frame scale"] = "訊息框架縮放", |
||
172 | |||
173 | ["Message frame"] = "訊息框架", |
||
174 | ["Show anchor"] = "顯示錨點", |
||
175 | ["Send messages to RaidWarning frame"] = "通過團隊警告框架發送訊息", |
||
176 | ["Set the message frame scale."] = "設置訊息框架縮放比例", |
||
177 | ["Colorize messages"] = "彩色訊息", |
||
178 | ["Scale"] = "縮放", |
||
179 | |||
180 | ["|cffff0000Co|cffff00fflo|cff00ff00r|r"] = "|cffff0000顏|cffff00ff色|r", |
||
181 | ["White"] = "白色", |
||
182 | ["BigWigs frame"] = "BigWigs框架", |
||
183 | ["RaidWarning frame"] = "團隊警告框架", |
||
184 | ["Scale is set to %s"] = "縮放比例設置為%s", |
||
185 | ["Messages are now sent to the %2$s"] = "目前訊息設定為發送到%2$s", |
||
186 | ["Messages are currently sent to the %2$s"] = "目前訊息設定為發送到%2$s", |
||
187 | |||
188 | ["display"] = "顯示", |
||
189 | ["Display"] = "顯示", |
||
190 | ["Set where messages are displayed."] = "選擇訊息顯示的位置", |
||
191 | ["Display is now set to %2$s"] = "顯示設置到%2$s", |
||
192 | ["Display is currently set to %2$s"] = "顯示目前設置到%2$s", |
||
193 | |||
194 | ["Mik's Scrolling Battle Text"] = "Mik's滾動戰鬥訊息", |
||
195 | ["Scrolling Combat Text"] = "滾動戰鬥訊息", |
||
196 | ["Floating Combat Text"] = "浮動戰鬥訊息", |
||
197 | |||
198 | ["Test"] = "測試", |
||
199 | ["Close"] = "關閉", |
||
200 | |||
201 | } end) |
||
202 | |||
203 | L:RegisterTranslations("deDE", function() return { |
||
204 | ["Messages"] = "Nachrichten", |
||
205 | |||
206 | ["msg"] = "msg", |
||
207 | ["anchor"] = "verankerung", |
||
208 | ["rw"] = "rw", |
||
209 | ["color"] = "farbe", |
||
210 | ["scale"] = "skalierung", |
||
211 | |||
212 | ["Options for the message frame."] = "Optionen f\195\188r das Nachrichtenfenster.", |
||
213 | ["Anchor"] = "Verankerung", |
||
214 | ["Show the message anchor frame."] = "Verankerung des Nachrichtenfensters anzeigen.", |
||
215 | ["Use RaidWarning"] = "RaidWarning benutzen", |
||
216 | ["Toggle sending messages to the RaidWarnings frame."] = "Nachrichten \195\188ber RaidWarning senden.", |
||
217 | ["Use colors"] = "Farben benutzen", |
||
218 | ["Toggles white only messages ignoring coloring."] = "Nachrichten farbig/wei\195\159 anzeigen.", |
||
219 | ["Message frame scale"] = "Nachrichtenfenster Skalierung", |
||
220 | |||
221 | ["Message frame"] = "Nachrichtenfenster", |
||
222 | ["Show anchor"] = "Verankerung anzeigen", |
||
223 | ["Send messages to RaidWarning frame"] = "Nachrichten \195\188ber RaidWarning senden.", |
||
224 | ["Set the message frame scale."] = "Skalierung des Nachrichtenfensters w\195\164hlen.", |
||
225 | ["Colorize messages"] = "Farbige Nachrichten", |
||
226 | ["Scale"] = "Skalierung", |
||
227 | |||
228 | ["|cffff0000Co|cffff00fflo|cff00ff00r|r"] = "|cffff0000Fa|cffff00ffr|cff00ff00be|r", |
||
229 | ["White"] = "Wei\195\159", |
||
230 | ["BigWigs frame"] = "BigWigs", |
||
231 | ["RaidWarning frame"] = "RaidWarning", |
||
232 | ["Scale is set to %s"] = "Skalierung jetzt: %s", |
||
233 | ["Messages are now sent to the %2$s"] = "Nachrichten werden nun gesendet an: %2$s", |
||
234 | ["Messages are currently sent to the %2$s"] = "Nachrichten werden zur Zeit gesendet an: %2$s", |
||
235 | |||
236 | ["display"] = "anzeige", |
||
237 | ["Display"] = "Anzeige", |
||
238 | ["Set where messages are displayed."] = "W\195\164hle, wo Nachrichten angezeigt werden sollen.", |
||
239 | ["Display is now set to %2$s"] = "Anzeige nun \195\188ber: %2$s", |
||
240 | ["Display is currently set to %2$s"] = "Anzeige zur Zeit \195\188ber: %2$s", |
||
241 | |||
242 | ["Mik's Scrolling Battle Text"] = "MSBT", |
||
243 | ["Scrolling Combat Text"] = "SCT", |
||
244 | ["Floating Combat Text"] = "FCT", |
||
245 | |||
246 | ["Test"] = "Test", |
||
247 | ["Close"] = "Schlie\195\159en", |
||
248 | } end) |
||
249 | |||
250 | L:RegisterTranslations("frFR", function() return { |
||
251 | ["Messages"] = "Messages", |
||
252 | |||
253 | ["Options for the message frame."] = "Options concernant le cadre des messages.", |
||
254 | ["Anchor"] = "Ancre", |
||
255 | ["Show the message anchor frame."] = "Affiche l'ancre du cadre des messages.", |
||
256 | ["Use RaidWarning"] = "Utiliser le cadre de l'Avertissement Raid", |
||
257 | ["Toggle sending messages to the RaidWarnings frame."] = "Affiche ou non les messages dans le cadre des Avertissements Raid.", |
||
258 | ["Use colors"] = "Utiliser des couleurs", |
||
259 | ["Toggles white only messages ignoring coloring."] = "Utilise ou non des couleurs dans les messages à la place du blanc unique.", |
||
260 | ["Message frame scale"] = "Taille du cadre des messages", |
||
261 | |||
262 | ["Message frame"] = "Cadre des messages", |
||
263 | ["Show anchor"] = "Afficher l'ancre", |
||
264 | ["Send messages to RaidWarning frame"] = "Envoyer les messages dans le cadre des Avertissements Raid", |
||
265 | ["Set the message frame scale."] = "Détermine la taille du cadre des messages.", |
||
266 | ["Colorize messages"] = "Colorer les messages", |
||
267 | ["Scale"] = "Taille", |
||
268 | |||
269 | ["|cffff0000Co|cffff00fflo|cff00ff00r|r"] = "|cffff0000Co|cffff00ffule|cff00ff00ur|r", |
||
270 | ["White"] = "Blanc", |
||
271 | ["BigWigs frame"] = "Cadre de BigWigs", |
||
272 | ["RaidWarning frame"] = "Cadre des Avertissements Raid", |
||
273 | ["Scale is set to %s"] = "La taille est désormais définie à %s", |
||
274 | ["Messages are now sent to the %2$s"] = "Les messages sont désormais affichés dans le %2$s", |
||
275 | ["Messages are currently sent to the %2$s"] = "Les messages sont actuellement affichés dans le %2$s", |
||
276 | |||
277 | ["Display"] = "Affichage", |
||
278 | ["Set where messages are displayed."] = "Détermine où les messages sont affichés.", |
||
279 | ["Display is now set to %2$s"] = "L'affichage est désormais défini au %2$s", |
||
280 | ["Display is currently set to %2$s"] = "L'affichage est actuellement défini au %2$s", |
||
281 | |||
282 | ["Mik's Scrolling Battle Text"] = "Scrolling Battle Text de Mik", |
||
283 | --["Scrolling Combat Text"] = "Scrolling Combat Text", |
||
284 | ["Floating Combat Text"] = "Message de combat flottant", |
||
285 | |||
286 | --["Test"] = "Test", |
||
287 | ["Close"] = "Fermer", |
||
288 | } end) |
||
289 | |||
290 | ---------------------------------- |
||
291 | -- Module Declaration -- |
||
292 | ---------------------------------- |
||
293 | |||
294 | BigWigsMessages = BigWigs:NewModule(L["Messages"]) |
||
295 | BigWigsMessages.defaultDB = { |
||
296 | display = L["RaidWarning frame"], |
||
297 | usecolors = true, |
||
298 | scale = 1.0, |
||
299 | } |
||
300 | BigWigsMessages.consoleCmd = L["msg"] |
||
301 | BigWigsMessages.consoleOptions = { |
||
302 | type = "group", |
||
303 | name = L["Messages"], |
||
304 | desc = L["Options for the message frame."], |
||
305 | args = { |
||
306 | [L["anchor"]] = { |
||
307 | type = "execute", |
||
308 | name = L["Anchor"], |
||
309 | desc = L["Show the message anchor frame."], |
||
310 | func = function() BigWigsMessages:BigWigs_ShowAnchors() end, |
||
311 | disabled = function() return (BigWigsMessages.db.profile.display ~= L["BigWigs frame"]) end, |
||
312 | }, |
||
313 | [L["color"]] = { |
||
314 | type = "toggle", |
||
315 | name = L["Use colors"], |
||
316 | desc = L["Toggles white only messages ignoring coloring."], |
||
317 | get = function() return BigWigsMessages.db.profile.usecolors end, |
||
318 | set = function(v) BigWigsMessages.db.profile.usecolors = v end, |
||
319 | map = {[true] = L["|cffff0000Co|cffff00fflo|cff00ff00r|r"], [false] = L["White"]}, |
||
320 | }, |
||
321 | [L["scale"]] = { |
||
322 | type = "range", |
||
323 | name = L["Message frame scale"], |
||
324 | desc = L["Set the message frame scale."], |
||
325 | min = 0.2, |
||
326 | max = 2.0, |
||
327 | step = 0.1, |
||
328 | get = function() return BigWigsMessages.db.profile.scale end, |
||
329 | set = function(v) |
||
330 | BigWigsMessages.db.profile.scale = v |
||
331 | if BigWigsMessages.msgframe then BigWigsMessages.msgframe:SetScale(v) end |
||
332 | end, |
||
333 | disabled = function() return (BigWigsMessages.db.profile.display ~= L["BigWigs frame"]) end, |
||
334 | }, |
||
335 | [L["display"]] = { |
||
336 | type = "text", |
||
337 | name = L["Display"], |
||
338 | desc = L["Set where messages are displayed."], |
||
339 | get = function() return BigWigsMessages.db.profile.display end, |
||
340 | validate = {L["BigWigs frame"], L["RaidWarning frame"]}, |
||
341 | set = function(v) |
||
342 | BigWigsMessages.db.profile.display = v |
||
343 | end, |
||
344 | message = L["Display is now set to %2$s"], |
||
345 | current = L["Display is currently set to %2$s"], |
||
346 | } |
||
347 | }, |
||
348 | } |
||
349 | |||
350 | ------------------------------ |
||
351 | -- Optional Dependancies -- |
||
352 | ------------------------------ |
||
353 | |||
354 | if MikSBT then |
||
355 | table.insert(BigWigsMessages.consoleOptions.args[L["display"]].validate, L["Mik's Scrolling Battle Text"]) |
||
356 | end |
||
357 | |||
358 | if SCT_Display_Message or ( SCT and SCT.DisplayMessage ) then |
||
359 | table.insert(BigWigsMessages.consoleOptions.args[L["display"]].validate, L["Scrolling Combat Text"]) |
||
360 | end |
||
361 | |||
362 | if CombatText_AddMessage then |
||
363 | table.insert(BigWigsMessages.consoleOptions.args[L["display"]].validate, L["Floating Combat Text"]) |
||
364 | end |
||
365 | |||
366 | ------------------------------ |
||
367 | -- Initialization -- |
||
368 | ------------------------------ |
||
369 | |||
370 | function BigWigsMessages:OnRegister() |
||
371 | self:SetupFrames() |
||
372 | self:CreateMsgFrame() |
||
373 | end |
||
374 | |||
375 | |||
376 | function BigWigsMessages:OnEnable() |
||
377 | self:RegisterEvent("BigWigs_Message") |
||
378 | self:RegisterEvent("BigWigs_ShowAnchors") |
||
379 | self:RegisterEvent("BigWigs_HideAnchors") |
||
380 | end |
||
381 | |||
382 | |||
383 | function BigWigsMessages:CreateMsgFrame() |
||
384 | self.msgframe = CreateFrame("MessageFrame") |
||
385 | self.msgframe:SetWidth(512) |
||
386 | self.msgframe:SetHeight(80) |
||
387 | |||
388 | self.msgframe:SetPoint("TOP", self.frames.anchor, "BOTTOM", 0, 0) |
||
389 | self.msgframe:SetScale(self.db.profile.scale or 1) |
||
390 | self.msgframe:SetInsertMode("TOP") |
||
391 | self.msgframe:SetFrameStrata("HIGH") |
||
392 | self.msgframe:SetToplevel(true) |
||
393 | self.msgframe:SetFontObject(GameFontNormalLarge) |
||
394 | self.msgframe:Show() |
||
395 | end |
||
396 | |||
397 | |||
398 | ------------------------------ |
||
399 | -- Event Handlers -- |
||
400 | ------------------------------ |
||
401 | |||
402 | function BigWigsMessages:BigWigs_ShowAnchors() |
||
403 | self.frames.anchor:Show() |
||
404 | end |
||
405 | |||
406 | |||
407 | function BigWigsMessages:BigWigs_HideAnchors() |
||
408 | self.frames.anchor:Hide() |
||
409 | end |
||
410 | |||
411 | |||
412 | function BigWigsMessages:BigWigs_Message(text, color, noraidsay, sound, broadcastonly) |
||
413 | if not text then return end |
||
414 | if broadcastonly then return end |
||
415 | local r, g, b |
||
416 | if color ~= nil and type(color) == "table" and type(color.r) == "number" and type(color.g) == "number" and type(color.b) == "number" then |
||
417 | r, g, b = color.r, color.g, color.b |
||
418 | else |
||
419 | if self.db.profile.usecolors and type(BigWigsColors) == "table" and type(BigWigsColors.MsgColor) == "function" then |
||
420 | color = BigWigsColors:MsgColor(color) |
||
421 | end |
||
422 | _, r, g, b = paint:GetRGBPercent(color or "white") |
||
423 | end |
||
424 | |||
425 | if self.db.profile.display == L["RaidWarning frame"] then |
||
426 | RaidWarningFrame:AddMessage(text, r, g, b, 1, UIERRORS_HOLD_TIME) |
||
427 | elseif MikSBT and self.db.profile.display == L["Mik's Scrolling Battle Text"] then |
||
428 | MikSBT.DisplayMessage(text, MikSBT.DISPLAYTYPE_NOTIFICATION, false, r * 255, g * 255, b * 255) |
||
429 | elseif SCT_Display_Message and self.db.profile.display == L["Scrolling Combat Text"] then -- SCT 4.x |
||
430 | local colorStruct = {} |
||
431 | colorStruct.r, colorStruct.g, colorStruct.b = r, g, b |
||
432 | SCT_Display_Message( text, colorStruct ) |
||
433 | elseif SCT and SCT_MSG_FRAME and self.db.profile.display == L["Scrolling Combat Text"] then -- SCT 5.x |
||
434 | SCT_MSG_FRAME:AddMessage( text, r, g, b, 1 ) |
||
435 | elseif CombatText_AddMessage and self.db.profile.display == L["Floating Combat Text"] then -- Blizzards FCT |
||
436 | CombatText_AddMessage(text, COMBAT_TEXT_SCROLL_FUNCTION, r, g, b, "sticky", nil) |
||
437 | else -- Default BigWigs Frame fallback |
||
438 | self.msgframe:AddMessage(text, r, g, b, 1, UIERRORS_HOLD_TIME) |
||
439 | end |
||
440 | end |
||
441 | |||
442 | ------------------------------ |
||
443 | -- Create the Anchor -- |
||
444 | ------------------------------ |
||
445 | |||
446 | function BigWigsMessages:SetupFrames() |
||
447 | local f, t |
||
448 | |||
449 | f, _, _ = GameFontNormal:GetFont() |
||
450 | |||
451 | self.frames = {} |
||
452 | self.frames.anchor = CreateFrame("Frame", "BigWigsMessageAnchor", UIParent) |
||
453 | self.frames.anchor.owner = self |
||
454 | self.frames.anchor:Hide() |
||
455 | |||
456 | self.frames.anchor:SetWidth(175) |
||
457 | self.frames.anchor:SetHeight(75) |
||
458 | self.frames.anchor:SetBackdrop({ |
||
459 | bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", tile = true, tileSize = 16, |
||
460 | edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 16, |
||
461 | insets = {left = 4, right = 4, top = 4, bottom = 4}, |
||
462 | }) |
||
463 | self.frames.anchor:SetBackdropBorderColor(.5, .5, .5) |
||
464 | self.frames.anchor:SetBackdropColor(0,0,0) |
||
465 | self.frames.anchor:ClearAllPoints() |
||
466 | self.frames.anchor:SetPoint("CENTER", UIParent, "CENTER", 0, 100) |
||
467 | self.frames.anchor:EnableMouse(true) |
||
468 | self.frames.anchor:RegisterForDrag("LeftButton") |
||
469 | self.frames.anchor:SetMovable(true) |
||
470 | self.frames.anchor:SetScript("OnDragStart", function() this:StartMoving() end) |
||
471 | self.frames.anchor:SetScript("OnDragStop", function() this:StopMovingOrSizing() this.owner:SavePosition() end) |
||
472 | |||
473 | |||
474 | self.frames.cfade = self.frames.anchor:CreateTexture(nil, "BORDER") |
||
475 | self.frames.cfade:SetWidth(169) |
||
476 | self.frames.cfade:SetHeight(25) |
||
477 | self.frames.cfade:SetTexture("Interface\\ChatFrame\\ChatFrameBackground") |
||
478 | self.frames.cfade:SetPoint("TOP", self.frames.anchor, "TOP", 0, -4) |
||
479 | self.frames.cfade:SetBlendMode("ADD") |
||
480 | self.frames.cfade:SetGradientAlpha("VERTICAL", .1, .1, .1, 0, .25, .25, .25, 1) |
||
481 | self.frames.anchor.Fade = self.frames.fade |
||
482 | |||
483 | self.frames.cheader = self.frames.anchor:CreateFontString(nil,"OVERLAY") |
||
484 | self.frames.cheader:SetFont(f, 14) |
||
485 | self.frames.cheader:SetWidth(150) |
||
486 | self.frames.cheader:SetText(L["Messages"]) |
||
487 | self.frames.cheader:SetTextColor(1, .8, 0) |
||
488 | self.frames.cheader:ClearAllPoints() |
||
489 | self.frames.cheader:SetPoint("TOP", self.frames.anchor, "TOP", 0, -10) |
||
490 | |||
491 | self.frames.leftbutton = CreateFrame("Button", nil, self.frames.anchor) |
||
492 | self.frames.leftbutton.owner = self |
||
493 | self.frames.leftbutton:SetWidth(40) |
||
494 | self.frames.leftbutton:SetHeight(25) |
||
495 | self.frames.leftbutton:SetPoint("RIGHT", self.frames.anchor, "CENTER", -10, -15) |
||
496 | self.frames.leftbutton:SetScript( "OnClick", function() self:TriggerEvent("BigWigs_Test") end ) |
||
497 | |||
498 | |||
499 | t = self.frames.leftbutton:CreateTexture() |
||
500 | t:SetWidth(50) |
||
501 | t:SetHeight(32) |
||
502 | t:SetPoint("CENTER", self.frames.leftbutton, "CENTER") |
||
503 | t:SetTexture("Interface\\Buttons\\UI-Panel-Button-Up") |
||
504 | t:SetTexCoord(0, 0.625, 0, 0.6875) |
||
505 | self.frames.leftbutton:SetNormalTexture(t) |
||
506 | |||
507 | t = self.frames.leftbutton:CreateTexture(nil, "BACKGROUND") |
||
508 | t:SetTexture("Interface\\Buttons\\UI-Panel-Button-Down") |
||
509 | t:SetTexCoord(0, 0.625, 0, 0.6875) |
||
510 | t:SetAllPoints(self.frames.leftbutton) |
||
511 | self.frames.leftbutton:SetPushedTexture(t) |
||
512 | |||
513 | t = self.frames.leftbutton:CreateTexture() |
||
514 | t:SetTexture("Interface\\Buttons\\UI-Panel-Button-Highlight") |
||
515 | t:SetTexCoord(0, 0.625, 0, 0.6875) |
||
516 | t:SetAllPoints(self.frames.leftbutton) |
||
517 | t:SetBlendMode("ADD") |
||
518 | self.frames.leftbutton:SetHighlightTexture(t) |
||
519 | self.frames.leftbuttontext = self.frames.leftbutton:CreateFontString(nil,"OVERLAY") |
||
520 | self.frames.leftbuttontext:SetFontObject(GameFontHighlight) |
||
521 | self.frames.leftbuttontext:SetText(L["Test"]) |
||
522 | self.frames.leftbuttontext:SetAllPoints(self.frames.leftbutton) |
||
523 | |||
524 | self.frames.rightbutton = CreateFrame("Button", nil, self.frames.anchor) |
||
525 | self.frames.rightbutton.owner = self |
||
526 | self.frames.rightbutton:SetWidth(40) |
||
527 | self.frames.rightbutton:SetHeight(25) |
||
528 | self.frames.rightbutton:SetPoint("LEFT", self.frames.anchor, "CENTER", 10, -15) |
||
529 | self.frames.rightbutton:SetScript( "OnClick", function() self:BigWigs_HideAnchors() end ) |
||
530 | |||
531 | |||
532 | t = self.frames.rightbutton:CreateTexture() |
||
533 | t:SetWidth(50) |
||
534 | t:SetHeight(32) |
||
535 | t:SetPoint("CENTER", self.frames.rightbutton, "CENTER") |
||
536 | t:SetTexture("Interface\\Buttons\\UI-Panel-Button-Up") |
||
537 | t:SetTexCoord(0, 0.625, 0, 0.6875) |
||
538 | self.frames.rightbutton:SetNormalTexture(t) |
||
539 | |||
540 | t = self.frames.rightbutton:CreateTexture(nil, "BACKGROUND") |
||
541 | t:SetTexture("Interface\\Buttons\\UI-Panel-Button-Down") |
||
542 | t:SetTexCoord(0, 0.625, 0, 0.6875) |
||
543 | t:SetAllPoints(self.frames.rightbutton) |
||
544 | self.frames.rightbutton:SetPushedTexture(t) |
||
545 | |||
546 | t = self.frames.rightbutton:CreateTexture() |
||
547 | t:SetTexture("Interface\\Buttons\\UI-Panel-Button-Highlight") |
||
548 | t:SetTexCoord(0, 0.625, 0, 0.6875) |
||
549 | t:SetAllPoints(self.frames.rightbutton) |
||
550 | t:SetBlendMode("ADD") |
||
551 | self.frames.rightbutton:SetHighlightTexture(t) |
||
552 | self.frames.rightbuttontext = self.frames.rightbutton:CreateFontString(nil,"OVERLAY") |
||
553 | self.frames.rightbuttontext:SetFontObject(GameFontHighlight) |
||
554 | self.frames.rightbuttontext:SetText(L["Close"]) |
||
555 | self.frames.rightbuttontext:SetAllPoints(self.frames.rightbutton) |
||
556 | |||
557 | self:RestorePosition() |
||
558 | end |
||
559 | |||
560 | |||
561 | function BigWigsMessages:SavePosition() |
||
562 | local f = self.frames.anchor |
||
563 | local s = f:GetEffectiveScale() |
||
564 | |||
565 | self.db.profile.posx = f:GetLeft() * s |
||
566 | self.db.profile.posy = f:GetTop() * s |
||
567 | end |
||
568 | |||
569 | |||
570 | function BigWigsMessages:RestorePosition() |
||
571 | local x = self.db.profile.posx |
||
572 | local y = self.db.profile.posy |
||
573 | |||
574 | if not x or not y then return end |
||
575 | |||
576 | local f = self.frames.anchor |
||
577 | local s = f:GetEffectiveScale() |
||
578 | |||
579 | f:ClearAllPoints() |
||
580 | f:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x / s, y / s) |
||
581 | end |