WoWInterface SVN SliceCommander

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/Libs/LibSharedMedia-3.0
    from Rev 231 to Rev 239
    Reverse comparison

Rev 231 → Rev 239

lib.xml
1,4 → 1,4
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="LibSharedMedia-3.0.lua" />
</Ui>
</Ui>
\ No newline at end of file
LibSharedMedia-3.0.lua
1,6 → 1,6
--[[
Name: LibSharedMedia-3.0
Revision: $Revision: 91 $
Revision: $Revision: 114 $
Author: Elkano (elkano@gmx.de)
Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com)
Website: http://www.wowace.com/projects/libsharedmedia-3-0/
9,7 → 9,7
License: LGPL v2.1
]]
 
local MAJOR, MINOR = "LibSharedMedia-3.0", 6010002 -- 6.1.0 v2 / increase manually on changes
local MAJOR, MINOR = "LibSharedMedia-3.0", 8020003 -- 8.2.0 v3 / increase manually on changes
local lib = LibStub:NewLibrary(MAJOR, MINOR)
 
if not lib then return end
20,10 → 20,10
local type = _G.type
 
local band = _G.bit.band
 
local table_insert = _G.table.insert
local table_sort = _G.table.sort
 
local RESTRICTED_FILE_ACCESS = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE -- starting with 8.2, some rules for file access have changed; classic still uses the old way
 
local locale = GetLocale()
local locale_is_western
local LOCALE_MASK = 0
193,11 → 193,12
lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]]
lib.MediaTable.statusbar["Blizzard Character Skills Bar"] = [[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]]
lib.MediaTable.statusbar["Blizzard Raid Bar"] = [[Interface\RaidFrame\Raid-Bar-Hp-Fill]]
lib.MediaTable.statusbar["Solid"] = [[Interface\Buttons\WHITE8X8]]
lib.DefaultMedia.statusbar = "Blizzard"
 
-- SOUND
if not lib.MediaTable.sound then lib.MediaTable.sound = {} end
lib.MediaTable.sound["None"] = [[Interface\Quiet.ogg]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input.
lib.MediaTable.sound["None"] = RESTRICTED_FILE_ACCESS and 1 or [[Interface\Quiet.ogg]] -- Relies on the fact that PlaySound[File] doesn't error on these values.
lib.DefaultMedia.sound = "None"
 
local function rebuildMediaList(mediatype)
222,18 → 223,25
error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
end
mediatype = mediatype:lower()
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end
if mediatype == lib.MediaType.SOUND and type(data) == "string" then
if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then
-- ignore fonts that aren't flagged as supporting local glyphs on non-western clients
return false
end
if type(data) == "string" and (mediatype == lib.MediaType.BACKGROUND or mediatype == lib.MediaType.BORDER or mediatype == lib.MediaType.STATUSBAR or mediatype == lib.MediaType.SOUND) then
local path = data:lower()
-- Only ogg and mp3 are valid sounds.
if not path:find(".ogg", nil, true) and not path:find(".mp3", nil, true) then
if RESTRICTED_FILE_ACCESS and not path:find("^interface") then
-- files accessed via path only allowed from interface folder
return false
end
if mediatype == lib.MediaType.SOUND and not (path:find(".ogg", nil, true) or path:find(".mp3", nil, true)) then
-- Only ogg and mp3 are valid sounds.
return false
end
end
if not mediaTable[mediatype] then mediaTable[mediatype] = {} end
local mtable = mediaTable[mediatype]
if mtable[key] then return false end
 
 
mtable[key] = data
rebuildMediaList(mediatype)
self.callbacks:Fire("LibSharedMedia_Registered", mediatype, key)