상속: UIEventArgs
 void sgBox_ListItemKeyboardEvent(object sender, UIKeyEventArgs e)
 {
     //keyboard event occurs on list item in suggestion box
     //
     switch (e.UIEventName)
     {
         case UIEventName.KeyDown:
             {
                 switch (e.KeyCode)
                 {
                     case UIKeys.Down:
                         sgBox.SelectedIndex++;
                         e.CancelBubbling = true;
                         break;
                     case UIKeys.Up:
                         sgBox.SelectedIndex--;
                         e.CancelBubbling = true;
                         break;
                     case UIKeys.Enter:
                         //use select some item
                         sgBox_UserConfirmSelectedItem(null, EventArgs.Empty);
                         e.CancelBubbling = true;
                         break;
                     default:
                         textbox.Focus();
                         break;
                 }
             }
             break;
     }
 }
예제 #2
0
 public void HandleKeyUp(UIKeyEventArgs keyEventArgs)
 {
     _canvasViewport.FullMode = false;
     _topWinEventRoot.RootKeyUp(keyEventArgs);
     keyEventArgs.ResetAll();
     PrepareRenderAndFlushAccumGraphics();
 }
        //------------------------------------------------------
        UIKeyEventArgs GetTranslatedUIKeyEventArg(System.Windows.Forms.KeyEventArgs e)
        {
            UIKeyEventArgs keyEventArg = _keyEventStack.Count > 0 ? _keyEventStack.Pop() : new UIKeyEventArgs();

            keyEventArg.SetEventInfo((int)e.KeyData, e.Shift, e.Alt, e.Control);
            return(keyEventArg);
        }
        UIKeyEventArgs GetTranslatedUIKeyEventArg(System.Windows.Forms.KeyPressEventArgs e)
        {
            UIKeyEventArgs keyEventArg = _keyEventStack.Count > 0 ? _keyEventStack.Pop() : new UIKeyEventArgs();

            keyEventArg.SetKeyChar(e.KeyChar);
            return(keyEventArg);
        }
예제 #5
0
        void simpleBox_KeyDown(object sender, UIKeyEventArgs e)
        {
            if (selectedItem != null && ListItemKeyboardEvent != null)
            {
                e.UIEventName = UIEventName.KeyDown;
                ListItemKeyboardEvent(this, e);
            }
            //switch (e.KeyCode)
            //{
            //    case UIKeys.Down:
            //        {
            //            e.CancelBubbling = true;
            //            SelectedIndex++;
            //        } break;
            //    case UIKeys.Up:
            //        {
            //            e.CancelBubbling = true;
            //            SelectedIndex--;
            //        } break;
            //    case UIKeys.Enter:
            //        {
            //            //accept selected item?

            //            if (selectedItem != null && ListItemKeyboardEvent != null)
            //            {
            //                ListItemKeyboardEvent(this, e);
            //            }
            //        }
            //        break;
            //    case UIKeys.Escape:
            //        //
            //        break;
            //}
        }
예제 #6
0
        bool IEventListener.ListenProcessDialogKey(UIKeyEventArgs e)
        {
            //TODO: review this, no external event or beh for this?
            bool result = OnProcessDialogKey(e);

            _externalEventListener?.ListenProcessDialogKey(e);
            return(result);
        }
        public void HandleKeyUp(System.Windows.Forms.KeyEventArgs e)
        {
            _canvasViewport.FullMode = false;
            UIKeyEventArgs keyEventArgs = GetTranslatedUIKeyEventArg(e);

            _topWinEventRoot.RootKeyUp(keyEventArgs);
            ReleaseUIKeyEventArgs(keyEventArgs);

            PrepareRenderAndFlushAccumGraphics();
        }
