comparison Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua @ 5:c31ee4251181

Libs Update
author tercio
date Tue, 25 Nov 2014 21:15:10 -0200
parents fc346da3afd9
children 371e14cd2feb
comparison
equal deleted inserted replaced
4:453c68ff5d72 5:c31ee4251181
1 --[[ 1 --[[
2 Name: LibSharedMedia-3.0 2 Name: LibSharedMedia-3.0
3 Revision: $Revision: 69 $ 3 Revision: $Revision: 89 $
4 Author: Elkano (elkano@gmx.de) 4 Author: Elkano (elkano@gmx.de)
5 Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com) 5 Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com)
6 Website: http://www.wowace.com/projects/libsharedmedia-3-0/ 6 Website: http://www.wowace.com/projects/libsharedmedia-3-0/
7 Description: Shared handling of media data (fonts, sounds, textures, ...) between addons. 7 Description: Shared handling of media data (fonts, sounds, textures, ...) between addons.
8 Dependencies: LibStub, CallbackHandler-1.0 8 Dependencies: LibStub, CallbackHandler-1.0
9 License: LGPL v2.1 9 License: LGPL v2.1
10 ]] 10 ]]
11 11
12 local MAJOR, MINOR = "LibSharedMedia-3.0", 4030402 -- increase manualy on changes 12 local MAJOR, MINOR = "LibSharedMedia-3.0", 6000201 -- 6.0.2 v1 / increase manually on changes
13 local lib = LibStub:NewLibrary(MAJOR, MINOR) 13 local lib = LibStub:NewLibrary(MAJOR, MINOR)
14 14
15 if not lib then return end 15 if not lib then return end
16 16
17 local _G = getfenv(0) 17 local _G = getfenv(0)
58 58
59 -- populate lib with default Blizzard data 59 -- populate lib with default Blizzard data
60 -- BACKGROUND 60 -- BACKGROUND
61 if not lib.MediaTable.background then lib.MediaTable.background = {} end 61 if not lib.MediaTable.background then lib.MediaTable.background = {} end
62 lib.MediaTable.background["None"] = [[]] 62 lib.MediaTable.background["None"] = [[]]
63 lib.MediaTable.background["Blizzard Collections Background"] = [[Interface\Collections\CollectionsBackgroundTile]]
63 lib.MediaTable.background["Blizzard Dialog Background"] = [[Interface\DialogFrame\UI-DialogBox-Background]] 64 lib.MediaTable.background["Blizzard Dialog Background"] = [[Interface\DialogFrame\UI-DialogBox-Background]]
64 lib.MediaTable.background["Blizzard Dialog Background Dark"] = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]] 65 lib.MediaTable.background["Blizzard Dialog Background Dark"] = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]]
65 lib.MediaTable.background["Blizzard Dialog Background Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]] 66 lib.MediaTable.background["Blizzard Dialog Background Gold"] = [[Interface\DialogFrame\UI-DialogBox-Gold-Background]]
67 lib.MediaTable.background["Blizzard Garrison Background"] = [[Interface\Garrison\GarrisonUIBackground]]
68 lib.MediaTable.background["Blizzard Garrison Background 2"] = [[Interface\Garrison\GarrisonUIBackground2]]
69 lib.MediaTable.background["Blizzard Garrison Background 3"] = [[Interface\Garrison\GarrisonMissionUIInfoBoxBackgroundTile]]
66 lib.MediaTable.background["Blizzard Low Health"] = [[Interface\FullScreenTextures\LowHealth]] 70 lib.MediaTable.background["Blizzard Low Health"] = [[Interface\FullScreenTextures\LowHealth]]
67 lib.MediaTable.background["Blizzard Marble"] = [[Interface\FrameGeneral\UI-Background-Marble]] 71 lib.MediaTable.background["Blizzard Marble"] = [[Interface\FrameGeneral\UI-Background-Marble]]
68 lib.MediaTable.background["Blizzard Out of Control"] = [[Interface\FullScreenTextures\OutOfControl]] 72 lib.MediaTable.background["Blizzard Out of Control"] = [[Interface\FullScreenTextures\OutOfControl]]
69 lib.MediaTable.background["Blizzard Parchment"] = [[Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]] 73 lib.MediaTable.background["Blizzard Parchment"] = [[Interface\AchievementFrame\UI-Achievement-Parchment-Horizontal]]
70 lib.MediaTable.background["Blizzard Parchment 2"] = [[Interface\AchievementFrame\UI-GuildAchievement-Parchment-Horizontal]] 74 lib.MediaTable.background["Blizzard Parchment 2"] = [[Interface\AchievementFrame\UI-GuildAchievement-Parchment-Horizontal]]
86 lib.DefaultMedia.border = "None" 90 lib.DefaultMedia.border = "None"
87 91
88 -- FONT 92 -- FONT
89 if not lib.MediaTable.font then lib.MediaTable.font = {} end 93 if not lib.MediaTable.font then lib.MediaTable.font = {} end
90 local SML_MT_font = lib.MediaTable.font 94 local SML_MT_font = lib.MediaTable.font
95 --[[
96 All font files are currently in all clients, the following table depicts which font supports which charset as of 5.0.4
97 Fonts were checked using langcover.pl from DejaVu fonts (http://sourceforge.net/projects/dejavu/) and FontForge (http://fontforge.org/)
98 latin means check for: de, en, es, fr, it, pt
99
100 file name latin koKR ruRU zhCN zhTW
101 2002.ttf 2002 X X X - -
102 2002B.ttf 2002 Bold X X X - -
103 ARHei.ttf AR CrystalzcuheiGBK Demibold X - X X X
104 ARIALN.TTF Arial Narrow X - X - -
105 ARKai_C.ttf AR ZhongkaiGBK Medium (Combat) X - X X X
106 ARKai_T.ttf AR ZhongkaiGBK Medium X - X X X
107 bHEI00M.ttf AR Heiti2 Medium B5 - - - - X
108 bHEI01B.ttf AR Heiti2 Bold B5 - - - - X
109 bKAI00M.ttf AR Kaiti Medium B5 - - - - X
110 bLEI00D.ttf AR Leisu Demi B5 - - - - X
111 FRIZQT__.TTF Friz Quadrata TT X - - - -
112 FRIZQT___CYR.TTF FrizQuadrataCTT x - X - -
113 K_Damage.TTF YDIWingsM - X X - -
114 K_Pagetext.TTF MoK X X X - -
115 MORPHEUS.TTF Morpheus X - - - -
116 MORPHEUS_CYR.TTF Morpheus X - X - -
117 NIM_____.ttf Nimrod MT X - X - -
118 SKURRI.TTF Skurri X - - - -
119 SKURRI_CYR.TTF Skurri X - X - -
120
121 WARNING: Although FRIZQT___CYR is available on western clients, it doesn't support special European characters e.g. é, ï, ö
122 Due to this, we cannot use it as a replacement for FRIZQT__.TTF
123 ]]
124
91 if locale == "koKR" then 125 if locale == "koKR" then
92 LOCALE_MASK = lib.LOCALE_BIT_koKR 126 LOCALE_MASK = lib.LOCALE_BIT_koKR
93 -- 127 --
94 SML_MT_font["굵은 글꼴"] = [[Fonts\2002B.TTF]] 128 SML_MT_font["굵은 글꼴"] = [[Fonts\2002B.TTF]]
95 SML_MT_font["기본 글꼴"] = [[Fonts\2002.TTF]] 129 SML_MT_font["기본 글꼴"] = [[Fonts\2002.TTF]]
118 lib.DefaultMedia["font"] = "預設" -- someone from zhTW please adjust if needed 152 lib.DefaultMedia["font"] = "預設" -- someone from zhTW please adjust if needed
119 153
120 elseif locale == "ruRU" then 154 elseif locale == "ruRU" then
121 LOCALE_MASK = lib.LOCALE_BIT_ruRU 155 LOCALE_MASK = lib.LOCALE_BIT_ruRU
122 -- 156 --
123 SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]] 157 SML_MT_font["2002"] = [[Fonts\2002.TTF]]
124 SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT__.TTF]] 158 SML_MT_font["2002 Bold"] = [[Fonts\2002B.TTF]]
125 SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS.TTF]] 159 SML_MT_font["AR CrystalzcuheiGBK Demibold"] = [[Fonts\ARHei.TTF]]
126 SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]] 160 SML_MT_font["AR ZhongkaiGBK Medium (Combat)"] = [[Fonts\ARKai_C.TTF]]
127 SML_MT_font["Skurri"] = [[Fonts\SKURRI.TTF]] 161 SML_MT_font["AR ZhongkaiGBK Medium"] = [[Fonts\ARKai_T.TTF]]
162 SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]]
163 SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT___CYR.TTF]]
164 SML_MT_font["MoK"] = [[Fonts\K_Pagetext.TTF]]
165 SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS_CYR.TTF]]
166 SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]]
167 SML_MT_font["Skurri"] = [[Fonts\SKURRI_CYR.TTF]]
128 -- 168 --
129 lib.DefaultMedia.font = "Friz Quadrata TT" 169 lib.DefaultMedia.font = "Friz Quadrata TT"
130 -- 170 --
131 else 171 else
132 LOCALE_MASK = lib.LOCALE_BIT_western 172 LOCALE_MASK = lib.LOCALE_BIT_western
133 locale_is_western = true 173 locale_is_western = true
134 -- 174 --
135 SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]] 175 SML_MT_font["2002"] = [[Fonts\2002.TTF]]
136 SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT__.TTF]] 176 SML_MT_font["2002 Bold"] = [[Fonts\2002B.TTF]]
137 SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS.TTF]] 177 SML_MT_font["AR CrystalzcuheiGBK Demibold"] = [[Fonts\ARHei.TTF]]
138 SML_MT_font["Skurri"] = [[Fonts\SKURRI.TTF]] 178 SML_MT_font["AR ZhongkaiGBK Medium (Combat)"] = [[Fonts\ARKai_C.TTF]]
179 SML_MT_font["AR ZhongkaiGBK Medium"] = [[Fonts\ARKai_T.TTF]]
180 SML_MT_font["Arial Narrow"] = [[Fonts\ARIALN.TTF]]
181 SML_MT_font["Friz Quadrata TT"] = [[Fonts\FRIZQT__.TTF]]
182 SML_MT_font["MoK"] = [[Fonts\K_Pagetext.TTF]]
183 SML_MT_font["Morpheus"] = [[Fonts\MORPHEUS_CYR.TTF]]
184 SML_MT_font["Nimrod MT"] = [[Fonts\NIM_____.ttf]]
185 SML_MT_font["Skurri"] = [[Fonts\SKURRI_CYR.TTF]]
139 -- 186 --
140 lib.DefaultMedia.font = "Friz Quadrata TT" 187 lib.DefaultMedia.font = "Friz Quadrata TT"
141 -- 188 --
142 end 189 end
143 190
144 -- STATUSBAR 191 -- STATUSBAR
145 if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end 192 if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end
146 lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]] 193 lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]]
147 lib.MediaTable.statusbar["Blizzard Character Skills Bar"] = [[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]] 194 lib.MediaTable.statusbar["Blizzard Character Skills Bar"] = [[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]]
195 lib.MediaTable.statusbar["Blizzard Raid Bar"] = [[Interface\RaidFrame\Raid-Bar-Hp-Fill]]
148 lib.DefaultMedia.statusbar = "Blizzard" 196 lib.DefaultMedia.statusbar = "Blizzard"
149 197
150 -- SOUND 198 -- SOUND
151 if not lib.MediaTable.sound then lib.MediaTable.sound = {} end 199 if not lib.MediaTable.sound then lib.MediaTable.sound = {} end
152 lib.MediaTable.sound["None"] = [[Interface\Quiet.ogg]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input. 200 lib.MediaTable.sound["None"] = [[Interface\Quiet.ogg]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input.
172 end 220 end
173 if type(key) ~= "string" then 221 if type(key) ~= "string" then
174 error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key)) 222 error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key))
175 end 223 end
176 mediatype = mediatype:lower() 224 mediatype = mediatype:lower()
177 if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end 225 if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end
178 if not mediaTable[mediatype] then mediaTable[mediatype] = {} end 226 if not mediaTable[mediatype] then mediaTable[mediatype] = {} end
179 local mtable = mediaTable[mediatype] 227 local mtable = mediaTable[mediatype]
180 if mtable[key] then return false end 228 if mtable[key] then return false end
181 229
182 mtable[key] = data 230 mtable[key] = data