| 6666 | } |
| 6667 | |
| 6668 | void Editor::ButtonMove ( Point pt ) |
| 6669 | { |
| 6670 | if ( ( ptMouseLast.x != pt.x ) || ( ptMouseLast.y != pt.y ) ) { |
| 6671 | DwellEnd ( true ); |
| 6672 | } |
| 6673 | SelectionPosition movePos = SPositionFromLocation ( pt, false, false, |
| 6674 | AllowVirtualSpace ( virtualSpaceOptions, sel.IsRectangular() ) ); |
| 6675 | movePos = MovePositionOutsideChar ( movePos, sel.MainCaret() - movePos.Position() ); |
| 6676 | if ( inDragDrop == ddInitial ) { |
| 6677 | if ( DragThreshold ( ptMouseLast, pt ) ) { |
| 6678 | SetMouseCapture ( false ); |
| 6679 | SetDragPosition ( movePos ); |
| 6680 | CopySelectionRange ( &drag ); |
| 6681 | StartDrag(); |
| 6682 | } |
| 6683 | return; |
| 6684 | } |
| 6685 | ptMouseLast = pt; |
| 6686 | //Platform::DebugPrintf("Move %d %d\n", pt.x, pt.y); |
| 6687 | if ( HaveMouseCapture() ) { |
| 6688 | // Slow down autoscrolling/selection |
| 6689 | autoScrollTimer.ticksToWait -= timer.tickSize; |
| 6690 | if ( autoScrollTimer.ticksToWait > 0 ) { |
| 6691 | return; |
| 6692 | } |
| 6693 | autoScrollTimer.ticksToWait = autoScrollDelay; |
| 6694 | // Adjust selection |
| 6695 | if ( posDrag.IsValid() ) { |
| 6696 | SetDragPosition ( movePos ); |
| 6697 | } else { |
| 6698 | if ( selectionType == selChar ) { |
| 6699 | if ( sel.IsRectangular() ) { |
| 6700 | sel.Rectangular() = SelectionRange ( movePos, sel.Rectangular().anchor ); |
| 6701 | SetSelection ( movePos, sel.RangeMain().anchor ); |
| 6702 | } else if ( sel.Count() > 1 ) { |
| 6703 | SelectionRange range ( movePos, sel.RangeMain().anchor ); |
| 6704 | sel.TentativeSelection ( range ); |
| 6705 | InvalidateSelection ( range, true ); |
| 6706 | } else { |
| 6707 | SetSelection ( movePos, sel.RangeMain().anchor ); |
| 6708 | } |
| 6709 | } else if ( selectionType == selWord ) { |
| 6710 | // Continue selecting by word |
| 6711 | if ( movePos.Position() == wordSelectInitialCaretPos ) { // Didn't move |
| 6712 | // No need to do anything. Previously this case was lumped |
| 6713 | // in with "Moved forward", but that can be harmful in this |
| 6714 | // case: a handler for the NotifyDoubleClick re-adjusts |
| 6715 | // the selection for a fancier definition of "word" (for |
| 6716 | // example, in Perl it is useful to include the leading |
| 6717 | // '$', '%' or '@' on variables for word selection). In this |
| 6718 | // the ButtonMove() called via Tick() for auto-scrolling |
| 6719 | // could result in the fancier word selection adjustment |
| 6720 | // being unmade. |
| 6721 | } else { |
| 6722 | wordSelectInitialCaretPos = -1; |
| 6723 | WordSelection ( movePos.Position() ); |
| 6724 | } |
| 6725 | } else { |
nothing calls this directly
no test coverage detected