198 /* Unregister RichEdit built-in drop target. */ 199 VERIFY(::RevokeDragDrop(c->GetHWnd()) != DRAGDROP_E_INVALIDHWND); 200 201 /* To enforce CF_TEXT format for paste operations. */ 202 VERIFY(c->SendMessage(EM_SETOLECALLBACK, 0, 203 (LPARAM)&GetOleCallback())); 204 205 c->SendMessage(EM_SETEVENTMASK, 0, ENM_CHANGE); 206 } 207 } catch (...) { 208 env->DeleteLocalRef(target); 209 throw; 210 } 211 212 done: 213 env->DeleteLocalRef(target); 214 215 return c; 216 } 217 218 LONG AwtTextComponent::EditGetCharFromPos(POINT& pt) { 219 return static_cast<LONG>(SendMessage(EM_CHARFROMPOS, 0, 220 reinterpret_cast<LPARAM>(&pt))); 221 } 222 223 /* Set a suitable font to IME against the component font. */ 224 void AwtTextComponent::SetFont(AwtFont* font) 225 { 226 DASSERT(font != NULL); 227 if (font->GetAscent() < 0) { 228 AwtFont::SetupAscent(font); 229 } 230 231 int index = font->GetInputHFontIndex(); 232 if (index < 0) 233 /* In this case, user cannot get any suitable font for input. */ 234 index = 0; 235 236 //im --- changed for over the spot composing 237 m_hFont = font->GetHFont(index); | 198 /* Unregister RichEdit built-in drop target. */ 199 VERIFY(::RevokeDragDrop(c->GetHWnd()) != DRAGDROP_E_INVALIDHWND); 200 201 /* To enforce CF_TEXT format for paste operations. */ 202 VERIFY(c->SendMessage(EM_SETOLECALLBACK, 0, 203 (LPARAM)&GetOleCallback())); 204 205 c->SendMessage(EM_SETEVENTMASK, 0, ENM_CHANGE); 206 } 207 } catch (...) { 208 env->DeleteLocalRef(target); 209 throw; 210 } 211 212 done: 213 env->DeleteLocalRef(target); 214 215 return c; 216 } 217 218 LRESULT 219 AwtTextComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { 220 221 switch (message) { 222 case WM_PRINTCLIENT: 223 { 224 FORMATRANGE fr; 225 HDC hPrinterDC = (HDC)wParam; 226 int nHorizRes = ::GetDeviceCaps(hPrinterDC, HORZRES); 227 int nVertRes = ::GetDeviceCaps(hPrinterDC, VERTRES); 228 int nLogPixelsX = ::GetDeviceCaps(hPrinterDC, LOGPIXELSX); 229 int nLogPixelsY = ::GetDeviceCaps(hPrinterDC, LOGPIXELSY); 230 231 // Ensure the printer DC is in MM_TEXT mode. 232 ::SetMapMode ( hPrinterDC, MM_TEXT ); 233 234 // Rendering to the same DC we are measuring. 235 ::ZeroMemory(&fr, sizeof(fr)); 236 fr.hdc = fr.hdcTarget = hPrinterDC; 237 // Set up the page. 238 fr.rcPage.left = fr.rcPage.top = 0; 239 fr.rcPage.right = (nHorizRes/nLogPixelsX) * 1440; // in twips 240 fr.rcPage.bottom = (nVertRes/nLogPixelsY) * 1440; 241 fr.rc.left = fr.rcPage.left; 242 fr.rc.top = fr.rcPage.top; 243 fr.rc.right = fr.rcPage.right; 244 fr.rc.bottom = fr.rcPage.bottom; 245 246 // start printing from the first visible line 247 LRESULT nLine = SendMessage(EM_GETFIRSTVISIBLELINE, 0, 0); 248 LONG startCh = static_cast<LONG>(SendMessage(EM_LINEINDEX, 249 (WPARAM)nLine, 0)); 250 fr.chrg.cpMin = startCh; 251 fr.chrg.cpMax = -1; 252 253 SendMessage(EM_FORMATRANGE, TRUE, (LPARAM)&fr); 254 } 255 256 break; 257 } 258 259 return AwtComponent::WindowProc(message, wParam, lParam); 260 } 261 262 LONG AwtTextComponent::EditGetCharFromPos(POINT& pt) { 263 return static_cast<LONG>(SendMessage(EM_CHARFROMPOS, 0, 264 reinterpret_cast<LPARAM>(&pt))); 265 } 266 267 /* Set a suitable font to IME against the component font. */ 268 void AwtTextComponent::SetFont(AwtFont* font) 269 { 270 DASSERT(font != NULL); 271 if (font->GetAscent() < 0) { 272 AwtFont::SetupAscent(font); 273 } 274 275 int index = font->GetInputHFontIndex(); 276 if (index < 0) 277 /* In this case, user cannot get any suitable font for input. */ 278 index = 0; 279 280 //im --- changed for over the spot composing 281 m_hFont = font->GetHFont(index); |