From e9a739f45fdc464b19ad520c3efcb202d8bd5458 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 18 Jul 2011 01:33:57 +0100 Subject: refactor: group all the undo/redo code in SOP into one place for easier code reading --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 121 +++++++++++---------- 1 file changed, 62 insertions(+), 59 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6b9607c..253326e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -414,7 +414,6 @@ namespace OpenSim.Region.Framework.Scenes CreateSelected = true; TrimPermissions(); - //m_undo = new UndoStack(ParentGroup.GetSceneMaxUndo()); m_inventory = new SceneObjectPartInventory(this); } @@ -1621,19 +1620,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void ClearUndoState() - { - lock (m_undo) - { - m_undo.Clear(); - } - lock (m_redo) - { - m_redo.Clear(); - } - StoreUndoState(); - } - public byte ConvertScriptUintToByte(uint indata) { byte outdata = (byte)TextureAnimFlags.NONE; @@ -3721,6 +3707,68 @@ namespace OpenSim.Region.Framework.Scenes // } } + public void Undo() + { +// m_log.DebugFormat("[SCENE OBJECT PART]: Handling undo request for {0} {1}", Name, LocalId); + + lock (m_undo) + { + if (m_undo.Count > 0) + { + UndoState nUndo = null; + + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + nUndo = new UndoState(this); + } + + UndoState goback = m_undo.Pop(); + + if (goback != null) + { + goback.PlaybackState(this); + if (nUndo != null) + m_redo.Push(nUndo); + } + } + } + } + + public void Redo() + { +// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId); + + lock (m_redo) + { + if (m_parentGroup.GetSceneMaxUndo() > 0) + { + UndoState nUndo = new UndoState(this); + + m_undo.Push(nUndo); + } + + UndoState gofwd = m_redo.Pop(); + + if (gofwd != null) + gofwd.PlayfwdState(this); + } + } + + public void ClearUndoState() + { + lock (m_undo) + { + m_undo.Clear(); + } + + lock (m_redo) + { + m_redo.Clear(); + } + + StoreUndoState(); + } + public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) { // In this case we're using a sphere with a radius of the largest dimension of the prim @@ -4181,51 +4229,6 @@ namespace OpenSim.Region.Framework.Scenes _nextOwnerMask &= (uint)PermissionMask.All; } - public void Undo() - { - lock (m_undo) - { - if (m_undo.Count > 0) - { - UndoState nUndo = null; - - if (m_parentGroup.GetSceneMaxUndo() > 0) - { - nUndo = new UndoState(this); - } - - UndoState goback = m_undo.Pop(); - - if (goback != null) - { - goback.PlaybackState(this); - if (nUndo != null) - m_redo.Push(nUndo); - } - } - } - } - - public void Redo() - { -// m_log.DebugFormat("[SCENE OBJECT PART]: Handling redo request for {0} {1}", Name, LocalId); - - lock (m_redo) - { - if (m_parentGroup.GetSceneMaxUndo() > 0) - { - UndoState nUndo = new UndoState(this); - - m_undo.Push(nUndo); - } - - UndoState gofwd = m_redo.Pop(); - - if (gofwd != null) - gofwd.PlayfwdState(this); - } - } - public void UpdateExtraParam(ushort type, bool inUse, byte[] data) { m_shape.ReadInUpdateExtraParam(type, inUse, data); -- cgit v1.1