Quantcast
WoWInterface: SVN - gMedia - Blame - Rev 2 - /gMedia.lua

WoWInterface SVN gMedia

[/] [gMedia.lua] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 Goldpaw-66380
--[[
2 Goldpaw-66380
        gMedia
3 Goldpaw-66380
        Author: Lars Norberg
4 Goldpaw-66380
 
5 Goldpaw-66380
        License:
6 Goldpaw-66380
                This program is free software; you can redistribute it and/or
7 Goldpaw-66380
                modify it under the terms of the GNU General Public License
8 Goldpaw-66380
                as published by the Free Software Foundation; either version 2
9 Goldpaw-66380
                of the License, or (at your option) any later version.
10 Goldpaw-66380
 
11 Goldpaw-66380
                This program is distributed in the hope that it will be useful,
12 Goldpaw-66380
                but WITHOUT ANY WARRANTY; without even the implied warranty of
13 Goldpaw-66380
                MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 Goldpaw-66380
                GNU General Public License for more details.
15 Goldpaw-66380
 
16 Goldpaw-66380
                You should have received a copy of the GNU General Public License
17 Goldpaw-66380
                along with this program(see GPL.txt); if not, write to the Free Software
18 Goldpaw-66380
                Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 Goldpaw-66380
 
20 Goldpaw-66380
        Note:
21 Goldpaw-66380
                This AddOn's source code is specifically designed to work with
22 Goldpaw-66380
                World of Warcraft's interpreted AddOn system.
23 Goldpaw-66380
                You have an implicit licence to use this AddOn with these facilities
24 Goldpaw-66380
                since that is its designated purpose as per:
25 Goldpaw-66380
                http://www.fsf.org/licensing/licenses/gpl-faq.html#InterpreterIncompat
26 Goldpaw-66380
]]--
27 Goldpaw-66380
 
28 Goldpaw-66380
gMedia = CreateFrame("Frame", nil, UIParent);
29 Goldpaw-66380
gMedia.ADDON = "gMedia";
30 Goldpaw-66380
gMedia.VERSION = GetAddOnMetadata(gMedia.ADDON,"Version");
31 Goldpaw-66380
 
32 Goldpaw-66380
gMedia:SetScript("OnEvent", function(self, event, ...) self[event](self, ...) end);
33 Goldpaw-66380
gMedia:RegisterEvent("ADDON_LOADED");
34 Goldpaw-66380
 
35 Goldpaw-66380
-- enUS localization
36 Goldpaw-66380
gMedia.L = {
37 Goldpaw-66380
        -- error messages
38 Goldpaw-66380
        ["ERR_LIB_UNKNOWN"]                                             = "Library not found: lib['%s']";
39 Goldpaw-66380
        ["ERR_MEDIA_UNKNOWN"]                                           = "Media not found: lib['%s']['%s']";
40 Goldpaw-66380
        ["ERR_MEDIA_EXIST"]                                             = "gMedia.lib['%s']['%s'] already exists.";
41 Goldpaw-66380
        ["ERR_NOT_STRING"]                                                      = "'%s' must be a String, got %s.";
42 Goldpaw-66380
        ["ERR_USAGE"]                                                           = "Usage: %s";
43 Goldpaw-66380
        ["ERR_CANNOT_DELETE_DEFAULT"]                           = "Cannot unregister default media.";
44 Goldpaw-66380
}
45 Goldpaw-66380
 
46 Goldpaw-66380
-- simple list of valid points in frames
47 Goldpaw-66380
gMedia.VALIDPOINTS = {
48 Goldpaw-66380
        ["TOP"]                                 = true;
49 Goldpaw-66380
        ["BOTTOM"]                              = true;
50 Goldpaw-66380
        ["RIGHT"]                               = true;
51 Goldpaw-66380
        ["LEFT"]                                = true;
52 Goldpaw-66380
        ["TOPLEFT"]                     = true;
53 Goldpaw-66380
        ["TOPRIGHT"]                    = true;
54 Goldpaw-66380
        ["BOTTOMLEFT"]                  = true;
55 Goldpaw-66380
        ["BOTTOMRIGHT"]                 = true;
56 Goldpaw-66380
        ["CENTER"]                              = true;
57 Goldpaw-66380
}
58 Goldpaw-66380
 
59 Goldpaw-66380
-- simple list of valid layers for textures
60 Goldpaw-66380
gMedia.VALIDLAYERS = {
61 Goldpaw-66380
        ["BACKGROUND"]                  = true; -- Level 0. Place the background of your frame here.
62 Goldpaw-66380
        ["BORDER"]                              = true; -- Level 1. Place the artwork of your frame here .
63 Goldpaw-66380
        ["ARTWORK"]                     = true; -- Level 2. Place the artwork of your frame here.
64 Goldpaw-66380
        ["OVERLAY"]                     = true; -- Level 3. Place your text, objects, and buttons in this level.
65 Goldpaw-66380
        ["HIGHLIGHT"]                   = true; -- Level 4. Place your text, objects, and buttons in this level.
66 Goldpaw-66380
}
67 Goldpaw-66380
 
68 Goldpaw-66380
-- simple list of valid FrameStrata values for frames
69 Goldpaw-66380
gMedia.VALIDFRAMESTRATAS = {
70 Goldpaw-66380
        ["PARENT"]                              = true;
71 Goldpaw-66380
        ["BACKGROUND"]                  = true;
72 Goldpaw-66380
        ["LOW"]                                 = true;
73 Goldpaw-66380
        ["MEDIUM"]                              = true;
74 Goldpaw-66380
        ["HIGH"]                                = true;
75 Goldpaw-66380
        ["DIALOG"]                              = true;
76 Goldpaw-66380
        ["FULLSCREEN"]                  = true;
77 Goldpaw-66380
        ["FULLSCREEN_DIALOG"]   = true;
78 Goldpaw-66380
        ["TOOLTIP"]                     = true;
79 Goldpaw-66380
}
80 Goldpaw-66380
 
81 Goldpaw-66380
-- main media paths
82 Goldpaw-66380
local path                              = "Interface\\AddOns\\gMedia\\";
83 Goldpaw-66380
local buttonpath                = "Interface\\AddOns\\gMedia\\buttons\\";
84 Goldpaw-66380
local fontpath                  = "Interface\\AddOns\\gMedia\\fonts\\";
85 Goldpaw-66380
local iconpath                  = "Interface\\AddOns\\gMedia\\icons\\";
86 Goldpaw-66380
local texpath                   = "Interface\\AddOns\\gMedia\\texture\\";
87 Goldpaw-66380
 
88 Goldpaw-66380
------------------------------------------------------
89 Goldpaw-66380
--      Default library
90 Goldpaw-66380
------------------------------------------------------
91 Goldpaw-66380
 
