NofitySplitNewLine() статический приватный Метод

static private NofitySplitNewLine ( TextSurfaceEventListener listener, UIKeyEventArgs e ) : void
listener TextSurfaceEventListener
e LayoutFarm.UI.UIKeyEventArgs
Результат void
        public bool OnProcessDialogKey(UIKeyEventArgs e)
        {
            UIKeys keyData = (UIKeys)e.KeyData;

            SetCaretState(true);

            if (isInVerticalPhase && (keyData != UIKeys.Up || keyData != UIKeys.Down))
            {
                isInVerticalPhase = false;
            }

            switch (e.KeyCode)
            {
            case UIKeys.Home:
            {
                OnKeyDown(e);
                return(true);
            }

            case UIKeys.Return:
            {
                if (textSurfaceEventListener != null &&
                    TextSurfaceEventListener.NotifyPreviewEnter(textSurfaceEventListener))
                {
                    return(true);
                }
                if (isMultiLine)
                {
                    if (internalTextLayerController.SelectionRange != null)
                    {
                        InvalidateGraphicLocalArea(this, GetSelectionUpdateArea());
                    }
                    internalTextLayerController.SplitCurrentLineIntoNewLine();


                    if (textSurfaceEventListener != null)
                    {
                        TextSurfaceEventListener.NofitySplitNewLine(textSurfaceEventListener, e);
                    }

                    Rectangle lineArea = internalTextLayerController.CurrentLineArea;
                    if (lineArea.Bottom > this.ViewportBottom)
                    {
                        ScrollBy(0, lineArea.Bottom - this.ViewportBottom);
                    }
                    else
                    {
                        InvalidateGraphicOfCurrentLineArea();
                    }
                    EnsureCaretVisible();

                    return(true);
                }
                return(true);
            }

            case UIKeys.Left:
            {
                if (textSurfaceEventListener != null &&
                    TextSurfaceEventListener.NotifyPreviewArrow(textSurfaceEventListener, keyData))
                {
                    return(true);
                }

                InvalidateGraphicOfCurrentLineArea();
                if (!e.Shift)
                {
                    internalTextLayerController.CancelSelect();
                }
                else
                {
                    internalTextLayerController.StartSelectIfNoSelection();
                }

                Point currentCaretPos = Point.Empty;
                if (!isMultiLine)
                {
                    while (!internalTextLayerController.IsOnStartOfLine)
                    {
                        Point prvCaretPos = internalTextLayerController.CaretPos;
                        internalTextLayerController.CharIndex--;
                        currentCaretPos = internalTextLayerController.CaretPos;
                        if (currentCaretPos.X != prvCaretPos.X)
                        {
                            break;
                        }
                    }
                }
                else
                {
                    if (internalTextLayerController.IsOnStartOfLine)
                    {
                        internalTextLayerController.CharIndex--;
                        currentCaretPos = internalTextLayerController.CaretPos;
                    }
                    else
                    {
                        while (!internalTextLayerController.IsOnStartOfLine)
                        {
                            Point prvCaretPos = internalTextLayerController.CaretPos;
                            internalTextLayerController.CharIndex--;
                            currentCaretPos = internalTextLayerController.CaretPos;
                            if (currentCaretPos.X != prvCaretPos.X)
                            {
                                break;
                            }
                        }
                    }
                }
                //-------------------
                if (e.Shift)
                {
                    internalTextLayerController.EndSelectIfNoSelection();
                }
                //-------------------

                EnsureCaretVisible();
                if (textSurfaceEventListener != null)
                {
                    TextSurfaceEventListener.NotifyArrowKeyCaretPosChanged(textSurfaceEventListener, keyData);
                }

                return(true);
            }

            case UIKeys.Right:
            {
                if (textSurfaceEventListener != null &&
                    TextSurfaceEventListener.NotifyPreviewArrow(textSurfaceEventListener, keyData))
                {
                    return(true);
                }

                InvalidateGraphicOfCurrentLineArea();
                if (!e.Shift)
                {
                    internalTextLayerController.CancelSelect();
                }
                else
                {
                    internalTextLayerController.StartSelectIfNoSelection();
                }


                Point currentCaretPos = Point.Empty;
                if (!isMultiLine)
                {
                    while (!internalTextLayerController.IsOnEndOfLine)
                    {
                        Point prvCaretPos = internalTextLayerController.CaretPos;
                        internalTextLayerController.CharIndex++;
                        currentCaretPos = internalTextLayerController.CaretPos;
                        if (currentCaretPos.X != prvCaretPos.X)
                        {
                            int nextCharWidth = internalTextLayerController.GetNextCharacterWidth();
                            if (nextCharWidth > 0)
                            {
                                break;
                            }
                        }
                    }
                }
                else
                {
                    if (internalTextLayerController.IsOnEndOfLine)
                    {
                        internalTextLayerController.CharIndex++;
                        currentCaretPos = internalTextLayerController.CaretPos;
                    }
                    else
                    {
                        while (!internalTextLayerController.IsOnEndOfLine)
                        {
                            Point prvCaretPos = internalTextLayerController.CaretPos;
                            internalTextLayerController.CharIndex++;
                            currentCaretPos = internalTextLayerController.CaretPos;

                            if (currentCaretPos.X != prvCaretPos.X)
                            {
                                //forward check next caret
                                int nextCharWidth = internalTextLayerController.GetNextCharacterWidth();
                                if (nextCharWidth > 0)
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
                //-------------------
                if (e.Shift)
                {
                    internalTextLayerController.EndSelectIfNoSelection();
                }
                //-------------------

                EnsureCaretVisible();
                if (textSurfaceEventListener != null)
                {
                    TextSurfaceEventListener.NotifyArrowKeyCaretPosChanged(textSurfaceEventListener, keyData);
                }

                return(true);
            }

            case UIKeys.Down:
            {
                if (textSurfaceEventListener != null &&
                    TextSurfaceEventListener.NotifyPreviewArrow(textSurfaceEventListener, keyData))
                {
                    return(true);
                }
                if (isMultiLine)
                {
                    if (!isInVerticalPhase)
                    {
                        isInVerticalPhase         = true;
                        verticalExpectedCharIndex = internalTextLayerController.CharIndex;
                    }

                    //----------------------------
                    if (!e.Shift)
                    {
                        internalTextLayerController.CancelSelect();
                    }
                    else
                    {
                        internalTextLayerController.StartSelectIfNoSelection();
                    }
                    //----------------------------

                    internalTextLayerController.CurrentLineNumber++;

                    if (verticalExpectedCharIndex > internalTextLayerController.CurrentLineCharCount - 1)
                    {
                        internalTextLayerController.CharIndex = internalTextLayerController.CurrentLineCharCount - 1;
                    }
                    else
                    {
                        internalTextLayerController.CharIndex = verticalExpectedCharIndex;
                    }
                    //----------------------------

                    if (e.Shift)
                    {
                        internalTextLayerController.EndSelectIfNoSelection();
                    }
                    //----------------------------
                    Rectangle lineArea = internalTextLayerController.CurrentLineArea;
                    if (lineArea.Bottom > this.ViewportBottom)
                    {
                        ScrollBy(0, lineArea.Bottom - this.ViewportBottom);
                    }
                    else
                    {
                        InvalidateGraphicOfCurrentLineArea();
                    }
                }

                if (textSurfaceEventListener != null)
                {
                    TextSurfaceEventListener.NotifyArrowKeyCaretPosChanged(textSurfaceEventListener, keyData);
                }
                return(true);
            }

            case UIKeys.Up:
            {
                if (textSurfaceEventListener != null &&
                    TextSurfaceEventListener.NotifyPreviewArrow(textSurfaceEventListener, keyData))
                {
                    return(true);
                }

                if (isMultiLine)
                {
                    if (!isInVerticalPhase)
                    {
                        isInVerticalPhase         = true;
                        verticalExpectedCharIndex = internalTextLayerController.CharIndex;
                    }

                    //----------------------------
                    if (!e.Shift)
                    {
                        internalTextLayerController.CancelSelect();
                    }
                    else
                    {
                        internalTextLayerController.StartSelectIfNoSelection();
                    }
                    //----------------------------

                    internalTextLayerController.CurrentLineNumber--;

                    if (verticalExpectedCharIndex > internalTextLayerController.CurrentLineCharCount - 1)
                    {
                        internalTextLayerController.CharIndex = internalTextLayerController.CurrentLineCharCount - 1;
                    }
                    else
                    {
                        internalTextLayerController.CharIndex = verticalExpectedCharIndex;
                    }

                    //----------------------------
                    if (e.Shift)
                    {
                        internalTextLayerController.EndSelectIfNoSelection();
                    }

                    Rectangle lineArea = internalTextLayerController.CurrentLineArea;

                    if (lineArea.Top < ViewportY)
                    {
                        ScrollBy(0, lineArea.Top - ViewportY);
                    }
                    else
                    {
                        EnsureCaretVisible();
                        InvalidateGraphicOfCurrentLineArea();
                    }
                }
                else
                {
                }
                if (textSurfaceEventListener != null)
                {
                    TextSurfaceEventListener.NotifyArrowKeyCaretPosChanged(textSurfaceEventListener, keyData);
                }
                return(true);
            }

            case UIKeys.Tab:
            {
                DoTab();
                return(true);
            }

            default:
            {
                return(false);
            }
            }
        }