public bool AktionNodeOderZeichenHinterCursorPosLoeschen(XMLCursorPos position, UndoSnapshotSetzenOptionen undoSnapshotSetzen)
        {
            if (!this.AktionenMoeglich)
            {
                return(false);
            }
            if (undoSnapshotSetzen == UndoSnapshotSetzenOptionen.ja)
            {
                this._undoHandler.SnapshotSetzen(ResReader.Reader.GetString("AktionLoeschen"), this._cursor);
            }
            XMLCursor xMLCursor = new XMLCursor();

            xMLCursor.StartPos.CursorSetzen(position.AktNode, position.PosAmNode, position.PosImTextnode);
            XMLCursorPos xMLCursorPos = xMLCursor.StartPos.Clone();

            xMLCursorPos.MoveRight(this._rootNode, this.Regelwerk);
            xMLCursor.EndPos.CursorSetzen(xMLCursorPos.AktNode, xMLCursorPos.PosAmNode, xMLCursorPos.PosImTextnode);
            xMLCursor.SelektionOptimieren();
            if (xMLCursor.StartPos.AktNode == this._rootNode)
            {
                return(false);
            }
            XMLCursorPos xMLCursorPos2 = default(XMLCursorPos);

            if (xMLCursor.SelektionLoeschen(out xMLCursorPos2))
            {
                this._cursor.BeideCursorPosSetzen(xMLCursorPos2.AktNode, xMLCursorPos2.PosAmNode, xMLCursorPos2.PosImTextnode);
                this._cursor.ErzwingeChanged();
                this.ContentChanged();
                return(true);
            }
            return(false);
        }
예제 #2
0
        public bool AktionNodeOderZeichenHinterCursorPosLoeschen(
            XMLCursorPos position,
            XMLEditor.UndoSnapshotSetzenOptionen undoSnapshotSetzen)
        {
            if (!this.AktionenMoeglich)
            {
                return(false);
            }
            if (undoSnapshotSetzen == XMLEditor.UndoSnapshotSetzenOptionen.ja)
            {
                this._undoHandler.SnapshotSetzen(de.springwald.xml.ResReader.Reader.GetString("AktionLoeschen"), this._cursor);
            }
            XMLCursor xmlCursor = new XMLCursor();

            xmlCursor.StartPos.CursorSetzen(position.AktNode, position.PosAmNode, position.PosImTextnode);
            XMLCursorPos xmlCursorPos = xmlCursor.StartPos.Clone();

            xmlCursorPos.MoveRight(this._rootNode, this.Regelwerk);
            xmlCursor.EndPos.CursorSetzen(xmlCursorPos.AktNode, xmlCursorPos.PosAmNode, xmlCursorPos.PosImTextnode);
            xmlCursor.SelektionOptimieren();
            XMLCursorPos neueCursorPosNachLoeschen;

            if (xmlCursor.StartPos.AktNode == this._rootNode || !xmlCursor.SelektionLoeschen(out neueCursorPosNachLoeschen))
            {
                return(false);
            }
            this._cursor.BeideCursorPosSetzen(neueCursorPosNachLoeschen.AktNode, neueCursorPosNachLoeschen.PosAmNode, neueCursorPosNachLoeschen.PosImTextnode);
            this._cursor.ErzwingeChanged();
            this.ContentChanged();
            return(true);
        }
        private void zeichnungsSteuerelement_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (!this.Regelwerk.PreviewKeyDown(e, out this._naechsteTasteBeiKeyPressAlsTextAufnehmen, this))
            {
                this._naechsteTasteBeiKeyPressAlsTextAufnehmen = false;
                switch (e.KeyData)
                {
                case Keys.Escape:
                case Keys.Control:
                    break;

                case Keys.Return:
                case Keys.LButton | Keys.MButton | Keys.Back | Keys.Shift:
                    this.AktionenEnterGedrueckt();
                    break;

                case Keys.Tab:
                {
                    XmlNode xmlNode = this._cursor.StartPos.AktNode;
                    bool    flag    = false;
                    if (xmlNode.FirstChild != null)
                    {
                        xmlNode = xmlNode.FirstChild;
                    }
                    else if (xmlNode.NextSibling != null)
                    {
                        xmlNode = xmlNode.NextSibling;
                    }
                    else if (xmlNode.ParentNode.NextSibling != null)
                    {
                        xmlNode = xmlNode.ParentNode.NextSibling;
                    }
                    else
                    {
                        flag = true;
                    }
                    if (!flag)
                    {
                        this._cursor.BeideCursorPosSetzen(xmlNode, XMLCursorPositionen.CursorInDemLeeremNode);
                    }
                    this._naechstesLostFokusVerhindern = true;
                    break;
                }

                case Keys.LButton | Keys.MButton | Keys.Space | Keys.Shift:
                    this._cursor.EndPos.MoveLeft(this._rootNode, this.Regelwerk);
                    break;

                case Keys.LButton | Keys.RButton | Keys.MButton | Keys.Space | Keys.Shift:
                    this._cursor.EndPos.MoveRight(this._rootNode, this.Regelwerk);
                    break;

                case (Keys)131137:
                    this.AktionAllesMarkieren();
                    break;

                case (Keys)131160:
                    this.AktionCutToClipboard(UndoSnapshotSetzenOptionen.ja);
                    break;

                case (Keys)131139:
                    this.AktionCopyToClipboard();
                    break;

                case (Keys)131158:
                    this.AktionPasteFromClipboard(UndoSnapshotSetzenOptionen.ja);
                    break;

                case Keys.Home:
                    this.AktionCursorAufPos1();
                    break;

                case (Keys)131162:
                    this.UnDo();
                    break;

                case Keys.Left:
                {
                    XMLCursorPos xMLCursorPos = this._cursor.StartPos.Clone();
                    xMLCursorPos.MoveLeft(this._rootNode, this.Regelwerk);
                    this._cursor.BeideCursorPosSetzen(xMLCursorPos.AktNode, xMLCursorPos.PosAmNode, xMLCursorPos.PosImTextnode);
                    break;
                }

                case Keys.Right:
                {
                    XMLCursorPos xMLCursorPos = this._cursor.StartPos.Clone();
                    xMLCursorPos.MoveRight(this._rootNode, this.Regelwerk);
                    this._cursor.BeideCursorPosSetzen(xMLCursorPos.AktNode, xMLCursorPos.PosAmNode, xMLCursorPos.PosImTextnode);
                    break;
                }

                case Keys.Back:
                case Keys.Back | Keys.Shift:
                    if (this._cursor.IstEtwasSelektiert)
                    {
                        this.AktionDelete(UndoSnapshotSetzenOptionen.ja);
                    }
                    else
                    {
                        this.AktionNodeOderZeichenVorDerCursorPosLoeschen(this._cursor.StartPos, UndoSnapshotSetzenOptionen.ja);
                    }
                    break;

                case Keys.Delete:
                case Keys.RButton | Keys.MButton | Keys.Back | Keys.Space | Keys.Shift:
                    if (this._cursor.IstEtwasSelektiert)
                    {
                        this.AktionDelete(UndoSnapshotSetzenOptionen.ja);
                    }
                    else
                    {
                        this.AktionNodeOderZeichenHinterCursorPosLoeschen(this._cursor.StartPos, UndoSnapshotSetzenOptionen.ja);
                    }
                    break;

                default:
                    this._naechsteTasteBeiKeyPressAlsTextAufnehmen = true;
                    break;
                }
            }
        }