Skip to content

Commit 8d5be7c

Browse files
committed
Update LibSharedMedia-3.0.lua
1 parent 4f24248 commit 8d5be7c

File tree

1 file changed

+40
-24
lines changed

1 file changed

+40
-24
lines changed

BigWigs/Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua

+40-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
--[[
1+
--[[
22
Name: LibSharedMedia-3.0
3-
Revision: $Revision: 58 $
3+
Revision: $Revision: 62 $
44
Author: Elkano (elkano@gmx.de)
55
Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com)
66
Website: http://www.wowace.com/projects/libsharedmedia-3-0/
@@ -9,7 +9,7 @@ Dependencies: LibStub, CallbackHandler-1.0
99
License: LGPL v2.1
1010
]]
1111

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
1313
local lib = LibStub:NewLibrary(MAJOR, MINOR)
1414

1515
if not lib then return end
@@ -20,8 +20,6 @@ local pairs = _G.pairs
2020
local type = _G.type
2121

2222
local band = _G.bit.band
23-
24-
local table_insert = _G.table.insert
2523
local table_sort = _G.table.sort
2624

2725
local locale = GetLocale()
@@ -59,24 +57,31 @@ lib.MediaType.SOUND = "sound" -- sound files
5957
-- populate lib with default Blizzard data
6058
-- BACKGROUND
6159
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"
7074

7175
-- BORDER
7276
if not lib.MediaTable.border then lib.MediaTable.border = {} end
73-
lib.MediaTable.border["None"] = [[Interface\None]]
77+
lib.MediaTable.border["None"] = [[]]
7478
lib.MediaTable.border["Blizzard Achievement Wood"] = [[Interface\AchievementFrame\UI-Achievement-WoodBorder]]
7579
lib.MediaTable.border["Blizzard Chat Bubble"] = [[Interface\Tooltips\ChatBubble-Backdrop]]
7680
lib.MediaTable.border["Blizzard Dialog"] = [[Interface\DialogFrame\UI-DialogBox-Border]]
7781
lib.MediaTable.border["Blizzard Dialog Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Border]]
7882
lib.MediaTable.border["Blizzard Party"] = [[Interface\CHARACTERFRAME\UI-Party-Border]]
7983
lib.MediaTable.border["Blizzard Tooltip"] = [[Interface\Tooltips\UI-Tooltip-Border]]
84+
lib.DefaultMedia.border = "None"
8085

8186
-- FONT
8287
if not lib.MediaTable.font then lib.MediaTable.font = {} end
@@ -119,16 +124,16 @@ elseif locale == "ruRU" then
119124
SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]]
120125
SML_MT_font["Skurri"] = [[Fonts\SKURRI.TTF]]
121126
--
122-
lib.DefaultMedia.font = "Friz Quadrata TT"
127+
lib.DefaultMedia.font = "Arial Narrow"
123128
--
124129
else
125130
LOCALE_MASK = lib.LOCALE_BIT_western
126131
locale_is_western = true
127132
--
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]]
132137
--
133138
lib.DefaultMedia.font = "Friz Quadrata TT"
134139
--
@@ -137,11 +142,13 @@ end
137142
-- STATUSBAR
138143
if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end
139144
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]]
140147
lib.DefaultMedia.statusbar = "Blizzard"
141148

142149
-- SOUND
143150
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.
145152
lib.DefaultMedia.sound = "None"
146153

147154
local function rebuildMediaList(mediatype)
@@ -165,12 +172,22 @@ function lib:Register(mediatype, key, data, langmask)
165172
if type(key) ~= "string" then
166173
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
167174
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
169175
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
170187
if not mediaTable[mediatype] then mediaTable[mediatype] = {} end
171188
local mtable = mediaTable[mediatype]
172189
if mtable[key] then return false end
173-
190+
174191
mtable[key] = data
175192
rebuildMediaList(mediatype)
176193
self.callbacks:Fire("LibSharedMedia_Registered", mediatype, key)
@@ -181,8 +198,7 @@ function lib:Fetch(mediatype, key, noDefault)
181198
local mtt = mediaTable[mediatype]
182199
local overridekey = overrideMedia[mediatype]
183200
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
186202
end
187203

188204
function lib:IsValid(mediatype, key)

0 commit comments

Comments
 (0)