diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2014-05-22 09:41:44 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2014-05-22 10:22:24 +0300 |
commit | f2a80f864fe05792b1f234aa3716f2cb89b3474e (patch) | |
tree | 4b604cc8f6c2ebbfbeb4546ff0cbece41170956a /scintilla/src/LineMarker.cxx | |
parent | 12ee3c17590032a0e93654fb6fbdeb0972b4e113 (diff) | |
download | notepad2-mod-f2a80f864fe05792b1f234aa3716f2cb89b3474e.zip notepad2-mod-f2a80f864fe05792b1f234aa3716f2cb89b3474e.tar.gz notepad2-mod-f2a80f864fe05792b1f234aa3716f2cb89b3474e.tar.bz2 |
Update Scintilla to 3.4.2.
Diffstat (limited to 'scintilla/src/LineMarker.cxx')
-rw-r--r-- | scintilla/src/LineMarker.cxx | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/scintilla/src/LineMarker.cxx b/scintilla/src/LineMarker.cxx index 2a332ab..b5d9f88 100644 --- a/scintilla/src/LineMarker.cxx +++ b/scintilla/src/LineMarker.cxx @@ -37,37 +37,37 @@ void LineMarker::SetXPM(const char *const *linesForm) { void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage) {
delete image;
- image = new RGBAImage(sizeRGBAImage.x, sizeRGBAImage.y, scale, pixelsRGBAImage);
+ image = new RGBAImage(static_cast<int>(sizeRGBAImage.x), static_cast<int>(sizeRGBAImage.y), scale, pixelsRGBAImage);
markType = SC_MARK_RGBAIMAGE;
}
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;
- rc.right = centreX + armSize + 1;
- rc.bottom = centreY + armSize + 1;
+ PRectangle rc = PRectangle::FromInts(
+ centreX - armSize,
+ centreY - armSize,
+ centreX + armSize + 1,
+ centreY + armSize + 1);
surface->RectangleDraw(rc, back, fore);
}
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;
- rcCircle.right = centreX + armSize + 1;
- rcCircle.bottom = centreY + armSize + 1;
+ PRectangle rcCircle = PRectangle::FromInts(
+ centreX - armSize,
+ centreY - armSize,
+ centreX + armSize + 1,
+ centreY + armSize + 1);
surface->Ellipse(rcCircle, back, 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);
+ PRectangle rcV = PRectangle::FromInts(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);
+ PRectangle rcH = PRectangle::FromInts(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, ColourDesired fore) {
- PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);
+ PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1);
surface->FillRectangle(rcH, fore);
}
@@ -102,9 +102,9 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac if ((markType == SC_MARK_RGBAIMAGE) && (image)) {
// Make rectangle just large enough to fit image centred on centre of rcWhole
PRectangle rcImage;
- rcImage.top = static_cast<int>(((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2);
+ rcImage.top = ((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2;
rcImage.bottom = rcImage.top + image->GetScaledHeight();
- rcImage.left = static_cast<int>(((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2);
+ rcImage.left = ((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2;
rcImage.right = rcImage.left + image->GetScaledWidth();
surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels());
return;
@@ -113,17 +113,17 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac PRectangle rc = rcWhole;
rc.top++;
rc.bottom--;
- int minDim = Platform::Minimum(rc.Width(), rc.Height());
+ int minDim = Platform::Minimum(static_cast<int>(rc.Width()), static_cast<int>(rc.Height()));
minDim--; // Ensure does not go beyond edge
- int centreX = floor((rc.right + rc.left) / 2.0);
- int centreY = floor((rc.bottom + rc.top) / 2.0);
+ int centreX = static_cast<int>(floor((rc.right + rc.left) / 2.0));
+ int centreY = static_cast<int>(floor((rc.bottom + rc.top) / 2.0));
int dimOn2 = minDim / 2;
int dimOn4 = minDim / 4;
int blobSize = dimOn2-1;
int armSize = dimOn2-2;
if (marginStyle == SC_MARGIN_NUMBER || marginStyle == SC_MARGIN_TEXT || marginStyle == SC_MARGIN_RTEXT) {
// On textual margins move marker to the left to try to avoid overlapping the text
- centreX = rc.left + dimOn2 + 1;
+ centreX = static_cast<int>(rc.left) + dimOn2 + 1;
}
if (markType == SC_MARK_ROUNDRECT) {
PRectangle rcRounded = rc;
@@ -131,51 +131,51 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac rcRounded.right = rc.right - 1;
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;
+ PRectangle rcCircle = PRectangle::FromInts(
+ centreX - dimOn2,
+ centreY - dimOn2,
+ centreX + dimOn2,
+ centreY + dimOn2);
surface->Ellipse(rcCircle, fore, back);
} else if (markType == SC_MARK_ARROW) {
Point pts[] = {
- Point(centreX - dimOn4, centreY - dimOn2),
- Point(centreX - dimOn4, centreY + dimOn2),
- Point(centreX + dimOn2 - dimOn4, centreY),
+ Point::FromInts(centreX - dimOn4, centreY - dimOn2),
+ Point::FromInts(centreX - dimOn4, centreY + dimOn2),
+ Point::FromInts(centreX + dimOn2 - dimOn4, centreY),
};
surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else if (markType == SC_MARK_ARROWDOWN) {
Point pts[] = {
- Point(centreX - dimOn2, centreY - dimOn4),
- Point(centreX + dimOn2, centreY - dimOn4),
- Point(centreX, centreY + dimOn2 - dimOn4),
+ Point::FromInts(centreX - dimOn2, centreY - dimOn4),
+ Point::FromInts(centreX + dimOn2, centreY - dimOn4),
+ Point::FromInts(centreX, centreY + dimOn2 - dimOn4),
};
surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else if (markType == SC_MARK_PLUS) {
Point pts[] = {
- Point(centreX - armSize, centreY - 1),
- Point(centreX - 1, centreY - 1),
- Point(centreX - 1, centreY - armSize),
- Point(centreX + 1, centreY - armSize),
- Point(centreX + 1, centreY - 1),
- Point(centreX + armSize, centreY -1),
- Point(centreX + armSize, centreY +1),
- Point(centreX + 1, centreY + 1),
- Point(centreX + 1, centreY + armSize),
- Point(centreX - 1, centreY + armSize),
- Point(centreX - 1, centreY + 1),
- Point(centreX - armSize, centreY + 1),
+ Point::FromInts(centreX - armSize, centreY - 1),
+ Point::FromInts(centreX - 1, centreY - 1),
+ Point::FromInts(centreX - 1, centreY - armSize),
+ Point::FromInts(centreX + 1, centreY - armSize),
+ Point::FromInts(centreX + 1, centreY - 1),
+ Point::FromInts(centreX + armSize, centreY -1),
+ Point::FromInts(centreX + armSize, centreY +1),
+ Point::FromInts(centreX + 1, centreY + 1),
+ Point::FromInts(centreX + 1, centreY + armSize),
+ Point::FromInts(centreX - 1, centreY + armSize),
+ Point::FromInts(centreX - 1, centreY + 1),
+ Point::FromInts(centreX - armSize, centreY + 1),
};
surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else if (markType == SC_MARK_MINUS) {
Point pts[] = {
- Point(centreX - armSize, centreY - 1),
- Point(centreX + armSize, centreY -1),
- Point(centreX + armSize, centreY +1),
- Point(centreX - armSize, centreY + 1),
+ Point::FromInts(centreX - armSize, centreY - 1),
+ Point::FromInts(centreX + armSize, centreY -1),
+ Point::FromInts(centreX + armSize, centreY +1),
+ Point::FromInts(centreX - armSize, centreY + 1),
};
surface->Polygon(pts, ELEMENTS(pts), fore, back);
@@ -193,46 +193,46 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac } else if (markType == SC_MARK_VLINE) {
surface->PenColour(body);
- surface->MoveTo(centreX, rcWhole.top);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
} else if (markType == SC_MARK_LCORNER) {
surface->PenColour(tail);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY);
- surface->LineTo(rc.right - 1, centreY);
+ surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
} else if (markType == SC_MARK_TCORNER) {
surface->PenColour(tail);
surface->MoveTo(centreX, centreY);
- surface->LineTo(rc.right - 1, centreY);
+ surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
surface->PenColour(body);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY + 1);
surface->PenColour(head);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
} else if (markType == SC_MARK_LCORNERCURVE) {
surface->PenColour(tail);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY-3);
surface->LineTo(centreX+3, centreY);
- surface->LineTo(rc.right - 1, centreY);
+ surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
} else if (markType == SC_MARK_TCORNERCURVE) {
surface->PenColour(tail);
surface->MoveTo(centreX, centreY-3);
surface->LineTo(centreX+3, centreY);
- surface->LineTo(rc.right - 1, centreY);
+ surface->LineTo(static_cast<int>(rc.right) - 1, centreY);
surface->PenColour(body);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY-2);
surface->PenColour(head);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
} else if (markType == SC_MARK_BOXPLUS) {
DrawBox(surface, centreX, centreY, blobSize, fore, head);
@@ -244,10 +244,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac else
surface->PenColour(body);
surface->MoveTo(centreX, centreY + blobSize);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
surface->PenColour(body);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY - blobSize);
DrawBox(surface, centreX, centreY, blobSize, fore, head);
@@ -270,7 +270,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac surface->PenColour(head);
surface->MoveTo(centreX, centreY + blobSize);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
} else if (markType == SC_MARK_BOXMINUSCONNECTED) {
DrawBox(surface, centreX, centreY, blobSize, fore, head);
@@ -278,10 +278,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac surface->PenColour(head);
surface->MoveTo(centreX, centreY + blobSize);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
surface->PenColour(body);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY - blobSize);
if (tFold == LineMarker::body) {
@@ -305,10 +305,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac else
surface->PenColour(body);
surface->MoveTo(centreX, centreY + blobSize);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
surface->PenColour(body);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY - blobSize);
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
@@ -317,7 +317,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac } else if (markType == SC_MARK_CIRCLEMINUS) {
surface->PenColour(head);
surface->MoveTo(centreX, centreY + blobSize);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
DrawMinus(surface, centreX, centreY, blobSize, tail);
@@ -325,10 +325,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac } else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) {
surface->PenColour(head);
surface->MoveTo(centreX, centreY + blobSize);
- surface->LineTo(centreX, rcWhole.bottom);
+ surface->LineTo(centreX, static_cast<int>(rcWhole.bottom));
surface->PenColour(body);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, static_cast<int>(rcWhole.top));
surface->LineTo(centreX, centreY - blobSize);
DrawCircle(surface, centreX, centreY, blobSize, fore, head);
@@ -344,11 +344,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac character, 1, fore, back);
} else if (markType == SC_MARK_DOTDOTDOT) {
- int right = centreX - 6;
+ XYPOSITION right = static_cast<XYPOSITION>(centreX - 6);
for (int b=0; b<3; b++) {
PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2);
surface->FillRectangle(rcBlob, fore);
- right += 5;
+ right += 5.0f;
}
} else if (markType == SC_MARK_ARROWS) {
surface->PenColour(fore);
@@ -363,14 +363,14 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac }
} else if (markType == SC_MARK_SHORTARROW) {
Point pts[] = {
- Point(centreX, centreY + dimOn2),
- Point(centreX + dimOn2, centreY),
- Point(centreX, centreY - dimOn2),
- Point(centreX, centreY - dimOn4),
- Point(centreX - dimOn4, centreY - dimOn4),
- Point(centreX - dimOn4, centreY + dimOn4),
- Point(centreX, centreY + dimOn4),
- Point(centreX, centreY + dimOn2),
+ Point::FromInts(centreX, centreY + dimOn2),
+ Point::FromInts(centreX + dimOn2, centreY),
+ Point::FromInts(centreX, centreY - dimOn2),
+ Point::FromInts(centreX, centreY - dimOn4),
+ Point::FromInts(centreX - dimOn4, centreY - dimOn4),
+ Point::FromInts(centreX - dimOn4, centreY + dimOn4),
+ Point::FromInts(centreX, centreY + dimOn4),
+ Point::FromInts(centreX, centreY + dimOn2),
};
surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else if (markType == SC_MARK_LEFTRECT) {
@@ -380,11 +380,11 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac } else if (markType == SC_MARK_BOOKMARK) {
int halfHeight = minDim / 3;
Point pts[] = {
- Point(rc.left, centreY-halfHeight),
- Point(rc.right-3, centreY-halfHeight),
- Point(rc.right-3-halfHeight, centreY),
- Point(rc.right-3, centreY+halfHeight),
- Point(rc.left, centreY+halfHeight),
+ Point::FromInts(static_cast<int>(rc.left), centreY-halfHeight),
+ Point::FromInts(static_cast<int>(rc.right) - 3, centreY - halfHeight),
+ Point::FromInts(static_cast<int>(rc.right) - 3 - halfHeight, centreY),
+ Point::FromInts(static_cast<int>(rc.right) - 3, centreY + halfHeight),
+ Point::FromInts(static_cast<int>(rc.left), centreY + halfHeight),
};
surface->Polygon(pts, ELEMENTS(pts), fore, back);
} else { // SC_MARK_FULLRECT
|