Changeset 20997
- Timestamp:
- Feb 16, 2004, 2:20:10 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tags/trunk/src/user32/edit.c ¶
r20752 r20997 231 231 static INT EDIT_EM_LineIndex(EDITSTATE *es, INT line); 232 232 static INT EDIT_EM_LineLength(EDITSTATE *es, INT index); 233 #ifdef __WIN32OS2__ 234 static INT EDIT_EM_LineLengthA(EDITSTATE *es, INT index); 235 #endif 233 236 static BOOL EDIT_EM_LineScroll(HWND hwnd, EDITSTATE *es, INT dx, INT dy); 234 237 static BOOL EDIT_EM_LineScroll_internal(HWND hwnd, EDITSTATE *es, INT dx, INT dy); … … 459 462 EDIT_EM_SetSel(hwnd, es, (UINT)-1, 0, FALSE); 460 463 else 464 #ifdef __WIN32OS2__ 465 if( IsDBCSEnv() && SHIWORD( lParam ) != -1 ) 466 { 467 INT countA = WideCharToMultiByte( CP_ACP, 0, es->text, -1, 0, 0, 0, 0 ); 468 LPSTR textA = HeapAlloc( GetProcessHeap(), 0, countA ); 469 WORD wLo, wHi; 470 471 if( textA ) 472 { 473 WideCharToMultiByte( CP_ACP, 0, es->text, -1, textA, countA, 0, 0 ); 474 475 wLo = LOWORD( lParam ); 476 wHi = HIWORD( lParam ); 477 478 if( wLo > countA ) 479 wLo = countA; 480 wLo = ( WPARAM )MultiByteToWideChar( CP_ACP, 0, textA, wLo, 0, 0 ); 481 482 if( wHi > countA ) 483 wHi = countA; 484 wHi = ( LPARAM )MultiByteToWideChar( CP_ACP, 0, textA, wHi, 0, 0 ); 485 486 lParam = MAKELPARAM( wLo, wHi ); 487 488 HeapFree( GetProcessHeap(), 0, textA ); 489 } 490 #endif 461 491 EDIT_EM_SetSel(hwnd, es, LOWORD(lParam), HIWORD(lParam), FALSE); 492 #ifdef __WIN32OS2__ 493 } 494 #endif 462 495 if (!wParam) 463 496 EDIT_EM_ScrollCaret(hwnd, es); … … 466 499 case EM_SETSEL: 467 500 DPRINTF_EDIT_MSG32("EM_SETSEL"); 501 #ifdef __WIN32OS2__ 502 if( !unicode && IsDBCSEnv() && ( INT )wParam != -1 && ( INT )lParam != -1 ) 503 { 504 INT countA = WideCharToMultiByte( CP_ACP, 0, es->text, -1, 0, 0, 0, 0 ); 505 LPSTR textA = HeapAlloc( GetProcessHeap(), 0, countA ); 506 507 if( textA ) 508 { 509 WideCharToMultiByte( CP_ACP, 0, es->text, -1, textA, countA, 0, 0 ); 510 511 if(( INT )wParam > countA ) 512 wParam = ( WPARAM ) countA; 513 wParam = ( WPARAM )MultiByteToWideChar( CP_ACP, 0, textA, ( INT )wParam, 0, 0 ); 514 515 if(( INT )lParam > countA ) 516 lParam = ( LPARAM ) countA; 517 lParam = ( LPARAM )MultiByteToWideChar( CP_ACP, 0, textA, ( INT )lParam, 0, 0 ); 518 519 HeapFree( GetProcessHeap(), 0, textA ); 520 } 521 } 522 #endif 468 523 EDIT_EM_SetSel(hwnd, es, wParam, lParam, FALSE); 469 524 EDIT_EM_ScrollCaret(hwnd, es); … … 575 630 DPRINTF_EDIT_MSG32("EM_LINEINDEX"); 576 631 result = (LRESULT)EDIT_EM_LineIndex(es, (INT)wParam); 632 #ifdef __WIN32OS2__ 633 if( !unicode ) 634 result = WideCharToMultiByte( CP_ACP, 0, es->text, result, 0, 0, 0, 0 ); 635 #endif 577 636 break; 578 637 … … 630 689 case EM_LINELENGTH: 631 690 DPRINTF_EDIT_MSG32("EM_LINELENGTH"); 691 #ifdef __WIN32OS2__ 692 if( !unicode ) 693 result = ( LRESULT )EDIT_EM_LineLengthA(es, (INT)wParam); 694 else 695 #endif 632 696 result = (LRESULT)EDIT_EM_LineLength(es, (INT)wParam); 633 697 break; … … 719 783 case EM_LINEFROMCHAR: 720 784 DPRINTF_EDIT_MSG32("EM_LINEFROMCHAR"); 785 #ifdef __WIN32OS2__ 786 if( !unicode && IsDBCSEnv() && ( INT )wParam != -1 ) 787 { 788 INT countA = WideCharToMultiByte( CP_ACP, 0, es->text, -1, 0, 0, 0, 0 ); 789 LPSTR textA = HeapAlloc( GetProcessHeap(), 0, countA ); 790 791 if( textA ) 792 { 793 WideCharToMultiByte( CP_ACP, 0, es->text, -1, textA, countA, 0, 0 ); 794 795 if(( INT )wParam > countA ) 796 wParam = ( WPARAM )countA; 797 798 wParam = ( WPARAM )MultiByteToWideChar( CP_ACP, 0, textA, ( INT )wParam, 0, 0 ); 799 800 HeapFree( GetProcessHeap(), 0, textA ); 801 } 802 } 803 #endif 721 804 result = (LRESULT)EDIT_EM_LineFromChar(es, (INT)wParam); 722 805 break; … … 854 937 case EM_POSFROMCHAR: 855 938 DPRINTF_EDIT_MSG32("EM_POSFROMCHAR"); 939 #ifdef __WIN32OS2__ 940 if( !unicode && IsDBCSEnv() ) 941 { 942 INT countA = WideCharToMultiByte( CP_ACP, 0, es->text, -1, 0, 0, 0, 0 ); 943 LPSTR textA = HeapAlloc( GetProcessHeap(), 0, countA ); 944 945 if( textA ) 946 { 947 WideCharToMultiByte( CP_ACP, 0, es->text, -1, textA, countA, 0, 0 ); 948 949 if(( INT )wParam > countA ) 950 wParam = ( WPARAM ) countA; 951 wParam = ( WPARAM )MultiByteToWideChar( CP_ACP, 0, textA, ( INT )wParam, 0, 0 ); 952 953 HeapFree( GetProcessHeap(), 0, textA ); 954 } 955 } 956 #endif 856 957 result = EDIT_EM_PosFromChar(hwnd, es, (INT)wParam, FALSE); 857 958 break; … … 860 961 DPRINTF_EDIT_MSG32("EM_CHARFROMPOS"); 861 962 result = EDIT_EM_CharFromPos(hwnd, es, SLOWORD(lParam), SHIWORD(lParam)); 963 #ifdef __WIN32OS2__ 964 if( !unicode ) 965 { 966 WORD wLo = LOWORD( result ); 967 WORD wHi = HIWORD( result ); 968 969 wLo = WideCharToMultiByte( CP_ACP, 0, es->text, wLo, 0, 0, 0, 0 ); 970 wHi = WideCharToMultiByte( CP_ACP, 0, es->text, wHi, 0, 0, 0, 0 ); 971 result = ( LRESULT )MAKELONG( wLo, wHi ); 972 } 973 #endif 862 974 break; 863 975 … … 978 1090 DPRINTF_EDIT_MSG32("WM_GETTEXTLENGTH"); 979 1091 result = strlenW(es->text); 1092 #ifdef __WIN32OS2__ 1093 if( !unicode ) 1094 result = WideCharToMultiByte( CP_ACP, 0, es->text, result, 0, 0, 0, 0 ); 1095 #endif 980 1096 break; 981 1097 … … 2216 2332 INT y; 2217 2333 LRESULT pos; 2334 HBRUSH brush; 2335 RECT rc; 2336 2218 2337 2219 2338 if (es->style & ES_MULTILINE) { … … 2229 2348 x = SLOWORD(pos); 2230 2349 y = SHIWORD(pos); 2350 2231 2351 li = EDIT_EM_LineIndex(es, line); 2232 2352 ll = EDIT_EM_LineLength(es, li); … … 2243 2363 } else 2244 2364 x += EDIT_PaintText(es, dc, x, y, line, 0, ll, FALSE); 2365 2366 #if 0 2367 #ifdef __WIN32OS2__ 2368 if ( get_app_version() >= 0x40000 &&( 2369 !es->bEnableState || (es->style & ES_READONLY))) 2370 brush = (HBRUSH)EDIT_SEND_CTLCOLORSTATIC(hwnd, dc); 2371 else 2372 brush = (HBRUSH)EDIT_SEND_CTLCOLOR(hwnd, dc); 2373 2374 if (!brush) 2375 brush = (HBRUSH)GetStockObject(WHITE_BRUSH); 2376 2377 rc.left = x; 2378 rc.right = es->format_rect.right; 2379 rc.top = y; 2380 rc.bottom = y + es->line_height; 2381 2382 FillRect(dc, &rc, brush); 2383 #endif 2384 #endif 2245 2385 } 2246 2386 … … 2776 2916 UINT e = es->selection_end; 2777 2917 2918 #ifdef __WIN32OS2__ 2919 if( !es->is_unicode) 2920 { 2921 s = WideCharToMultiByte( CP_ACP, 0, es->text, s, 0, 0, 0, 0 ); 2922 e = WideCharToMultiByte( CP_ACP, 0, es->text, e, 0, 0, 0, 0 ); 2923 } 2924 #endif 2925 2778 2926 ORDER_UINT(s, e); 2779 2927 if (start) … … 2901 3049 } 2902 3050 3051 #ifdef __WIN32OS2__ 3052 /********************************************************************* 3053 * 3054 * EM_LINELENGTH for ANSI 3055 * 3056 */ 3057 static INT EDIT_EM_LineLengthA(EDITSTATE *es, INT index) 3058 { 3059 LINEDEF *line_def; 3060 3061 if (!(es->style & ES_MULTILINE)) 3062 return ( WideCharToMultiByte( CP_ACP, 0, es->text, -1, 0, 0, 0, 0 ) - 1); 3063 3064 if (index == -1) { 3065 /* get the number of remaining non-selected chars of selected lines */ 3066 INT32 l; /* line number */ 3067 INT32 li; /* index of first char in line */ 3068 INT32 count; 3069 l = EDIT_EM_LineFromChar(es, es->selection_start); 3070 li = EDIT_EM_LineIndex( es, l ); 3071 li = WideCharToMultiByte( CP_ACP, 0, es->text, li, 0, 0, 0, 0 ); 3072 /* # chars before start of selection area */ 3073 count = WideCharToMultiByte( CP_ACP, 0, es->text, es->selection_start, 0, 0, 0, 0 ); 3074 count -= li; 3075 l = EDIT_EM_LineFromChar(es, es->selection_end); 3076 /* # chars after end of selection */ 3077 li = EDIT_EM_LineIndex(es, l); 3078 li = WideCharToMultiByte( CP_ACP, 0, es->text, li, 0, 0, 0, 0 ); 3079 count += li + EDIT_EM_LineLengthA(es, li); 3080 count -= WideCharToMultiByte( CP_ACP, 0, es->text, es->selection_end, 0, 0, 0, 0 ); 3081 return count; 3082 } 3083 line_def = es->first_line_def; 3084 index -= line_def->length; 3085 while ((index >= 0) && line_def->next) { 3086 line_def = line_def->next; 3087 index -= line_def->length; 3088 } 3089 return WideCharToMultiByte( CP_ACP, 0, es->text + line_def->index, line_def->net_length, 0, 0, 0, 0 ); 3090 } 3091 #endif 2903 3092 2904 3093 /*********************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.