aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorjrxx <devnull@localhost>2011-01-17 16:04:20 -0600
committerjrxx <devnull@localhost>2011-01-17 16:04:20 -0600
commit9d5f8be054e6c3289b7730935664c0baf65e4c51 (patch)
treec2eb4407e29227d7f4b5f787f8a4e9c34f605784 /src
parent89c21a81fcfccc4beecc2442e6e434fd6edbc9b1 (diff)
downloadscintilla-mirror-9d5f8be054e6c3289b7730935664c0baf65e4c51.tar.gz
Add SCI_SETMARGINCURSORN and SCI_GETMARGINCURSORN.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx25
-rw-r--r--src/Editor.h1
-rw-r--r--src/ViewStyle.cxx2
-rw-r--r--src/ViewStyle.h1
4 files changed, 26 insertions, 3 deletions
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();
};