예제 #8
0
        //------------------------------------------------------
        public void HandleKeyDown(UIKeyEventArgs keyEventArgs)
        {
#if DEBUG
            //System.Diagnostics.Debug.WriteLine("keydown" + (dbug_keydown_count++));
            dbugTopwin.dbugVisualRoot?.dbug_PushLayoutTraceMessage("======");
            dbugTopwin.dbugVisualRoot?.dbug_PushLayoutTraceMessage("KEYDOWN " + (LayoutFarm.UI.UIKeys)keyEventArgs.KeyCode);
            dbugTopwin.dbugVisualRoot?.dbug_PushLayoutTraceMessage("======");
#endif
            _canvasViewport.FullMode = false;
            _topWinEventRoot.RootKeyDown(keyEventArgs);
            keyEventArgs.ResetAll();
            PrepareRenderAndFlushAccumGraphics();
        }
        //------------------------------------------------------
        public void HandleKeyDown(System.Windows.Forms.KeyEventArgs e)
        {
#if DEBUG
            //System.Diagnostics.Debug.WriteLine("keydown" + (dbug_keydown_count++));
            dbugTopwin.dbugVisualRoot.dbug_PushLayoutTraceMessage("======");
            dbugTopwin.dbugVisualRoot.dbug_PushLayoutTraceMessage("KEYDOWN " + (LayoutFarm.UI.UIKeys)e.KeyCode);
            dbugTopwin.dbugVisualRoot.dbug_PushLayoutTraceMessage("======");
#endif
            _canvasViewport.FullMode = false;
            UIKeyEventArgs keyEventArgs = GetTranslatedUIKeyEventArg(e);
            _topWinEventRoot.RootKeyDown(keyEventArgs);
            ReleaseUIKeyEventArgs(keyEventArgs);

            PrepareRenderAndFlushAccumGraphics();
        }
        //#if DEBUG
        //        static int dbug_preview_dialogKey_count = 0;
        //#endif

        public bool HandleProcessDialogKey(Keys keyData)
        {
            //#if DEBUG
            //          System.Diagnostics.Debug.WriteLine("prev_dlgkey" + (dbug_preview_dialogKey_count++));
            //#endif
            _canvasViewport.FullMode = false;

            UIKeyEventArgs keyEventArgs = GetFreeUIKeyEventArg();

            keyEventArgs.SetEventInfo((int)keyData, false, false, false);//f-f-f will be set later
            bool result = _topWinEventRoot.RootProcessDialogKey(keyEventArgs);

            if (result)
            {
                PrepareRenderAndFlushAccumGraphics();
            }
            ReleaseUIKeyEventArgs(keyEventArgs);
            return(result);
        }
예제 #11
0
        public void HandleKeyPress(UIKeyEventArgs keyEventArgs, char keyChar)
        {
            if (char.IsControl(keyChar))
            {
                return;
            }
#if DEBUG
            dbugTopwin.dbugVisualRoot?.dbug_PushLayoutTraceMessage("======");
            dbugTopwin.dbugVisualRoot?.dbug_PushLayoutTraceMessage("KEYPRESS " + keyChar);
            dbugTopwin.dbugVisualRoot?.dbug_PushLayoutTraceMessage("======");
#endif
            _canvasViewport.FullMode = false;

            keyEventArgs.SetKeyChar(keyChar);
            _topWinEventRoot.RootKeyPress(keyEventArgs);
            keyEventArgs.ResetAll();

            PrepareRenderAndFlushAccumGraphics();
        }
        public void HandleKeyPress(System.Windows.Forms.KeyPressEventArgs e)
        {
            if (char.IsControl(e.KeyChar))
            {
                return;
            }
#if DEBUG
            dbugTopwin.dbugVisualRoot.dbug_PushLayoutTraceMessage("======");
            dbugTopwin.dbugVisualRoot.dbug_PushLayoutTraceMessage("KEYPRESS " + e.KeyChar);
            dbugTopwin.dbugVisualRoot.dbug_PushLayoutTraceMessage("======");
#endif
            _canvasViewport.FullMode = false;

            UIKeyEventArgs keyEventArgs = GetTranslatedUIKeyEventArg(e);
            keyEventArgs.SetKeyChar(e.KeyChar);
            _topWinEventRoot.RootKeyPress(keyEventArgs);
            ReleaseUIKeyEventArgs(keyEventArgs);

            PrepareRenderAndFlushAccumGraphics();
        }
 void IEventListener.ListenKeyPress(UIKeyEventArgs e)
 {
     OnKeyPress(e);
 }
예제 #14
0
 protected virtual bool OnProcessDialogKey(UIKeyEventArgs e)
 {
     return(false);
 }
예제 #15
0
 protected virtual void OnKeyUp(UIKeyEventArgs e)
 {
 }
        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;
                    }
            }
        }
 public void OnKeyUp(UIKeyEventArgs e)
 {
     this.SetCaretState(true);
 }
예제 #18
0
 void IEventListener.ListenKeyUp(UIKeyEventArgs e)
 {
     KeyUp?.Invoke(this, e);
 }
예제 #19
0
 protected override void OnKeyPress(UIKeyEventArgs e)
 {
     base.OnKeyPress(e);
 }
 internal static void NofitySplitNewLine(TextSurfaceEventListener listener, UIKeyEventArgs e)
 {
     if (listener.SplitedNewLine != null)
     {
         listener.SplitedNewLine(listener, e);
     }
 }
 bool IEventPortal.PortalProcessDialogKey(UIKeyEventArgs e)
 {
     return false;
 }
 void IEventPortal.PortalKeyPress(UIKeyEventArgs e)
 {
 }
 void IEventPortal.PortalKeyUp(UIKeyEventArgs e)
 {
 }
 void IEventPortal.PortalKeyDown(UIKeyEventArgs e)
 {
 }
