- Timestamp:
- Nov 11, 1999, 6:13:45 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/edit.cpp
r1637 r1705 1 /* $Id: edit.cpp,v 1.1 1 1999-11-08 14:12:44 phallerExp $ */1 /* $Id: edit.cpp,v 1.12 1999-11-11 17:13:45 cbratschi Exp $ */ 2 2 /* 3 3 * Edit control … … 88 88 INT y_offset; /* scroll offset in number of lines */ 89 89 BOOL bCaptureState; /* flag indicating whether mouse was captured */ 90 90 BOOL bEnableState; /* flag keeping the enable state */ 91 91 /* 92 92 * only for multi line controls … … 114 114 (SendMessageA(GetParent(hwnd), WM_CTLCOLOREDIT, \ 115 115 (WPARAM)(hdc), (LPARAM)hwnd)) 116 #define EDIT_NOTIFY_PARENT(hwnd, wNotifyCode, str) \ 117 do { \ 118 SendMessageA(GetParent(hwnd), WM_COMMAND, \ 119 MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID), wNotifyCode), \ 120 (LPARAM)hwnd);} while(0) 116 #define EDIT_NOTIFY_PARENT(hwnd, wNotifyCode) \ 117 (SendMessageA(GetParent(hwnd), WM_COMMAND, \ 118 MAKEWPARAM(GetWindowLongA(hwnd,GWL_ID), wNotifyCode), (LPARAM)hwnd)) 121 119 122 120 /********************************************************************* … … 1175 1173 return TRUE; 1176 1174 if (size > es->buffer_limit) { 1177 EDIT_NOTIFY_PARENT(hwnd, EN_MAXTEXT , "EN_MAXTEXT");1175 EDIT_NOTIFY_PARENT(hwnd, EN_MAXTEXT); 1178 1176 return FALSE; 1179 1177 } … … 1202 1200 EDIT_LockBuffer(hwnd, es); 1203 1201 //WARN_(edit)("FAILED ! We now have %d+1\n", es->buffer_size); 1204 EDIT_NOTIFY_PARENT(hwnd, EN_ERRSPACE , "EN_ERRSPACE");1202 EDIT_NOTIFY_PARENT(hwnd, EN_ERRSPACE); 1205 1203 return FALSE; 1206 1204 } else { … … 1298 1296 INT e; 1299 1297 1300 1301 1302 1303 1298 /* Pass a high value in x to make sure of receiving the en of the line */ 1299 if (es->style & ES_MULTILINE) 1300 e = EDIT_CharFromPos(hwnd, es, 0x3fffffff, 1301 HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap); 1304 1302 else 1305 1303 e = lstrlenA(es->text); … … 1343 1341 INT e; 1344 1342 1345 1346 1347 1348 1349 1350 1351 1343 /* Pass the x_offset in x to make sure of receiving the first position of the line */ 1344 if (es->style & ES_MULTILINE) 1345 e = EDIT_CharFromPos(hwnd, es, -es->x_offset, 1346 HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL); 1347 else 1348 e = 0; 1349 EDIT_EM_SetSel(hwnd, es, extend ? es->selection_start : e, e, FALSE); 1352 1350 EDIT_EM_ScrollCaret(hwnd, es); 1353 1351 } … … 1852 1850 //SvL: Shouldn't this be *lpch-1? For terminating 0 1853 1851 //len = MIN(*(WORD *)lpch-1, EDIT_EM_LineLength(hwnd, es, i)); 1854 1852 len = MIN(*(WORD *)lpch, EDIT_EM_LineLength(hwnd, es, i)); 1855 1853 for (i = 0 ; i < len ; i++) { 1856 1854 *lpch = *src; … … 2028 2026 GetClientRect(hwnd, &rc1); 2029 2027 IntersectRect(&rc, &rc1, &es->format_rect); 2028 rc.top--; //CB: top line not moved/refreshed 2030 2029 ScrollWindowEx(hwnd, -dx, dy, 2031 2030 NULL, &rc, (HRGN)NULL, NULL, SW_INVALIDATE); … … 2034 2033 } 2035 2034 if (dx && !(es->flags & EF_HSCROLL_TRACK)) 2036 EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL , "EN_HSCROLL");2035 EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL); 2037 2036 if (dy && !(es->flags & EF_VSCROLL_TRACK)) 2038 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL , "EN_VSCROLL");2037 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL); 2039 2038 return TRUE; 2040 2039 } … … 2245 2244 if (dy) { 2246 2245 EDIT_EM_LineScroll(hwnd, es, 0, dy); 2247 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL , "EN_VSCROLL");2246 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL); 2248 2247 } 2249 2248 return MAKELONG((INT16)dy, (BOOL16)TRUE); … … 2471 2470 ORDER_UINT(start, old_start); 2472 2471 ORDER_UINT(old_start, old_end); 2472 if (es->flags & EF_FOCUSED) HideCaret(hwnd); 2473 2473 if (end != old_start) 2474 2474 { … … 2492 2492 } 2493 2493 else EDIT_InvalidateText(hwnd, es, start, old_end); 2494 if (es->flags & EF_FOCUSED) ShowCaret(hwnd); 2494 2495 } 2495 2496 … … 2573 2574 switch (c) { 2574 2575 case '\r': 2575 2576 2577 2576 /* If the edit doesn't want the return, do nothing */ 2577 if(!(es->style & ES_WANTRETURN)) 2578 break; 2578 2579 case '\n': 2579 2580 if (es->style & ES_MULTILINE) { … … 2589 2590 EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\t"); 2590 2591 break; 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2592 case VK_BACK: 2593 if (!(es->style & ES_READONLY) && !control) { 2594 if (es->selection_start != es->selection_end) 2595 EDIT_WM_Clear(hwnd, es); 2596 else { 2597 /* delete character left of caret */ 2598 EDIT_EM_SetSel(hwnd, es, -1, 0, FALSE); 2599 EDIT_MoveBackward(hwnd, es, TRUE); 2600 EDIT_WM_Clear(hwnd, es); 2601 } 2602 } 2603 break; 2603 2604 default: 2604 2605 if (!(es->style & ES_READONLY) && ((BYTE)c >= ' ') && (c != 127)) { … … 2721 2722 /********************************************************************* 2722 2723 * 2723 * 2724 * WM_CREATE 2724 2725 * 2725 2726 */ … … 2727 2728 { 2728 2729 /* 2729 * 2730 * 2731 * 2732 * 2730 * To initialize some final structure members, we call some helper 2731 * functions. However, since the EDITSTATE is not consistent (i.e. 2732 * not fully initialized), we should be very careful which 2733 * functions can be called, and in what order. 2733 2734 */ 2734 2735 EDIT_WM_SetFont(hwnd, es, 0, FALSE); 2735 2736 EDIT_EM_EmptyUndoBuffer(hwnd, es); 2736 2737 if (cs->lpszName && *(cs->lpszName) != '\0') { 2737 2738 2738 EDIT_EM_ReplaceSel(hwnd, es, FALSE, cs->lpszName); 2739 /* if we insert text to the editline, the text scrolls out 2739 2740 * of the window, as the caret is placed after the insert 2740 2741 * pos normally; thus we reset es->selection... to 0 and 2741 2742 * update caret 2742 2743 */ 2743 2744 2744 es->selection_start = es->selection_end = 0; 2745 EDIT_EM_ScrollCaret(hwnd, es); 2745 2746 } 2746 2747 return 0; … … 2871 2872 es->flags &= ~EF_HSCROLL_TRACK; 2872 2873 if (!(dx = pos * es->text_width / 100 - es->x_offset)) 2873 EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL , "EN_HSCROLL");2874 EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL); 2874 2875 break; 2875 2876 case SB_ENDSCROLL: … … 2940 2941 if (!(dx = pos - es->x_offset)) { 2941 2942 SetScrollPos(hwnd, SB_HORZ, pos, TRUE); 2942 EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL , "EN_HSCROLL");2943 EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL); 2943 2944 } 2944 2945 break; … … 3100 3101 EDIT_WM_Copy(hwnd, es); 3101 3102 break; 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3103 case VK_RETURN: 3104 /* If the edit doesn't want the return send a message to the default object */ 3105 if(!(es->style & ES_WANTRETURN)) 3106 { 3107 HWND hwndParent = GetParent(hwnd); 3108 DWORD dw = SendMessageA( hwndParent, DM_GETDEFID, 0, 0 ); 3109 if (HIWORD(dw) == DC_HASDEFID) 3110 { 3111 SendMessageA( hwndParent, WM_COMMAND, 3112 MAKEWPARAM( LOWORD(dw), BN_CLICKED ), 3113 (LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) ); 3114 } 3115 } 3116 break; 3116 3117 } 3117 3118 return 0; … … 3130 3131 if(!(es->style & ES_NOHIDESEL)) 3131 3132 EDIT_InvalidateText(hwnd, es, es->selection_start, es->selection_end); 3132 EDIT_NOTIFY_PARENT(hwnd, EN_KILLFOCUS , "EN_KILLFOCUS");3133 EDIT_NOTIFY_PARENT(hwnd, EN_KILLFOCUS); 3133 3134 return 0; 3134 3135 } … … 3231 3232 EDIT_EM_SetSel(hwnd, es, es->selection_start, e, after_wrap); 3232 3233 3233 3234 return 1; //SvL: Bugfix -> PMWINDOW expects non-zero return value if 3234 3235 // we want to restore the default mouse cursor 3235 3236 } … … 3344 3345 3345 3346 if (es->flags & EF_UPDATE) 3346 EDIT_NOTIFY_PARENT(hwnd, EN_UPDATE , "EN_UPDATE");3347 EDIT_NOTIFY_PARENT(hwnd, EN_UPDATE); 3347 3348 3348 3349 if (!wParam) … … 3419 3420 if (es->flags & EF_UPDATE) { 3420 3421 es->flags &= ~EF_UPDATE; 3421 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE , "EN_CHANGE");3422 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 3422 3423 } 3423 3424 } … … 3459 3460 EDIT_InvalidateText(hwnd, es, es->selection_start, es->selection_end); 3460 3461 ShowCaret(hwnd); 3461 EDIT_NOTIFY_PARENT(hwnd, EN_SETFOCUS , "EN_SETFOCUS");3462 EDIT_NOTIFY_PARENT(hwnd, EN_SETFOCUS); 3462 3463 } 3463 3464 … … 3497 3498 EDIT_EM_SetMargins(hwnd, es, EC_LEFTMARGIN | EC_RIGHTMARGIN, 3498 3499 EC_USEFONTINFO, EC_USEFONTINFO); 3499 3500 3501 3500 /* Force the recalculation of the format rect for each font change */ 3501 GetClientRect(hwnd, &r); 3502 EDIT_SetRectNP(hwnd, es, &r); 3502 3503 if (es->style & ES_MULTILINE) 3503 3504 EDIT_BuildLineDefs_ML(hwnd, es); … … 3643 3644 es->flags &= ~EF_VSCROLL_TRACK; 3644 3645 if (!(dy = (pos * (es->line_count - 1) + 50) / 100 - es->y_offset)) 3645 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL , "EN_VSCROLL");3646 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL); 3646 3647 break; 3647 3648 case SB_ENDSCROLL: … … 3699 3700 if (!(dy = pos - es->y_offset)) { 3700 3701 SetScrollPos(hwnd, SB_VERT, pos, TRUE); 3701 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL , "EN_VSCROLL");3702 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL); 3702 3703 } 3703 3704 break; -
trunk/src/user32/pmframe.cpp
r1704 r1705 1 /* $Id: pmframe.cpp,v 1.2 3 1999-11-11 13:17:30 sandervlExp $ */1 /* $Id: pmframe.cpp,v 1.24 1999-11-11 17:13:45 cbratschi Exp $ */ 2 2 /* 3 3 * Win32 Frame Managment Code for OS/2 … … 643 643 { 644 644 WinSetParent(win32wnd->getHorzScrollHandle(),fShow ? win32wnd->getOS2FrameWindowHandle():HWND_OBJECT,FALSE); 645 updateFlags = FCF_HORZSCROLL;645 updateFlags |= FCF_HORZSCROLL; 646 646 } 647 647 }
Note:
See TracChangeset
for help on using the changeset viewer.