From fcd2d11478997b753da98a136363220c443b936b Mon Sep 17 00:00:00 2001 From: NoM0Re Date: Thu, 16 Jan 2025 19:46:24 +0100 Subject: [PATCH] from retail --- WeakAuras/Media/Textures/VoiceChat-On.blp | Bin 0 -> 2564 bytes .../Media/Textures/VoiceChat-Speaker.blp | Bin 0 -> 2564 bytes WeakAuras/Types.lua | 4 + .../AceGUIWidget-WeakAurasMediaSound.lua | 98 ++++++++++++++++++ WeakAurasOptions/ActionOptions.lua | 2 + WeakAurasOptions/AuthorOptions.lua | 2 + WeakAurasOptions/ConditionOptions.lua | 1 + WeakAurasOptions/WeakAurasOptions.toc | 1 + 8 files changed, 108 insertions(+) create mode 100644 WeakAuras/Media/Textures/VoiceChat-On.blp create mode 100644 WeakAuras/Media/Textures/VoiceChat-Speaker.blp create mode 100644 WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMediaSound.lua diff --git a/WeakAuras/Media/Textures/VoiceChat-On.blp b/WeakAuras/Media/Textures/VoiceChat-On.blp new file mode 100644 index 0000000000000000000000000000000000000000..8ed7c225e1d6f02c7e2e61f1c4dd2c137cfc1dd4 GIT binary patch literal 2564 zcmZ?r2{2-0U|?Y4U}sbS(jYvA1&BF-n3I9w3J^a5;x9l6Q+~1 z|1$pIoAMoKe_^BQE5RoTL6tY>q(4(&U=dL;d&o%)u&-b=$AP)GMETG8-uWHRHjyeCutQ(k}lL7^G%JMTx&v7hsY# zXngXPfgvI;bgJb$n>zcZ}@CznN{@moeg@Hk}u`=`-*CS{3+Ajjh zKz>-LsOno*X8x}WHrqXU%D@m55f)CY{pjv<%3@$(y^6>$3yVPZ2ZlapUO&IxbHbiS zi$Up6H1w6MB-=!7Un>y5u^=RrwO!KZW)tsibn~di=Wp7U<-9EyZhis7gU9N?@FCTF z-WH(yLqkO^{eXsTOSCQrrRPxbE6RI-{0(z&8lD63Ljqvo#|M^YVutZ^|2rB2bIYou zOeg1xbc&zK2Btq3l`9Sxn5QHw?dmFcepP|P(OpFarvC96V7q8FB0QV-BnU8Yt=xKo zNm1@{=fsl7M-(_5rY$SGD(TTafu}|f6rUAJ|WMB{ldO$VWEW>(R>TOW` zOc4(aUC!j7tmZdK`VE_OC literal 0 HcmV?d00001 diff --git a/WeakAuras/Media/Textures/VoiceChat-Speaker.blp b/WeakAuras/Media/Textures/VoiceChat-Speaker.blp new file mode 100644 index 0000000000000000000000000000000000000000..f2e3cb71fdf57bd3f76e6a9d6e4487149454d645 GIT binary patch literal 2564 zcmeHJZAep57=G`jbtjnv8A&oc)K(z$qmUpd=T{%2f~6i^_JOlNNC#iWlp-UDO$W;gT?R!;^x;R>o!%pyTlu4pfBo>`zMS*$-uLso=WoRhNC>`A z#Ny^Z=7obEXTallJI{E&K66N8EjA}TW}b8j{omG0 zWZ(_tJ$3K`6Jf01VK|7-srfcrQ zXT>Csuh$Fz?=YVxYPSpSM*U%%Ekp2#83K-E>;6NzbI;hfI@b0kS1-BUYW!nk;}zV$ zh&M6(uuSf}>l1wa)8JLqe-ZK1LIl=c$;lD^gC79wM`@Gbrl$ZI>9)gyhYbQ)t;r6< z{U==;>W>H1^XO$Qrof8D*Z4dtG7z|?&$v;BGivrx_LX->4->8BL=)fcwuCIo03JbJ z&9D7W?FKNrO4ai}hCGWJ)bj|w0Z6xJWs7{&_PG z^!?oZ=!y-g{_|E95k^XcXcUv zKZd8)$&uK{xRA@}uRibBy#zR&;7t?u`DkCXyRF;!V&N6rs{ySK|BKowWk=9RQ!iEa z=EgvTyC*J$#??l@whbW7n@}R`Q#**<9o$(exTycLG*{n@B{-4+3|K%6a~<(lI0M&l ze!QbUzHjR)aXzyt-T2AljP*Qcop?W}Asp(!+HcxZVXB=>lIdwBGzS`6g!QsX+ktuY zP#Rr(+ZebV8OW<4a))x3ev%$%Y^%IvSv5lR$$jt76vRBKDhzm>!&CjmayY<_M6^Q; KwN= Version then + return +end +local L = WeakAuras.L +local media = LibStub("LibSharedMedia-3.0") +local prototype = LibStub("AceGUI-3.0-DropDown-ItemBase"):GetItemBase() + +local ignore = { + [" " ..L["Custom"]] = true, + [" " ..L["Sound by Kit ID"]] = true, + [L["None"]] = true +} + +local function updateToggle(self) + if self.value then + self.check:Show() + else + self.check:Hide() + end +end + +local function updateSndButton(self) + local text = self.obj.text:GetText() + if text == nil or ignore[text] then + self.sndButton:Hide() + else + self.sndButton:Show() + end +end + +local function onRelease(self) + prototype.OnRelease(self) + self:SetValue(nil) +end + +local function onClick(frame) + local self = frame.obj + if self.disabled then return end + self.value = not self.value + if self.value then + PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON + else + PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF + end + updateToggle(self) + self:Fire("OnValueChanged", self.value) +end + +local function setValue(self, value) + self.value = value + updateToggle(self) +end + +local function getValue(self) + return self.value +end + +local function soundOnClick(self) + local snd = media:Fetch("sound", self.sound:GetText()) + if snd then PlaySoundFile(snd, "Master") end +end + +local function constructor() + local self = prototype.Create(Type) + self.frame:SetScript("OnShow", updateSndButton) + self.frame:SetScript("OnClick", onClick) + self.SetValue = setValue + self.GetValue = getValue + self.OnRelease = onRelease + local frame = self.frame + + local sndButton = CreateFrame("Button", nil, frame) + sndButton:SetWidth(16) + sndButton:SetHeight(16) + sndButton:SetPoint("RIGHT", frame, "RIGHT", -3, -1) + sndButton:SetScript("OnClick", soundOnClick) + sndButton.sound = frame.obj.text + frame.sndButton = sndButton + + local icon = sndButton:CreateTexture(nil, "BACKGROUND") + icon:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\VoiceChat-Speaker") --"Interface\\Common\\VoiceChat-Speaker" + icon:SetAllPoints(sndButton) + + local highlight = sndButton:CreateTexture(nil, "HIGHLIGHT") + highlight:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\VoiceChat-On") --"Interface\\Common\\VoiceChat-On" + highlight:SetAllPoints(sndButton) + + AceGUI:RegisterAsWidget(self) + return self +end +AceGUI:RegisterWidgetType(Type, constructor, Version) diff --git a/WeakAurasOptions/ActionOptions.lua b/WeakAurasOptions/ActionOptions.lua index 6d300ba..eb9082c 100644 --- a/WeakAurasOptions/ActionOptions.lua +++ b/WeakAurasOptions/ActionOptions.lua @@ -218,6 +218,7 @@ function OptionsPrivate.GetActionOptions(data) width = WeakAuras.normalWidth, name = L["Sound"], order = 8.4, + itemControl = "WeakAurasMediaSound", values = OptionsPrivate.Private.sound_types, sorting = OptionsPrivate.Private.SortOrderForValues(OptionsPrivate.Private.sound_types), disabled = function() return not data.actions.start.do_sound end, @@ -599,6 +600,7 @@ function OptionsPrivate.GetActionOptions(data) width = WeakAuras.normalWidth, name = L["Sound"], order = 28.1, + itemControl = "WeakAurasMediaSound", values = OptionsPrivate.Private.sound_types, sorting = OptionsPrivate.Private.SortOrderForValues(OptionsPrivate.Private.sound_types), disabled = function() return not data.actions.finish.do_sound end, diff --git a/WeakAurasOptions/AuthorOptions.lua b/WeakAurasOptions/AuthorOptions.lua index a0b3380..0619249 100644 --- a/WeakAurasOptions/AuthorOptions.lua +++ b/WeakAurasOptions/AuthorOptions.lua @@ -1016,6 +1016,7 @@ typeControlAdders = { end end, dialogControl = OptionsPrivate.Private.author_option_media_controls[option.mediaType], + itemControl = OptionsPrivate.Private.author_option_media_itemControls[option.mediaType], order = order(), get = get(option, "default"), set = function(_, value) @@ -2346,6 +2347,7 @@ local function addUserModeOption(options, args, data, order, prefix, i) elseif optionType == "media" then userOption.type = "select" userOption.dialogControl = OptionsPrivate.Private.author_option_media_controls[option.mediaType] + userOption.itemControl = OptionsPrivate.Private.author_option_media_itemControls[option.mediaType] userOption.values = function() if option.mediaType == "sound" then return OptionsPrivate.Private.sound_file_types diff --git a/WeakAurasOptions/ConditionOptions.lua b/WeakAurasOptions/ConditionOptions.lua index a8380f9..2e9af6f 100644 --- a/WeakAurasOptions/ConditionOptions.lua +++ b/WeakAurasOptions/ConditionOptions.lua @@ -581,6 +581,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA width = WeakAuras.normalWidth, values = OptionsPrivate.Private.sound_types, sorting = OptionsPrivate.Private.SortOrderForValues(OptionsPrivate.Private.sound_types), + itemControl = "WeakAurasMediaSound", name = blueIfNoValue2(data, conditions[i].changes[j], "value", "sound", L["Differences"]), desc = descIfNoValue2(data, conditions[i].changes[j], "value", "sound", propertyType, OptionsPrivate.Private.sound_types), order = order, diff --git a/WeakAurasOptions/WeakAurasOptions.toc b/WeakAurasOptions/WeakAurasOptions.toc index 89ad494..f88f087 100644 --- a/WeakAurasOptions/WeakAurasOptions.toc +++ b/WeakAurasOptions/WeakAurasOptions.toc @@ -95,3 +95,4 @@ AceGUI-Widgets\AceGUIWidget-WeakAurasSpacer.lua AceGUI-Widgets\AceGuiWidget-WeakAurasProgressBar.lua AceGUI-Widgets\AceGUIWidget-WeakAurasSpinBox.lua AceGUI-Widgets\AceGUIWidget-WeakAurasInputFocus.lua +AceGUI-Widgets\AceGUIWidget-WeakAurasMediaSound.lua