diff options
author | Neil <nyamatongwe@gmail.com> | 2018-03-01 11:03:37 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-03-01 11:03:37 +1100 |
commit | ae4b1d41a3e763240a5e9f60f76cedab55e1e5e2 (patch) | |
tree | b201f21a3c0bcae634b8633c1c3d8ea704529b46 /src/CallTip.cxx | |
parent | 5b88f2c8d74cdeab860dc8a009428f9474bc2c8b (diff) | |
download | scintilla-mirror-ae4b1d41a3e763240a5e9f60f76cedab55e1e5e2.tar.gz |
Mark variables as const where simple.
Diffstat (limited to 'src/CallTip.cxx')
-rw-r--r-- | src/CallTip.cxx | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/CallTip.cxx b/src/CallTip.cxx index b7aaaceb8..3d62dba88 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -108,7 +108,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s, int startSeg = 0; int xEnd; for (int seg = 0; seg<maxEnd; seg++) { - int endSeg = ends[seg]; + const int endSeg = ends[seg]; if (endSeg > startSeg) { if (IsArrowCharacter(s[startSeg])) { xEnd = x + widthArrow; @@ -121,7 +121,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s, const int centreX = x + widthArrow / 2 - 1; const int centreY = static_cast<int>(rcClient.top + rcClient.bottom) / 2; surface->FillRectangle(rcClient, colourBG); - PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1, + const PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1, rcClient.right - 2, rcClient.bottom - 1); surface->FillRectangle(rcClientInner, colourUnSel); @@ -166,13 +166,13 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s, } int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { - PRectangle rcClientPos = wCallTip.GetClientPosition(); - PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left, + const PRectangle rcClientPos = wCallTip.GetClientPosition(); + const PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left, rcClientPos.bottom - rcClientPos.top); PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1); // To make a nice small call tip window, it is only sized to fit most normal characters without accents - int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)); + const int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)); // For each line... // Draw the definition in three parts: before highlight, highlighted, after highlight @@ -219,10 +219,10 @@ int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { void CallTip::PaintCT(Surface *surfaceWindow) { if (val.empty()) return; - PRectangle rcClientPos = wCallTip.GetClientPosition(); - PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left, + const PRectangle rcClientPos = wCallTip.GetClientPosition(); + const PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left, rcClientPos.bottom - rcClientPos.top); - PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1); + const PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1); surfaceWindow->FillRectangle(rcClient, colourBG); @@ -265,8 +265,8 @@ PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, co endHighlight = 0; inCallTipMode = true; posStartCallTip = pos; - XYPOSITION deviceHeight = static_cast<XYPOSITION>(surfaceMeasure->DeviceHeightFont(size)); - FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet); + const XYPOSITION deviceHeight = static_cast<XYPOSITION>(surfaceMeasure->DeviceHeightFont(size)); + const FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet); font.Create(fp); // Look for multiple lines in the text // Only support \n here - simply means container must avoid \r! @@ -286,7 +286,7 @@ PRectangle CallTip::CallTipStart(Sci::Position pos, Point pt, int textHeight, co // The returned // rectangle is aligned to the right edge of the last arrow encountered in // the tip text, else to the tip text left edge. - int height = lineHeight * numLines - static_cast<int>(surfaceMeasure->InternalLeading(font)) + borderHeight * 2; + const int height = lineHeight * numLines - static_cast<int>(surfaceMeasure->InternalLeading(font)) + borderHeight * 2; if (above) { return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset); } else { |