예제 #25
0
 //-------------------
 protected override bool OnProcessDialogKey(UIKeyEventArgs e)
 {
     if (KeyDown != null)
     {
         KeyDown(this, e);
     }
     //return true if you want to stop event bubble to other 
     if (e.CancelBubbling)
     {
         return true;
     }
     else
     {
         return base.OnProcessDialogKey(e);
     }
 }
 bool IEventListener.ListenProcessDialogKey(UIKeyEventArgs e)
 {
     return(OnProcessDialogKey(e));
 }
 //------------------------------------------------------------
 void IEventPortal.PortalKeyUp(UIKeyEventArgs e)
 {
     //this.OnKeyUp(e);
 }
 void IEventPortal.PortalKeyDown(UIKeyEventArgs e)
 {
     //this.OnKeyDown(e);
 }
 void IEventListener.ListenKeyDown(UIKeyEventArgs e)
 {
     OnKeyDown(e);
 }
 void IEventPortal.PortalKeyPress(UIKeyEventArgs e)
 {
     // this.OnKeyPress(e);
 }
        public void OnKeyPress(UIKeyEventArgs e)
        {
            this.SetCaretState(true);
            //------------------------
            if (e.IsControlCharacter)
            {
                OnKeyDown(e);
                return;
            }

            char c = e.KeyChar;
            e.CancelBubbling = true;
            if (internalTextLayerController.SelectionRange != null
                && internalTextLayerController.SelectionRange.IsValid)
            {
                InvalidateGraphicLocalArea(this, GetSelectionUpdateArea());
            }
            bool preventDefault = false;
            if (textSurfaceEventListener != null &&
                !(preventDefault = TextSurfaceEventListener.NotifyPreviewKeydown(textSurfaceEventListener, c)))
            {
                internalTextLayerController.UpdateSelectionRange();
            }
            if (preventDefault)
            {
                return;
            }
            if (internalTextLayerController.SelectionRange != null)
            {
                internalTextLayerController.AddCharToCurrentLine(c);
                if (textSurfaceEventListener != null)
                {
                    TextSurfaceEventListener.NotifyCharactersReplaced(textSurfaceEventListener, e.KeyChar);
                }
            }
            else
            {
                internalTextLayerController.AddCharToCurrentLine(c);
                if (textSurfaceEventListener != null)
                {
                    TextSurfaceEventListener.NotifyCharacterAdded(textSurfaceEventListener, e.KeyChar);
                }
            }

            EnsureCaretVisible();
            if (textSurfaceEventListener != null)
            {
                TextSurfaceEventListener.NotifyKeyDown(textSurfaceEventListener, e.KeyCode);
            }
        }
 bool IEventPortal.PortalProcessDialogKey(UIKeyEventArgs e)
 {
     return false;
     //return this.OnProcessDialogKey(e);
 }
        public void OnKeyDown(UIKeyEventArgs e)
        {
            this.SetCaretState(true);
            if (!e.HasKeyData)
            {
                return;
            }

            switch (e.KeyCode)
            {
                case UIKeys.Home:
                    {
                        this.DoHome(e.Shift);
                    }
                    break;
                case UIKeys.End:
                    {
                        this.DoEnd(e.Shift);
                    }
                    break;
                case UIKeys.Back:
                    {
                        if (internalTextLayerController.SelectionRange != null)
                        {
                            InvalidateGraphicLocalArea(this, GetSelectionUpdateArea());
                        }
                        else
                        {
                            InvalidateGraphicOfCurrentLineArea();
                        }
                        if (textSurfaceEventListener == null)
                        {
                            internalTextLayerController.DoBackspace();
                        }
                        else
                        {
                            if (!TextSurfaceEventListener.NotifyPreviewBackSpace(textSurfaceEventListener) &&
                                internalTextLayerController.DoBackspace())
                            {
                                TextSurfaceEventListener.NotifyCharactersRemoved(textSurfaceEventListener,
                                    new TextDomEventArgs(internalTextLayerController.updateJustCurrentLine));
                            }
                        }

                        EnsureCaretVisible();
                    }
                    break;
                case UIKeys.Delete:
                    {
                        if (internalTextLayerController.SelectionRange != null)
                        {
                            InvalidateGraphicLocalArea(this, GetSelectionUpdateArea());
                        }
                        else
                        {
                            InvalidateGraphicOfCurrentLineArea();
                        }
                        if (textSurfaceEventListener == null)
                        {
                            internalTextLayerController.DoDelete();
                        }
                        else
                        {
                            VisualSelectionRangeSnapShot delpart = internalTextLayerController.DoDelete();
                            TextSurfaceEventListener.NotifyCharactersRemoved(textSurfaceEventListener,
                                new TextDomEventArgs(internalTextLayerController.updateJustCurrentLine));
                        }

                        EnsureCaretVisible();
                    }
                    break;
                default:
                    {
                        if (textSurfaceEventListener != null)
                        {
                            UIKeys keycode = e.KeyCode;
                            if (keycode >= UIKeys.F1 && keycode <= UIKeys.F12)
                            {
                                InvalidateGraphicLocalArea(this, GetSelectionUpdateArea());
                                TextSurfaceEventListener.NotifyFunctionKeyDown(textSurfaceEventListener, keycode);
                                EnsureCaretVisible();
                            }
                        }
                    }
                    break;
            }

            if (e.HasKeyData && e.Ctrl)
            {
                switch (e.KeyCode)
                {
                    case UIKeys.C:
                        {
                            StringBuilder stBuilder = GetFreeStringBuilder();
                            internalTextLayerController.CopySelectedTextToPlainText(stBuilder);
                            if (stBuilder != null)
                            {
                                if (stBuilder.Length == 0)
                                {
                                    Clipboard.Clear();
                                }
                                else
                                {
                                    Clipboard.SetText(stBuilder.ToString());
                                }
                            }
                            ReleaseStringBuilder(stBuilder);
                        }
                        break;
                    case UIKeys.V:
                        {
                            if (Clipboard.ContainUnicodeText())
                            {
                                internalTextLayerController.AddTextRunsToCurrentLine(
                                    new EditableRun[]{
                                        new EditableTextRun(this.Root,
                                            Clipboard.GetUnicodeText(), this.CurrentTextSpanStyle)
                                           });
                                EnsureCaretVisible();
                            }
                        }
                        break;
                    case UIKeys.X:
                        {
                            if (internalTextLayerController.SelectionRange != null)
                            {
                                if (internalTextLayerController.SelectionRange != null)
                                {
                                    InvalidateGraphicLocalArea(this, GetSelectionUpdateArea());
                                }
                                StringBuilder stBuilder = GetFreeStringBuilder();
                                internalTextLayerController.CopySelectedTextToPlainText(stBuilder);
                                if (stBuilder != null)
                                {
                                    Clipboard.SetText(stBuilder.ToString());
                                }

                                internalTextLayerController.DoDelete();
                                EnsureCaretVisible();
                                ReleaseStringBuilder(stBuilder);
                            }
                        }
                        break;
                    case UIKeys.Z:
                        {
                            internalTextLayerController.UndoLastAction();
                            EnsureCaretVisible();
                        }
                        break;
                    case UIKeys.Y:
                        {
                            internalTextLayerController.ReverseLastUndoAction();
                            EnsureCaretVisible();
                        }
                        break;
                    case UIKeys.B:
                        {
                            //TextSpanStyle style = internalTextLayerController.GetFirstTextStyleInSelectedRange(); 
                            //TextSpanStyle textStyle = null;

                            ////test only ***
                            ////TODO: make this more configurable
                            //if (style != null)
                            //{
                            //    TextSpanStyle defaultBeh = ((TextSpanStyle)style);
                            //    if (defaultBeh.FontBold)
                            //    {
                            //        textStyle = StyleHelper.CreateNewStyle(Color.Black);
                            //    }
                            //    else
                            //    {
                            //        textStyle = StyleHelper.CreateNewStyle(Color.Blue);
                            //    }
                            //}
                            //else
                            //{
                            //    textStyle = StyleHelper.CreateNewStyle(Color.Blue); 
                            //} 

                            //internalTextLayerController.DoFormatSelection(textStyle);

                            //if (internalTextLayerController.updateJustCurrentLine)
                            //{

                            //    InvalidateGraphicOfCurrentLineArea();
                            //}
                            //else
                            //{
                            //    InvalidateGraphics(); 
                            //}

                        }
                        break;
                }
            }
            if (textSurfaceEventListener != null)
            {
                TextSurfaceEventListener.NotifyKeyDown(textSurfaceEventListener, e.KeyCode);
            }
        }
