示例#1
0
        /// <inheritdoc/>
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);
            if (!e.Handled && TextView != null && textArea != null)
            {
                e.Handled = true;
                textArea.Focus();

                SimpleSegment currentSeg = GetTextLineSegment(e);
                if (currentSeg == SimpleSegment.Invalid)
                {
                    return;
                }
                textArea.Caret.Offset = currentSeg.Offset + currentSeg.Length;
                if (CaptureMouse())
                {
                    selecting      = true;
                    selectionStart = new AnchorSegment(Document, currentSeg.Offset, currentSeg.Length);
                    if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                    {
                        SimpleSelection simpleSelection = textArea.Selection as SimpleSelection;
                        if (simpleSelection != null)
                        {
                            selectionStart = new AnchorSegment(Document, simpleSelection.SurroundingSegment);
                        }
                    }
                    textArea.Selection = Selection.Create(textArea, selectionStart);
                    if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                    {
                        ExtendSelection(currentSeg);
                    }
                }
            }
        }
示例#2
0
        /// <inheritdoc/>
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);
            if (!e.Handled && TextView != null && textArea != null && ShowIcon)
            {
                e.Handled = true;
                textArea.Focus();

                var pos = e.GetPosition(this);
                if (iconRect.Contains(pos))
                {
                    if (IconClicked != null)
                    {
                        IconClicked();
                    }
                }
            }
        }
示例#3
0
        /// <inheritdoc/>
        protected void OnMouseLeftButtonDowns(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);
            if (!e.Handled && TextView != null && textArea != null)
            {
                e.Handled = true;
                textArea.Focus();

                SimpleSegment currentSeg = GetTextLineSegment(e);
                if (currentSeg == SimpleSegment.Invalid)
                {
                    return;
                }
                textArea.Caret.Offset = currentSeg.Offset + currentSeg.Length;

                int i = 0;
                while (Char.IsWhiteSpace(textArea.Document.Text[currentSeg.Offset + i]) && i < currentSeg.Length)
                {
                    i++;
                }

                if (CaptureMouse())
                {
                    selecting      = true;
                    selectionStart = new AnchorSegment(Document, currentSeg.Offset + i, currentSeg.Length - i);
                    if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                    {
                        SimpleSelection simpleSelection = textArea.Selection as SimpleSelection;
                        if (simpleSelection != null)
                        {
                            selectionStart = new AnchorSegment(Document, simpleSelection.SurroundingSegment);
                        }
                    }
                    textArea.Selection = Selection.Create(textArea, selectionStart);
                    if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                    {
                        ExtendSelection(currentSeg);
                    }
                    textArea.Caret.BringCaretToView(0.0);
                }
            }
        }