from retail
This commit is contained in:
@@ -443,31 +443,7 @@ StaticPopupDialogs["WEAKAURAS_CONFIRM_DELETE"] = {
|
|||||||
button2 = L["Cancel"],
|
button2 = L["Cancel"],
|
||||||
OnAccept = function(self)
|
OnAccept = function(self)
|
||||||
if self.data then
|
if self.data then
|
||||||
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
|
OptionsPrivate.DeleteAuras(self.data.toDelete, self.data.parents)
|
||||||
OptionsPrivate.massDelete = true
|
|
||||||
for _, auraData in pairs(self.data.toDelete) do
|
|
||||||
WeakAuras.Delete(auraData)
|
|
||||||
end
|
|
||||||
OptionsPrivate.massDelete = false
|
|
||||||
|
|
||||||
if self.data.parents then
|
|
||||||
for id in pairs(self.data.parents) do
|
|
||||||
local parentData = WeakAuras.GetData(id)
|
|
||||||
local parentButton = OptionsPrivate.GetDisplayButton(id)
|
|
||||||
WeakAuras.UpdateGroupOrders(parentData)
|
|
||||||
if(#parentData.controlledChildren == 0) then
|
|
||||||
parentButton:DisableExpand()
|
|
||||||
else
|
|
||||||
parentButton:EnableExpand()
|
|
||||||
end
|
|
||||||
parentButton:SetNormalTooltip()
|
|
||||||
WeakAuras.Add(parentData)
|
|
||||||
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
|
||||||
parentButton:UpdateParentWarning()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
|
|
||||||
OptionsPrivate.SortDisplayButtons(nil, true)
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
OnCancel = function(self)
|
OnCancel = function(self)
|
||||||
@@ -784,6 +760,54 @@ local function LayoutDisplayButtons(msg)
|
|||||||
OptionsPrivate.Private.dynFrame:AddAction("LayoutDisplayButtons1", co1);
|
OptionsPrivate.Private.dynFrame:AddAction("LayoutDisplayButtons1", co1);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function OptionsPrivate.DeleteAuras(auras, parents)
|
||||||
|
local func1 = function()
|
||||||
|
frame:SetLoadProgressVisible(true)
|
||||||
|
local num = 0
|
||||||
|
local total = 0
|
||||||
|
for _, auraData in pairs(auras) do
|
||||||
|
total = total +1
|
||||||
|
end
|
||||||
|
|
||||||
|
frame.loadProgress:SetText(L["Deleting auras: "]..num.."/"..total)
|
||||||
|
|
||||||
|
local suspended = OptionsPrivate.Private.PauseAllDynamicGroups()
|
||||||
|
OptionsPrivate.massDelete = true
|
||||||
|
for _, auraData in pairs(auras) do
|
||||||
|
WeakAuras.Delete(auraData)
|
||||||
|
num = num +1
|
||||||
|
frame.loadProgress:SetText(L["Deleting auras: "]..num.."/"..total)
|
||||||
|
coroutine.yield()
|
||||||
|
end
|
||||||
|
OptionsPrivate.massDelete = false
|
||||||
|
|
||||||
|
if parents then
|
||||||
|
for id in pairs(parents) do
|
||||||
|
local parentData = WeakAuras.GetData(id)
|
||||||
|
local parentButton = OptionsPrivate.GetDisplayButton(id)
|
||||||
|
WeakAuras.UpdateGroupOrders(parentData)
|
||||||
|
if(#parentData.controlledChildren == 0) then
|
||||||
|
parentButton:DisableExpand()
|
||||||
|
else
|
||||||
|
parentButton:EnableExpand()
|
||||||
|
end
|
||||||
|
parentButton:SetNormalTooltip()
|
||||||
|
WeakAuras.Add(parentData)
|
||||||
|
WeakAuras.ClearAndUpdateOptions(parentData.id)
|
||||||
|
frame.loadProgress:SetText(L["Finishing..."])
|
||||||
|
coroutine.yield()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
OptionsPrivate.Private.ResumeAllDynamicGroups(suspended)
|
||||||
|
OptionsPrivate.SortDisplayButtons(nil, true)
|
||||||
|
|
||||||
|
frame:SetLoadProgressVisible(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
local co1 = coroutine.create(func1)
|
||||||
|
OptionsPrivate.Private.dynFrame:AddAction("Deleting Auras", co1)
|
||||||
|
end
|
||||||
|
|
||||||
function WeakAuras.ShowOptions(msg)
|
function WeakAuras.ShowOptions(msg)
|
||||||
local firstLoad = not(frame);
|
local firstLoad = not(frame);
|
||||||
OptionsPrivate.Private.Pause();
|
OptionsPrivate.Private.Pause();
|
||||||
@@ -1466,51 +1490,75 @@ end
|
|||||||
function OptionsPrivate.Drop(mainAura, target, action, area)
|
function OptionsPrivate.Drop(mainAura, target, action, area)
|
||||||
WeakAuras_DropDownMenu:Hide()
|
WeakAuras_DropDownMenu:Hide()
|
||||||
|
|
||||||
local mode = ""
|
local func1 = function()
|
||||||
if (frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0) then
|
frame:SetLoadProgressVisible(true)
|
||||||
mode = "MULTI"
|
|
||||||
elseif mainAura.controlledChildren then
|
|
||||||
mode = "GROUP"
|
|
||||||
else
|
|
||||||
mode = "SINGLE"
|
|
||||||
end
|
|
||||||
|
|
||||||
local buttonsToSort = {}
|
local total = 0
|
||||||
|
local num = 0
|
||||||
|
for id, button in pairs(displayButtons) do
|
||||||
|
if button:IsDragging() then
|
||||||
|
total = total + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
frame.loadProgress:SetText(L["Moving auras: "]..num.."/"..total)
|
||||||
|
|
||||||
for id, button in pairs(displayButtons) do
|
local mode = ""
|
||||||
if button:IsDragging() then
|
if (frame.pickedDisplay == tempGroup and #tempGroup.controlledChildren > 0) then
|
||||||
tinsert(buttonsToSort, button)
|
mode = "MULTI"
|
||||||
|
elseif mainAura.controlledChildren then
|
||||||
|
mode = "GROUP"
|
||||||
else
|
else
|
||||||
button:Drop(mode, mainAura, target, action);
|
mode = "SINGLE"
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if mode == "MULTI" then
|
local buttonsToSort = {}
|
||||||
-- If we are dragging and dropping multiple auras at once, the order in which we drop is important
|
|
||||||
-- We want to preserve the top-down order
|
for id, button in pairs(displayButtons) do
|
||||||
-- Depending on how exactly we find the insert position, we need to use the right order of insertions
|
if button:IsDragging() then
|
||||||
if area == "GROUP" then
|
tinsert(buttonsToSort, button)
|
||||||
table.sort(buttonsToSort, CompareButtonOrderReverse)
|
num = num + 1
|
||||||
elseif area == "BEFORE" then
|
frame.loadProgress:SetText(L["Preparing auras: "]..num.."/"..total)
|
||||||
table.sort(buttonsToSort, CompareButtonOrder)
|
else
|
||||||
else -- After
|
button:Drop(mode, mainAura, target, action);
|
||||||
table.sort(buttonsToSort, CompareButtonOrderReverse)
|
end
|
||||||
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
num = 0
|
||||||
|
frame.loadProgress:SetText(L["Moving auras: "]..num.."/"..total)
|
||||||
|
if mode == "MULTI" then
|
||||||
|
-- If we are dragging and dropping multiple auras at once, the order in which we drop is important
|
||||||
|
-- We want to preserve the top-down order
|
||||||
|
-- Depending on how exactly we find the insert position, we need to use the right order of insertions
|
||||||
|
if area == "GROUP" then
|
||||||
|
table.sort(buttonsToSort, CompareButtonOrderReverse)
|
||||||
|
elseif area == "BEFORE" then
|
||||||
|
table.sort(buttonsToSort, CompareButtonOrder)
|
||||||
|
else -- After
|
||||||
|
table.sort(buttonsToSort, CompareButtonOrderReverse)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, button in ipairs(buttonsToSort) do
|
||||||
|
button:Drop(mode, mainAura, target, action)
|
||||||
|
num = num + 1
|
||||||
|
frame.loadProgress:SetText(L["Moving auras: "]..num.."/"..total)
|
||||||
|
coroutine.yield()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Update offset, this is a bit wasteful to do for every aura
|
||||||
|
-- But we also need to update the offset if a parent was dragged
|
||||||
|
for _, button in pairs(displayButtons) do
|
||||||
|
button:UpdateOffset();
|
||||||
|
end
|
||||||
|
coroutine.yield()
|
||||||
|
frame:SetLoadProgressVisible(false)
|
||||||
|
OptionsPrivate.SortDisplayButtons()
|
||||||
|
OptionsPrivate.UpdateButtonsScroll()
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, button in ipairs(buttonsToSort) do
|
local co1 = coroutine.create(func1)
|
||||||
button:Drop(mode, mainAura, target, action)
|
OptionsPrivate.Private.dynFrame:AddAction("Dropping Auras", co1)
|
||||||
end
|
|
||||||
|
|
||||||
-- Update offset, this is a bit wasteful to do for every aura
|
|
||||||
-- But we also need to update the offset if a parent was dragged
|
|
||||||
for _, button in pairs(displayButtons) do
|
|
||||||
button:UpdateOffset();
|
|
||||||
end
|
|
||||||
|
|
||||||
OptionsPrivate.SortDisplayButtons()
|
|
||||||
OptionsPrivate.UpdateButtonsScroll()
|
|
||||||
WeakAuras.FillOptions()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function OptionsPrivate.StartDrag(mainAura)
|
function OptionsPrivate.StartDrag(mainAura)
|
||||||
|
|||||||
Reference in New Issue
Block a user