92 Goldpaw-66380
-- create the main library table
93 Goldpaw-66380
gMedia.lib = {};
94 Goldpaw-66380
 
95 Goldpaw-66380
-- shortcut
96 Goldpaw-66380
local lib = gMedia.lib;
97 Goldpaw-66380
 
98 Goldpaw-66380
-- create the categories
99 Goldpaw-66380
lib.backdrop = {};
100 Goldpaw-66380
lib.background = {};
101 Goldpaw-66380
lib.border = {};
102 Goldpaw-66380
lib.button = {};
103 Goldpaw-66380
lib.color = {};
104 Goldpaw-66380
lib.font = {};
105 Goldpaw-66380
lib.fontn = {};
106 Goldpaw-66380
lib.icon = {};
107 Goldpaw-66380
lib.iconstring = {};
108 Goldpaw-66380
lib.statusbar = {};
109 Goldpaw-66380
 
110 Goldpaw-66380
-- borders
111 Goldpaw-66380
lib.border["glow"]                                                      = texpath.."glowtex.tga";
112 Goldpaw-66380
 
113 Goldpaw-66380
-- colors
114 Goldpaw-66380
lib.color["gui"] = {
115 Goldpaw-66380
        ["background"]                                                          = {0.05, 0.05, 0.05, 1};
116 Goldpaw-66380
        ["border"]                                                                      = {0.15, 0.15, 0.15, 1};
117 Goldpaw-66380
}
118 Goldpaw-66380
lib.color["RAID_CLASS_COLORS"] = {
119 Goldpaw-66380
        ["HUNTER"]                                                                      = { r = 0.67, g = 0.83, b = 0.45 };
120 Goldpaw-66380
        ["WARLOCK"]                                                             = { r = 0.58, g = 0.51, b = 0.79 };
121 Goldpaw-66380
        ["PRIEST"]                                                                      = { r = 0.90, g = 0.90, b = 0.90 };
122 Goldpaw-66380
        ["PALADIN"]                                                             = { r = 0.96, g = 0.55, b = 0.73 };
123 Goldpaw-66380
        ["MAGE"]                                                                        = { r = 0.41, g = 0.80, b = 0.94 };
124 Goldpaw-66380
        ["ROGUE"]                                                                       = { r = 1.00, g = 0.96, b = 0.41 };
125 Goldpaw-66380
        ["DRUID"]                                                                       = { r = 1.00, g = 0.49, b = 0.04 };
126 Goldpaw-66380
        ["SHAMAN"]                                                                      = { r = 0.00, g = 0.44, b = 0.87 };
127 Goldpaw-66380
        ["WARRIOR"]                                                             = { r = 0.78, g = 0.61, b = 0.43 };
128 Goldpaw-66380
        ["DEATHKNIGHT"]                                                         = { r = 0.77, g = 0.12, b = 0.23 };
129 Goldpaw-66380
}
130 Goldpaw-66380
 
131 Goldpaw-66380
-- backgrounds
132 Goldpaw-66380
lib.background["default"]                                       = texpath.."blank.tga";
133 Goldpaw-66380
lib.background["blank"]                                         = texpath.."blank.tga";
134 Goldpaw-66380
lib.background["fullscreenshader"]                      = texpath.."fullscreenshader.tga";
135 Goldpaw-66380
lib.background["horizontalshadow"]                      = "Interface\\AchievementFrame\\UI-Achievement-HorizontalShadow.blp";
136 Goldpaw-66380
lib.background["satin"]                                         = texpath.."satin.tga";
137 Goldpaw-66380
lib.background["steel"]                                         = texpath.."Steel.tga";
138 Goldpaw-66380
lib.background["unitshader"]                            = texpath.."unitshader.tga";
139 Goldpaw-66380
lib.background["vignette"]                                      = texpath.."vignette.blp";
140 Goldpaw-66380
 
141 Goldpaw-66380
-- statusbars
142 Goldpaw-66380
lib.statusbar["acebar"]                                         = texpath.."AceBarFrames.tga";
143 Goldpaw-66380
lib.statusbar["bantobar"]                                       = texpath.."BantoBar.tga";
144 Goldpaw-66380
lib.statusbar["darkbottom"]                             = texpath.."DarkBottom.tga";
145 Goldpaw-66380
lib.statusbar["diagonal"]                                       = texpath.."diagonalTex.tga";
146 Goldpaw-66380
lib.statusbar["highlight"]                                      = texpath.."highlightTex.tga";
147 Goldpaw-66380
lib.statusbar["minimalist"]                             = texpath.."Minimalist.tga";
148 Goldpaw-66380
lib.statusbar["progressbar"]                            = texpath.."progressbar.tga";
149 Goldpaw-66380
lib.statusbar["spark"]                                          = "Interface\\CastingBar\\UI-CastingBar-Spark";
150 Goldpaw-66380
 
151 Goldpaw-66380
-- buttons
152 Goldpaw-66380
lib.button["button"]                                            = buttonpath.."buttonTex.blp";
153 Goldpaw-66380
lib.button["gloss"]                                             = buttonpath.."gloss.tga";
154 Goldpaw-66380
lib.button["flash"]                                             = buttonpath.."flash.tga";
155 Goldpaw-66380
lib.button["hover"]                                             = buttonpath.."hover.tga";
156 Goldpaw-66380
lib.button["pushed"]                                            = buttonpath.."pushed.tga";
157 Goldpaw-66380
lib.button["checked"]                                           = buttonpath.."checked.tga";
158 Goldpaw-66380
lib.button["equipped"]                                          = buttonpath.."gloss_grey.tga";
159 Goldpaw-66380
lib.button["glow"]                                                      = buttonpath.."UI-ActionButton-Border.blp";
160 Goldpaw-66380
lib.button["highlight"]                                         = buttonpath.."ButtonHilight-Square.blp";
161 Goldpaw-66380
 
