diff options
-rw-r--r-- | include/Scintilla.h | 4 | ||||
-rw-r--r-- | include/Scintilla.iface | 8 | ||||
-rw-r--r-- | src/Editor.cxx | 25 | ||||
-rw-r--r-- | src/Editor.h | 1 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 2 | ||||
-rw-r--r-- | src/ViewStyle.h | 1 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 2 |
7 files changed, 39 insertions, 4 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index c0bb32332..ed1102010 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -159,6 +159,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETMARGINMASKN 2245 #define SCI_SETMARGINSENSITIVEN 2246 #define SCI_GETMARGINSENSITIVEN 2247 +#define SCI_SETMARGINCURSORN 2248 +#define SCI_GETMARGINCURSORN 2249 #define STYLE_DEFAULT 32 #define STYLE_LINENUMBER 33 #define STYLE_BRACELIGHT 34 @@ -590,7 +592,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETMOUSEDOWNCAPTURES 2384 #define SCI_GETMOUSEDOWNCAPTURES 2385 #define SC_CURSORNORMAL -1 +#define SC_CURSORARROW 2 #define SC_CURSORWAIT 4 +#define SC_CURSORREVERSEARROW 7 #define SCI_SETCURSOR 2386 #define SCI_GETCURSOR 2387 #define SCI_SETCONTROLCHARSYMBOL 2388 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index b3c10ea6a..8d5db4941 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -352,6 +352,12 @@ set void SetMarginSensitiveN=2246(int margin, bool sensitive) # Retrieve the mouse click sensitivity of a margin. get bool GetMarginSensitiveN=2247(int margin,) +# Set the cursor shown when the mouse is inside a margin. +set void SetMarginCursorN=2248(int margin, int cursor) + +# Retrieve the cursor shown in a margin. +get int GetMarginCursorN=2249(int margin,) + # Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. # Style 39 is for future use. enu StylesCommon=STYLE_ @@ -1540,7 +1546,9 @@ get bool GetMouseDownCaptures=2385(,) enu CursorShape=SC_CURSOR val SC_CURSORNORMAL=-1 +val SC_CURSORARROW=2 val SC_CURSORWAIT=4 +val SC_CURSORREVERSEARROW=7 # Sets the cursor to one of the SC_CURSOR* values. set void SetCursor=2386(int cursorType,) # Get cursor type. diff --git a/src/Editor.cxx b/src/Editor.cxx index 5b908ac6f..865633be3 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5844,6 +5844,16 @@ bool Editor::PointInSelMargin(Point pt) { } } +Window::Cursor Editor::GetMarginCursor(Point pt) { + int x = 0; + for (int margin = 0; margin < ViewStyle::margins; margin++) { + if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width)) + return static_cast<Window::Cursor>(vs.ms[margin].cursor); + x += vs.ms[margin].width; + } + return Window::cursorReverseArrow; +} + void Editor::LineSelection(int lineCurrent_, int lineAnchor_) { if (lineAnchor_ < lineCurrent_) { SetSelection(pdoc->LineStart(lineCurrent_ + 1), @@ -6201,7 +6211,7 @@ void Editor::ButtonMove(Point pt) { } else { if (vs.fixedColumnWidth > 0) { // There is a margin if (PointInSelMargin(pt)) { - DisplayCursor(Window::cursorReverseArrow); + DisplayCursor(GetMarginCursor(pt)); SetHotSpotRange(NULL); return; // No need to test for selection } @@ -6236,7 +6246,7 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { } if (HaveMouseCapture()) { if (PointInSelMargin(pt)) { - DisplayCursor(Window::cursorReverseArrow); + DisplayCursor(GetMarginCursor(pt)); } else { DisplayCursor(Window::cursorText); SetHotSpotRange(NULL); @@ -7839,6 +7849,17 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { else return 0; + case SCI_SETMARGINCURSORN: + if (ValidMargin(wParam)) + vs.ms[wParam].cursor = lParam; + break; + + case SCI_GETMARGINCURSORN: + if (ValidMargin(wParam)) + return vs.ms[wParam].cursor; + else + return 0; + case SCI_STYLECLEARALL: vs.ClearStyles(); InvalidateStyleRedraw(); diff --git a/src/Editor.h b/src/Editor.h index 97af7b089..db8a36aa1 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -483,6 +483,7 @@ protected: // ScintillaBase subclass needs access to much of Editor bool PositionInSelection(int pos); bool PointInSelection(Point pt); bool PointInSelMargin(Point pt); + Window::Cursor GetMarginCursor(Point pt); void LineSelection(int lineCurrent_, int lineAnchor_); void WordSelection(int pos); void DwellEnd(bool mouseMoved); diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 1b315d17e..78ba1f78c 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -24,7 +24,7 @@ using namespace Scintilla; #endif MarginStyle::MarginStyle() : - style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) { + style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false), cursor(SC_CURSORREVERSEARROW) { } // A list of the fontnames - avoids wasting space in each style diff --git a/src/ViewStyle.h b/src/ViewStyle.h index cd6dc1a28..6ca488dff 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -20,6 +20,7 @@ public: int width; int mask; bool sensitive; + int cursor; MarginStyle(); }; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 603e9b6f8..d4d3b24da 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -785,7 +785,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam ::GetCursorPos(&pt); ::ScreenToClient(MainHWND(), &pt); if (PointInSelMargin(Point(pt.x, pt.y))) { - DisplayCursor(Window::cursorReverseArrow); + DisplayCursor(GetMarginCursor(Point(pt.x, pt.y))); } else if (PointInSelection(Point(pt.x, pt.y)) && !SelectionEmpty()) { DisplayCursor(Window::cursorArrow); } else if (PointIsHotspot(Point(pt.x, pt.y))) { |