aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authormitchell <unknown>2018-05-06 09:16:53 -0400
committermitchell <unknown>2018-05-06 09:16:53 -0400
commit91bdbe3b40b76e9ea822ee750b4ab543f4bb105d (patch)
tree13ff976a6dd0cb0b43d8dae12319629856a215d4 /win32/PlatWin.cxx
parent74a34523f9c17cdca12143d31a578d8565b1922d (diff)
downloadscintilla-mirror-91bdbe3b40b76e9ea822ee750b4ab543f4bb105d.tar.gz
Backport: Feature [feature-requests:#1215]. Use standard functions in prference to RoundXYPosition, XYMinimum, and XYMaximum.
Backport of changeset 6713:fadc4c551b6d.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx23
1 files changed, 5 insertions, 18 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 8e06b7f4c..170d8988b 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -44,6 +44,7 @@
#include "Platform.h"
#include "StringCopy.h"
+#include "Position.h"
#include "XPM.h"
#include "UniConversion.h"
#include "DBCS.h"
@@ -2441,20 +2442,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 +2484,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 = Sci::clamp(rc.left, rcPreSize.right - ptMax.x, rcPreSize.right - ptMin.x);
+ rc.top = Sci::clamp(rc.top, rcPreSize.bottom - ptMax.y, rcPreSize.bottom - ptMin.y);
+ rc.right = Sci::clamp(rc.right, rcPreSize.left + ptMin.x, rcPreSize.left + ptMax.x);
+ rc.bottom = Sci::clamp(rc.bottom, rcPreSize.top + ptMin.y, rcPreSize.top + ptMax.y);
SetPosition(rc);
}