public void RedoInternal(bool IncludeSelectionOperation = false) { if (redoStack.Count == 0) { return; } PostFilter redoFilter; do { redoFilter = redoStack.Pop(); undoStack.Push(redoFilter); redoFilter.Apply(); } while ((!IncludeSelectionOperation && redoFilter is SelectionOperation) && redoStack.Count != 0); if (!(redoFilter is EditingDeactivatedOperation || redoFilter is SelectionOperation || redoFilter is SetColorOperation)) { ClearCanvas(false); RecreateCanvasViewModel(); UpdateUIElements(); DisplaySettingsTool.SliceImage(); } else { UpdateUIElements(); } SelectedTool.OnRedo(); }
public async void AddColumn(bool addRight, int index = -1, IDominoShape colorReference = null) { var selected = GetSelectedDominoes(); try { if (selected.Count > 0 || index != -1) { int selDomino = selected.Count > 0 ? selected.First() : index; int color = (colorReference ?? dominoTransfer[selDomino]).Color; if (CurrentProject is IRowColumnAddableDeletable) { AddColumns addRows = new AddColumns((CurrentProject as IRowColumnAddableDeletable), selDomino, 1, color, addRight); ClearCanvas(); ExecuteOperation(addRows); RecreateCanvasViewModel(); SelectionTool.Select(addRows.added_indizes, true); UpdateUIElements(); DisplaySettingsTool.SliceImage(); } else { await Errorhandler.RaiseMessage(_("Adding columns is not supported in this project."), _("Add Row"), Errorhandler.MessageType.Warning); } } } catch (InvalidOperationException ex) { await Errorhandler.RaiseMessage(ex.Message, _("Error"), Errorhandler.MessageType.Error); } }
public void UndoInternal(bool IncludeSelectionOperation = false) { if (undoStack.Count == 0) { return; } PostFilter undoFilter; do { undoFilter = undoStack.Pop(); redoStack.Push(undoFilter); undoFilter.Undo(); } while ((!IncludeSelectionOperation && (undoFilter is SelectionOperation)) && (undoStack.Count != 0)); if (!(undoFilter is EditingActivatedOperation || undoFilter is SelectionOperation || undoFilter is SetColorOperation)) { ClearCanvas(false); RecreateCanvasViewModel(); UpdateUIElements(); DisplaySettingsTool.SliceImage(); if (undoStack.Count == 0) { UnsavedChanges = false; } } else { UpdateUIElements(); } SelectedTool.OnUndo(); }
public async void RemoveSelColumns(int index = -1) { var selected = GetSelectedDominoes(); try { if (CurrentProject is IRowColumnAddableDeletable) { int[] deletionIndices = null; if (index != -1) { deletionIndices = new int[] { index }; } if (selected.Count > 0) { deletionIndices = selected.ToArray(); } if (deletionIndices != null) { DeleteColumns deleteColumns = new DeleteColumns((CurrentProject as IRowColumnAddableDeletable), deletionIndices); ClearCanvas(); ExecuteOperation(deleteColumns); RecreateCanvasViewModel(); DisplaySettingsTool.SliceImage(); } } else { await Errorhandler.RaiseMessage(_("Removing columns is not supported in this project."), _("Remove Column"), Errorhandler.MessageType.Warning); } } catch (InvalidOperationException ex) { await Errorhandler.RaiseMessage(ex.Message, _("Error"), Errorhandler.MessageType.Error); } }