/// <summary> /// Call this when the user hits CTRL + Z /// </summary> public void Undo() { Functions.PrintDebug("Undo() called", typeof(UndoBuffer)); if (mi_Undo.Count == 0) { mi_Box.WriteStatus("Undo not available!"); return; } RtfData i_Old = (RtfData) mi_Undo.Pop(); RtfData i_New = new RtfData(mi_Box); // The new text has just been pushed and nothing changed afterwards if (i_Old.Equals(i_New) && mi_Undo.Count > 0) i_Old = (RtfData) mi_Undo.Pop(); i_Old.SetRtf(mi_Box); mi_Redo.Push (i_New); DebugOut(); }
public bool Equals(RtfData i_Data) { return (s_Rtf == i_Data.s_Rtf && s32_SelStart == i_Data.s32_SelStart && s32_SelLen == i_Data.s32_SelLen); }
/// <summary> /// Call this when the user hits CTRL + Y /// </summary> public void Redo() { Functions.PrintDebug("Redo() called", typeof(UndoBuffer)); if (mi_Redo.Count == 0) { mi_Box.WriteStatus("Redo not available!"); return; } RtfData i_Old = (RtfData) mi_Redo.Pop(); RtfData i_New = new RtfData(mi_Box); i_Old.SetRtf(mi_Box); mi_Undo.Push (i_New); DebugOut(); }