162 Goldpaw-66380
-- fonts
163 Goldpaw-66380
lib.font["arialn"]                                                      = fontpath.."ARIALN.ttf";
164 Goldpaw-66380
lib.fontn["arialn"]                                                     = "Arial Narrow";
165 Goldpaw-66380
lib.font["bignoodletitling"]                            = fontpath.."BigNoodleTitling.ttf";
166 Goldpaw-66380
lib.fontn["bignoodletitling"]                           = "BigNoodleTitling";
167 Goldpaw-66380
lib.font["distinking"]                                          = fontpath.."DISTInking-Regular.ttf";
168 Goldpaw-66380
lib.fontn["distinking"]                                         = "DIST Inking Regular";
169 Goldpaw-66380
lib.font["rkillc"]                                                      = fontpath.."rkillc.ttf";
170 Goldpaw-66380
lib.fontn["rkillc"]                                             = "Righteous Kill Condensed";
171 Goldpaw-66380
lib.font["eurostile-roman"]                             = fontpath.."EuroStile-Roman-DTC.ttf";
172 Goldpaw-66380
lib.fontn["eurostile-roman"]                            = "EuroStile-Roman-DTC";
173 Goldpaw-66380
lib.font["waukegan-gui"]                                        = fontpath.."Waukegan LDO.ttf";
174 Goldpaw-66380
lib.fontn["waukegan-gui"]                                       = "Waukegan LDO (|cFFFF7D0Ag|r|cFFFFBB00UI|r)";
175 Goldpaw-66380
lib.font["gamma"]                                                       = fontpath.."M025094d.ttf";
176 Goldpaw-66380
lib.fontn["gamma"]                                                      = "MicrogrammaDMedExt";
177 Goldpaw-66380
lib.font["steelfis"]                                            = fontpath.."steelfis.ttf";
178 Goldpaw-66380
lib.fontn["steelfis"]                                           = "Steelfish";
179 Goldpaw-66380
lib.font["bluecondensed"]                                       = fontpath.."Bluecond.ttf";
180 Goldpaw-66380
lib.fontn["bluecondensed"]                                      = "Blue Highway Condensed";
181 Goldpaw-66380
lib.font["dreamorphan"]                                         = fontpath.."Dreamorp.ttf";
182 Goldpaw-66380
lib.fontn["dreamorphan"]                                        = "Dream Orphans";
183 Goldpaw-66380
lib.font["kenyancoffee"]                                        = fontpath.."Kenyc___.ttf";
184 Goldpaw-66380
lib.fontn["kenyancoffee"]                                       = "Kenyan Coffee";
185 Goldpaw-66380
lib.font["zekton"]                                                      = fontpath.."Zekton__.ttf";
186 Goldpaw-66380
lib.fontn["zekton"]                                             = "Zekton";
187 Goldpaw-66380
lib.font["zrnic"]                                                       = fontpath.."Zrnic___.ttf";
188 Goldpaw-66380
lib.fontn["zrnic"]                                                      = "Zrnic";
189 Goldpaw-66380
lib.font["frizq"]                                                       = "Fonts\\FRIZQT__.TTF";
190 Goldpaw-66380
lib.fontn["frizq"]                                                      = "Friz Quadrata TT";
191 Goldpaw-66380
lib.font["morpheus"]                                            = "Fonts\\MORPHEUS.TTF";
192 Goldpaw-66380
lib.fontn["morpheus"]                                           = "Morpheus";
193 Goldpaw-66380
lib.font["skurri"]                                                      = "Fonts\\SKURRI.TTF";
194 Goldpaw-66380
lib.fontn["skurri"]                                             = "Skurri";
195 Goldpaw-66380
 
196 Goldpaw-66380
-- icons
197 Goldpaw-66380
lib.icon["alliance"]                                            = iconpath.."Alliance.tga";
198 Goldpaw-66380
lib.icon["horde"]                                                       = iconpath.."Horde.tga";
199 Goldpaw-66380
lib.icon["bubble"]                                                      = texpath.."bubbleTex.tga";
200 Goldpaw-66380
lib.icon["mailbox"]                                             = iconpath.."Mailbox.blp";
201 Goldpaw-66380
 
202 Goldpaw-66380
-- iconstrings
203 Goldpaw-66380
lib.iconstring["role-tank"]                             = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:0:64:64:0:19:22:41|t";
204 Goldpaw-66380
lib.iconstring["role-heal"]                             = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:0:64:64:20:39:1:20|t";
205 Goldpaw-66380
lib.iconstring["role-dps"]                                      = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:0:64:64:20:39:22:41|t";
206 Goldpaw-66380
 
207 Goldpaw-66380
-- backdrops
208 Goldpaw-66380
lib.backdrop["default"] = {
209 Goldpaw-66380
        backdrop = {
210 Goldpaw-66380
                bgFile = lib.statusbar["minimalist"],
211 Goldpaw-66380
                edgeFile = lib.background["blank"],
212 Goldpaw-66380
                edgeSize = 2,
213 Goldpaw-66380
                insets = {left = 2, right = 2, top = 2, bottom = 2}
214 Goldpaw-66380
        };
215 Goldpaw-66380
        color = {0.15, 0.15, 0.15, 1.0};
216 Goldpaw-66380
        bordercolor = {0, 0, 0, 0.9};
217 Goldpaw-66380
};
218 Goldpaw-66380
lib.backdrop["blank"] = {
219 Goldpaw-66380
        backdrop = {
220 Goldpaw-66380
                bgFile = lib.background["blank"],
221 Goldpaw-66380
                insets = {left = 0, right = 0, top = 0, bottom = 0}
222 Goldpaw-66380
        };
223 Goldpaw-66380
        color = {0.05, 0.05, 0.05, 1};
224 Goldpaw-66380
        bordercolor = {0.45, 0.45, 0.45, 1};
225 Goldpaw-66380
};
226 Goldpaw-66380
lib.backdrop["blank-inset"] = {
227 Goldpaw-66380
        backdrop = {
228 Goldpaw-66380
                bgFile = lib.background["blank"],
229 Goldpaw-66380
                edgeFile = lib.background["blank"],
230 Goldpaw-66380
                edgeSize = 1,
231 Goldpaw-66380
                tile = false, tileSize = 0,
232 Goldpaw-66380
                insets = {left = -1, right = -1, top = -1, bottom = -1};
233 Goldpaw-66380
        };
234 Goldpaw-66380
        color = {0.05, 0.05, 0.05, 1};
235 Goldpaw-66380
        bordercolor = {0.45, 0.45, 0.45, 1};
236 Goldpaw-66380
};
237 Goldpaw-66380
lib.backdrop["clean"] = {
238 Goldpaw-66380
        backdrop = {
239 Goldpaw-66380
                bgFile = lib.statusbar["diagonal"],
240 Goldpaw-66380
                edgeFile = lib.background["blank"],
241 Goldpaw-66380
                edgeSize = 2,
242 Goldpaw-66380
                insets = {left = 2, right = 2, top = 2, bottom = 2}
243 Goldpaw-66380
        };
244 Goldpaw-66380
        color = {0.15, 0.15, 0.15, 0.9};
245 Goldpaw-66380
        bordercolor = {0, 0, 0, 0.9};
246 Goldpaw-66380
};
247 Goldpaw-66380
lib.backdrop["glow"] = {
248 Goldpaw-66380
        backdrop = {
249 Goldpaw-66380
                edgeFile = lib.border["glow"];
250 Goldpaw-66380
                edgeSize = 5;
251 Goldpaw-66380
                insets = {left = 2, right = 2, top = 2, bottom = 2};
252 Goldpaw-66380
        };
253 Goldpaw-66380
        color = {0, 0, 0, 1};
254 Goldpaw-66380
        bordercolor = {0, 0, 0, 1};
255 Goldpaw-66380
};
256 Goldpaw-66380
lib.backdrop["satin"] = {
257 Goldpaw-66380
        backdrop = {
258 Goldpaw-66380
                bgFile = lib.background["satin"],
259 Goldpaw-66380
                edgeFile = lib.background["blank"],
260 Goldpaw-66380
                edgeSize =  1,
261 Goldpaw-66380
                insets = {left = -1, right = -1, top = -1, bottom = -1};
262 Goldpaw-66380
        };
263 Goldpaw-66380
        color = lib.color["gui"]["background"];
264 Goldpaw-66380
        bordercolor = lib.color["gui"]["border"];
265 Goldpaw-66380
};
266 Goldpaw-66380
 
