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
This commit is contained in:
cxl 2012-06-12 09:22:15 +00:00
parent aa5fc95fb2
commit e0d8cb9607
2 changed files with 8 additions and 7 deletions

View file

@ -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);

View file

@ -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)