mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Add warning when performing destructive undo of global operation
This commit is contained in:
parent
d695226657
commit
d1a2c53bd7
2 changed files with 103 additions and 1 deletions
|
@ -278,6 +278,31 @@ namespace Beefy.utils
|
|||
return true;
|
||||
}
|
||||
|
||||
public void PreUndo(delegate void (UndoAction) dlg)
|
||||
{
|
||||
int undoIdx = mUndoIdx;
|
||||
if (undoIdx == 0)
|
||||
return;
|
||||
|
||||
var undoAction = mUndoList[undoIdx - 1];
|
||||
if (IUndoBatchEnd undoBatchEnd = undoAction as IUndoBatchEnd)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
dlg(undoAction);
|
||||
if (undoIdx == 0)
|
||||
return;
|
||||
undoIdx--;
|
||||
if ((undoAction == undoBatchEnd.BatchStart) || (undoIdx == 0))
|
||||
return;
|
||||
undoAction = mUndoList[undoIdx - 1];
|
||||
}
|
||||
}
|
||||
|
||||
dlg(undoAction);
|
||||
undoIdx--;
|
||||
}
|
||||
|
||||
public bool Redo()
|
||||
{
|
||||
mSkipNextMerge = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue