1
- --[[
1
+ --[[
2
2
Name: LibSharedMedia-3.0
3
- Revision: $Revision: 58 $
3
+ Revision: $Revision: 62 $
4
4
Author: Elkano (elkano@gmx.de)
5
5
Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com)
6
6
Website: http://www.wowace.com/projects/libsharedmedia-3-0/
@@ -9,7 +9,7 @@ Dependencies: LibStub, CallbackHandler-1.0
9
9
License: LGPL v2.1
10
10
]]
11
11
12
- local MAJOR , MINOR = " LibSharedMedia-3.0" , 90000 + tonumber (( " $Revision: 58 $ " ): match ( " (%d+) " ))
12
+ local MAJOR , MINOR = " LibSharedMedia-3.0" , 3030002 -- 3.3.5 / increase manually on changes
13
13
local lib = LibStub :NewLibrary (MAJOR , MINOR )
14
14
15
15
if not lib then return end
@@ -20,8 +20,6 @@ local pairs = _G.pairs
20
20
local type = _G .type
21
21
22
22
local band = _G .bit .band
23
-
24
- local table_insert = _G .table .insert
25
23
local table_sort = _G .table .sort
26
24
27
25
local locale = GetLocale ()
@@ -59,24 +57,31 @@ lib.MediaType.SOUND = "sound" -- sound files
59
57
-- populate lib with default Blizzard data
60
58
-- BACKGROUND
61
59
if not lib .MediaTable .background then lib .MediaTable .background = {} end
62
- lib .MediaTable .background [" Blizzard Dialog Background" ] = [[ Interface\DialogFrame\UI-DialogBox-Background]]
63
- lib .MediaTable .background [" Blizzard Low Health" ] = [[ Interface\FullScreenTextures\LowHealth]]
64
- lib .MediaTable .background [" Blizzard Out of Control" ] = [[ Interface\FullScreenTextures\OutOfControl]]
65
- lib .MediaTable .background [" Blizzard Parchment" ] = [[ Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]]
66
- lib .MediaTable .background [" Blizzard Parchment 2" ] = [[ Interface\AchievementFrame\UI-Achievement-Parchment]]
67
- lib .MediaTable .background [" Blizzard Tabard Background" ] = [[ Interface\TabardFrame\TabardFrameBackground]]
68
- lib .MediaTable .background [" Blizzard Tooltip" ] = [[ Interface\Tooltips\UI-Tooltip-Background]]
69
- lib .MediaTable .background [" Solid" ] = [[ Interface\Buttons\WHITE8X8]]
60
+ lib .MediaTable .background [" None" ] = [[ ]]
61
+ lib .MediaTable .background [" Blizzard Dialog Background" ] = [[ Interface\DialogFrame\UI-DialogBox-Background]]
62
+ lib .MediaTable .background [" Blizzard Dialog Background Dark" ] = [[ Interface\DialogFrame\UI-DialogBox-Background-Dark]]
63
+ lib .MediaTable .background [" Blizzard Dialog Background Gold" ] = [[ Interface\DialogFrame\UI-DialogBox-Gold-Background]]
64
+ lib .MediaTable .background [" Blizzard Low Health" ] = [[ Interface\FullScreenTextures\LowHealth]]
65
+ lib .MediaTable .background [" Blizzard Marble" ] = [[ Interface\FrameGeneral\UI-Background-Marble]]
66
+ lib .MediaTable .background [" Blizzard Out of Control" ] = [[ Interface\FullScreenTextures\OutOfControl]]
67
+ lib .MediaTable .background [" Blizzard Parchment" ] = [[ Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]]
68
+ lib .MediaTable .background [" Blizzard Parchment 2" ] = [[ Interface\AchievementFrame\UI-GuildAchievement-Parchment-Horizontal]]
69
+ lib .MediaTable .background [" Blizzard Rock" ] = [[ Interface\FrameGeneral\UI-Background-Rock]]
70
+ lib .MediaTable .background [" Blizzard Tabard Background" ] = [[ Interface\TabardFrame\TabardFrameBackground]]
71
+ lib .MediaTable .background [" Blizzard Tooltip" ] = [[ Interface\Tooltips\UI-Tooltip-Background]]
72
+ lib .MediaTable .background [" Solid" ] = [[ Interface\Buttons\WHITE8X8]]
73
+ lib .DefaultMedia .background = " None"
70
74
71
75
-- BORDER
72
76
if not lib .MediaTable .border then lib .MediaTable .border = {} end
73
- lib .MediaTable .border [" None" ] = [[ Interface\None ]]
77
+ lib .MediaTable .border [" None" ] = [[ ]]
74
78
lib .MediaTable .border [" Blizzard Achievement Wood" ] = [[ Interface\AchievementFrame\UI-Achievement-WoodBorder]]
75
79
lib .MediaTable .border [" Blizzard Chat Bubble" ] = [[ Interface\Tooltips\ChatBubble-Backdrop]]
76
80
lib .MediaTable .border [" Blizzard Dialog" ] = [[ Interface\DialogFrame\UI-DialogBox-Border]]
77
81
lib .MediaTable .border [" Blizzard Dialog Gold" ] = [[ Interface\DialogFrame\UI-DialogBox-Gold-Border]]
78
82
lib .MediaTable .border [" Blizzard Party" ] = [[ Interface\CHARACTERFRAME\UI-Party-Border]]
79
83
lib .MediaTable .border [" Blizzard Tooltip" ] = [[ Interface\Tooltips\UI-Tooltip-Border]]
84
+ lib .DefaultMedia .border = " None"
80
85
81
86
-- FONT
82
87
if not lib .MediaTable .font then lib .MediaTable .font = {} end
@@ -119,16 +124,16 @@ elseif locale == "ruRU" then
119
124
SML_MT_font [" Nimrod MT" ] = [[ Fonts\NIM_____.ttf]]
120
125
SML_MT_font [" Skurri" ] = [[ Fonts\SKURRI.TTF]]
121
126
--
122
- lib .DefaultMedia .font = " Friz Quadrata TT "
127
+ lib .DefaultMedia .font = " Arial Narrow "
123
128
--
124
129
else
125
130
LOCALE_MASK = lib .LOCALE_BIT_western
126
131
locale_is_western = true
127
132
--
128
- SML_MT_font [" Arial Narrow" ] = [[ Fonts\ARIALN.TTF]]
129
- SML_MT_font [" Friz Quadrata TT" ] = [[ Fonts\FRIZQT__.TTF]]
130
- SML_MT_font [" Morpheus" ] = [[ Fonts\MORPHEUS.TTF]]
131
- SML_MT_font [" Skurri" ] = [[ Fonts\SKURRI.TTF]]
133
+ SML_MT_font [" Arial Narrow" ] = [[ Fonts\ARIALN.TTF]]
134
+ SML_MT_font [" Friz Quadrata TT" ] = [[ Fonts\FRIZQT__.TTF]]
135
+ SML_MT_font [" Morpheus" ] = [[ Fonts\MORPHEUS.TTF]]
136
+ SML_MT_font [" Skurri" ] = [[ Fonts\SKURRI.TTF]]
132
137
--
133
138
lib .DefaultMedia .font = " Friz Quadrata TT"
134
139
--
@@ -137,11 +142,13 @@ end
137
142
-- STATUSBAR
138
143
if not lib .MediaTable .statusbar then lib .MediaTable .statusbar = {} end
139
144
lib .MediaTable .statusbar [" Blizzard" ] = [[ Interface\TargetingFrame\UI-StatusBar]]
145
+ lib .MediaTable .statusbar [" Blizzard Character Skills Bar" ] = [[ Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]]
146
+ lib .MediaTable .statusbar [" Solid" ] = [[ Interface\Buttons\WHITE8X8]]
140
147
lib .DefaultMedia .statusbar = " Blizzard"
141
148
142
149
-- SOUND
143
150
if not lib .MediaTable .sound then lib .MediaTable .sound = {} end
144
- lib .MediaTable .sound [" None" ] = [[ Interface\Quiet.mp3 ]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input .
151
+ lib .MediaTable .sound [" None" ] = [[ Interface\Quiet.ogg ]] -- Relies on the fact that PlaySound[File] doesn't error on these values .
145
152
lib .DefaultMedia .sound = " None"
146
153
147
154
local function rebuildMediaList (mediatype )
@@ -165,12 +172,22 @@ function lib:Register(mediatype, key, data, langmask)
165
172
if type (key ) ~= " string" then
166
173
error (MAJOR .. " :Register(mediatype, key, data, langmask) - key must be string, got " .. type (key ))
167
174
end
168
- if mediatype == lib .MediaType .FONT and ((langmask and band (langmask , LOCALE_MASK ) == 0 ) or not (langmask or locale_is_western )) then return false end
169
175
mediatype = mediatype :lower ()
176
+ if mediatype == lib .MediaType .FONT and ((langmask and band (langmask , LOCALE_MASK ) == 0 ) or not (langmask or locale_is_western )) then
177
+ -- ignore fonts that aren't flagged as supporting local glyphs on non-western clients
178
+ return false
179
+ end
180
+ if mediatype == lib .MediaType .SOUND and type (data ) == " string" then
181
+ local path = data :lower ()
182
+ if not path :find (" .ogg" , nil , true ) and not path :find (" .mp3" , nil , true ) and not path :find (" .wav" , nil , true ) then
183
+ -- Only wav, ogg and mp3 are valid sounds.
184
+ return false
185
+ end
186
+ end
170
187
if not mediaTable [mediatype ] then mediaTable [mediatype ] = {} end
171
188
local mtable = mediaTable [mediatype ]
172
189
if mtable [key ] then return false end
173
-
190
+
174
191
mtable [key ] = data
175
192
rebuildMediaList (mediatype )
176
193
self .callbacks :Fire (" LibSharedMedia_Registered" , mediatype , key )
@@ -181,8 +198,7 @@ function lib:Fetch(mediatype, key, noDefault)
181
198
local mtt = mediaTable [mediatype ]
182
199
local overridekey = overrideMedia [mediatype ]
183
200
local result = mtt and ((overridekey and mtt [overridekey ] or mtt [key ]) or (not noDefault and defaultMedia [mediatype ] and mtt [defaultMedia [mediatype ]])) or nil
184
-
185
- return result
201
+ return result ~= " " and result or nil
186
202
end
187
203
188
204
function lib :IsValid (mediatype , key )
0 commit comments