protected void UndoAction_DeleteBackText(int aItemNo, int aOffset, string aText) { HCUndoList vUndoList = GetUndoList(); if ((vUndoList != null) && vUndoList.Enable) { HCUndo vUndo = vUndoList.Last; if (vUndo != null) { HCTextUndoAction vTextAction = vUndo.ActionAppend(UndoActionTag.uatDeleteBackText, aItemNo, aOffset, Items[aItemNo].ParaFirst) as HCTextUndoAction; vTextAction.Text = aText; } } }
public HCCustomUndoAction ActionAppend(HCAction aTag, int aItemNo, int aOffset, bool aParaFirst) { HCCustomUndoAction Result = null; switch (aTag) { case HCAction.actBackDeleteText: case HCAction.actDeleteText: case HCAction.actInsertText: Result = new HCTextUndoAction(); break; case HCAction.actSetItemText: Result = new HCSetItemTextUndoAction(); break; case HCAction.actDeleteItem: case HCAction.actInsertItem: case HCAction.actItemMirror: Result = new HCItemUndoAction(); break; //case HCAction.actItemProperty: // Result = new HCItemParaFirstUndoAction(); // break; case HCAction.actItemSelf: Result = new HCItemSelfUndoAction(); break; default: Result = new HCCustomUndoAction(); break; } Result.Tag = aTag; Result.ItemNo = aItemNo; Result.Offset = aOffset; Result.ParaFirst = aParaFirst; this.Actions.Add(Result); return(Result); }
private void UndoRedoDeleteText(HCCustomUndoAction aAction, bool aIsUndo, ref int aCaretItemNo, ref int aCaretOffset) { HCTextUndoAction vAction = aAction as HCTextUndoAction; aCaretItemNo = vAction.ItemNo; int vLen = vAction.Text.Length; string vText = Items[vAction.ItemNo].Text; if (aIsUndo) { vText = vText.Insert(vAction.Offset - 1, vAction.Text); } else { vText = vText.Remove(vAction.Offset - 1, vLen); } aCaretOffset = vAction.Offset - 1; Items[vAction.ItemNo].Text = vText; }
public HCCustomUndoAction ActionAppend(UndoActionTag ATag, int AItemNo, int AOffset) { HCCustomUndoAction Result = null; switch (ATag) { case UndoActionTag.uatDeleteText: case UndoActionTag.uatInsertText: Result = new HCTextUndoAction(); break; case UndoActionTag.uatDeleteItem: case UndoActionTag.uatInsertItem: Result = new HCItemUndoAction(); break; case UndoActionTag.uatItemProperty: Result = new HCItemParaFirstUndoAction(); break; case UndoActionTag.uatItemSelf: Result = new HCItemSelfUndoAction(); break; default: Result = new HCCustomUndoAction(); break; } Result.Tag = ATag; Result.ItemNo = AItemNo; Result.Offset = AOffset; this.Actions.Add(Result); return(Result); }