--- old/src/windows/native/sun/windows/awt_TextArea.cpp 2012-07-23 14:01:40.856404200 +0400 +++ new/src/windows/native/sun/windows/awt_TextArea.cpp 2012-07-23 14:01:40.180365600 +0400 @@ -131,48 +131,13 @@ MsgRouting mr = mrDoDefault; switch (message) { - case WM_PRINTCLIENT: - { - FORMATRANGE fr; - HDC hPrinterDC = (HDC)wParam; - int nHorizRes = ::GetDeviceCaps(hPrinterDC, HORZRES); - int nVertRes = ::GetDeviceCaps(hPrinterDC, VERTRES); - int nLogPixelsX = ::GetDeviceCaps(hPrinterDC, LOGPIXELSX); - int nLogPixelsY = ::GetDeviceCaps(hPrinterDC, LOGPIXELSY); - - // Ensure the printer DC is in MM_TEXT mode. - ::SetMapMode ( hPrinterDC, MM_TEXT ); - - // Rendering to the same DC we are measuring. - ::ZeroMemory(&fr, sizeof(fr)); - fr.hdc = fr.hdcTarget = hPrinterDC; - // Set up the page. - fr.rcPage.left = fr.rcPage.top = 0; - fr.rcPage.right = (nHorizRes/nLogPixelsX) * 1440; // in twips - fr.rcPage.bottom = (nVertRes/nLogPixelsY) * 1440; - fr.rc.left = fr.rcPage.left; - fr.rc.top = fr.rcPage.top; - fr.rc.right = fr.rcPage.right; - fr.rc.bottom = fr.rcPage.bottom; - - // start printing from the first visible line - LRESULT nLine = SendMessage(EM_GETFIRSTVISIBLELINE, 0, 0); - LONG startCh = static_cast(SendMessage(EM_LINEINDEX, - (WPARAM)nLine, 0)); - fr.chrg.cpMin = startCh; - fr.chrg.cpMax = -1; - - SendMessage(EM_FORMATRANGE, TRUE, (LPARAM)&fr); - } - - break; case EM_SETCHARFORMAT: case WM_SETFONT: SetIgnoreEnChange(TRUE); break; } - retValue = AwtComponent::WindowProc(message, wParam, lParam); + retValue = AwtTextComponent::WindowProc(message, wParam, lParam); switch (message) { case EM_SETCHARFORMAT: --- old/src/windows/native/sun/windows/awt_TextComponent.cpp 2012-07-23 14:01:44.340603500 +0400 +++ new/src/windows/native/sun/windows/awt_TextComponent.cpp 2012-07-23 14:01:43.679565700 +0400 @@ -215,6 +215,50 @@ return c; } +LRESULT +AwtTextComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { + + switch (message) { + case WM_PRINTCLIENT: + { + FORMATRANGE fr; + HDC hPrinterDC = (HDC)wParam; + int nHorizRes = ::GetDeviceCaps(hPrinterDC, HORZRES); + int nVertRes = ::GetDeviceCaps(hPrinterDC, VERTRES); + int nLogPixelsX = ::GetDeviceCaps(hPrinterDC, LOGPIXELSX); + int nLogPixelsY = ::GetDeviceCaps(hPrinterDC, LOGPIXELSY); + + // Ensure the printer DC is in MM_TEXT mode. + ::SetMapMode ( hPrinterDC, MM_TEXT ); + + // Rendering to the same DC we are measuring. + ::ZeroMemory(&fr, sizeof(fr)); + fr.hdc = fr.hdcTarget = hPrinterDC; + // Set up the page. + fr.rcPage.left = fr.rcPage.top = 0; + fr.rcPage.right = (nHorizRes/nLogPixelsX) * 1440; // in twips + fr.rcPage.bottom = (nVertRes/nLogPixelsY) * 1440; + fr.rc.left = fr.rcPage.left; + fr.rc.top = fr.rcPage.top; + fr.rc.right = fr.rcPage.right; + fr.rc.bottom = fr.rcPage.bottom; + + // start printing from the first visible line + LRESULT nLine = SendMessage(EM_GETFIRSTVISIBLELINE, 0, 0); + LONG startCh = static_cast(SendMessage(EM_LINEINDEX, + (WPARAM)nLine, 0)); + fr.chrg.cpMin = startCh; + fr.chrg.cpMax = -1; + + SendMessage(EM_FORMATRANGE, TRUE, (LPARAM)&fr); + } + + break; + } + + return AwtComponent::WindowProc(message, wParam, lParam); +} + LONG AwtTextComponent::EditGetCharFromPos(POINT& pt) { return static_cast(SendMessage(EM_CHARFROMPOS, 0, reinterpret_cast(&pt))); --- old/src/windows/native/sun/windows/awt_TextComponent.h 2012-07-23 14:01:47.844803900 +0400 +++ new/src/windows/native/sun/windows/awt_TextComponent.h 2012-07-23 14:01:47.183766100 +0400 @@ -50,6 +50,7 @@ static AwtTextComponent* Create(jobject self, jobject parent, BOOL isMultiline); virtual LPCTSTR GetClassName(); + LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam); int RemoveCR(WCHAR *pStr);