267 Goldpaw-66380
 
268 Goldpaw-66380
------------------------------------------------------
269 Goldpaw-66380
--      Start of gMedia 1.x backward compability
270 Goldpaw-66380
------------------------------------------------------
271 Goldpaw-66380
 
272 Goldpaw-66380
gMedia.texture = {
273 Goldpaw-66380
        ["ACE"]                                                 = texpath.."AceBarFrames.tga",
274 Goldpaw-66380
        ["BANTO"]                                               = texpath.."BantoBar.tga",
275 Goldpaw-66380
        ["BLANK"]                                               = texpath.."blank.tga",
276 Goldpaw-66380
        ["BUBBLE"]                                              = texpath.."bubbleTex.tga",
277 Goldpaw-66380
        ["DARKBOTTOM"]                                  = texpath.."DarkBottom.tga",
278 Goldpaw-66380
        ["DIAGONAL"]                                    = texpath.."diagonalTex.tga",
279 Goldpaw-66380
        ["GLOW"]                                                = texpath.."glowtex.tga",
280 Goldpaw-66380
        ["HIGHLIGHT"]                                   = texpath.."highlightTex.tga",
281 Goldpaw-66380
        ["LSHADER"]                                     = "Interface\\AchievementFrame\\UI-Achievement-HorizontalShadow.blp",
282 Goldpaw-66380
        ["MINIMALIST"]                                  = texpath.."Minimalist.tga",
283 Goldpaw-66380
        ["PROGRESSBAR"]                                 = texpath.."progressbar.tga",
284 Goldpaw-66380
        ["SATIN"]                                               = texpath.."satin.tga",
285 Goldpaw-66380
        ["SCREENSHADER"]                                = texpath.."fullscreenshader.tga",
286 Goldpaw-66380
        ["SPARK"]                                               = "Interface\\CastingBar\\UI-CastingBar-Spark",
287 Goldpaw-66380
        ["STEEL"]                                               = texpath.."Steel.tga",
288 Goldpaw-66380
        ["UNITSHADER"]                                  = texpath.."unitshader.tga",
289 Goldpaw-66380
        ["VIGNETTE"]                                    = texpath.."vignette.blp",
290 Goldpaw-66380
}
291 Goldpaw-66380
gMedia.buttons = {
292 Goldpaw-66380
        ["BUTTON"]                                              = buttonpath.."buttonTex.blp",
293 Goldpaw-66380
        ["NORMAL"]                                              = buttonpath.."gloss.tga",
294 Goldpaw-66380
        ["FLASH"]                                               = buttonpath.."flash.tga",
295 Goldpaw-66380
        ["HOVER"]                                               = buttonpath.."hover.tga",
296 Goldpaw-66380
        ["PUSHED"]                                              = buttonpath.."pushed.tga",
297 Goldpaw-66380
        ["CHECKED"]                                     = buttonpath.."checked.tga",
298 Goldpaw-66380
        ["EQUIPPED"]                                    = buttonpath.."gloss_grey.tga",
299 Goldpaw-66380
        ["BUTTONGLOW"]                                  = buttonpath.."UI-ActionButton-Border.blp",
300 Goldpaw-66380
        ["BUTTONHIGHLIGHT"]                     = buttonpath.."ButtonHilight-Square.blp",
301 Goldpaw-66380
}
302 Goldpaw-66380
gMedia.icons = {
303 Goldpaw-66380
        ["ALLIANCE"]                                    = iconpath.."Alliance.tga",
304 Goldpaw-66380
        ["HORDE"]                                               = iconpath.."Horde.tga",
305 Goldpaw-66380
        ["MAILBOX"]                                     = iconpath.."Mailbox.blp",
306 Goldpaw-66380
        ["ROLETANK"]                                    = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:0:64:64:0:19:22:41|t",
307 Goldpaw-66380
        ["ROLEHEAL"]                                    = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:0:64:64:20:39:1:20|t",
308 Goldpaw-66380
        ["ROLEDPS"]                                     = "|TInterface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES.blp:16:16:0:0:64:64:20:39:22:41|t",
309 Goldpaw-66380
}
310 Goldpaw-66380
gMedia.fonts = {
311 Goldpaw-66380
        ["ARIALN"]                                              = fontpath.."ARIALN.ttf",
312 Goldpaw-66380
        ["RUSSEL"]                                              = fontpath.."BigNoodleTitling.ttf",
313 Goldpaw-66380
        ["DISTINK"]                                     = fontpath.."DISTInking-Regular.ttf",
314 Goldpaw-66380
        ["KILL"]                                                = fontpath.."rkillc.ttf",
315 Goldpaw-66380
        ["EURON"]                                               = fontpath.."EuroStile-Roman-DTC.ttf",
316 Goldpaw-66380
        ["EURO"]                                                = fontpath.."Waukegan LDO.ttf",
317 Goldpaw-66380
        ["GAMMA"]                                               = fontpath.."M025094d.ttf",
318 Goldpaw-66380
        ["STEEL"]                                               = fontpath.."steelfis.ttf",
319 Goldpaw-66380
        ["BLUEC"]                                               = fontpath.."Bluecond.ttf",
320 Goldpaw-66380
        ["DREAM"]                                               = fontpath.."Dreamorp.ttf",
321 Goldpaw-66380
        ["KENYC"]                                               = fontpath.."Kenyc___.ttf",
322 Goldpaw-66380
        ["ZEKTON"]                                              = fontpath.."Zekton__.ttf",
323 Goldpaw-66380
        ["ZRNIC"]                                               = fontpath.."Zrnic___.ttf",
324 Goldpaw-66380
}
325 Goldpaw-66380
gMedia.backdrops = {
326 Goldpaw-66380
        ["DEFAULT"] = {
327 Goldpaw-66380
                backdrop = {
328 Goldpaw-66380
                        bgFile = gMedia.texture["MINIMALIST"],
329 Goldpaw-66380
                        edgeFile = gMedia.texture["BLANK"],
330 Goldpaw-66380
                        edgeSize = 2,
331 Goldpaw-66380
                        insets = {left = 2, right = 2, top = 2, bottom = 2}
332 Goldpaw-66380
                };
333 Goldpaw-66380
                color = {0.15, 0.15, 0.15, 1.0};
334 Goldpaw-66380
                bordercolor = {0, 0, 0, 0.9};
335 Goldpaw-66380
        };
336 Goldpaw-66380
        ["BLANK"] = {
337 Goldpaw-66380
                backdrop = {
338 Goldpaw-66380
                        bgFile = gMedia.texture["BLANK"],
339 Goldpaw-66380
                        insets = {left = 0, right = 0, top = 0, bottom = 0}
340 Goldpaw-66380
                };
341 Goldpaw-66380
                color = {0.05, 0.05, 0.05, 1};
342 Goldpaw-66380
                bordercolor = {0.45, 0.45, 0.45, 1};
343 Goldpaw-66380
        };
344 Goldpaw-66380
        ["BLANKINSET"] = {
345 Goldpaw-66380
                backdrop = {
346 Goldpaw-66380
                        bgFile = gMedia.texture["BLANK"],
347 Goldpaw-66380
                        edgeFile = gMedia.texture["BLANK"],
348 Goldpaw-66380
                        edgeSize = 1,
349 Goldpaw-66380
                        tile = false, tileSize = 0,
350 Goldpaw-66380
                        insets = {left = -1, right = -1, top = -1, bottom = -1};
351 Goldpaw-66380
                };
352 Goldpaw-66380
                color = {0.05, 0.05, 0.05, 1};
353 Goldpaw-66380
                bordercolor = {0.45, 0.45, 0.45, 1};
354 Goldpaw-66380
        };
355 Goldpaw-66380
        ["CLEAN"] = {
356 Goldpaw-66380
                backdrop = {
357 Goldpaw-66380
                        bgFile = gMedia.texture["DIAGONAL"],
358 Goldpaw-66380
                        edgeFile = gMedia.texture["BLANK"],
359 Goldpaw-66380
                        edgeSize = 2,
360 Goldpaw-66380
                        insets = {left = 2, right = 2, top = 2, bottom = 2}
361 Goldpaw-66380
                };
362 Goldpaw-66380
                color = {0.15, 0.15, 0.15, 0.9};
363 Goldpaw-66380
                bordercolor = {0, 0, 0, 0.9};
364 Goldpaw-66380
        };
365 Goldpaw-66380
        ["GLOW"] = {
366 Goldpaw-66380
                backdrop = {
367 Goldpaw-66380
                        edgeFile = gMedia.texture["GLOW"],
368 Goldpaw-66380
                        edgeSize = 5,
369 Goldpaw-66380
                        insets = {left = 2, right = 2, top = 2, bottom = 2};
370 Goldpaw-66380
                };
371 Goldpaw-66380
                color = {0, 0, 0, 1};
372 Goldpaw-66380
                bordercolor = {0, 0, 0, 1};
373 Goldpaw-66380
        };
374 Goldpaw-66380
        ["SATIN"] = {
375 Goldpaw-66380
                backdrop = {
376 Goldpaw-66380
                        bgFile = gMedia.texture["SATIN"],
377 Goldpaw-66380
                        edgeFile = gMedia.texture["BLANK"],
378 Goldpaw-66380
                        edgeSize =  1,
379 Goldpaw-66380
                        insets = {left = -1, right = -1, top = -1, bottom = -1};
380 Goldpaw-66380
                };
381 Goldpaw-66380
                color = {0.05, 0.05, 0.05, 1};
382 Goldpaw-66380
                bordercolor = {0.25, 0.25, 0.25, 1};
383 Goldpaw-66380
        };
384 Goldpaw-66380
}
385 Goldpaw-66380
gMedia.colors = {
386 Goldpaw-66380
        RAID_CLASS_COLORS = {
387 Goldpaw-66380
                ["HUNTER"] =                    { r = 0.67, g = 0.83, b = 0.45 };
388 Goldpaw-66380
                ["WARLOCK"] =                   { r = 0.58, g = 0.51, b = 0.79 };
389 Goldpaw-66380
                ["PRIEST"] =                    { r = 0.90, g = 0.90, b = 0.90 };
390 Goldpaw-66380
                ["PALADIN"] =                   { r = 0.96, g = 0.55, b = 0.73 };
391 Goldpaw-66380
                ["MAGE"] =                              { r = 0.41, g = 0.80, b = 0.94 };
392 Goldpaw-66380
                ["ROGUE"] =                     { r = 1.00, g = 0.96, b = 0.41 };
393 Goldpaw-66380
                ["DRUID"] =                     { r = 1.00, g = 0.49, b = 0.04 };
394 Goldpaw-66380
                ["SHAMAN"] =                    { r = 0.00, g = 0.44, b = 0.87 };
395 Goldpaw-66380
                ["WARRIOR"] =                   { r = 0.78, g = 0.61, b = 0.43 };
396 Goldpaw-66380
                ["DEATHKNIGHT"] =               { r = 0.77, g = 0.12, b = 0.23 };
397 Goldpaw-66380
        }
398 Goldpaw-66380
}
399 Goldpaw-66380
 
