- Timestamp:
- Feb 26, 2003, 3:17:30 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/riched32/richedit.c
r9857 r9859 52 52 hwnd, (UINT)wParam, (UINT)lParam) 53 53 54 55 static INT CALLBACK EDIT_WordBreakProc(LPWSTR s, INT index, INT count, INT action); 56 54 57 #ifdef __WIN32OS2__ 58 #include <dbglog.h> 59 55 60 #define RICHEDIT_WND_PROP "RICHEDIT_PROP" 56 61 62 FARPROC pfnEditProcA = (FARPROC)DefWindowProcA; 63 FARPROC pfnEditProcW = (FARPROC)DefWindowProcW; 64 65 typedef struct { 66 CHARFORMAT2A cf; 67 HBRUSH hbrBackground; 68 } RICHEDIT_INFO; 57 69 #endif 58 70 … … 114 126 LONG style = 0; 115 127 116 #ifdef __WIN32OS2__ 117 HWND hwndEdit; 118 HWND hwndParent; 128 HWND hwndParent = GetParent(hwnd); 119 129 char* rtfBuffer; 120 130 HANDLE hProp = 0; … … 122 132 123 133 CHARRANGE *cr; 124 #else 125 static HWND hwndEdit; 126 static HWND hwndParent; 127 static char* rtfBuffer; 128 int rtfBufferSize; 129 130 CHARRANGE *cr; 131 TRACE("previous hwndEdit: %p hwndParent %p\n",hwndEdit,hwndParent); 132 #endif 133 hwndEdit = GetWindow(hwnd,GW_CHILD); 134 TRACE("uMsg: 0x%x hwnd: %p hwndEdit: %p\n",uMsg,hwnd,hwndEdit); 134 FARPROC pfnEditProc; 135 136 TRACE("uMsg: 0x%x hwnd: %p",uMsg,hwnd); 137 138 if(IsWindowUnicode(hwnd)) { 139 pfnEditProc = pfnEditProcW; 140 } 141 else pfnEditProc = pfnEditProcA; 135 142 136 143 switch (uMsg) … … 138 145 139 146 case WM_CREATE : 140 DPRINTF_EDIT_MSG32("WM_CREATE"); 141 142 /* remove SCROLLBARS from the current window style */ 143 hwndParent = ((LPCREATESTRUCTA) lParam)->hwndParent; 144 145 newstyle = style = ((LPCREATESTRUCTA) lParam)->style; 146 newstyle &= ~WS_HSCROLL; 147 newstyle &= ~WS_VSCROLL; 148 newstyle &= ~ES_AUTOHSCROLL; 149 newstyle &= ~ES_AUTOVSCROLL; 150 151 TRACE("previous hwndEdit: %p\n",hwndEdit); 152 hwndEdit = CreateWindowA ("edit", ((LPCREATESTRUCTA) lParam)->lpszName, 153 style, 0, 0, 0, 0, 154 hwnd, (HMENU) ID_EDIT, 155 ((LPCREATESTRUCTA) lParam)->hInstance, NULL) ; 156 TRACE("hwndEdit: %p hwnd: %p\n",hwndEdit,hwnd); 157 158 SetWindowLongA(hwnd,GWL_STYLE, newstyle); 159 #ifdef __WIN32OS2__ 160 { 161 CHARFORMAT2A *pcf; 162 163 hProp = GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT, sizeof(CHARFORMAT2A)); 164 SetPropA(hwnd, RICHEDIT_WND_PROP, hProp); 165 pcf = (CHARFORMAT2A *)GlobalLock(hProp); 166 if(pcf) { 167 pcf->cbSize = sizeof(CHARFORMAT2A); 168 GlobalUnlock(hProp); 169 } 170 } 171 #endif 172 return 0 ; 173 174 case WM_SETFOCUS : 175 DPRINTF_EDIT_MSG32("WM_SETFOCUS"); 176 SetFocus (hwndEdit) ; 177 return 0 ; 178 179 case WM_SIZE : 180 DPRINTF_EDIT_MSG32("WM_SIZE"); 181 MoveWindow (hwndEdit, 0, 0, LOWORD (lParam), HIWORD (lParam), TRUE) ; 182 return 0 ; 183 184 case WM_COMMAND : 185 DPRINTF_EDIT_MSG32("WM_COMMAND"); 186 switch(HIWORD(wParam)) { 187 case EN_CHANGE: 188 case EN_HSCROLL: 189 case EN_KILLFOCUS: 190 case EN_SETFOCUS: 191 case EN_UPDATE: 192 case EN_VSCROLL: 193 return SendMessageA(hwndParent, WM_COMMAND, 194 wParam, (LPARAM)(hwnd)); 195 196 case EN_ERRSPACE: 197 case EN_MAXTEXT: 198 MessageBoxA (hwnd, "RichEdit control out of space.", 199 "ERROR", MB_OK | MB_ICONSTOP) ; 200 return 0 ; 201 } 147 { 148 RICHEDIT_INFO *prinfo; 149 LRESULT ret; 150 151 DPRINTF_EDIT_MSG32("WM_CREATE"); 152 153 ret = pfnEditProc(hwnd, WM_CREATE, wParam, lParam); 154 if(ret) return ret; /* window creation cancelled */ 155 156 hProp = GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT, sizeof(RICHEDIT_INFO)); 157 SetPropA(hwnd, RICHEDIT_WND_PROP, hProp); 158 return 0 ; 159 } 160 161 case WM_DESTROY: 162 { 163 RICHEDIT_INFO *prinfo; 164 165 hProp = GetPropA(hwnd, RICHEDIT_WND_PROP); 166 prinfo = (RICHEDIT_INFO *)GlobalLock(hProp); 167 if(prinfo) { 168 //Destroy old brush if present 169 if(prinfo->hbrBackground) DeleteObject(prinfo->hbrBackground); 170 GlobalUnlock(hProp); 171 } 172 173 if(hProp) GlobalFree(hProp); 174 RemovePropA(hwnd, RICHEDIT_WND_PROP); 175 176 return pfnEditProc(hwnd, uMsg, wParam, lParam); 177 } 178 179 /* Messages specific to Richedit controls */ 202 180 203 181 case EM_STREAMIN: 182 { 204 183 DPRINTF_EDIT_MSG32("EM_STREAMIN"); 205 184 … … 219 198 { 220 199 RTFToBuffer(rtfBuffer, rtfBufferSize); 221 SetWindowTextA(hwnd Edit,rtfBuffer);200 SetWindowTextA(hwnd,rtfBuffer); 222 201 HeapFree(RICHED32_hHeap, 0,rtfBuffer); 223 202 } … … 226 205 227 206 return 0; 228 229 /* Messages specific to Richedit controls */ 230 207 } 208 231 209 case EM_AUTOURLDETECT: 232 210 DPRINTF_EDIT_MSG32("EM_AUTOURLDETECT Ignored"); … … 248 226 DPRINTF_EDIT_MSG32("EM_EXGETSEL -> EM_GETSEL"); 249 227 cr = (VOID *) lParam; 250 if (hwndEdit) SendMessageA( hwndEdit, EM_GETSEL, (INT)&cr->cpMin, (INT)&cr->cpMax);228 pfnEditProc( hwnd, EM_GETSEL, (INT)&cr->cpMin, (INT)&cr->cpMax); 251 229 TRACE("cpMin: 0x%x cpMax: 0x%x\n",(INT)cr->cpMin,(INT)cr->cpMax); 252 230 return 0; … … 260 238 limit = 0xFFFFFFFF; 261 239 } 262 return SendMessageA(hwndEdit,EM_SETLIMITTEXT,limit,0);240 return pfnEditProc(hwnd,EM_SETLIMITTEXT,limit,0); 263 241 } 264 242 265 243 case EM_EXLINEFROMCHAR: 266 244 DPRINTF_EDIT_MSG32("EM_EXLINEFROMCHAR -> LINEFROMCHAR"); 267 if (hwndEdit) return SendMessageA( hwndEdit, EM_LINEFROMCHAR, lParam, wParam); 268 return 0; 245 return pfnEditProc( hwnd, EM_LINEFROMCHAR, lParam, wParam); 269 246 270 247 case EM_EXSETSEL: 271 248 DPRINTF_EDIT_MSG32("EM_EXSETSEL -> EM_SETSEL"); 272 249 cr = (VOID *) lParam; 273 if (hwndEdit) SendMessageA( hwndEdit, EM_SETSEL, cr->cpMin, cr->cpMax);250 pfnEditProc( hwnd, EM_SETSEL, cr->cpMin, cr->cpMax); 274 251 return 0; 275 252 … … 291 268 292 269 case EM_FINDWORDBREAK: 293 DPRINTF_EDIT_MSG32("EM_FINDWORDBREAK Ignored"); 294 return 0; 270 { 271 DWORD ret = 0; 272 DWORD len = GetWindowTextLengthA(hwnd); 273 LPWSTR lpszText = (LPWSTR)HeapAlloc(RICHED32_hHeap, 0, (len+1)*sizeof(WCHAR)); 274 275 if(lpszText == NULL) { 276 DebugInt3(); 277 return 0; 278 } 279 lpszText[0] = 0; 280 GetWindowTextW(hwnd, lpszText, len); 281 282 DPRINTF_EDIT_MSG32("EM_FINDWORDBREAK: partly implemented"); 283 switch(wParam) { 284 case WB_ISDELIMITER: 285 case WB_LEFT: 286 case WB_RIGHT: 287 ret = EDIT_WordBreakProc(lpszText, lParam, len, wParam); 288 break; 289 } 290 HeapFree(RICHED32_hHeap, 0, lpszText); 291 return ret; 292 } 295 293 296 294 case EM_FORMATRANGE: … … 360 358 case EM_GETSELTEXT: 361 359 DPRINTF_EDIT_MSG32("EM_GETSELTEXT"); 362 return RICHEDIT_GetSelText(hwnd Edit,(void *)lParam);360 return RICHEDIT_GetSelText(hwnd,(void *)lParam); 363 361 364 362 case EM_GETTEXTEX: … … 376 374 case EM_GETTEXTRANGE: 377 375 DPRINTF_EDIT_MSG32("EM_GETTEXTRANGE"); 378 return RICHEDIT_GetTextRange(hwnd Edit,(TEXTRANGEA *)lParam);376 return RICHEDIT_GetTextRange(hwnd,(TEXTRANGEA *)lParam); 379 377 380 378 case EM_GETTYPOGRAPHYOPTIONS: … … 427 425 428 426 case EM_SETBKGNDCOLOR: 429 #ifdef __WIN32OS2__ 430 { 431 CHARFORMAT2A *pcf; 427 { 428 RICHEDIT_INFO *prinfo; 429 430 DPRINTF_EDIT_MSG32("EM_SETBKGNDCOLOR"); 432 431 433 432 hProp = GetPropA(hwnd, RICHEDIT_WND_PROP); 434 p cf = (CHARFORMAT2A*)GlobalLock(hProp);435 if(p cf)433 prinfo = (RICHEDIT_INFO *)GlobalLock(hProp); 434 if(prinfo) 436 435 { 437 p cf->dwMask |= CFM_BACKCOLOR;438 p cf->crBackColor = (wParam) ? GetSysColor(COLOR_BACKGROUND) : (COLORREF)lParam;436 prinfo->cf.dwMask |= CFM_BACKCOLOR; 437 prinfo->cf.crBackColor = (wParam) ? GetSysColor(COLOR_BACKGROUND) : (COLORREF)lParam; 439 438 440 439 //Destroy old brush if present 441 if(p cf->dwReserved) DeleteObject(pcf->dwReserved);440 if(prinfo->hbrBackground) DeleteObject(prinfo->hbrBackground); 442 441 443 442 //Create a brush that we return in WM_CTLCOLORSTATIC 444 p cf->dwReserved = (DWORD)CreateSolidBrush(pcf->crBackColor);443 prinfo->hbrBackground = (DWORD)CreateSolidBrush(prinfo->cf.crBackColor); 445 444 446 dprintf(("Set background color to %x brush %x", p cf->crBackColor, pcf->dwReserved));445 dprintf(("Set background color to %x brush %x", prinfo->cf.crBackColor, prinfo->hbrBackground)); 447 446 448 447 GlobalUnlock(hProp); 449 448 } 450 } 451 #endif 452 DPRINTF_EDIT_MSG32("EM_SETBKGNDCOLOR Ignored"); 453 return 0; 449 return 0; 450 } 454 451 455 452 case EM_SETCHARFORMAT: 456 #ifdef __WIN32OS2__457 453 { 458 454 CHARFORMAT2A *pnewcf = (CHARFORMAT2A *)lParam; 459 CHARFORMAT2A *pcf; 455 RICHEDIT_INFO *prinfo; 456 457 DPRINTF_EDIT_MSG32("EM_SETCHARFORMAT: not completely implemented!!"); 460 458 461 459 hProp = GetPropA(hwnd, RICHEDIT_WND_PROP); 462 p cf = (CHARFORMAT2A*)GlobalLock(hProp);463 if(p cf&& pnewcf && pnewcf->cbSize >= sizeof(CHARFORMATA))460 prinfo = (RICHEDIT_INFO *)GlobalLock(hProp); 461 if(prinfo && pnewcf && pnewcf->cbSize >= sizeof(CHARFORMATA)) 464 462 { 465 463 if((pnewcf->dwMask & CFM_COLOR) && !(pnewcf->dwEffects & CFE_AUTOCOLOR)) { 466 p cf->dwMask |= CFM_COLOR;467 p cf->crTextColor = pnewcf->crTextColor;468 dprintf(("Set text color to %x", p cf->crTextColor));464 prinfo->cf.dwMask |= CFM_COLOR; 465 prinfo->cf.crTextColor = pnewcf->crTextColor; 466 dprintf(("Set text color to %x", prinfo->cf.crTextColor)); 469 467 } 470 468 if(pnewcf->cbSize == sizeof(CHARFORMAT2A)) … … 472 470 if((pnewcf->dwMask & CFM_BACKCOLOR) && !(pnewcf->dwEffects & CFE_AUTOBACKCOLOR)) 473 471 { 474 p cf->dwMask |= CFM_BACKCOLOR;475 p cf->crBackColor = pnewcf->crBackColor;472 prinfo->cf.dwMask |= CFM_BACKCOLOR; 473 prinfo->cf.crBackColor = pnewcf->crBackColor; 476 474 477 475 //Destroy old brush if present 478 if(p cf->dwReserved) DeleteObject(pcf->dwReserved);476 if(prinfo->hbrBackground) DeleteObject(prinfo->hbrBackground); 479 477 480 478 //Create a brush that we return in WM_CTLCOLORSTATIC 481 p cf->dwReserved = (DWORD)CreateSolidBrush(pcf->crBackColor);479 prinfo->hbrBackground = (DWORD)CreateSolidBrush(prinfo->cf.crBackColor); 482 480 483 dprintf(("Set background color to %x brush %x", p cf->crBackColor, pcf->dwReserved));481 dprintf(("Set background color to %x brush %x", prinfo->cf.crBackColor, prinfo->hbrBackground)); 484 482 } 485 483 } 486 484 } 487 485 488 if(pcf) GlobalUnlock(hProp); 489 } 490 #else 491 DPRINTF_EDIT_MSG32("EM_SETCHARFORMAT Ignored"); 492 #endif 493 return 0; 486 if(prinfo) GlobalUnlock(hProp); 487 return 0; 488 } 494 489 495 490 case EM_SETEDITSTYLE: … … 585 580 return 0; 586 581 587 /* Messages dispatched to the edit control */ 588 case EM_CANUNDO: 589 DPRINTF_EDIT_MSG32("EM_CANUNDO Passed to edit control"); 590 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 591 case EM_CHARFROMPOS: 592 DPRINTF_EDIT_MSG32("EM_CHARFROMPOS Passed to edit control"); 593 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 594 case EM_EMPTYUNDOBUFFER: 595 DPRINTF_EDIT_MSG32("EM_EMPTYUNDOBUFFER Passed to edit control"); 596 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 597 case EM_FMTLINES: 598 DPRINTF_EDIT_MSG32("EM_FMTLINES Passed to edit control"); 599 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 600 case EM_GETFIRSTVISIBLELINE: 601 DPRINTF_EDIT_MSG32("EM_GETFIRSTVISIBLELINE Passed to edit control"); 602 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 603 case EM_GETHANDLE: 604 DPRINTF_EDIT_MSG32("EM_GETHANDLE Passed to edit control"); 605 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 606 /* case EM_GETIMESTATUS:*/ 607 case EM_GETLIMITTEXT: 608 DPRINTF_EDIT_MSG32("EM_GETLIMITTEXT Passed to edit control"); 609 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 610 case EM_GETLINE: 611 DPRINTF_EDIT_MSG32("EM_GETLINE Passed to edit control"); 612 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 613 case EM_GETLINECOUNT: 614 DPRINTF_EDIT_MSG32("EM_GETLINECOUNT Passed to edit control"); 615 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 616 case EM_GETMARGINS: 617 DPRINTF_EDIT_MSG32("EM_GETMARGINS Passed to edit control"); 618 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 619 case EM_GETMODIFY: 620 DPRINTF_EDIT_MSG32("EM_GETMODIFY Passed to edit control"); 621 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 622 case EM_GETPASSWORDCHAR: 623 DPRINTF_EDIT_MSG32("EM_GETPASSWORDCHAR Passed to edit control"); 624 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 625 case EM_GETRECT: 626 DPRINTF_EDIT_MSG32("EM_GETRECT Passed to edit control"); 627 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 628 case EM_GETSEL: 629 DPRINTF_EDIT_MSG32("EM_GETSEL Passed to edit control"); 630 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 631 case EM_GETTHUMB: 632 DPRINTF_EDIT_MSG32("EM_GETTHUMB Passed to edit control"); 633 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 634 case EM_GETWORDBREAKPROC: 635 DPRINTF_EDIT_MSG32("EM_GETWORDBREAKPROC Passed to edit control"); 636 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 637 case EM_LINEFROMCHAR: 638 DPRINTF_EDIT_MSG32("EM_LINEFROMCHAR Passed to edit control"); 639 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 640 case EM_LINEINDEX: 641 DPRINTF_EDIT_MSG32("EM_LINEINDEX Passed to edit control"); 642 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 643 case EM_LINELENGTH: 644 DPRINTF_EDIT_MSG32("EM_LINELENGTH Passed to edit control"); 645 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 646 case EM_LINESCROLL: 647 DPRINTF_EDIT_MSG32("EM_LINESCROLL Passed to edit control"); 648 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 649 case EM_POSFROMCHAR: 650 DPRINTF_EDIT_MSG32("EM_POSFROMCHAR Passed to edit control"); 651 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 652 case EM_REPLACESEL: 653 DPRINTF_EDIT_MSG32("case EM_REPLACESEL Passed to edit control"); 654 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 655 case EM_SCROLL: 656 DPRINTF_EDIT_MSG32("case EM_SCROLL Passed to edit control"); 657 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 658 case EM_SCROLLCARET: 659 DPRINTF_EDIT_MSG32("EM_SCROLLCARET Passed to edit control"); 660 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 661 case EM_SETHANDLE: 662 DPRINTF_EDIT_MSG32("EM_SETHANDLE Passed to edit control"); 663 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 664 /* case EM_SETIMESTATUS:*/ 665 case EM_SETLIMITTEXT: 666 DPRINTF_EDIT_MSG32("EM_SETLIMITTEXT Passed to edit control"); 667 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 668 case EM_SETMARGINS: 669 DPRINTF_EDIT_MSG32("case EM_SETMARGINS Passed to edit control"); 670 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 671 case EM_SETMODIFY: 672 DPRINTF_EDIT_MSG32("EM_SETMODIFY Passed to edit control"); 673 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 674 case EM_SETPASSWORDCHAR: 675 DPRINTF_EDIT_MSG32("EM_SETPASSWORDCHAR Passed to edit control"); 676 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 677 case EM_SETREADONLY: 678 DPRINTF_EDIT_MSG32("EM_SETREADONLY Passed to edit control"); 679 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 680 case EM_SETRECT: 681 DPRINTF_EDIT_MSG32("EM_SETRECT Passed to edit control"); 682 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 683 case EM_SETRECTNP: 684 DPRINTF_EDIT_MSG32("EM_SETRECTNP Passed to edit control"); 685 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 686 case EM_SETSEL: 687 DPRINTF_EDIT_MSG32("EM_SETSEL Passed to edit control"); 688 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 689 case EM_SETTABSTOPS: 690 DPRINTF_EDIT_MSG32("EM_SETTABSTOPS Passed to edit control"); 691 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 692 case EM_SETWORDBREAKPROC: 693 DPRINTF_EDIT_MSG32("EM_SETWORDBREAKPROC Passed to edit control"); 694 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 695 case EM_UNDO: 696 DPRINTF_EDIT_MSG32("EM_UNDO Passed to edit control"); 697 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 698 699 case WM_STYLECHANGING: 700 DPRINTF_EDIT_MSG32("WM_STYLECHANGING Passed to edit control"); 701 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 702 case WM_STYLECHANGED: 703 DPRINTF_EDIT_MSG32("WM_STYLECHANGED Passed to edit control"); 704 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 705 case WM_NCCALCSIZE: 706 #ifdef __WIN32OS2__ 707 break; //this is completely wrong, we resize the control in the WM_SIZE handler 708 #else 709 DPRINTF_EDIT_MSG32("WM_NCCALCSIZE Passed to edit control"); 710 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 711 #endif 712 case WM_GETTEXT: 713 DPRINTF_EDIT_MSG32("WM_GETTEXT Passed to edit control"); 714 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 715 case WM_GETTEXTLENGTH: 716 DPRINTF_EDIT_MSG32("WM_GETTEXTLENGTH Passed to edit control"); 717 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 718 case WM_SETTEXT: 719 DPRINTF_EDIT_MSG32("WM_SETTEXT Passed to edit control"); 720 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 721 case WM_CUT: 722 DPRINTF_EDIT_MSG32("WM_CUT Passed to edit control"); 723 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 724 case WM_COPY: 725 DPRINTF_EDIT_MSG32("WM_COPY Passed to edit control"); 726 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 727 case WM_PASTE: 728 DPRINTF_EDIT_MSG32("WM_PASTE Passed to edit control"); 729 return SendMessageA( hwndEdit, uMsg, wParam, lParam); 730 731 /* Messages passed to default handler. */ 732 case WM_NCPAINT: 733 DPRINTF_EDIT_MSG32("WM_NCPAINT Passed to default"); 734 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 735 case WM_PAINT: 736 DPRINTF_EDIT_MSG32("WM_PAINT Passed to default"); 737 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 738 case WM_ERASEBKGND: 739 DPRINTF_EDIT_MSG32("WM_ERASEBKGND Passed to default"); 740 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 741 case WM_KILLFOCUS: 742 DPRINTF_EDIT_MSG32("WM_KILLFOCUS Passed to default"); 743 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 744 case WM_DESTROY: 745 #ifdef __WIN32OS2__ 746 { 747 CHARFORMAT2A *pcf; 748 749 hProp = GetPropA(hwnd, RICHEDIT_WND_PROP); 750 pcf = (CHARFORMAT2A *)GlobalLock(hProp); 751 if(pcf) { 752 //Destroy old brush if present 753 if(pcf->dwReserved) DeleteObject(pcf->dwReserved); 754 GlobalUnlock(hProp); 755 } 756 757 if(hProp) GlobalFree(hProp); 758 RemovePropA(hwnd, RICHEDIT_WND_PROP); 759 } 760 #endif 761 DPRINTF_EDIT_MSG32("WM_DESTROY Passed to default"); 762 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 763 case WM_CHILDACTIVATE: 764 DPRINTF_EDIT_MSG32("WM_CHILDACTIVATE Passed to default"); 765 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 766 767 case WM_WINDOWPOSCHANGING: 768 DPRINTF_EDIT_MSG32("WM_WINDOWPOSCHANGING Passed to default"); 769 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 770 case WM_WINDOWPOSCHANGED: 771 DPRINTF_EDIT_MSG32("WM_WINDOWPOSCHANGED Passed to default"); 772 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 773 /* case WM_INITIALUPDATE: 774 DPRINTF_EDIT_MSG32("WM_INITIALUPDATE Passed to default"); 775 return DefWindowProcA( hwnd,uMsg,wParam,lParam); */ 776 #ifndef __WIN32OS2__ 777 case WM_CTLCOLOREDIT: 778 DPRINTF_EDIT_MSG32("WM_CTLCOLOREDIT Passed to default"); 779 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 780 #endif 781 case WM_SETCURSOR: 782 DPRINTF_EDIT_MSG32("WM_SETCURSOR Passed to default"); 783 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 784 case WM_MOVE: 785 DPRINTF_EDIT_MSG32("WM_MOVE Passed to default"); 786 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 787 case WM_SHOWWINDOW: 788 DPRINTF_EDIT_MSG32("WM_SHOWWINDOW Passed to default"); 789 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 790 case WM_NCCREATE: 791 DPRINTF_EDIT_MSG32("WM_NCCREATE Passed to default"); 792 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 793 case WM_PARENTNOTIFY: 794 DPRINTF_EDIT_MSG32("WM_PARENTNOTIFY Passed to default"); 795 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 796 case WM_SETREDRAW: 797 DPRINTF_EDIT_MSG32("WM_SETREDRAW Passed to default"); 798 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 799 case WM_NCDESTROY: 800 DPRINTF_EDIT_MSG32("WM_NCDESTROY Passed to default"); 801 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 802 case WM_NCHITTEST: 803 DPRINTF_EDIT_MSG32("WM_NCHITTEST Passed to default"); 804 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 582 #if 0 805 583 case WM_CTLCOLORSTATIC: 806 584 #ifdef __WIN32OS2__ 807 585 case WM_CTLCOLOREDIT: 808 {809 CHARFORMAT2A *pcf;586 { 587 RICHEDIT_INFO *prinfo; 810 588 HBRUSH hBrush = 0; 811 589 HDC hdc = (HDC)wParam; 812 590 813 591 hProp = GetPropA(hwnd, RICHEDIT_WND_PROP); 814 p cf = (CHARFORMAT2A*)GlobalLock(hProp);815 if(p cf)592 prinfo = (RICHEDIT_INFO *)GlobalLock(hProp); 593 if(prinfo) 816 594 { 817 if(p cf->dwMask & CFM_BACKCOLOR) {818 SetBkColor(hdc, p cf->crBackColor);819 hBrush = p cf->dwReserved;595 if(prinfo->cf.dwMask & CFM_BACKCOLOR) { 596 SetBkColor(hdc, prinfo->cf.crBackColor); 597 hBrush = prinfo->hbrBackground; 820 598 } 821 if(p cf->dwMask & CFM_COLOR) {822 SetTextColor(hdc, p cf->crTextColor);599 if(prinfo->cf.dwMask & CFM_COLOR) { 600 SetTextColor(hdc, prinfo->cf.crTextColor); 823 601 } 824 602 } 825 if(p cf) GlobalUnlock(hProp);603 if(prinfo) GlobalUnlock(hProp); 826 604 827 605 if(hBrush) return hBrush; 828 }606 } 829 607 #endif 830 608 DPRINTF_EDIT_MSG32("WM_CTLCOLORSTATIC Passed to default"); 831 609 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 832 case WM_NCMOUSEMOVE: 833 DPRINTF_EDIT_MSG32("WM_NCMOUSEMOVE Passed to default"); 834 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 835 case WM_CLEAR: 836 DPRINTF_EDIT_MSG32("WM_CLEAR Passed to default"); 837 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 610 #endif 611 612 /* Edit control messages that are different for RichEdit controls */ 613 case EM_CHARFROMPOS: 614 { 615 POINTL *lpPoint = (POINTL *)lParam; 616 DWORD curpos; 617 618 curpos = pfnEditProc(hwnd, EM_CHARFROMPOS, wParam, MAKELPARAM(lpPoint->x, lpPoint->y)); 619 TRACE("curpos: 0x%x richedit pos: 0x%x\n", curpos, LOWORD(curpos)); 620 return LOWORD(curpos); 621 } 622 838 623 /* 839 624 * used by IE in the EULA box … … 842 627 DPRINTF_EDIT_MSG32("WM_ALTTABACTIVE"); 843 628 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 844 case WM_GETDLGCODE: 845 DPRINTF_EDIT_MSG32("WM_GETDLGCODE"); 846 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 847 case WM_SETFONT: 848 DPRINTF_EDIT_MSG32("WM_SETFONT"); 849 return DefWindowProcA( hwnd,uMsg,wParam,lParam); 850 851 } 852 853 FIXME("Unknown message 0x%x Passed to default hwnd=%p, wParam=%08x, lParam=%08x\n", 629 } 630 631 /* pass the rest to the edit window procedure */ 632 TRACE("Message 0x%x Passed to pfnEditProc hwnd=%p, wParam=%08x, lParam=%08x\n", 854 633 uMsg, hwnd, (UINT)wParam, (UINT)lParam); 855 634 856 return DefWindowProcA(hwnd,uMsg,wParam,lParam);635 return pfnEditProc(hwnd,uMsg,wParam,lParam); 857 636 } 858 637 … … 905 684 WNDCLASSA wndClass; 906 685 686 #ifdef __WIN32OS2__ 687 WNDCLASSA classinfoA; 688 WNDCLASSW classinfoW; 689 690 if(GetClassInfoA(NULL, "EDIT", &classinfoA)) 691 { 692 pfnEditProcA = classinfoA.lpfnWndProc; 693 } 694 else DebugInt3(); 695 if(GetClassInfoW(NULL, L"EDIT", &classinfoW)) 696 { 697 pfnEditProcW = classinfoW.lpfnWndProc; 698 } 699 else DebugInt3(); 700 701 ZeroMemory(&wndClass, sizeof(WNDCLASSA)); 702 wndClass.style = classinfoA.style; 703 wndClass.lpfnWndProc = (WNDPROC)RICHED32_WindowProc; 704 wndClass.cbClsExtra = classinfoA.cbClsExtra; 705 wndClass.cbWndExtra = classinfoA.cbWndExtra; 706 wndClass.hCursor = classinfoA.hCursor; 707 wndClass.hbrBackground = classinfoA.hbrBackground; 708 wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */ 709 #else 907 710 TRACE("\n"); 908 711 … … 915 718 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 916 719 wndClass.lpszClassName = RICHEDIT_CLASS10A; /* WC_RICHED32A; */ 720 #endif 917 721 918 722 RegisterClassA (&wndClass); … … 934 738 935 739 UnregisterClassA(RICHEDIT_CLASS10A, (HINSTANCE)NULL); 740 741 #ifdef __WIN32OS2__ 742 pfnEditProcA = (FARPROC)DefWindowProcA; 743 pfnEditProcW = (FARPROC)DefWindowProcW; 744 #endif 936 745 } 937 746 … … 968 777 return RICHEDIT_GetTextRange(hwnd,&textrange); 969 778 } 779 780 /********************************************************************* 781 * 782 * EDIT_WordBreakProc 783 * 784 * Find the beginning of words. 785 * Note: unlike the specs for a WordBreakProc, this function only 786 * allows to be called without linebreaks between s[0] upto 787 * s[count - 1]. Remember it is only called 788 * internally, so we can decide this for ourselves. 789 * 790 */ 791 static INT CALLBACK EDIT_WordBreakProc(LPWSTR s, INT index, INT count, INT action) 792 { 793 INT ret = 0; 794 795 TRACE("s=%p, index=%d, count=%d, action=%d\n", s, index, count, action); 796 797 if(!s) return 0; 798 799 switch (action) { 800 case WB_LEFT: 801 if (!count) 802 break; 803 if (index) 804 index--; 805 if (s[index] == ' ') { 806 while (index && (s[index] == ' ')) 807 index--; 808 if (index) { 809 while (index && (s[index] != ' ')) 810 index--; 811 if (s[index] == ' ') 812 index++; 813 } 814 } else { 815 while (index && (s[index] != ' ')) 816 index--; 817 if (s[index] == ' ') 818 index++; 819 } 820 ret = index; 821 break; 822 case WB_RIGHT: 823 if (!count) 824 break; 825 if (index) 826 index--; 827 if (s[index] == ' ') 828 while ((index < count) && (s[index] == ' ')) index++; 829 else { 830 while (s[index] && (s[index] != ' ') && (index < count)) 831 index++; 832 while ((s[index] == ' ') && (index < count)) index++; 833 } 834 ret = index; 835 break; 836 case WB_ISDELIMITER: 837 ret = (s[index] == ' '); 838 break; 839 default: 840 ERR("unknown action code, please report !\n"); 841 break; 842 } 843 return ret; 844 }
Note:
See TracChangeset
for help on using the changeset viewer.