예제 #34
0
 protected override void OnKeyDown(UIKeyEventArgs e)
 {
     if (e.Ctrl)
     {
         switch (e.KeyCode)
         {
             case UIKeys.C:
                 {
                     //copy this box to a clipboard***
                     //copy this content to clipboard 
                     this.DesignBoardModule.CopyToClipBoard(this.TargetBox as IDesignBox);
                 }
                 break;
         }
     }
     else
     {
         switch (e.KeyCode)
         {
             case UIKeys.Delete:
                 {
                     //-------------------------------------
                     //add action history to design board?
                     //------------------------------------- 
                     //remove the target and its controller 
                     var masterCollectionSet = this.MasterSelectionSet;
                     this.RelaseTargetAndRemoveSelf();
                     if (masterCollectionSet != null)
                     {
                         //remove other from selection set too!
                         masterCollectionSet.NotifyRemoveUIElement(this);
                     }
                 }
                 break;
         }
     }
     base.OnKeyDown(e);
 }
예제 #35
0
 //------------------------------------------------------------
 protected virtual void OnKeyDown(UIKeyEventArgs e)
 {
 }
예제 #36
0
 void IEventPortal.PortalKeyDown(UIKeyEventArgs e)
 {
 }
예제 #37
0
 protected virtual void OnKeyPress(UIKeyEventArgs e)
 {
 }
