diff options
Diffstat (limited to 'src/LineMarker.cxx')
-rw-r--r-- | src/LineMarker.cxx | 127 |
1 files changed, 59 insertions, 68 deletions
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index b2b7ceae8..a14e4e40d 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -20,15 +20,6 @@ using namespace Scintilla; #endif -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); - } -} - void LineMarker::SetXPM(const char *textForm) { delete pxpm; pxpm = new XPM(textForm); @@ -47,7 +38,7 @@ void LineMarker::SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRG markType = SC_MARK_RGBAIMAGE; } -static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) { +static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { PRectangle rc; rc.left = centreX - armSize; rc.top = centreY - armSize; @@ -56,7 +47,7 @@ static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, Col surface->RectangleDraw(rc, back, fore); } -static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) { +static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { PRectangle rcCircle; rcCircle.left = centreX - armSize; rcCircle.top = centreY - armSize; @@ -65,22 +56,22 @@ static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, surface->Ellipse(rcCircle, back, fore); } -static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore) { +static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { PRectangle rcV(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1); surface->FillRectangle(rcV, fore); PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1); surface->FillRectangle(rcH, fore); } -static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore) { +static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1); surface->FillRectangle(rcH, fore); } void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold) { - ColourPair head = back; - ColourPair body = back; - ColourPair tail = back; + ColourDesired head = back; + ColourDesired body = back; + ColourDesired tail = back; switch (tFold) { case LineMarker::head : @@ -130,14 +121,14 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac PRectangle rcRounded = rc; rcRounded.left = rc.left + 1; rcRounded.right = rc.right - 1; - surface->RoundedRectangle(rcRounded, fore.allocated, back.allocated); + surface->RoundedRectangle(rcRounded, fore, back); } else if (markType == SC_MARK_CIRCLE) { PRectangle rcCircle; rcCircle.left = centreX - dimOn2; rcCircle.top = centreY - dimOn2; rcCircle.right = centreX + dimOn2; rcCircle.bottom = centreY + dimOn2; - surface->Ellipse(rcCircle, fore.allocated, back.allocated); + surface->Ellipse(rcCircle, fore, back); } else if (markType == SC_MARK_ARROW) { Point pts[] = { Point(centreX - dimOn4, centreY - dimOn2), @@ -145,7 +136,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point(centreX + dimOn2 - dimOn4, centreY), }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), - fore.allocated, back.allocated); + fore, back); } else if (markType == SC_MARK_ARROWDOWN) { Point pts[] = { @@ -154,7 +145,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point(centreX, centreY + dimOn2 - dimOn4), }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), - fore.allocated, back.allocated); + fore, back); } else if (markType == SC_MARK_PLUS) { Point pts[] = { @@ -172,7 +163,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point(centreX - armSize, centreY + 1), }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), - fore.allocated, back.allocated); + fore, back); } else if (markType == SC_MARK_MINUS) { Point pts[] = { @@ -182,7 +173,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point(centreX - armSize, centreY + 1), }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), - fore.allocated, back.allocated); + fore, back); } else if (markType == SC_MARK_SMALLRECT) { PRectangle rcSmall; @@ -190,76 +181,76 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac rcSmall.top = rc.top + 2; rcSmall.right = rc.right - 1; rcSmall.bottom = rc.bottom - 2; - surface->RectangleDraw(rcSmall, fore.allocated, back.allocated); + surface->RectangleDraw(rcSmall, fore, back); } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND || markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) { // An invisible marker so don't draw anything } else if (markType == SC_MARK_VLINE) { - surface->PenColour(body.allocated); + surface->PenColour(body); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, rcWhole.bottom); } else if (markType == SC_MARK_LCORNER) { - surface->PenColour(tail.allocated); + surface->PenColour(tail); 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(tail.allocated); + surface->PenColour(tail); surface->MoveTo(centreX, rc.top + dimOn2); surface->LineTo(rc.right - 2, rc.top + dimOn2); - surface->PenColour(body.allocated); + surface->PenColour(body); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, rc.top + dimOn2 + 1); - surface->PenColour(head.allocated); + surface->PenColour(head); surface->LineTo(centreX, rcWhole.bottom); } else if (markType == SC_MARK_LCORNERCURVE) { - surface->PenColour(tail.allocated); + surface->PenColour(tail); 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(tail.allocated); + surface->PenColour(tail); 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->PenColour(body); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, rc.top + dimOn2-2); - surface->PenColour(head.allocated); + surface->PenColour(head); surface->LineTo(centreX, rcWhole.bottom); } else if (markType == SC_MARK_BOXPLUS) { - DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); - DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); + DrawBox(surface, centreX, centreY, blobSize, fore, head); + DrawPlus(surface, centreX, centreY, blobSize, tail); } else if (markType == SC_MARK_BOXPLUSCONNECTED) { if (tFold == LineMarker::headWithTail) - surface->PenColour(tail.allocated); + surface->PenColour(tail); else - surface->PenColour(body.allocated); + surface->PenColour(body); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); - surface->PenColour(body.allocated); + surface->PenColour(body); 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); + DrawBox(surface, centreX, centreY, blobSize, fore, head); + DrawPlus(surface, centreX, centreY, blobSize, tail); if (tFold == LineMarker::body) { - surface->PenColour(tail.allocated); + surface->PenColour(tail); surface->MoveTo(centreX + 1, centreY + blobSize); surface->LineTo(centreX + blobSize + 1, centreY + blobSize); @@ -270,27 +261,27 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac surface->LineTo(centreX + blobSize + 1, centreY - blobSize); } } else if (markType == SC_MARK_BOXMINUS) { - DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); - DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); + DrawBox(surface, centreX, centreY, blobSize, fore, head); + DrawMinus(surface, centreX, centreY, blobSize, tail); - surface->PenColour(head.allocated); + surface->PenColour(head); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); } else if (markType == SC_MARK_BOXMINUSCONNECTED) { - DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); - DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); + DrawBox(surface, centreX, centreY, blobSize, fore, head); + DrawMinus(surface, centreX, centreY, blobSize, tail); - surface->PenColour(head.allocated); + surface->PenColour(head); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); - surface->PenColour(body.allocated); + surface->PenColour(body); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, centreY - blobSize); if (tFold == LineMarker::body) { - surface->PenColour(tail.allocated); + surface->PenColour(tail); surface->MoveTo(centreX + 1, centreY + blobSize); surface->LineTo(centreX + blobSize + 1, centreY + blobSize); @@ -301,41 +292,41 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac surface->LineTo(centreX + blobSize + 1, centreY - blobSize); } } else if (markType == SC_MARK_CIRCLEPLUS) { - DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); - DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); + DrawCircle(surface, centreX, centreY, blobSize, fore, head); + DrawPlus(surface, centreX, centreY, blobSize, tail); } else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) { if (tFold == LineMarker::headWithTail) - surface->PenColour(tail.allocated); + surface->PenColour(tail); else - surface->PenColour(body.allocated); + surface->PenColour(body); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); - surface->PenColour(body.allocated); + surface->PenColour(body); 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); + DrawCircle(surface, centreX, centreY, blobSize, fore, head); + DrawPlus(surface, centreX, centreY, blobSize, tail); } else if (markType == SC_MARK_CIRCLEMINUS) { - DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); - DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); + DrawCircle(surface, centreX, centreY, blobSize, fore, head); + DrawMinus(surface, centreX, centreY, blobSize, tail); - surface->PenColour(head.allocated); + surface->PenColour(head); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); } else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) { - DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); - DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); + DrawCircle(surface, centreX, centreY, blobSize, fore, head); + DrawMinus(surface, centreX, centreY, blobSize, tail); - surface->PenColour(head.allocated); + surface->PenColour(head); surface->MoveTo(centreX, centreY + blobSize); surface->LineTo(centreX, rcWhole.bottom); - surface->PenColour(body.allocated); + surface->PenColour(body); surface->MoveTo(centreX, rcWhole.top); surface->LineTo(centreX, centreY - blobSize); @@ -346,17 +337,17 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac rc.left += (rc.Width() - width) / 2; rc.right = rc.left + width; surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2, - character, 1, fore.allocated, back.allocated); + character, 1, fore, back); } else if (markType == SC_MARK_DOTDOTDOT) { int right = centreX - 6; for (int b=0; b<3; b++) { PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2); - surface->FillRectangle(rcBlob, fore.allocated); + surface->FillRectangle(rcBlob, fore); right += 5; } } else if (markType == SC_MARK_ARROWS) { - surface->PenColour(fore.allocated); + surface->PenColour(fore); int right = centreX - 2; for (int b=0; b<3; b++) { surface->MoveTo(right - 4, centreY - 4); @@ -376,12 +367,12 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac Point(centreX, centreY + dimOn2), }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), - fore.allocated, back.allocated); + fore, back); } else if (markType == SC_MARK_LEFTRECT) { PRectangle rcLeft = rcWhole; rcLeft.right = rcLeft.left + 4; - surface->FillRectangle(rcLeft, back.allocated); + surface->FillRectangle(rcLeft, back); } else { // SC_MARK_FULLRECT - surface->FillRectangle(rcWhole, back.allocated); + surface->FillRectangle(rcWhole, back); } } |