aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-04-20 09:33:43 +1000
committerNeil <nyamatongwe@gmail.com>2018-04-20 09:33:43 +1000
commit1d60604d5e2d82a64d8af4ec458c0c7e61c15097 (patch)
tree83d0beaf7dca24fb50d98f4e513653dbd6b318ec /win32/PlatWin.cxx
parent4b46a6a409ac3099cfea46371af34434087489f1 (diff)
downloadscintilla-mirror-1d60604d5e2d82a64d8af4ec458c0c7e61c15097.tar.gz
Feature [feature-requests:#1215]. Use standard functions in prference to
RoundXYPosition, XYMinimum, and XYMaximum.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx22
1 files changed, 4 insertions, 18 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 8e06b7f4c..2e3ed0d00 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -2441,20 +2441,6 @@ void ListBoxX::SetRedraw(bool on) {
::InvalidateRect(lb, NULL, TRUE);
}
-static XYPOSITION XYMinimum(XYPOSITION a, XYPOSITION b) {
- if (a < b)
- return a;
- else
- return b;
-}
-
-static XYPOSITION XYMaximum(XYPOSITION a, XYPOSITION b) {
- if (a > b)
- return a;
- else
- return b;
-}
-
void ListBoxX::ResizeToCursor() {
PRectangle rc = GetPosition();
POINT ptw;
@@ -2497,10 +2483,10 @@ void ListBoxX::ResizeToCursor() {
POINT ptMin = MinTrackSize();
POINT ptMax = MaxTrackSize();
// We don't allow the left edge to move at present, but just in case
- rc.left = XYMaximum(XYMinimum(rc.left, rcPreSize.right - ptMin.x), rcPreSize.right - ptMax.x);
- rc.top = XYMaximum(XYMinimum(rc.top, rcPreSize.bottom - ptMin.y), rcPreSize.bottom - ptMax.y);
- rc.right = XYMaximum(XYMinimum(rc.right, rcPreSize.left + ptMax.x), rcPreSize.left + ptMin.x);
- rc.bottom = XYMaximum(XYMinimum(rc.bottom, rcPreSize.top + ptMax.y), rcPreSize.top + ptMin.y);
+ rc.left = std::clamp(rc.left, rcPreSize.right - ptMax.x, rcPreSize.right - ptMin.x);
+ rc.top = std::clamp(rc.top, rcPreSize.bottom - ptMax.y, rcPreSize.bottom - ptMin.y);
+ rc.right = std::clamp(rc.right, rcPreSize.left + ptMin.x, rcPreSize.left + ptMax.x);
+ rc.bottom = std::clamp(rc.bottom, rcPreSize.top + ptMin.y, rcPreSize.top + ptMax.y);
SetPosition(rc);
}