コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
ファイル: HCUndo.cs プロジェクト: talent-zhang/HCView-CSharp
        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);
        }
コード例 #3
0
ファイル: HCUndoData.cs プロジェクト: qq32qq/HCView-CSharp
        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;
        }
コード例 #4
0
        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);
        }