aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2014-05-03 20:21:13 +1000
committerNeil <nyamatongwe@gmail.com>2014-05-03 20:21:13 +1000
commit97ae63fa3914ac9894a319c0c75eeeffe96b16e9 (patch)
tree7cc80911f2b6338a9ea84744577c535c16346c2d /win32
parent850baf30484384711aa410d3596531f49c15e1ac (diff)
downloadscintilla-mirror-97ae63fa3914ac9894a319c0c75eeeffe96b16e9.tar.gz
Replacing the int-based constructors for Point and PRectangle with FromInts
static methods as there were too many failures with mixed types and not-quite matching types.
Diffstat (limited to 'win32')
-rw-r--r--win32/PlatWin.cxx18
-rw-r--r--win32/ScintillaWin.cxx22
2 files changed, 22 insertions, 18 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 180d2d1a7..082a177e6 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -1878,7 +1878,7 @@ bool Window::HasFocus() {
PRectangle Window::GetPosition() {
RECT rc;
::GetWindowRect(reinterpret_cast<HWND>(wid), &rc);
- return PRectangle(rc.left, rc.top, rc.right, rc.bottom);
+ return PRectangle::FromInts(rc.left, rc.top, rc.right, rc.bottom);
}
void Window::SetPosition(PRectangle rc) {
@@ -1943,7 +1943,7 @@ PRectangle Window::GetClientPosition() {
RECT rc={0,0,0,0};
if (wid)
::GetClientRect(reinterpret_cast<HWND>(wid), &rc);
- return PRectangle(rc.left, rc.top, rc.right, rc.bottom);
+ return PRectangle::FromInts(rc.left, rc.top, rc.right, rc.bottom);
}
void Window::Show(bool show) {
@@ -2235,7 +2235,7 @@ void ListBoxX::Create(Window &parent_, int ctrlID_, Point location_, int lineHei
POINT locationw = {static_cast<LONG>(location.x), static_cast<LONG>(location.y)};
::MapWindowPoints(hwndParent, NULL, &locationw, 1);
- location = Point(locationw.x, locationw.y);
+ location = Point::FromInts(locationw.x, locationw.y);
}
void ListBoxX::SetFont(Font &font) {
@@ -2415,7 +2415,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {
if (technology == SCWIN_TECH_GDI) {
surfaceItem->Init(pDrawItem->hDC, pDrawItem->hwndItem);
long left = pDrawItem->rcItem.left + static_cast<int>(ItemInset.x + ImageInset.x);
- PRectangle rcImage(left, pDrawItem->rcItem.top,
+ PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top,
left + images.GetWidth(), pDrawItem->rcItem.bottom);
surfaceItem->DrawRGBAImage(rcImage,
pimage->GetWidth(), pimage->GetHeight(), pimage->Pixels());
@@ -2443,7 +2443,7 @@ void ListBoxX::Draw(DRAWITEMSTRUCT *pDrawItem) {
surfaceItem->Init(pDCRT, pDrawItem->hwndItem);
pDCRT->BeginDraw();
long left = pDrawItem->rcItem.left + static_cast<long>(ItemInset.x + ImageInset.x);
- PRectangle rcImage(left, pDrawItem->rcItem.top,
+ PRectangle rcImage = PRectangle::FromInts(left, pDrawItem->rcItem.top,
left + images.GetWidth(), pDrawItem->rcItem.bottom);
surfaceItem->DrawRGBAImage(rcImage,
pimage->GetWidth(), pimage->GetHeight(), pimage->Pixels());
@@ -2520,7 +2520,7 @@ void ListBoxX::SetList(const char *list, char separator, char typesep) {
void ListBoxX::AdjustWindowRect(PRectangle *rc) {
RECT rcw = RectFromPRectangle(*rc);
::AdjustWindowRectEx(&rcw, WS_THICKFRAME, false, WS_EX_WINDOWEDGE);
- *rc = PRectangle(rcw.left, rcw.top, rcw.right, rcw.bottom);
+ *rc = PRectangle::FromInts(rcw.left, rcw.top, rcw.right, rcw.bottom);
}
int ListBoxX::ItemHeight() const {
@@ -2537,14 +2537,14 @@ int ListBoxX::MinClientWidth() const {
}
POINT ListBoxX::MinTrackSize() const {
- PRectangle rc(0, 0, MinClientWidth(), ItemHeight());
+ PRectangle rc = PRectangle::FromInts(0, 0, MinClientWidth(), ItemHeight());
AdjustWindowRect(&rc);
POINT ret = {static_cast<LONG>(rc.Width()), static_cast<LONG>(rc.Height())};
return ret;
}
POINT ListBoxX::MaxTrackSize() const {
- PRectangle rc(0, 0,
+ PRectangle rc = PRectangle::FromInts(0, 0,
Platform::Maximum(MinClientWidth(),
maxCharWidth * maxItemCharacters + static_cast<int>(TextInset.x) * 2 +
TextOffset() + ::GetSystemMetrics(SM_CXVSCROLL)),
@@ -2578,7 +2578,7 @@ void ListBoxX::ResizeToCursor() {
PRectangle rc = GetPosition();
POINT ptw;
::GetCursorPos(&ptw);
- Point pt(ptw.x, ptw.y);
+ Point pt = Point::FromInts(ptw.x, ptw.y);
pt.x += dragOffset.x;
pt.y += dragOffset.y;
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 9288eb21b..b19ebeb3c 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -121,6 +121,10 @@ static void SetWindowID(HWND hWnd, int identifier) {
::SetWindowLongPtr(hWnd, GWLP_ID, identifier);
}
+static Point PointFromPOINT(POINT pt) {
+ return Point::FromInts(pt.x, pt.y);
+}
+
class ScintillaWin; // Forward declaration for COM interface subobjects
typedef void VFunction(void);
@@ -567,7 +571,7 @@ LRESULT ScintillaWin::WndPaint(uptr_t wParam) {
pps = &ps;
::BeginPaint(MainHWND(), pps);
}
- rcPaint = PRectangle(pps->rcPaint.left, pps->rcPaint.top, pps->rcPaint.right, pps->rcPaint.bottom);
+ rcPaint = PRectangle::FromInts(pps->rcPaint.left, pps->rcPaint.top, pps->rcPaint.right, pps->rcPaint.bottom);
PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient);
if (technology == SC_TECHNOLOGY_DEFAULT) {
@@ -906,11 +910,11 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
POINT pt;
if (0 != ::GetCursorPos(&pt)) {
::ScreenToClient(MainHWND(), &pt);
- if (PointInSelMargin(Point(pt.x, pt.y))) {
- DisplayCursor(GetMarginCursor(Point(pt.x, pt.y)));
- } else if (PointInSelection(Point(pt.x, pt.y)) && !SelectionEmpty()) {
+ if (PointInSelMargin(PointFromPOINT(pt))) {
+ DisplayCursor(GetMarginCursor(PointFromPOINT(pt)));
+ } else if (PointInSelection(PointFromPOINT(pt)) && !SelectionEmpty()) {
DisplayCursor(Window::cursorArrow);
- } else if (PointIsHotspot(Point(pt.x, pt.y))) {
+ } else if (PointIsHotspot(PointFromPOINT(pt))) {
DisplayCursor(Window::cursorHand);
} else {
DisplayCursor(Window::cursorText);
@@ -1047,7 +1051,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
pt = PointMainCaret();
POINT spt = {static_cast<int>(pt.x), static_cast<int>(pt.y)};
::ClientToScreen(MainHWND(), &spt);
- pt = Point(spt.x, spt.y);
+ pt = PointFromPOINT(spt);
}
ContextMenu(pt);
return 0;
@@ -2429,7 +2433,7 @@ STDMETHODIMP ScintillaWin::DragOver(DWORD grfKeyState, POINTL pt, PDWORD pdwEffe
// Update the cursor.
POINT rpt = {pt.x, pt.y};
::ScreenToClient(MainHWND(), &rpt);
- SetDragPosition(SPositionFromLocation(Point(rpt.x, rpt.y), false, false, UserVirtualSpace()));
+ SetDragPosition(SPositionFromLocation(PointFromPOINT(rpt), false, false, UserVirtualSpace()));
return S_OK;
} catch (...) {
@@ -2511,7 +2515,7 @@ STDMETHODIMP ScintillaWin::Drop(LPDATAOBJECT pIDataSource, DWORD grfKeyState,
POINT rpt = {pt.x, pt.y};
::ScreenToClient(MainHWND(), &rpt);
- SelectionPosition movePos = SPositionFromLocation(Point(rpt.x, rpt.y), false, false, UserVirtualSpace());
+ SelectionPosition movePos = SPositionFromLocation(PointFromPOINT(rpt), false, false, UserVirtualSpace());
DropAt(movePos, &data[0], data.size() - 1, *pdwEffect == DROPEFFECT_MOVE, hrRectangular == S_OK);
@@ -2751,7 +2755,7 @@ sptr_t PASCAL ScintillaWin::CTWndProc(
pt.x = static_cast<short>(LOWORD(lParam));
pt.y = static_cast<short>(HIWORD(lParam));
ScreenToClient(hWnd, &pt);
- sciThis->ct.MouseClick(Point(pt.x, pt.y));
+ sciThis->ct.MouseClick(PointFromPOINT(pt));
sciThis->CallTipClick();
return 0;
} else if (iMessage == WM_LBUTTONDOWN) {