From 5d9c28189e152655f91b59296507bc2414886ed9 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 15 Jul 1999 23:42:21 +0000 Subject: [PATCH] Preserve -1 for dilog unit conversions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wincmn.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 2665e8d0ec..71028dc3ac 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -1250,9 +1250,11 @@ wxPoint wxWindowBase::ConvertPixelsToDialog(const wxPoint& pt) { int charWidth = GetCharWidth(); int charHeight = GetCharHeight(); - wxPoint pt2; - pt2.x = (int) ((pt.x * 4) / charWidth) ; - pt2.y = (int) ((pt.y * 8) / charHeight) ; + wxPoint pt2(-1, -1); + if (pt.x != -1) + pt2.x = (int) ((pt.x * 4) / charWidth) ; + if (pt.y != -1) + pt2.y = (int) ((pt.y * 8) / charHeight) ; return pt2; } @@ -1261,9 +1263,11 @@ wxPoint wxWindowBase::ConvertDialogToPixels(const wxPoint& pt) { int charWidth = GetCharWidth(); int charHeight = GetCharHeight(); - wxPoint pt2; - pt2.x = (int) ((pt.x * charWidth) / 4) ; - pt2.y = (int) ((pt.y * charHeight) / 8) ; + wxPoint pt2(-1, -1); + if (pt.x != -1) + pt2.x = (int) ((pt.x * charWidth) / 4) ; + if (pt.y != -1) + pt2.y = (int) ((pt.y * charHeight) / 8) ; return pt2; } -- 2.45.2