400 Goldpaw-66380
------------------------------------------------------
401 Goldpaw-66380
--      End of gMedia 1.x backward compability
402 Goldpaw-66380
------------------------------------------------------
403 Goldpaw-66380
 
404 Goldpaw-66380
 
405 Goldpaw-66380
 
406 Goldpaw-66380
------------------------------------------------------
407 Goldpaw-66380
-- External media management
408 Goldpaw-66380
------------------------------------------------------
409 Goldpaw-66380
 
410 Goldpaw-66380
-- add media to the library
411 Goldpaw-66380
function gMedia:Register(lib, medianame, mediapath)
412 Goldpaw-66380
        local usage = "gMedia:Register(lib, medianame, mediapath)";
413 Goldpaw-66380
 
414 Goldpaw-66380
        -- syntax checks
415 Goldpaw-66380
        if type(lib) ~= "string" then
416 Goldpaw-66380
                error(self.L["ERR_USAGE"]:format(usage).." - ("..self.L["ERR_NOT_STRING"]:format("lib", type(lib))..")");
417 Goldpaw-66380
        end
418 Goldpaw-66380
 
419 Goldpaw-66380
        if type(mediapath) ~= "string" then
420 Goldpaw-66380
                error(self.L["ERR_USAGE"]:format(usage).." - ("..self.L["ERR_NOT_STRING"]:format("mediapath", type(mediapath))..")");
421 Goldpaw-66380
        end
422 Goldpaw-66380
 
423 Goldpaw-66380
        if not(self.lib[lib]) then
