| 6771 | } |
| 6772 | |
| 6773 | void Editor::ButtonUp ( Point pt, unsigned int curTime, bool ctrl ) |
| 6774 | { |
| 6775 | //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); |
| 6776 | SelectionPosition newPos = SPositionFromLocation ( pt, false, false, |
| 6777 | AllowVirtualSpace ( virtualSpaceOptions, sel.IsRectangular() ) ); |
| 6778 | newPos = MovePositionOutsideChar ( newPos, sel.MainCaret() - newPos.Position() ); |
| 6779 | if ( inDragDrop == ddInitial ) { |
| 6780 | inDragDrop = ddNone; |
| 6781 | SetEmptySelection ( newPos ); |
| 6782 | selectionType = selChar; |
| 6783 | originalAnchorPos = sel.MainCaret(); |
| 6784 | } |
| 6785 | if ( hotSpotClickPos != INVALID_POSITION && PointIsHotspot ( pt ) ) { |
| 6786 | hotSpotClickPos = INVALID_POSITION; |
| 6787 | NotifyHotSpotReleaseClick ( newPos.Position(), false, ctrl, false ); |
| 6788 | } |
| 6789 | if ( HaveMouseCapture() ) { |
| 6790 | if ( PointInSelMargin ( pt ) ) { |
| 6791 | DisplayCursor ( GetMarginCursor ( pt ) ); |
| 6792 | } else { |
| 6793 | DisplayCursor ( Window::cursorText ); |
| 6794 | SetHotSpotRange ( NULL ); |
| 6795 | } |
| 6796 | ptMouseLast = pt; |
| 6797 | SetMouseCapture ( false ); |
| 6798 | NotifyIndicatorClick ( false, newPos.Position(), false, false, false ); |
| 6799 | if ( inDragDrop == ddDragging ) { |
| 6800 | SelectionPosition selStart = SelectionStart(); |
| 6801 | SelectionPosition selEnd = SelectionEnd(); |
| 6802 | if ( selStart < selEnd ) { |
| 6803 | if ( drag.len ) { |
| 6804 | if ( ctrl ) { |
| 6805 | if ( pdoc->InsertString ( newPos.Position(), drag.s, drag.len ) ) { |
| 6806 | SetSelection ( newPos.Position(), newPos.Position() + drag.len ); |
| 6807 | } |
| 6808 | } else if ( newPos < selStart ) { |
| 6809 | pdoc->DeleteChars ( selStart.Position(), drag.len ); |
| 6810 | if ( pdoc->InsertString ( newPos.Position(), drag.s, drag.len ) ) { |
| 6811 | SetSelection ( newPos.Position(), newPos.Position() + drag.len ); |
| 6812 | } |
| 6813 | } else if ( newPos > selEnd ) { |
| 6814 | pdoc->DeleteChars ( selStart.Position(), drag.len ); |
| 6815 | newPos.Add ( -drag.len ); |
| 6816 | if ( pdoc->InsertString ( newPos.Position(), drag.s, drag.len ) ) { |
| 6817 | SetSelection ( newPos.Position(), newPos.Position() + drag.len ); |
| 6818 | } |
| 6819 | } else { |
| 6820 | SetEmptySelection ( newPos.Position() ); |
| 6821 | } |
| 6822 | drag.Free(); |
| 6823 | } |
| 6824 | selectionType = selChar; |
| 6825 | } |
| 6826 | } else { |
| 6827 | if ( selectionType == selChar ) { |
| 6828 | if ( sel.Count() > 1 ) { |
| 6829 | sel.RangeMain() = |
| 6830 | SelectionRange ( newPos, sel.Range ( sel.Count() - 1 ).anchor ); |
nothing calls this directly
no test coverage detected