diff options
| author | Nathaniel Braun <unknown> | 2026-01-08 08:22:01 +1100 |
|---|---|---|
| committer | Nathaniel Braun <unknown> | 2026-01-08 08:22:01 +1100 |
| commit | 56c071e2734e3812c7c77b611637cbc2698eb7d3 (patch) | |
| tree | 5da57f71c12bef0a8bd2706a0d8773cb5442ddfe /src | |
| parent | 0627663abd14c81cafde85ce9cc0502d9bc3a6c3 (diff) | |
| download | scintilla-mirror-56c071e2734e3812c7c77b611637cbc2698eb7d3.tar.gz | |
Feature [feature-requests:#184]. Add option to disable drag/drop editing
SCI_SETDRAGDROPENABLED. Fully implemented on Win32 but may only prevent dragging
on other platforms.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 12 | ||||
| -rw-r--r-- | src/Editor.h | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 1ad99c3ca..a2c3e0fe9 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -143,6 +143,7 @@ Editor::Editor() : durationWrapOneByte(0.000001, 0.00000001, 0.00001) { dwelling = false; ptMouseLast.x = 0; ptMouseLast.y = 0; + dragDropEnabled = true; inDragDrop = DragDrop::none; dropWentOutside = false; posDrop = SelectionPosition(Sci::invalidPosition); @@ -5041,7 +5042,7 @@ void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, KeyMod modifiers) { AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); movePos = MovePositionOutsideChar(movePos, sel.MainCaret() - movePos.Position()); - if (inDragDrop == DragDrop::initial) { + if (dragDropEnabled && inDragDrop == DragDrop::initial) { if (DragThreshold(ptMouseLast, pt)) { ChangeMouseCapture(false); SetDragPosition(movePos); @@ -5139,7 +5140,7 @@ void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, KeyMod modifiers) { } } // Display regular (drag) cursor over selection - if (PointInSelection(pt) && !SelectionEmpty()) { + if (PointInSelection(pt) && !SelectionEmpty() && dragDropEnabled) { DisplayCursor(Window::Cursor::arrow); SetHoverIndicatorPosition(Sci::invalidPosition); } else { @@ -7084,6 +7085,13 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::GetBufferedDraw: return view.bufferedDraw; + case Message::GetDragDropEnabled: + return dragDropEnabled; + + case Message::SetDragDropEnabled: + dragDropEnabled = wParam != 0; + break; + #ifdef INCLUDE_DEPRECATED_FEATURES case SCI_GETTWOPHASEDRAW: return view.phasesDraw == EditView::phasesTwo; diff --git a/src/Editor.h b/src/Editor.h index f8bc18970..95b83f1f7 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -238,6 +238,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool dwelling; enum class TextUnit { character, word, subLine, wholeLine } selectionUnit; Point ptMouseLast; + bool dragDropEnabled; enum class DragDrop { none, initial, dragging } inDragDrop; bool dropWentOutside; SelectionPosition posDrop; |
