public void RecordUndo(CanvasState state) { if (undostack.Count > 0 && undostack.Last.Equals(state)) { return; } undostack.AddLast(state); if (undostack.Count > 20) { undostack.RemoveFirst(); } }
CanvasState MakeState(Rectangle area) { var sel = Selection; _selection = area; var r = new CanvasState() { data = Copy(), area = area, selection = sel, }; _selection = sel; return(r); }
void ApplyState(CanvasState state) { _selection = state.area; Paste(state.data, false); Selection = state.selection; }