from retail
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
-- Item: Toggle
|
||||
-- Some sort of checkbox for dropdown menus.
|
||||
-- Does not close the pullout on click.
|
||||
-- Based on the AceGUI Toggle Item. Extracts the icon from the text
|
||||
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
local ItemBase = LibStub("AceGUI-3.0-DropDown-ItemBase"):GetItemBase()
|
||||
|
||||
local widgetType = "Dropdown-Currency"
|
||||
local widgetVersion = 1
|
||||
|
||||
local function UpdateToggle(self)
|
||||
if self.value and not self.isHeader then
|
||||
self.check:Show()
|
||||
else
|
||||
self.check:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local function OnRelease(self)
|
||||
ItemBase.OnRelease(self)
|
||||
self:SetValue(nil)
|
||||
end
|
||||
|
||||
local function Frame_OnClick(this, button)
|
||||
local self = this.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 Frame_OnShow(self)
|
||||
local userdata = self.obj.userdata
|
||||
local key = userdata and userdata.value
|
||||
local dropDownUserData = userdata and userdata.obj and userdata.obj.userdata
|
||||
local headers = dropDownUserData and dropDownUserData.option and dropDownUserData.option.headers
|
||||
if type(headers) == "function" then
|
||||
headers = headers()
|
||||
end
|
||||
|
||||
local isHeader = headers and key and headers[key]
|
||||
self.obj.isHeader = isHeader
|
||||
|
||||
if isHeader then
|
||||
self:SetScript("OnClick", nil)
|
||||
self.obj.text:SetTextColor(1, 1, 0)
|
||||
self.obj.text:SetPoint("TOPLEFT", self, "TOPLEFT", 7, 0)
|
||||
self.obj.icon:Hide()
|
||||
self.obj.useHighlight = false
|
||||
else
|
||||
self:SetScript("OnClick", Frame_OnClick)
|
||||
self.obj.text:SetTextColor(1, 1, 1)
|
||||
self.obj.text:SetPoint("TOPLEFT", self, "TOPLEFT", 34, 0)
|
||||
self.obj.icon:Show()
|
||||
self.obj.useHighlight = true
|
||||
end
|
||||
UpdateToggle(self.obj)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function SetValue(self, value)
|
||||
self.value = value
|
||||
UpdateToggle(self)
|
||||
end
|
||||
|
||||
-- exported
|
||||
local function GetValue(self)
|
||||
return self.value
|
||||
end
|
||||
|
||||
local function SetText(self, text)
|
||||
text = text or ""
|
||||
local pos = text:find("|t", 1, true)
|
||||
if pos then
|
||||
ItemBase.SetText(self, text:sub(pos + 2))
|
||||
|
||||
local firstColon = text:find(":", 1, true)
|
||||
local icon = text:sub(3, firstColon - 1)
|
||||
self.icon:SetTexture(icon)
|
||||
else
|
||||
ItemBase.SetText(self, text)
|
||||
end
|
||||
self.fullText = text
|
||||
end
|
||||
|
||||
|
||||
local function Constructor()
|
||||
local self = ItemBase.Create(widgetType)
|
||||
|
||||
self.text:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 34)
|
||||
|
||||
self.icon = self.frame:CreateTexture(nil, "OVERLAY")
|
||||
self.icon:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 18, -2)
|
||||
self.icon:SetWidth(12)
|
||||
self.icon:SetHeight(12)
|
||||
|
||||
self.frame:SetScript("OnClick", Frame_OnClick)
|
||||
self.frame:SetScript("OnShow", Frame_OnShow)
|
||||
|
||||
self.SetValue = SetValue
|
||||
self.GetValue = GetValue
|
||||
self.OnRelease = OnRelease
|
||||
self.SetText = SetText
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
||||
@@ -5,7 +5,7 @@ local L = WeakAuras.L
|
||||
|
||||
local pairs, next, type, unpack = pairs, next, type, unpack
|
||||
|
||||
local Type, Version = "WeakAurasPendingUpdateButton", 5
|
||||
local Type, Version = "WeakAurasPendingUpdateButton", 6
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then
|
||||
@@ -57,7 +57,14 @@ local methods = {
|
||||
self.linkedChildren = {}
|
||||
|
||||
function self.callbacks.OnUpdateClick()
|
||||
WeakAuras.Import(self.companionData.encoded)
|
||||
local linkedAuras = {}
|
||||
for auraId in pairs(self.linkedAuras) do
|
||||
if not self.linkedChildren[auraId] then
|
||||
tinsert(linkedAuras, auraId)
|
||||
end
|
||||
end
|
||||
|
||||
WeakAuras.Import(self.companionData.encoded, nil, nil, linkedAuras)
|
||||
end
|
||||
|
||||
self:SetTitle(self.companionData.name)
|
||||
|
||||
@@ -12,15 +12,8 @@ local hiddenAll = OptionsPrivate.commonOptions.CreateHiddenAll("action")
|
||||
local getAll = OptionsPrivate.commonOptions.CreateGetAll("action")
|
||||
local setAll = OptionsPrivate.commonOptions.CreateSetAll("action", getAll)
|
||||
|
||||
local RestrictedChannelCheck
|
||||
if WeakAuras.IsClassic() then
|
||||
RestrictedChannelCheck = function()
|
||||
return false
|
||||
end
|
||||
else
|
||||
RestrictedChannelCheck = function(data)
|
||||
return data.message_type == "SAY" or data.message_type == "YELL" or data.message_type == "SMARTRAID"
|
||||
end
|
||||
local RestrictedChannelCheck = function(data)
|
||||
return data.message_type == "SAY" or data.message_type == "YELL" or data.message_type == "SMARTRAID"
|
||||
end
|
||||
|
||||
--- a sound from each setter
|
||||
|
||||
@@ -1253,10 +1253,21 @@ typeControlAdders = {
|
||||
name = WeakAuras.newFeatureString .. name(option, "noMerge", L["Prevent Merging"]),
|
||||
desc = desc(option, "noMerge", L["If checked, then this group will not merge with other group when selecting multiple auras."]),
|
||||
order = order(),
|
||||
width = WeakAuras.doubleWidth,
|
||||
width = option.groupType == "simple" and WeakAuras.doubleWidth or WeakAuras.normalWidth,
|
||||
get = get(option, "noMerge"),
|
||||
set = set(data, option, "noMerge"),
|
||||
}
|
||||
if option.groupType ~="simple" then
|
||||
args[prefix .. "sortAlphabetically"] = {
|
||||
type = "toggle",
|
||||
name = WeakAuras.newFeatureString .. name(option, "sortAlphabetically", L["Sort"]),
|
||||
desc = desc(option, "sortAlphabetically", L["If checked, then the combo box in the User settings will be sorted."]),
|
||||
order = order(),
|
||||
width = WeakAuras.normalWidth,
|
||||
get = get(option, "sortAlphabetically"),
|
||||
set = set(data, option, "sortAlphabetically"),
|
||||
}
|
||||
end
|
||||
if option.groupType ~="simple" then
|
||||
args[prefix .. "limitType"] = {
|
||||
type = "select",
|
||||
@@ -2121,6 +2132,7 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
end
|
||||
WeakAuras.ClearAndUpdateOptions(data.id, true)
|
||||
end,
|
||||
sorting = option.sortAlphabetically and OptionsPrivate.Private.SortOrderForValues(values) or nil
|
||||
}
|
||||
args[prefix .. "resetEntry"] = {
|
||||
type = "execute",
|
||||
@@ -2355,6 +2367,15 @@ local function addUserModeOption(options, args, data, order, prefix, i)
|
||||
return AceGUIWidgetLSMlists[option.mediaType]
|
||||
end
|
||||
end
|
||||
|
||||
userOption.sorting = function()
|
||||
if option.mediaType == "sound" then
|
||||
return OptionsPrivate.Private.SortOrderForValues(OptionsPrivate.Private.sound_file_types)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
userOption.set = function(_, value)
|
||||
if option.mediaType == "sound" then
|
||||
PlaySoundFile(value, "Master")
|
||||
|
||||
@@ -991,7 +991,17 @@ local function SetCategories(globalCategories, categories)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function OnlyMetaDataCategory(categories)
|
||||
local metaData = false
|
||||
for category in pairs(categories) do
|
||||
if category == "metadata" then
|
||||
metaData = true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return metaData
|
||||
end
|
||||
|
||||
local function GetCategories(diff, isRoot)
|
||||
local categories = {}
|
||||
@@ -1001,6 +1011,7 @@ local function GetCategories(diff, isRoot)
|
||||
categories[category] = true
|
||||
end
|
||||
end
|
||||
|
||||
return categories
|
||||
end
|
||||
|
||||
@@ -1042,11 +1053,22 @@ local function BuildDiffsHelper(uid, newUidMap, oldUidMap, matchInfo)
|
||||
oldUidMap:SetDiff(matchedUid, diff, categories)
|
||||
SetCategories(matchInfo.activeCategories, categories)
|
||||
|
||||
matchInfo.diffs[uid] = true
|
||||
if isGroup then
|
||||
matchInfo.modifiedGroupCount = matchInfo.modifiedGroupCount + 1
|
||||
matchInfo.categories[uid] = categories
|
||||
|
||||
if OnlyMetaDataCategory(categories) then
|
||||
matchInfo.onlyMetaDataModified[uid] = true
|
||||
if isGroup then
|
||||
matchInfo.modifiedMetaDataGroupCount = matchInfo.modifiedMetaDataGroupCount + 1
|
||||
else
|
||||
matchInfo.modifiedMetaDataCount = matchInfo.modifiedMetaDataCount + 1
|
||||
end
|
||||
else
|
||||
matchInfo.modifiedCount = matchInfo.modifiedCount + 1
|
||||
matchInfo.modified[uid] = true
|
||||
if isGroup then
|
||||
matchInfo.modifiedGroupCount = matchInfo.modifiedGroupCount + 1
|
||||
else
|
||||
matchInfo.modifiedCount = matchInfo.modifiedCount + 1
|
||||
end
|
||||
end
|
||||
else
|
||||
matchInfo.unmodified[uid] = true
|
||||
@@ -1140,6 +1162,8 @@ end
|
||||
local function hasChanges(matchInfo)
|
||||
return matchInfo.modifiedCount > 0
|
||||
or matchInfo.modifiedGroupCount > 0
|
||||
or matchInfo.modifiedMetaDataCount > 0
|
||||
or matchInfo.modifiedMetaDataGroupCount > 0
|
||||
or matchInfo.addedCount > 0
|
||||
or matchInfo.addedGroupCount > 0
|
||||
or matchInfo.deletedCount > 0
|
||||
@@ -1151,13 +1175,17 @@ local function BuildDiffs(newUidMap, oldUidMap)
|
||||
local matchInfo = {
|
||||
modifiedCount = 0,
|
||||
modifiedGroupCount = 0,
|
||||
modifiedMetaDataCount = 0,
|
||||
modifiedMetaDataGroupCount = 0,
|
||||
unmodifiedCount = 0,
|
||||
unmodifiedGroupCount = 0,
|
||||
addedCount = 0,
|
||||
addedGroupCount = 0,
|
||||
deletedCount = 0,
|
||||
deletedGroupCount = 0,
|
||||
diffs = {}, -- Contains diffs for new uids
|
||||
modified = {}, -- Contains uids that were modified
|
||||
onlyMetaDataModified = {}, -- Contains uids that are only metadata modified
|
||||
categories = {}, -- Contains categories for uids
|
||||
unmodified = {}, -- Contains new uids that had a empty diff
|
||||
added = {}, -- Contains new uids that were added
|
||||
deleted = {}, -- Contains old uids that were removed
|
||||
@@ -1228,7 +1256,21 @@ local function MatchInfo(data, children, target)
|
||||
return matchInfo
|
||||
end
|
||||
|
||||
local function AddAuraList(container, uidMap, list, expandText)
|
||||
local function CategoriesToDisplayText(categories)
|
||||
local categoriesDisplayTexts = {}
|
||||
for _, category in ipairs(OptionsPrivate.Private.update_categories) do
|
||||
if categories[category.name] then
|
||||
tinsert(categoriesDisplayTexts, category.label)
|
||||
end
|
||||
end
|
||||
if #categoriesDisplayTexts > 0 then
|
||||
return table.concat(categoriesDisplayTexts, ", ")
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
local function AddAuraList(container, uidMap, list, categories, expandText)
|
||||
local expand = AceGUI:Create("WeakAurasExpand")
|
||||
local collapsed = true
|
||||
local image = collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\expand"
|
||||
@@ -1247,7 +1289,16 @@ local function AddAuraList(container, uidMap, list, expandText)
|
||||
|
||||
local sortedNames = {}
|
||||
for uid in pairs(list) do
|
||||
tinsert(sortedNames, uidMap:GetIdFor(uid))
|
||||
if categories[uid] then
|
||||
local categoriesText = CategoriesToDisplayText(categories[uid])
|
||||
if categoriesText then
|
||||
tinsert(sortedNames, L["%s (%s)"]:format(uidMap:GetIdFor(uid), categoriesText))
|
||||
else
|
||||
tinsert(sortedNames, uidMap:GetIdFor(uid))
|
||||
end
|
||||
else
|
||||
tinsert(sortedNames, uidMap:GetIdFor(uid))
|
||||
end
|
||||
end
|
||||
table.sort(sortedNames)
|
||||
|
||||
@@ -1277,7 +1328,7 @@ local function AddAuraList(container, uidMap, list, expandText)
|
||||
end
|
||||
|
||||
local methods = {
|
||||
Open = function(self, data, children, target, sender, callbackFunc)
|
||||
Open = function(self, data, children, target, linkedAuras, sender, callbackFunc)
|
||||
if(self.optionsWindow.window == "importexport") then
|
||||
self.optionsWindow.importexport:Close();
|
||||
elseif(self.optionsWindow.window == "texture") then
|
||||
@@ -1294,6 +1345,7 @@ local methods = {
|
||||
data = data,
|
||||
children = children or {},
|
||||
target = target,
|
||||
linkedAuras = linkedAuras,
|
||||
sender = sender
|
||||
}
|
||||
self.userChoices = {
|
||||
@@ -1355,13 +1407,22 @@ local methods = {
|
||||
local matchInfoText = L["This is a modified version of your group: |cff9900FF%s|r"]:format(oldRootId)
|
||||
matchInfoResult:SetText(matchInfoText)
|
||||
if matchInfo.addedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.newUidMap, matchInfo.added, L["%d |4aura:auras; added"]:format(matchInfo.addedCount))
|
||||
AddAuraList(self, matchInfo.newUidMap, matchInfo.added, {},
|
||||
L["%d |4aura:auras; added"]:format(matchInfo.addedCount))
|
||||
end
|
||||
if matchInfo.modifiedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.diffs, L["%d |4aura:auras; modified"]:format(matchInfo.modifiedCount))
|
||||
local modifiedCount = matchInfo.modifiedCount + matchInfo.modifiedGroupCount
|
||||
if modifiedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.modified, matchInfo.categories,
|
||||
L["%d |4aura:auras; modified"]:format(modifiedCount))
|
||||
end
|
||||
local onlyMetaDataModifiedCount = matchInfo.modifiedMetaDataCount + matchInfo.modifiedMetaDataGroupCount
|
||||
if onlyMetaDataModifiedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.onlyMetaDataModified, {},
|
||||
L["%d |4aura:auras; with meta data modified"]:format(onlyMetaDataModifiedCount))
|
||||
end
|
||||
if matchInfo.deletedCount ~= 0 then
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.deleted, L["%d |4aura:auras; deleted"]:format(matchInfo.deletedCount))
|
||||
AddAuraList(self, matchInfo.oldUidMap, matchInfo.deleted, {},
|
||||
L["%d |4aura:auras; deleted"]:format(matchInfo.deletedCount))
|
||||
end
|
||||
else
|
||||
matchInfoResult:SetText(L["This is a modified version of your aura, |cff9900FF%s.|r"]:format(oldRootId))
|
||||
@@ -1444,6 +1505,23 @@ local methods = {
|
||||
self:AddChild(scamCheckText)
|
||||
end
|
||||
|
||||
if linkedAuras and next(linkedAuras) then
|
||||
self:AddChild(AceGUI:Create("WeakAurasSpacer"))
|
||||
|
||||
local linkedAurasText = AceGUI:Create("Label")
|
||||
linkedAurasText:SetFontObject(GameFontHighlight)
|
||||
linkedAurasText:SetFullWidth(true)
|
||||
|
||||
local auraIdText = table.concat(self.pendingData.linkedAuras, ", ")
|
||||
if #self.pendingData.linkedAuras == 1 then
|
||||
linkedAurasText:SetText(L["This aura is marked as an update to an aura '%s', but cannot be used to update that aura. This usually happens if an aura is moved out of a group."]:format(auraIdText))
|
||||
else
|
||||
linkedAurasText:SetText(L["This aura is marked as an update to auras '%s', but cannot be used to update them. This usually happens if an aura is moved out of a group."]:format(auraIdText))
|
||||
end
|
||||
linkedAurasText:SetColor(1, 0, 0)
|
||||
self:AddChild(linkedAurasText)
|
||||
end
|
||||
|
||||
-- Let people install auras that are newer than their version of WeakAuras
|
||||
local highestVersion = data.internalVersion or 0
|
||||
if children then
|
||||
|
||||
@@ -647,7 +647,7 @@ local function GetSortedOptionsLists()
|
||||
tinsert(to_sort, id);
|
||||
end
|
||||
end
|
||||
table.sort(to_sort, function(a, b) return a < b end);
|
||||
table.sort(to_sort, function(a, b) return a:lower() < b:lower() end)
|
||||
for _, id in ipairs(to_sort) do
|
||||
local data = WeakAuras.GetData(id);
|
||||
for child in OptionsPrivate.Private.TraverseAll(data) do
|
||||
@@ -663,7 +663,7 @@ local function GetSortedOptionsLists()
|
||||
tinsert(to_sort, id);
|
||||
end
|
||||
end
|
||||
table.sort(to_sort, function(a, b) return a < b end);
|
||||
table.sort(to_sort, function(a, b) return a:lower() < b:lower() end)
|
||||
for _, id in ipairs(to_sort) do
|
||||
local data = WeakAuras.GetData(id);
|
||||
for child in OptionsPrivate.Private.TraverseAll(data) do
|
||||
@@ -927,8 +927,8 @@ function OptionsPrivate.OpenDebugLog(text)
|
||||
frame.debugLog:Open(text)
|
||||
end
|
||||
|
||||
function OptionsPrivate.OpenUpdate(data, children, target, sender, callbackFunc)
|
||||
return frame.update:Open(data, children, target, sender, callbackFunc)
|
||||
function OptionsPrivate.OpenUpdate(data, children, target, linkedAuras, sender, callbackFunc)
|
||||
return frame.update:Open(data, children, target, linkedAuras, sender, callbackFunc)
|
||||
end
|
||||
|
||||
function OptionsPrivate.ConvertDisplay(data, newType)
|
||||
@@ -1196,7 +1196,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
|
||||
|
||||
wipe(frame.loadedButton.childButtons)
|
||||
if frame.loadedButton:GetExpanded() then
|
||||
table.sort(topLevelLoadedAuras)
|
||||
table.sort(topLevelLoadedAuras, function(a, b) return a:lower() < b:lower() end)
|
||||
for _, id in ipairs(topLevelLoadedAuras) do
|
||||
if aurasMatchingFilter[id] then
|
||||
addButton(displayButtons[id], aurasMatchingFilter, visible)
|
||||
@@ -1214,7 +1214,7 @@ function OptionsPrivate.SortDisplayButtons(filter, overrideReset, id)
|
||||
|
||||
wipe(frame.unloadedButton.childButtons)
|
||||
if frame.unloadedButton:GetExpanded() then
|
||||
table.sort(topLevelUnloadedAuras)
|
||||
table.sort(topLevelUnloadedAuras, function(a, b) return a:lower() < b:lower() end)
|
||||
for _, id in ipairs(topLevelUnloadedAuras) do
|
||||
if aurasMatchingFilter[id] then
|
||||
addButton(displayButtons[id], aurasMatchingFilter, visible)
|
||||
|
||||
@@ -76,6 +76,7 @@ AceGUI-Widgets\AceGUIWidget-WeakAurasIcon.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasNewHeaderButton.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasLoadedHeaderButton.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasDisplayButton.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasDropDownItemCurrency.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasPendingInstallButton.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasPendingUpdateButton.lua
|
||||
AceGUI-Widgets\AceGUIWidget-WeakAurasTextureButton.lua
|
||||
|
||||
Reference in New Issue
Block a user