From e0d8cb96072277fbeb8cb334015e059de656cc06 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 12 Jun 2012 09:22:15 +0000 Subject: [PATCH] Painter: Fixed issue with Text(..const char *..) (wrong length of text if n = -1) git-svn-id: svn://ultimatepp.org/upp/trunk@5049 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/Win32Proc.cpp | 10 ++++++---- uppsrc/Painter/Painter.cpp | 5 ++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/uppsrc/CtrlCore/Win32Proc.cpp b/uppsrc/CtrlCore/Win32Proc.cpp index aa768d73c..a02e347ab 100644 --- a/uppsrc/CtrlCore/Win32Proc.cpp +++ b/uppsrc/CtrlCore/Win32Proc.cpp @@ -451,10 +451,12 @@ LRESULT Ctrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { MINMAXINFO *mmi = (MINMAXINFO *)lParam; Rect frmrc = Size(200, 200); ::AdjustWindowRect(frmrc, WS_OVERLAPPEDWINDOW, FALSE); - Size msz = Ctrl::GetWorkArea().Deflated(-frmrc.left, -frmrc.top, - frmrc.right - 200, frmrc.bottom - 200).GetSize(); - Rect minr(Point(50, 50), min(msz, GetMinSize())); - Rect maxr(Point(50, 50), min(msz, GetMaxSize())); +// Size msz = Ctrl::GetWorkArea().Deflated(-frmrc.left, -frmrc.top, +// frmrc.right - 200, frmrc.bottom - 200).GetSize(); +// Rect minr(Point(50, 50), min(msz, GetMinSize())); +// Rect maxr(Point(50, 50), min(msz, GetMaxSize())); // Removed cxl&nixnixnix 2012-6-12 + Rect minr(Point(50, 50), GetMinSize()); + Rect maxr(Point(50, 50), GetMaxSize()); dword style = ::GetWindowLong(hwnd, GWL_STYLE); dword exstyle = ::GetWindowLong(hwnd, GWL_EXSTYLE); AdjustWindowRectEx(minr, style, FALSE, exstyle); diff --git a/uppsrc/Painter/Painter.cpp b/uppsrc/Painter/Painter.cpp index 2eec8f96c..6c5223127 100644 --- a/uppsrc/Painter/Painter.cpp +++ b/uppsrc/Painter/Painter.cpp @@ -481,9 +481,8 @@ Painter& Painter::Text(double x, double y, const String& s, Font fnt, double *dx Painter& Painter::Text(const Pointf& p, const char *text, Font fnt, int n, double *dx) { - if(n < 0) - n = strlen(text); - return Text(p, ToUnicode(text, n, CHARSET_DEFAULT), fnt, n, dx); + WString s = ToUnicode(text, CHARSET_DEFAULT); + return Text(p, s, fnt, n < 0 ? s.GetCount() : n, dx); } Painter& Painter::Text(double x, double y, const char *text, Font fnt, int n, double *dx)