aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cocoa/ScintillaCocoa.mm2
-rw-r--r--gtk/PlatGTK.cxx8
-rw-r--r--gtk/ScintillaGTK.cxx8
-rw-r--r--lexers/LexCoffeeScript.cxx4
-rw-r--r--src/Indicator.cxx7
-rw-r--r--src/LineMarker.cxx3
-rw-r--r--win32/PlatWin.cxx17
7 files changed, 29 insertions, 20 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index eeb0daf8f..90d6aa4d7 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -1887,7 +1887,7 @@ void ScintillaCocoa::Resize() {
void ScintillaCocoa::UpdateForScroll() {
Point ptOrigin = GetVisibleOriginInMain();
xOffset = static_cast<int>(ptOrigin.x);
- int newTop = Platform::Minimum(static_cast<int>(ptOrigin.y / vs.lineHeight), MaxScrollPos());
+ Sci::Line newTop = std::min(static_cast<Sci::Line>(ptOrigin.y / vs.lineHeight), MaxScrollPos());
SetTopLine(newTop);
}
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index ee001cde4..b2437e7e6 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -432,10 +432,10 @@ void SurfaceImpl::LineTo(int x_, int y_) {
if ((xDiff == 0) || (yDiff == 0)) {
// Horizontal or vertical lines can be more precisely drawn as a filled rectangle
int xEnd = x_ - xDelta;
- int left = Platform::Minimum(x, xEnd);
+ int left = std::min(x, xEnd);
int width = abs(x - xEnd) + 1;
int yEnd = y_ - yDelta;
- int top = Platform::Minimum(y, yEnd);
+ int top = std::min(y, yEnd);
int height = abs(y - yEnd) + 1;
cairo_rectangle(context, left, top, width, height);
cairo_fill(context);
@@ -618,7 +618,7 @@ void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)
PLATFORM_ASSERT(context);
PenColour(back);
cairo_arc(context, (rc.left + rc.right) / 2, (rc.top + rc.bottom) / 2,
- Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*kPi);
+ std::min(rc.Width(), rc.Height()) / 2, 0, 2*kPi);
cairo_fill_preserve(context);
PenColour(fore);
cairo_stroke(context);
@@ -1307,7 +1307,7 @@ static int treeViewGetRowHeight(GtkTreeView *view) {
"vertical-separator", &vertical_separator,
"expander-size", &expander_size, NULL);
row_height += vertical_separator;
- row_height = Platform::Maximum(row_height, expander_size);
+ row_height = std::max(row_height, expander_size);
return row_height;
#endif
}
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 0737b71f1..2291dfffc 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -1614,7 +1614,7 @@ void ScintillaGTK::Resize(int width, int height) {
gtk_widget_show(GTK_WIDGET(PWidget(scrollbarh)));
alloc.x = 0;
alloc.y = height - horizontalScrollBarHeight;
- alloc.width = Platform::Maximum(minHScrollBarWidth, width - verticalScrollBarWidth);
+ alloc.width = std::max(minHScrollBarWidth, width - verticalScrollBarWidth);
alloc.height = horizontalScrollBarHeight;
gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarh)), &alloc);
} else {
@@ -1627,7 +1627,7 @@ void ScintillaGTK::Resize(int width, int height) {
alloc.x = width - verticalScrollBarWidth;
alloc.y = 0;
alloc.width = verticalScrollBarWidth;
- alloc.height = Platform::Maximum(minVScrollBarHeight, height - horizontalScrollBarHeight);
+ alloc.height = std::max(minVScrollBarHeight, height - horizontalScrollBarHeight);
gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarv)), &alloc);
} else {
gtk_widget_hide(GTK_WIDGET(PWidget(scrollbarv)));
@@ -1648,8 +1648,8 @@ void ScintillaGTK::Resize(int width, int height) {
alloc.width = requisition.width;
alloc.height = requisition.height;
#endif
- alloc.width = Platform::Maximum(alloc.width, width - verticalScrollBarWidth);
- alloc.height = Platform::Maximum(alloc.height, height - horizontalScrollBarHeight);
+ alloc.width = std::max(alloc.width, width - verticalScrollBarWidth);
+ alloc.height = std::max(alloc.height, height - horizontalScrollBarHeight);
gtk_widget_size_allocate(GTK_WIDGET(PWidget(wText)), &alloc);
}
diff --git a/lexers/LexCoffeeScript.cxx b/lexers/LexCoffeeScript.cxx
index 63ee172e2..b835c52ec 100644
--- a/lexers/LexCoffeeScript.cxx
+++ b/lexers/LexCoffeeScript.cxx
@@ -14,6 +14,8 @@
#include <assert.h>
#include <ctype.h>
+#include <algorithm>
+
#include "Platform.h"
#include "ILexer.h"
#include "Scintilla.h"
@@ -427,7 +429,7 @@ static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int
}
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
- const int levelBeforeComments = Platform::Maximum(indentCurrentLevel,levelAfterComments);
+ const int levelBeforeComments = std::max(indentCurrentLevel,levelAfterComments);
// Now set all the indent levels on the lines we skipped
// Do this from end to start. Once we encounter one line
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index 16fc5912d..b59f1804f 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -8,6 +8,7 @@
#include <stdexcept>
#include <vector>
#include <map>
+#include <algorithm>
#include <memory>
#include "Platform.h"
@@ -55,7 +56,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
} else if (sacDraw.style == INDIC_SQUIGGLEPIXMAP) {
PRectangle rcSquiggle = PixelGridAlign(rc);
- int width = Platform::Minimum(4000, static_cast<int>(rcSquiggle.Width()));
+ int width = std::min(4000, static_cast<int>(rcSquiggle.Width()));
RGBAImage image(width, 3, 1.0, 0);
enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f };
for (int x = 0; x < width; x++) {
@@ -137,7 +138,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
rcBox.top = rcLine.top + 1;
rcBox.bottom = rcLine.bottom;
// Cap width at 4000 to avoid large allocations when mistakes made
- int width = Platform::Minimum(static_cast<int>(rcBox.Width()), 4000);
+ int width = std::min(static_cast<int>(rcBox.Width()), 4000);
RGBAImage image(width, static_cast<int>(rcBox.Height()), 1.0, 0);
// Draw horizontal lines top and bottom
for (int x=0; x<width; x++) {
@@ -156,7 +157,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
int x = static_cast<int>(rc.left);
while (x < rc.right) {
surface->MoveTo(x, ymid);
- surface->LineTo(Platform::Minimum(x + 4, static_cast<int>(rc.right)), ymid);
+ surface->LineTo(std::min(x + 4, static_cast<int>(rc.right)), ymid);
x += 7;
}
} else if (sacDraw.style == INDIC_DOTS) {
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index d80a3c78c..5f8243ff8 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -11,6 +11,7 @@
#include <stdexcept>
#include <vector>
#include <map>
+#include <algorithm>
#include <memory>
#include "Platform.h"
@@ -117,7 +118,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
PRectangle rc = rcWhole;
rc.top++;
rc.bottom--;
- int minDim = Platform::Minimum(static_cast<int>(rc.Width()), static_cast<int>(rc.Height()));
+ int minDim = std::min(static_cast<int>(rc.Width()), static_cast<int>(rc.Height()));
minDim--; // Ensure does not go beyond edge
int centreX = static_cast<int>(floor((rc.right + rc.left) / 2.0));
const int centreY = static_cast<int>(floor((rc.bottom + rc.top) / 2.0));
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index f1d73c2d6..7a0385a27 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -17,8 +17,13 @@
#include <vector>
#include <map>
+#include <algorithm>
#include <memory>
+// Want to use std::min and std::max so don't want Windows.h version of min and max
+#if !defined(NOMINMAX)
+#define NOMINMAX
+#endif
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#undef WINVER
@@ -771,7 +776,7 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil
int width = static_cast<int>(rc.Width());
int height = static_cast<int>(rc.Height());
// Ensure not distorted too much by corners when small
- cornerSize = Platform::Minimum(cornerSize, (Platform::Minimum(width, height) / 2) - 2);
+ cornerSize = std::min(cornerSize, (std::min(width, height) / 2) - 2);
BITMAPINFO bpih = {{sizeof(BITMAPINFOHEADER), width, height, 1, 32, BI_RGB, 0, 0, 0, 0, 0}};
void *image = 0;
HBITMAP hbmMem = CreateDIBSection(hMemDC, &bpih,
@@ -929,7 +934,7 @@ XYPOSITION SurfaceGDI::WidthText(Font &font_, const char *s, int len) {
SetFont(font_);
SIZE sz={0,0};
if (!unicodeMode) {
- ::GetTextExtentPoint32A(hdc, s, Platform::Minimum(len, maxLenText), &sz);
+ ::GetTextExtentPoint32A(hdc, s, std::min(len, maxLenText), &sz);
} else {
const TextWide tbuf(s, len, unicodeMode, codePage);
::GetTextExtentPoint32W(hdc, tbuf.buffer, tbuf.tlen, &sz);
@@ -1306,10 +1311,10 @@ void SurfaceD2D::LineTo(int x_, int y_) {
if ((xDiff == 0) || (yDiff == 0)) {
// Horizontal or vertical lines can be more precisely drawn as a filled rectangle
const int xEnd = x_ - xDelta;
- const int left = Platform::Minimum(x, xEnd);
+ const int left = std::min(x, xEnd);
const int width = abs(x - xEnd) + 1;
const int yEnd = y_ - yDelta;
- const int top = Platform::Minimum(y, yEnd);
+ const int top = std::min(y, yEnd);
const int height = abs(y - yEnd) + 1;
D2D1_RECT_F rectangle1 = D2D1::RectF(static_cast<float>(left), static_cast<float>(top),
static_cast<float>(left+width), static_cast<float>(top+height));
@@ -2196,7 +2201,7 @@ PRectangle ListBoxX::GetDesiredRect() {
SelectFont(hdc, oldFont);
::ReleaseDC(lb, hdc);
- const int widthDesired = Platform::Maximum(textSize.cx, (len + 1) * tm.tmAveCharWidth);
+ const int widthDesired = std::max(textSize.cx, (len + 1) * tm.tmAveCharWidth);
if (width < widthDesired)
width = widthDesired;
@@ -2436,7 +2441,7 @@ POINT ListBoxX::MinTrackSize() const {
POINT ListBoxX::MaxTrackSize() const {
PRectangle rc = PRectangle::FromInts(0, 0,
- Platform::Maximum(MinClientWidth(),
+ std::max(static_cast<unsigned int>(MinClientWidth()),
maxCharWidth * maxItemCharacters + static_cast<int>(TextInset.x) * 2 +
TextOffset() + ::GetSystemMetrics(SM_CXVSCROLL)),
ItemHeight() * lti.Count());