aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-08-15 15:13:15 +1000
committerNeil <nyamatongwe@gmail.com>2013-08-15 15:13:15 +1000
commitd396f66bf0bc8d4c777c744efe77ccb5b28b385f (patch)
tree9dc0a355f751c37c953e835ac04a5dee383d6f51 /src
parentc68e1a5ffc74569e4d406e3c904f010390577fcf (diff)
downloadscintilla-mirror-d396f66bf0bc8d4c777c744efe77ccb5b28b385f.tar.gz
Feature: [feature-requests:#1007]. Option to allow mouse selection to
switch to rectangular by pressing Alt after start of gesture. From Neomi.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx17
-rw-r--r--src/Editor.h2
2 files changed, 18 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 45a88711f..3a30c52a4 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -169,6 +169,7 @@ Editor::Editor() {
endAtLastLine = true;
caretSticky = SC_CARETSTICKY_OFF;
marginOptions = SC_MARGINOPTION_NONE;
+ mouseSelectionRectangularSwitch = false;
multipleSelection = false;
additionalSelectionTyping = false;
multiPasteMode = SC_MULTIPASTE_ONCE;
@@ -6495,7 +6496,7 @@ void Editor::GetHotSpotRange(int &hsStart_, int &hsEnd_) const {
hsEnd_ = hsEnd;
}
-void Editor::ButtonMove(Point pt) {
+void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) {
if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) {
DwellEnd(true);
}
@@ -6529,6 +6530,9 @@ void Editor::ButtonMove(Point pt) {
SetDragPosition(movePos);
} else {
if (selectionType == selChar) {
+ if (sel.selType == Selection::selStream && (modifiers & SCI_ALT) && mouseSelectionRectangularSwitch) {
+ sel.selType = Selection::selRectangle;
+ }
if (sel.IsRectangular()) {
sel.Rectangular() = SelectionRange(movePos, sel.Rectangular().anchor);
SetSelection(movePos, sel.RangeMain().anchor);
@@ -6607,6 +6611,10 @@ void Editor::ButtonMove(Point pt) {
}
}
+void Editor::ButtonMove(Point pt) {
+ ButtonMoveWithModifiers(pt, 0);
+}
+
void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
//Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop);
SelectionPosition newPos = SPositionFromLocation(pt, false, false,
@@ -9389,6 +9397,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
pdoc->AddUndoAction(wParam, lParam & UNDO_MAY_COALESCE);
break;
+ case SCI_SETMOUSESELECTIONRECTANGULARSWITCH:
+ mouseSelectionRectangularSwitch = wParam != 0;
+ break;
+
+ case SCI_GETMOUSESELECTIONRECTANGULARSWITCH:
+ return mouseSelectionRectangularSwitch;
+
case SCI_SETMULTIPLESELECTION:
multipleSelection = wParam != 0;
InvalidateCaret();
diff --git a/src/Editor.h b/src/Editor.h
index 54358a075..20877b29e 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -219,6 +219,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool endAtLastLine;
int caretSticky;
int marginOptions;
+ bool mouseSelectionRectangularSwitch;
bool multipleSelection;
bool additionalSelectionTyping;
int multiPasteMode;
@@ -566,6 +567,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void DwellEnd(bool mouseMoved);
void MouseLeave();
virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt);
+ void ButtonMoveWithModifiers(Point pt, int modifiers);
void ButtonMove(Point pt);
void ButtonUp(Point pt, unsigned int curTime, bool ctrl);