424 Goldpaw-66380
                error(self.L["ERR_LIB_UNKNOWN"]:format(lib));
425 Goldpaw-66380
        end
426 Goldpaw-66380
 
427 Goldpaw-66380
        -- if the medianame is nil, fetch the name from the path
428 Goldpaw-66380
        if (medianame == nil) then
429 Goldpaw-66380
                local str = string.reverse(mediapath)
430 Goldpaw-66380
                medianame = string.reverse(string.sub(str, 1, (string.find(str, "\\"))-1))
431 Goldpaw-66380
        end
432 Goldpaw-66380
 
433 Goldpaw-66380
        if (type(medianame) ~= "string") then
434 Goldpaw-66380
                error(self.L["ERR_USAGE"]:format(usage).." - ("..self.L["ERR_NOT_STRING"]:format("medianame", type(medianame))..")");
435 Goldpaw-66380
        end
436 Goldpaw-66380
 
437 Goldpaw-66380
        lib = lib:lower();
438 Goldpaw-66380
 
439 Goldpaw-66380
        if self.lib[lib][medianame] then
440 Goldpaw-66380
                error(self.L["ERR_MEDIA_EXIST"]:format(lib, medianame));
441 Goldpaw-66380
        end
442 Goldpaw-66380
 
443 Goldpaw-66380
        -- add the media, nothing more to it
444 Goldpaw-66380
        self.lib[lib][medianame] = mediapath;
445 Goldpaw-66380
end
446 Goldpaw-66380
 
447 Goldpaw-66380
-- remove media from the library
448 Goldpaw-66380
function gMedia:Unregister(lib, medianame)
449 Goldpaw-66380
        local usage = "gMedia:Unregister(lib, medianame)";
450 Goldpaw-66380
 
451 Goldpaw-66380
        -- syntax checks
452 Goldpaw-66380
        if type(lib) ~= "string" then
453 Goldpaw-66380
                error(self.L["ERR_USAGE"]:format(usage).." - ("..self.L["ERR_NOT_STRING"]:format("lib", type(lib))..")");
454 Goldpaw-66380
        end
455 Goldpaw-66380
        if type(medianame) ~= "string" then
456 Goldpaw-66380
                error(self.L["ERR_USAGE"]:format(usage).." - ("..self.L["ERR_NOT_STRING"]:format("medianame", type(medianame))..")");
457 Goldpaw-66380
        end
458 Goldpaw-66380
        if not(self.lib[lib]) then
459 Goldpaw-66380
                error(self.L["ERR_LIB_UNKNOWN"]:format(lib));
460 Goldpaw-66380
        end
461 Goldpaw-66380
        if not(self.lib[lib][medianame]) then
462 Goldpaw-66380
                error(self.L["ERR_MEDIA_UNKNOWN"]:format(lib, medianame));
463 Goldpaw-66380
        end
464 Goldpaw-66380
 
465 Goldpaw-66380
        lib = lib:lower();
466 Goldpaw-66380
 
467 Goldpaw-66380
        -- protect our default library
468 Goldpaw-66380
        error(self.defaultlib[lib][medianame], self.L["ERR_CANNOT_DELETE_DEFAULT"])
469 Goldpaw-66380
 
470 Goldpaw-66380
        -- remove the media
471 Goldpaw-66380
        self.lib[lib][medianame] = nil;
472 Goldpaw-66380
end
473 Goldpaw-66380
 
474 Goldpaw-66380
-- creates a truetable of our default media to protect it from being deleted
475 Goldpaw-66380
function gMedia:RegisterDefaults()
476 Goldpaw-66380
        self.defaultlib = self.defaultlib or {}
477 Goldpaw-66380
        for i,v in pairs(self.lib) do
478 Goldpaw-66380
                self.defaultlib[i] = self.defaultlib[i] or {}
479 Goldpaw-66380
                for key,val in pairs(self.lib[i]) do
480 Goldpaw-66380
                        self.defaultlib[i][key] = true;
481 Goldpaw-66380
                end
482 Goldpaw-66380
        end
483 Goldpaw-66380
end
484 Goldpaw-66380
 
485 Goldpaw-66380
-- get some media
486 Goldpaw-66380
-- not strictly needed if you know the direct link
487 Goldpaw-66380
-- advantages of this function is it's error reports
488 Goldpaw-66380
function gMedia:Get(lib, medianame)
489 Goldpaw-66380
        local usage = "gMedia:Get(lib, medianame)";
490 Goldpaw-66380
 
491 Goldpaw-66380
        -- syntax checks
492 Goldpaw-66380
        if type(lib) ~= "string" then
493 Goldpaw-66380
                error(self.L["ERR_USAGE"]:format(usage).." - ("..self.L["ERR_NOT_STRING"]:format("lib", type(lib))..")");
494 Goldpaw-66380
        end
495 Goldpaw-66380
        if type(medianame) ~= "string" then
496 Goldpaw-66380
                error(self.L["ERR_USAGE"]:format(usage).." - ("..self.L["ERR_NOT_STRING"]:format("medianame", type(medianame))..")");
497 Goldpaw-66380
        end
498 Goldpaw-66380
 
499 Goldpaw-66380
        lib                     = lib:lower();
500 Goldpaw-66380
 
501 Goldpaw-66380
        if not(self.lib[lib]) then
502 Goldpaw-66380
                error(self.L["ERR_LIB_UNKNOWN"]:format(lib));
503 Goldpaw-66380
        end
504 Goldpaw-66380
        if not(self.lib[lib][medianame]) then
505 Goldpaw-66380
                error(self.L["ERR_MEDIA_UNKNOWN"]:format(lib, medianame));
506 Goldpaw-66380
        end
507 Goldpaw-66380
 
508 Goldpaw-66380
        return self.lib[lib][medianame];
509 Goldpaw-66380
end
510 Goldpaw-66380
 
511 Goldpaw-66380
 
512 Goldpaw-66380
------------------------------------------------------
513 Goldpaw-66380
--      Functions
514 Goldpaw-66380
------------------------------------------------------
515 Goldpaw-66380
function gMedia:SetFont()
516 Goldpaw-66380
end
517 Goldpaw-66380
function gMedia:SimpleTexture(args)
518 Goldpaw-66380
        if not(type(args)) == "table" then return end
519 Goldpaw-66380
 
520 Goldpaw-66380
        local tex = {};
521 Goldpaw-66380
 
522 Goldpaw-66380
        -- attribute                                    uservalue                                                                                               defaults
523 Goldpaw-66380
        tex.frame                                       = args.frame                                                                                    or UIParent;
524 Goldpaw-66380
        tex.texture                             = args.texture                                                                                  or self.lib.background["default"];
525 Goldpaw-66380
        tex.layer                                       = (self.VALIDLAYERS[args.layer]) and args.layer                 or "BACKGROUND";
