diff options
author | nyamatongwe <devnull@localhost> | 2001-09-24 13:29:37 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2001-09-24 13:29:37 +0000 |
commit | d1b0fa9c5d4e7cd8d48e1d4dc4d38676140193e7 (patch) | |
tree | fc015f71cea45575ad277f22127b99d97c57b2c9 | |
parent | 2748de50c1e4b12f3b4cd224950b350684558b88 (diff) | |
download | scintilla-mirror-d1b0fa9c5d4e7cd8d48e1d4dc4d38676140193e7.tar.gz |
Patch from Stephan for the SC_MARK_BACKGROUND marker.
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 3 | ||||
-rw-r--r-- | src/Editor.cxx | 33 | ||||
-rw-r--r-- | src/LineMarker.cxx | 2 |
4 files changed, 30 insertions, 9 deletions
diff --git a/include/Scintilla.h b/include/Scintilla.h index abe1581a4..7202712ad 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -107,6 +107,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MARKNUM_FOLDERSUB 29 #define SC_MARKNUM_FOLDER 30 #define SC_MARKNUM_FOLDEROPEN 31 +#define SC_MARK_BACKGROUND 32 #define SCI_MARKERDEFINE 2040 #define SCI_MARKERSETFORE 2041 #define SCI_MARKERSETBACK 2042 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index bdfcd2e54..f5aed53ae 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -240,6 +240,9 @@ val SC_MARKNUM_FOLDERSUB=29 val SC_MARKNUM_FOLDER=30 val SC_MARKNUM_FOLDEROPEN=31 +# Invisible mark that only sets the line background color +val SC_MARK_BACKGROUND=32 + # Set the symbol used for a particular marker number. fun void MarkerDefine=2040(int markerNumber, int markerSymbol) diff --git a/src/Editor.cxx b/src/Editor.cxx index 2171924f0..cbf3a951f 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -990,21 +990,38 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis // is taken by an individual character - internal leading gives varying results. Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; + // See if something overrides the line background color: Either if caret is on the line + // and background color is set for that, or if a marker is defined that forces its background + // color onto the line, or if a marker is defined but has no selection margin in which to + // display itself. These are checked in order with the earlier taking precedence. When + // multiple markers cause background override, the color for the highest numbered one is used. bool overrideBackground = false; Colour background = Colour(0, 0, 0); if (caret.active && vsDraw.showCaretLineBackground && ll.containsCaret) { overrideBackground = true; background = vsDraw.caretLineBackground.allocated; } - if (vsDraw.maskInLine) { - int marks = pdoc->GetMark(line) & vsDraw.maskInLine; - if (marks) { - overrideBackground = true; - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if (marks & 1) { - background = vsDraw.markers[markBit].back.allocated; + if (!overrideBackground) { + int marks = pdoc->GetMark(line); + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) { + background = vsDraw.markers[markBit].back.allocated; + overrideBackground = true; + } + marks >>= 1; + } + } + if (!overrideBackground) { + if (vsDraw.maskInLine) { + int marks = pdoc->GetMark(line) & vsDraw.maskInLine; + if (marks) { + overrideBackground = true; + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if (marks & 1) { + background = vsDraw.markers[markBit].back.allocated; + } + marks >>= 1; } - marks >>= 1; } } } diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index a7c5b124f..e4b8b3299 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -123,7 +123,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac rcSmall.bottom = rc.bottom - 2; surface->RectangleDraw(rcSmall, fore.allocated, back.allocated); - } else if (markType == SC_MARK_EMPTY) { + } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND) { // An invisible marker so don't draw anything } else if (markType == SC_MARK_VLINE) { |