예제 #38
0
 void IEventPortal.PortalKeyPress(UIKeyEventArgs e)
 {
 }
예제 #39
0
 void IEventListener.ListenKeyUp(UIKeyEventArgs e)
 {
     OnKeyUp(e);
     _externalEventListener?.ListenKeyUp(e);
 }
예제 #40
0
 void SetKeyData(UIKeyEventArgs keyEventArgs, int keydata)
 {
     keyEventArgs.SetEventInfo(keydata, lastKeydownWithShift, lastKeydownWithAlt, lastKeydownWithControl);
 }
 void ReleaseUIKeyEventArgs(UIKeyEventArgs e)
 {
     e.Clear();
     _keyEventStack.Push(e);
 }
 void IEventListener.ListenKeyDown(UIKeyEventArgs e)
 {
     OnKeyDown(e);
 }
 void IEventListener.ListenKeyUp(UIKeyEventArgs e)
 {
     OnKeyUp(e);
 }
 bool IEventListener.ListenProcessDialogKey(UIKeyEventArgs e)
 {
     return OnProcessDialogKey(e);
 }
예제 #45
0
 //------------------------------------------------------------
 protected virtual void OnKeyDown(UIKeyEventArgs e)
 {
 }
예제 #46
0
 protected override void OnKeyUp(UIKeyEventArgs e)
 {
     base.OnKeyUp(e);
 }
예제 #47
0
 protected override void OnKeyDown(UIKeyEventArgs e)
 {
     //handle special keydown
     if (e.Ctrl)
     {
         //control                 
         switch (e.KeyCode)
         {
             case UIKeys.V:
                 {
                     this.DesignBoardModule.PasteClipboardData();
                 }
                 break;
             case UIKeys.Z:
                 {
                     //undo
                     this.DesignBoardModule.UndoLastAction();
                 }
                 break;
             case UIKeys.Y:
                 {
                     //redo 
                 }
                 break;
         }
     }
     base.OnKeyDown(e);
 }
예제 #48
0
 protected virtual void OnKeyUp(UIKeyEventArgs e)
 {
 }
예제 #49
0
 void IEventPortal.PortalKeyUp(UIKeyEventArgs e)
 {
 }
예제 #50
0
 protected virtual void OnKeyPress(UIKeyEventArgs e)
 {
 }
예제 #51
0
 bool IEventPortal.PortalProcessDialogKey(UIKeyEventArgs e)
 {
     return(false);
 }
예제 #52
0
 protected virtual bool OnProcessDialogKey(UIKeyEventArgs e)
 {
     return false;
 }
예제 #53
0
 void ReleaseKeyEvent(UIKeyEventArgs e)
 {
     e.Clear();
     this.stockKeyEvents.Push(e);
 }
예제 #54
0
 bool IEventListener.ListenProcessDialogKey(UIKeyEventArgs e)
 {
     KeyDown?.Invoke(this, e);
     return(e.Handled);
 }
 void IEventListener.ListenKeyUp(UIKeyEventArgs e)
 {
     OnKeyUp(e);
 }
예제 #56
0
 void IEventListener.ListenKeyDown(UIKeyEventArgs e)
 {
     KeyDown?.Invoke(this, e);
 }
 void IEventListener.ListenKeyPress(UIKeyEventArgs e)
 {
     OnKeyPress(e);
 }
예제 #58
0
 void IEventListener.ListenKeyPress(UIKeyEventArgs e)
 {
     KeyPress?.Invoke(this, e);
 }