526 Goldpaw-66380
        tex.name                                        = args.name                                                                                     or nil;
527 Goldpaw-66380
        tex.blend                                       = args.blend                                                                                    or "BLEND";
528 Goldpaw-66380
        tex.alpha                                       = args.alpha                                                                                    or 1;
529 Goldpaw-66380
        tex.texcoord                            = args.texcoord                                                                                 or {0, 1, 0, 1};
530 Goldpaw-66380
 
531 Goldpaw-66380
        local t = tex.frame:CreateTexture(tex.name, tex.layer);
532 Goldpaw-66380
        t:SetTexture(tex.texture);
533 Goldpaw-66380
        t:SetBlendMode(tex.blend);
534 Goldpaw-66380
        t:SetAlpha(tex.alpha);
535 Goldpaw-66380
        t:SetTexCoord(unpack(tex.texcoord));
536 Goldpaw-66380
        t:SetAllPoints(tex.frame);
537 Goldpaw-66380
 
538 Goldpaw-66380
end
539 Goldpaw-66380
 
540 Goldpaw-66380
function gMedia:formatTime(seconds)
541 Goldpaw-66380
        if not(seconds) then return "0.0"; end
542 Goldpaw-66380
        local day, hour, minute = 86400, 3600, 60
543 Goldpaw-66380
        if seconds >= day then
544 Goldpaw-66380
                return format("%dd", floor(seconds/day + 0.5)), seconds % day
545 Goldpaw-66380
        elseif seconds >= hour then
546 Goldpaw-66380
                return format("%dh", floor(seconds/hour + 0.5)), seconds % hour
547 Goldpaw-66380
        elseif seconds >= minute then
548 Goldpaw-66380
                if seconds <= minute * 5 then
549 Goldpaw-66380
                        return format("%d:%02d", floor(seconds/60), seconds % minute), seconds - floor(seconds)
550 Goldpaw-66380
                end
551 Goldpaw-66380
                return format("%dm", floor(seconds/minute + 0.5)), seconds % minute
552 Goldpaw-66380
        elseif seconds >= minute / 12 then
553 Goldpaw-66380
                return floor(seconds + 0.5), (seconds * 100 - floor(seconds * 100))/100
554 Goldpaw-66380
        end
555 Goldpaw-66380
        return format("%.1f", seconds), (seconds * 100 - floor(seconds * 100))/100
556 Goldpaw-66380
end
557 Goldpaw-66380
function gMedia:shortValue(value)
558 Goldpaw-66380
        if not(value) then return "0.0"; end
559 Goldpaw-66380
        if value >= 1e6 then
560 Goldpaw-66380
                return ("%.1fm"):format(value / 1e6):gsub("%.?0+([km])$", "%1")
561 Goldpaw-66380
        elseif value >= 1e3 or value <= -1e3 then
562 Goldpaw-66380
                return ("%.1fk"):format(value / 1e3):gsub("%.?0+([km])$", "%1")
563 Goldpaw-66380
        else
564 Goldpaw-66380
                return value
565 Goldpaw-66380
        end
566 Goldpaw-66380
end
567 Goldpaw-66380
 
568 Goldpaw-66380
function gMedia:ADDON_LOADED()
569 Goldpaw-66380
        if not(arg1 == self.ADDON) then return end
570 Goldpaw-66380
 
571 Goldpaw-66380
        -- We're loaded, no need to watch for this anymore
572 Goldpaw-66380
        self:UnregisterEvent("ADDON_LOADED");
573 Goldpaw-66380
        self:SetScript("OnEvent", nil);
574 Goldpaw-66380
 
575 Goldpaw-66380
        -- build a list of our defaults
576 Goldpaw-66380
        self:RegisterDefaults();
577 Goldpaw-66380
 
578 Goldpaw-66380
end
579 Goldpaw-66380
 
580 Goldpaw-66380
--
581 Goldpaw-66380
--      IMPORTANT!
582 Goldpaw-66380
--      Do not call these function before PLAYER_LOGIN(), as certain information is not available to the client before that!
583 Goldpaw-66380
--
584 Goldpaw-66380
function gMedia:pixel()
585 Goldpaw-66380
        -- routine to figure out exactly how big a pixel is in the current resolution and UIScale
586 Goldpaw-66380
        return (768 / tonumber(string.match(GetCVar("gxResolution"), "%d+x(%d+)"))) / tonumber(GetCVar("uiScale"))
587 Goldpaw-66380
end
588 Goldpaw-66380
 
589 Goldpaw-66380
-- panel expects an effective framescale of 1 on the parent object, or the pixel borders won't be pixels
590 Goldpaw-66380
function gMedia:panel(args)
591 Goldpaw-66380
        local panel = {};
592 Goldpaw-66380
        local PIXEL = gMedia:pixel();
593 Goldpaw-66380
 
594 Goldpaw-66380
        -- attribute                                    uservalue                                       defaults                                                                        description
595 Goldpaw-66380
        panel.parent                            = args.parent                           or UIParent                                                             -- parent to our panel
596 Goldpaw-66380
        panel.anchor                            = args.anchor                           or panel.parent                                                         -- frame to anchor our panel to
597 Goldpaw-66380
        panel.bottomright                       = args.bottomright                      or panel.anchor                                                         -- bottomright corner to anchor to, overrides anchor
598 Goldpaw-66380
        panel.topleft                           = args.topleft                          or panel.anchor                                                         -- topleft corner to anchor to, overrides anchor
599 Goldpaw-66380
        panel.overlay                           = args.overlay                          or 1                                                                            -- 1 to use overlay, 0 to skip it
600 Goldpaw-66380
        panel.overlaytexture            = args.overlaytexture           or gMedia.lib.background["satin"]                       -- overlay texture
601 Goldpaw-66380
        panel.overlaycolor                      = args.overlaycolor             or {0.35, 0.35, 0.35, 1}                                        -- color of the overlay
602 Goldpaw-66380
        panel.alpha                             = args.alpha                            or 1                                                                            -- alpha of the backdrop
603 Goldpaw-66380
        panel.backdropcolor             = args.backdropcolor            or gMedia.lib.backdrop["satin"].color           -- color of the background
604 Goldpaw-66380
        panel.bordercolor                       = args.bordercolor                      or gMedia.lib.backdrop["satin"].bordercolor     -- color of the border
605 Goldpaw-66380
        panel.framestrata                       = args.framestrata                      or "BACKGROUND"                                                         -- framestrata of the entire object
606 Goldpaw-66380
        panel.padding                           = args.padding                          or 3                                                                            -- padding between the border and the contents
607 Goldpaw-66380
        panel.paddingx                          = args.paddingx                         or 0                                                                            -- horizontal padding. added to general padding.
