public IAction Redo()
        {
            if (!closed)
            {
                throw new Exception("Can't redo unclosed group.");
            }

            ActionsGroup group = new ActionsGroup();

            group.actions = new List <IAction>(actions).Select(x => x.Redo()).ToList();
            group.actions.Reverse();
            group.closed = true;

            return(group);
        }
Пример #2
0
 public static void UpdateEditEntitiesActions()
 {
     if (ManiacEditor.Methods.Solution.SolutionState.Main.IsEntitiesEdit())
     {
         if (Methods.Solution.CurrentSolution.Entities.SelectedEntities.Count > 0)
         {
             IAction action = new ActionMoveEntities(Methods.Solution.CurrentSolution.Entities.SelectedEntities.ToList(), new System.Drawing.Point(Methods.Solution.SolutionState.Main.DraggedX, Methods.Solution.SolutionState.Main.DraggedY));
             if (Methods.Solution.CurrentSolution.Entities.LastAction != null)
             {
                 // If it is move & duplicate, merge them together
                 var taction = new ActionsGroup();
                 taction.AddAction(Methods.Solution.CurrentSolution.Entities.LastAction);
                 Methods.Solution.CurrentSolution.Entities.LastAction = null;
                 taction.AddAction(action);
                 taction.Close();
                 action = taction;
             }
             Actions.UndoRedoModel.UndoStack.Push(action);
             Actions.UndoRedoModel.RedoStack.Clear();
         }
         if (Methods.Solution.CurrentSolution.Entities.SelectedInternalEntities.Count > 0)
         {
             IAction action = new ActionMoveEntities(Methods.Solution.CurrentSolution.Entities.SelectedInternalEntities.ToList(), new System.Drawing.Point(Methods.Solution.SolutionState.Main.DraggedX, Methods.Solution.SolutionState.Main.DraggedY));
             if (Methods.Solution.CurrentSolution.Entities.LastActionInternal != null)
             {
                 // If it is move & duplicate, merge them together
                 var taction = new ActionsGroup();
                 taction.AddAction(Methods.Solution.CurrentSolution.Entities.LastActionInternal);
                 Methods.Solution.CurrentSolution.Entities.LastActionInternal = null;
                 taction.AddAction(action);
                 taction.Close();
                 action = taction;
             }
             Actions.UndoRedoModel.UndoStack.Push(action);
             Actions.UndoRedoModel.RedoStack.Clear();
         }
     }
     Methods.Internal.UserInterface.UpdateControls(Methods.Internal.UserInterface.UpdateType.UndoRedoButtons);
 }