diff options
author | nyamatongwe <devnull@localhost> | 2011-04-07 21:26:47 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-04-07 21:26:47 +1000 |
commit | 4012f14e6397f5709586102540df824d8c9ca4a5 (patch) | |
tree | 9f1535ca2d7a2690ba79a62d0d96ec58b9c9af96 /src | |
parent | c3d271e16f72cad5bf4f669614a78a67c5663037 (diff) | |
download | scintilla-mirror-4012f14e6397f5709586102540df824d8c9ca4a5.tar.gz |
Add highlighting of current folding block. Feature #3147069.
APIs MarkerEnableHighlight and MarkerSetBackSelected.
From Jérôme Laforge.
Diffstat (limited to 'src')
-rw-r--r-- | src/Document.cxx | 98 | ||||
-rw-r--r-- | src/Document.h | 42 | ||||
-rw-r--r-- | src/Editor.cxx | 50 | ||||
-rw-r--r-- | src/Editor.h | 3 | ||||
-rw-r--r-- | src/LineMarker.cxx | 130 | ||||
-rw-r--r-- | src/LineMarker.h | 9 |
6 files changed, 290 insertions, 42 deletions
diff --git a/src/Document.cxx b/src/Document.cxx index e573e1906..f74ac5830 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -355,6 +355,104 @@ int Document::GetFoldParent(int line) { } } +void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDelimiter) { + int endLine = LineFromPosition(Length()); + int beginFoldBlock = -1; + int endFoldBlock = -1; + int beginMarginCorrectlyDrawnZone = -1; + int endMarginCorrectlyDrawnZone = endLine + 1; + int endOfTailOfWhiteFlag = -1; //endOfTailOfWhiteFlag points the last SC_FOLDLEVELWHITEFLAG if follow a fold block. Otherwise endOfTailOfWhiteFlag points end of fold block. + int level = GetLevel(line); + int levelNumber = -1; + int lineLookLevel = -1; + int lineLookLevelNumber = -1; + int lineLook = line; + bool beginFoldBlockFound = false; + bool endFoldBlockFound = false; + bool beginMarginCorrectlyDrawnZoneFound = false; + bool endMarginCorrectlyDrawnZoneFound = false; + + /*******************************************************************************/ + /* search backward (beginFoldBlock & beginMarginCorrectlyDrawnZone) */ + /*******************************************************************************/ + for (endOfTailOfWhiteFlag = line; lineLook >= 0 && (!beginFoldBlockFound || !beginMarginCorrectlyDrawnZoneFound); --lineLook) { + lineLookLevel = GetLevel(lineLook); + if (levelNumber != -1) { + lineLookLevelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK; + if (!beginMarginCorrectlyDrawnZoneFound && (lineLookLevelNumber > levelNumber)) { + beginMarginCorrectlyDrawnZoneFound = true; + beginMarginCorrectlyDrawnZone = endOfTailOfWhiteFlag; + } + //find the last space line (SC_FOLDLEVELWHITEFLAG). + if (!beginMarginCorrectlyDrawnZoneFound && !(lineLookLevel & SC_FOLDLEVELWHITEFLAG)) { + endOfTailOfWhiteFlag = lineLook - 1; + } + if (!beginFoldBlockFound && (lineLookLevelNumber < levelNumber)) { + beginFoldBlockFound = true; + beginFoldBlock = lineLook; + if (!beginMarginCorrectlyDrawnZoneFound) { + beginMarginCorrectlyDrawnZoneFound = true; + beginMarginCorrectlyDrawnZone = lineLook - 1; + } + } else if (!beginFoldBlockFound && lineLookLevelNumber == SC_FOLDLEVELBASE) { + beginFoldBlockFound = true; //beginFoldBlock already set to -1. + } + } else if (!(lineLookLevel & SC_FOLDLEVELWHITEFLAG)) { + endOfTailOfWhiteFlag = lineLook - 1; + if (lineLookLevel & SC_FOLDLEVELHEADERFLAG) { + beginFoldBlockFound = true; + beginFoldBlock = lineLook; + beginMarginCorrectlyDrawnZoneFound = true; + beginMarginCorrectlyDrawnZone = endOfTailOfWhiteFlag; + levelNumber = GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK;; + } else { + levelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK; + } + } + } + + /****************************************************************************/ + /* search forward (endStartBlock & endMarginCorrectlyDrawnZone) */ + /****************************************************************************/ + if (level & SC_FOLDLEVELHEADERFLAG) { + //ignore this line because this line is on first one of block. + lineLook = line + 1; + } else { + lineLook = line; + } + for (; lineLook <= endLine && (!endFoldBlockFound || !endMarginCorrectlyDrawnZoneFound); ++lineLook) { + lineLookLevel = GetLevel(lineLook); + lineLookLevelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK; + if (!endFoldBlockFound && !(lineLookLevel & SC_FOLDLEVELWHITEFLAG) && lineLookLevelNumber < levelNumber) { + endFoldBlockFound = true; + endFoldBlock = lineLook - 1; + if (!endMarginCorrectlyDrawnZoneFound) { + endMarginCorrectlyDrawnZoneFound = true; + endMarginCorrectlyDrawnZone = lineLook; + } + } else if (!endFoldBlockFound && lineLookLevel == SC_FOLDLEVELBASE) { + endFoldBlockFound = true; + endFoldBlock = -1; + } + if (!endMarginCorrectlyDrawnZoneFound && (lineLookLevel & SC_FOLDLEVELHEADERFLAG)) { + endMarginCorrectlyDrawnZoneFound = true; + endMarginCorrectlyDrawnZone = lineLook; + } + } + if (!endFoldBlockFound && ((lineLook > endLine && lineLookLevelNumber < levelNumber) || + (levelNumber > SC_FOLDLEVELBASE))) { + //manage when endfold is incorrect or on last line. + endFoldBlock = lineLook - 1; + //useless to set endMarginCorrectlyDrawnZone. + //if endMarginCorrectlyDrawnZoneFound equals false then endMarginCorrectlyDrawnZone already equals to endLine + 1. + } + + highlightDelimiter.beginFoldBlock = beginFoldBlock; + highlightDelimiter.endFoldBlock = endFoldBlock; + highlightDelimiter.beginMarginCorrectlyDrawnZone = beginMarginCorrectlyDrawnZone; + highlightDelimiter.endMarginCorrectlyDrawnZone = endMarginCorrectlyDrawnZone; +} + int Document::ClampPositionIntoDocument(int pos) { return Platform::Clamp(pos, 0, Length()); } diff --git a/src/Document.h b/src/Document.h index fd0998260..851c10081 100644 --- a/src/Document.h +++ b/src/Document.h @@ -115,6 +115,47 @@ struct StyledText { } }; +class HighlightDelimiter { +public: + HighlightDelimiter() { + beginFoldBlock = -1; + endFoldBlock = -1; + beginMarginCorrectlyDrawnZone = -1; + endMarginCorrectlyDrawnZone = -1; + isEnabled = false; + } + + bool NeedsDrawing(int line) { + return isEnabled && (line <= beginMarginCorrectlyDrawnZone || endMarginCorrectlyDrawnZone <= line); + } + + bool isCurrentBlockHighlight(int line) { + return isEnabled && beginFoldBlock <= line && line <= endFoldBlock; + } + + bool isHeadBlockFold(int line) { + return beginFoldBlock == line && line < endFoldBlock; + } + + bool isBodyBlockFold(int line) { + return beginFoldBlock < line && line < endFoldBlock; + } + + bool isTailBlockFold(int line) { + return beginFoldBlock < line && line == endFoldBlock; + } + + // beginFoldBlock : Begin of current fold block. + // endStartBlock : End of zone where margin is already drawn. + // beginMarginCorrectlyDrawnZone : Begin of zone where margin is already drawn. + // endMarginCorrectlyDrawnZone : End of current fold block. + int beginFoldBlock; + int endFoldBlock; + int beginMarginCorrectlyDrawnZone; + int endMarginCorrectlyDrawnZone; + bool isEnabled; +}; + class CaseFolder { public: virtual ~CaseFolder() { @@ -299,6 +340,7 @@ public: void ClearLevels(); int GetLastChild(int lineParent, int level=-1); int GetFoldParent(int line); + void GetHighlightDelimiters(int line, HighlightDelimiter &hDelimiter); void Indent(bool forwards); int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); diff --git a/src/Editor.cxx b/src/Editor.cxx index 58374bfc5..b0560e758 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -755,6 +755,7 @@ void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSel void Editor::SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_) { currentPos_ = ClampPositionIntoDocument(currentPos_); anchor_ = ClampPositionIntoDocument(anchor_); + int currentLine = pdoc->LineFromPosition(currentPos_.Position()); /* For Line selection - ensure the anchor and caret are always at the beginning and end of the region lines. */ if (sel.selType == Selection::selLines) { @@ -773,6 +774,10 @@ void Editor::SetSelection(SelectionPosition currentPos_, SelectionPosition ancho sel.RangeMain() = rangeNew; SetRectangularRange(); ClaimSelection(); + + if (highlightDelimiter.NeedsDrawing(currentLine)) { + RedrawSelMargin(); + } } void Editor::SetSelection(int currentPos_, int anchor_) { @@ -782,6 +787,7 @@ void Editor::SetSelection(int currentPos_, int anchor_) { // Just move the caret on the main selection void Editor::SetSelection(SelectionPosition currentPos_) { currentPos_ = ClampPositionIntoDocument(currentPos_); + int currentLine = pdoc->LineFromPosition(currentPos_.Position()); if (sel.Count() > 1 || !(sel.RangeMain().caret == currentPos_)) { InvalidateSelection(SelectionRange(currentPos_)); } @@ -794,6 +800,10 @@ void Editor::SetSelection(SelectionPosition currentPos_) { SelectionRange(SelectionPosition(currentPos_), sel.RangeMain().anchor); } ClaimSelection(); + + if (highlightDelimiter.NeedsDrawing(currentLine)) { + RedrawSelMargin(); + } } void Editor::SetSelection(int currentPos_) { @@ -801,6 +811,7 @@ void Editor::SetSelection(int currentPos_) { } void Editor::SetEmptySelection(SelectionPosition currentPos_) { + int currentLine = pdoc->LineFromPosition(currentPos_.Position()); SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_)); if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) { InvalidateSelection(rangeNew); @@ -810,6 +821,9 @@ void Editor::SetEmptySelection(SelectionPosition currentPos_) { SetRectangularRange(); ClaimSelection(); + if (highlightDelimiter.NeedsDrawing(currentLine)) { + RedrawSelMargin(); + } } void Editor::SetEmptySelection(int currentPos_) { @@ -910,6 +924,12 @@ int Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, b SetXYScroll(newXY); } } + + int currentLine = pdoc->LineFromPosition(newPos.Position()); + + if (highlightDelimiter.NeedsDrawing(currentLine)) { + RedrawSelMargin(); + } return 0; } @@ -1692,7 +1712,6 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { int visibleLine = topLine; int yposScreen = 0; - // Work out whether the top line is whitespace located after a // lessening of fold level which implies a 'fold tail' but which should not // be displayed until the last of a sequence of whitespace. @@ -1710,6 +1729,9 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { needWhiteClosure = true; } } + if (highlightDelimiter.isEnabled && (vs.ms[margin].mask & SC_MASK_FOLDERS)) { + pdoc->GetHighlightDelimiters(pdoc->LineFromPosition(CurrentPosition()), highlightDelimiter); + } // Old code does not know about new markers needed to distinguish all cases int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, @@ -1720,7 +1742,6 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) { PLATFORM_ASSERT(visibleLine < cs.LinesDisplayed()); - int lineDoc = cs.DocFromDisplay(visibleLine); PLATFORM_ASSERT(cs.GetVisible(lineDoc)); bool firstSubLine = visibleLine == cs.DisplayFromDoc(lineDoc); @@ -1791,7 +1812,6 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { marks |= 1 << SC_MARKNUM_FOLDERSUB; } } - marks &= vs.ms[margin].mask; PRectangle rcMarker = rcSelMargin; rcMarker.top = yposScreen; @@ -1838,7 +1858,20 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { if (marks) { for (int markBit = 0; (markBit < 32) && marks; markBit++) { if (marks & 1) { - vs.markers[markBit].Draw(surface, rcMarker, vs.styles[STYLE_LINENUMBER].font); + LineMarker::typeOfFold tFold; + if (!highlightDelimiter.isCurrentBlockHighlight(lineDoc)) { + tFold = LineMarker::undefined; + } else if (highlightDelimiter.isBodyBlockFold(lineDoc)) { + tFold = LineMarker::body; + } else if (highlightDelimiter.isHeadBlockFold(lineDoc)) { + tFold = LineMarker::head; + } else if (highlightDelimiter.isTailBlockFold(lineDoc)) { + tFold = LineMarker::tail; + } else { + //Normally, this branch is never used. But I prefer to manage it anyway. + tFold = LineMarker::undefined; + } + vs.markers[markBit].Draw(surface, rcMarker, vs.styles[STYLE_LINENUMBER].font, tFold); } marks >>= 1; } @@ -7744,6 +7777,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { InvalidateStyleData(); RedrawSelMargin(); break; + case SCI_MARKERSETBACKSELECTED: + if (wParam <= MARKER_MAX) + vs.markers[wParam].backSelected.desired = ColourDesired(lParam); + InvalidateStyleRedraw(); + break; + case SCI_MARKERENABLEHIGHLIGHT: + highlightDelimiter.isEnabled = wParam == 1; + InvalidateStyleRedraw(); + break; case SCI_MARKERSETBACK: if (wParam <= MARKER_MAX) vs.markers[wParam].back.desired = ColourDesired(lParam); diff --git a/src/Editor.h b/src/Editor.h index 27ef12459..50aa36686 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -139,6 +139,9 @@ protected: // ScintillaBase subclass needs access to much of Editor int cursorMode; int controlCharSymbol; + // Highlight current folding block + HighlightDelimiter highlightDelimiter; + bool hasFocus; bool hideSelection; bool inOverstrike; diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index 74d164de9..747c5ff12 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -20,6 +20,7 @@ using namespace Scintilla; void LineMarker::RefreshColourPalette(Palette &pal, bool want) { pal.WantFind(fore, want); pal.WantFind(back, want); + pal.WantFind(backSelected, want); if (pxpm) { pxpm->RefreshColourPalette(pal, want); } @@ -67,7 +68,30 @@ static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, C surface->FillRectangle(rcH, fore); } -void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter) { +void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold) { + ColourPair head = back; + ColourPair body = back; + ColourPair tail = back; + + switch (tFold) { + case LineMarker::head : + head = backSelected; + tail = backSelected; + break; + case LineMarker::body : + head = backSelected; + body = backSelected; + break; + case LineMarker::tail : + body = backSelected; + tail = backSelected; + break; + default : + // LineMarker::undefined + break; + } + + if ((markType == SC_MARK_PIXMAP) && (pxpm)) { pxpm->Draw(surface, rcWhole); return; @@ -159,106 +183,138 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac // An invisible marker so don't draw anything } else if (markType == SC_MARK_VLINE) { - surface->PenColour(back.allocated); + surface->PenColour(body.allocated); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, rcWhole.bottom); } else if (markType == SC_MARK_LCORNER) { - surface->PenColour(back.allocated); + surface->PenColour(tail.allocated); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, rc.top + dimOn2); surface->LineTo(rc.right - 2, rc.top + dimOn2); } else if (markType == SC_MARK_TCORNER) { - surface->PenColour(back.allocated); - surface->MoveTo(centreX, rcWhole.top); - surface->LineTo(centreX, rcWhole.bottom); + surface->PenColour(tail.allocated); surface->MoveTo(centreX, rc.top + dimOn2); surface->LineTo(rc.right - 2, rc.top + dimOn2); + surface->PenColour(body.allocated); + surface->MoveTo(centreX, rcWhole.top); + surface->LineTo(centreX, rc.top + dimOn2 + 1); + + surface->PenColour(head.allocated); + surface->LineTo(centreX, rcWhole.bottom); + } else if (markType == SC_MARK_LCORNERCURVE) { - surface->PenColour(back.allocated); + surface->PenColour(tail.allocated); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, rc.top + dimOn2-3); surface->LineTo(centreX+3, rc.top + dimOn2); surface->LineTo(rc.right - 1, rc.top + dimOn2); } else if (markType == SC_MARK_TCORNERCURVE) { - surface->PenColour(back.allocated); - surface->MoveTo(centreX, rcWhole.top); - surface->LineTo(centreX, rcWhole.bottom); - + surface->PenColour(tail.allocated); surface->MoveTo(centreX, rc.top + dimOn2-3); surface->LineTo(centreX+3, rc.top + dimOn2); surface->LineTo(rc.right - 1, rc.top + dimOn2); + surface->PenColour(body.allocated); + surface->MoveTo(centreX, rcWhole.top); + surface->LineTo(centreX, rc.top + dimOn2-2); + + surface->PenColour(head.allocated); + surface->LineTo(centreX, rcWhole.bottom); + } else if (markType == SC_MARK_BOXPLUS) { - surface->PenColour(back.allocated); - DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated); - DrawPlus(surface, centreX, centreY, blobSize, back.allocated); + DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); + DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); } else if (markType == SC_MARK_BOXPLUSCONNECTED) { - surface->PenColour(back.allocated); - DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated); - DrawPlus(surface, centreX, centreY, blobSize, back.allocated); - + surface->PenColour(body.allocated); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); + surface->PenColour(body.allocated); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, centreY - blobSize); + DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); + DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); + + if (tFold == LineMarker::body) { + surface->PenColour(tail.allocated); + surface->MoveTo(centreX + 1, centreY + blobSize); + surface->LineTo(centreX + blobSize + 1, centreY + blobSize); + + surface->MoveTo(centreX + blobSize, centreY + blobSize); + surface->LineTo(centreX + blobSize, centreY - blobSize); + + surface->MoveTo(centreX + 1, centreY - blobSize); + surface->LineTo(centreX + blobSize + 1, centreY - blobSize); + } } else if (markType == SC_MARK_BOXMINUS) { - surface->PenColour(back.allocated); - DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated); - DrawMinus(surface, centreX, centreY, blobSize, back.allocated); + DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); + DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); + surface->PenColour(head.allocated); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); } else if (markType == SC_MARK_BOXMINUSCONNECTED) { - surface->PenColour(back.allocated); - DrawBox(surface, centreX, centreY, blobSize, fore.allocated, back.allocated); - DrawMinus(surface, centreX, centreY, blobSize, back.allocated); + DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); + DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); + surface->PenColour(head.allocated); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); + surface->PenColour(body.allocated); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, centreY - blobSize); + if (tFold == LineMarker::body) { + surface->PenColour(tail.allocated); + surface->MoveTo(centreX + 1, centreY + blobSize); + surface->LineTo(centreX + blobSize + 1, centreY + blobSize); + + surface->MoveTo(centreX + blobSize, centreY + blobSize); + surface->LineTo(centreX + blobSize, centreY - blobSize); + + surface->MoveTo(centreX + 1, centreY - blobSize); + surface->LineTo(centreX + blobSize + 1, centreY - blobSize); + } } else if (markType == SC_MARK_CIRCLEPLUS) { - DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated); - surface->PenColour(back.allocated); - DrawPlus(surface, centreX, centreY, blobSize, back.allocated); + DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); + DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); } else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) { - DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated); - surface->PenColour(back.allocated); - DrawPlus(surface, centreX, centreY, blobSize, back.allocated); - + surface->PenColour(body.allocated); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, centreY - blobSize); + DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); + DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); + } else if (markType == SC_MARK_CIRCLEMINUS) { - DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated); - surface->PenColour(back.allocated); - DrawMinus(surface, centreX, centreY, blobSize, back.allocated); + DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); + DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); + surface->PenColour(head.allocated); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); } else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) { - DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, back.allocated); - surface->PenColour(back.allocated); - DrawMinus(surface, centreX, centreY, blobSize, back.allocated); + DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); + DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); + surface->PenColour(head.allocated); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); + surface->PenColour(body.allocated); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, centreY - blobSize); diff --git a/src/LineMarker.h b/src/LineMarker.h index 923211a05..39c38fa41 100644 --- a/src/LineMarker.h +++ b/src/LineMarker.h @@ -12,19 +12,24 @@ namespace Scintilla { #endif + /** */ class LineMarker { public: + enum typeOfFold { undefined, head, body, tail }; + int markType; ColourPair fore; ColourPair back; + ColourPair backSelected; int alpha; XPM *pxpm; LineMarker() { markType = SC_MARK_CIRCLE; fore = ColourDesired(0,0,0); back = ColourDesired(0xff,0xff,0xff); + backSelected = ColourDesired(0xff,0x00,0x00); alpha = SC_ALPHA_NOALPHA; pxpm = NULL; } @@ -33,6 +38,7 @@ public: markType = SC_MARK_CIRCLE; fore = ColourDesired(0,0,0); back = ColourDesired(0xff,0xff,0xff); + backSelected = ColourDesired(0xff,0x00,0x00); alpha = SC_ALPHA_NOALPHA; pxpm = NULL; } @@ -44,6 +50,7 @@ public: markType = SC_MARK_CIRCLE; fore = ColourDesired(0,0,0); back = ColourDesired(0xff,0xff,0xff); + backSelected = ColourDesired(0xff,0x00,0x00); alpha = SC_ALPHA_NOALPHA; delete pxpm; pxpm = NULL; @@ -52,7 +59,7 @@ public: void RefreshColourPalette(Palette &pal, bool want); void SetXPM(const char *textForm); void SetXPM(const char *const *linesForm); - void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter); + void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold); }; #ifdef SCI_NAMESPACE |