608 Goldpaw-66380
        panel.paddingy                          = args.paddingy                         or 0                                                                            -- vertical padding. added to general padding.
609 Goldpaw-66380
        panel.offsettop                         = args.offsettop                        or 0                                                                            -- top padding.
610 Goldpaw-66380
        panel.offsetbottom                      = args.offsetbottom             or 0                                                                            -- bottom padding.
611 Goldpaw-66380
        panel.offsetleft                        = args.offsetleft                       or 0                                                                            -- left padding.
612 Goldpaw-66380
        panel.offsetright                       = args.offsetright                      or 0                                                                            -- right padding.
613 Goldpaw-66380
        panel.shadow                            = args.shadow                           or 1                                                                            -- 1 to use shadows behind the panel, 0 to not
614 Goldpaw-66380
 
615 Goldpaw-66380
        -- create the frame for the border
616 Goldpaw-66380
        local frame = CreateFrame("Frame", panel.parent:GetName() and panel.parent:GetName().."_panel_border" or nil, panel.parent);
617 Goldpaw-66380
 
618 Goldpaw-66380
        -- create the 2 first parts of our 3px border
619 Goldpaw-66380
        frame:SetPoint("TOPLEFT", panel.topleft, "TOPLEFT", -(panel.padding + panel.paddingx + panel.offsetleft)/PIXEL, (panel.padding + panel.paddingy + panel.offsettop)/PIXEL );
620 Goldpaw-66380
        frame:SetPoint("BOTTOMRIGHT", panel.bottomright, "BOTTOMRIGHT", (panel.padding + panel.paddingx + panel.offsetright)/PIXEL, -(panel.padding + panel.paddingy + panel.offsetbottom)/PIXEL);
621 Goldpaw-66380
        frame:SetBackdrop(gMedia.lib.backdrop["blank-inset"].backdrop);
622 Goldpaw-66380
        frame:SetBackdropColor(unpack(panel.backdropcolor));
623 Goldpaw-66380
        frame:SetBackdropBorderColor(unpack(panel.bordercolor));
624 Goldpaw-66380
        frame:SetFrameStrata(panel.framestrata);
625 Goldpaw-66380
        frame:SetFrameLevel(max(1, panel.parent:GetFrameLevel() - 2));
626 Goldpaw-66380
        frame:SetScale(PIXEL);
627 Goldpaw-66380
 
628 Goldpaw-66380
        -- create the frame for the backdrop, and the 3rd part of our 3px border
629 Goldpaw-66380
        if panel.overlay == 1 then
630 Goldpaw-66380
                --   set a minimum of 2px for the padding, or the border will be invisible
631 Goldpaw-66380
                local overlaypadding = max(2, panel.padding - 2);
632 Goldpaw-66380
                frame.bg = frame:CreateTexture(frame:GetName() and frame:GetName().."_overlay" or nil, "ARTWORK", frame);
633 Goldpaw-66380
                frame.bg:ClearAllPoints();
634 Goldpaw-66380
                frame.bg:SetPoint("TOPLEFT", frame, "TOPLEFT", (overlaypadding)/PIXEL, -(overlaypadding)/PIXEL);
635 Goldpaw-66380
                frame.bg:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -(overlaypadding)/PIXEL, (overlaypadding)/PIXEL);
636 Goldpaw-66380
                frame.bg:SetTexture( (( type(panel.overlaytexture) == "table" ) and unpack( panel.overlaytexture )) or panel.overlaytexture );
637 Goldpaw-66380
                frame.bg:SetVertexColor(unpack(panel.overlaycolor));
638 Goldpaw-66380
        end
639 Goldpaw-66380
 
640 Goldpaw-66380
        -- create a shadow
641 Goldpaw-66380
        if panel.shadow == 1 then
642 Goldpaw-66380
                frame.shadow = self:shadow({ parent = frame, name = frame:GetName() and frame:GetName().."_shadow" or nil});
643 Goldpaw-66380
        end
644 Goldpaw-66380
 
645 Goldpaw-66380
        frame:SetAlpha(panel.alpha);
646 Goldpaw-66380
 
647 Goldpaw-66380
        return frame
648 Goldpaw-66380
end
649 Goldpaw-66380
function gMedia:shadow(args)
650 Goldpaw-66380
        local shadow = {};
651 Goldpaw-66380
        local PIXEL = gMedia:pixel();
652 Goldpaw-66380
 
653 Goldpaw-66380
        -- attribute                                    uservalue                                       defaults                                                                        description
654 Goldpaw-66380
        shadow.parent                           = args.parent                           or args.anchor or UIParent                                      -- parent to our panel
655 Goldpaw-66380
        shadow.anchor                           = args.anchor                           or shadow.parent                                                        -- what frame to anchor the shadow to
656 Goldpaw-66380
        shadow.name                                     = args.name                             or nil                                                                          -- name of our frame
657 Goldpaw-66380
 
658 Goldpaw-66380
        local frameshadow = CreateFrame("Frame", shadow.name, shadow.parent)
659 Goldpaw-66380
        frameshadow:SetFrameStrata(shadow.anchor:GetFrameStrata())
660 Goldpaw-66380
        frameshadow:SetFrameLevel(shadow.anchor:GetFrameLevel()-1)
661 Goldpaw-66380
        frameshadow:SetBackdrop(gMedia.lib.backdrop["glow"].backdrop)
662 Goldpaw-66380
        frameshadow:SetBackdropBorderColor(0.05, 0.05, 0.05, 0.85)
663 Goldpaw-66380
        frameshadow:SetPoint("TOPLEFT", shadow.anchor, "TOPLEFT", -4.5/PIXEL, 4.5/PIXEL)
664 Goldpaw-66380
        frameshadow:SetPoint("BOTTOMRIGHT", shadow.anchor, "BOTTOMRIGHT", 4.5/PIXEL, -4.5/PIXEL)
665 Goldpaw-66380
        frameshadow:SetScale(PIXEL)
666 Goldpaw-66380
 
667 Goldpaw-66380
        return frameshadow
668 Goldpaw-66380
end
669 Goldpaw-66380
 
670 Goldpaw-66380
-- font
671 Goldpaw-66380
function gMedia:makeFontString(parent, fontname, fontHeight, fontStyle)
672 Goldpaw-66380
        local fs = parent:CreateFontString(nil, "OVERLAY")
673 Goldpaw-66380
        fs:SetFont(fontname, fontHeight, fontStyle)
674 Goldpaw-66380
        fs:SetJustifyH("LEFT")
675 Goldpaw-66380
        fs:SetShadowColor(0, 0, 0)
676 Goldpaw-66380
        fs:SetShadowOffset(1.25, -1.25)
677 Goldpaw-66380
        return fs
678 Goldpaw-66380
end
679 Goldpaw-66380
 
680 Goldpaw-66380