Changeset 2852 for trunk/src/user32/edit.cpp
- Timestamp:
- Feb 21, 2000, 6:25:33 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/edit.cpp
r2834 r2852 1 /* $Id: edit.cpp,v 1.3 4 2000-02-20 18:28:31cbratschi Exp $ */1 /* $Id: edit.cpp,v 1.35 2000-02-21 17:25:26 cbratschi Exp $ */ 2 2 /* 3 3 * Edit control … … 9 9 * Copyright 1999 Christoph Bratschi 10 10 * 11 * Corel version: 20000212 11 12 * WINE version: 991212 12 13 * … … 257 258 static void EDIT_WM_Timer(HWND hwnd, EDITSTATE *es, INT id, TIMERPROC timer_proc); 258 259 static LRESULT EDIT_WM_VScroll(HWND hwnd, EDITSTATE *es, INT action, INT pos, HWND scroll_bar); 259 260 static LRESULT EDIT_WM_MouseWheel(HWND hwnd,EDITSTATE *es,WPARAM wParam,LPARAM lParam); 260 261 261 262 /********************************************************************* … … 290 291 { 291 292 EDIT_EM_ReplaceSel(hwnd, es, TRUE, ""); 293 if (es->flags & EF_UPDATE) { 294 es->flags &= ~EF_UPDATE; 295 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 296 } 292 297 } 293 298 … … 693 698 */ 694 699 //DPRINTF_EDIT_MSG32("WM_MOUSEACTIVATE"); 695 SetFocus(hwnd);696 700 result = MA_ACTIVATE; 697 701 break; … … 748 752 //DPRINTF_EDIT_MSG32("WM_VSCROLL"); 749 753 result = EDIT_WM_VScroll(hwnd, es, LOWORD(wParam), SHIWORD(wParam), (HWND)(lParam)); 754 break; 755 756 case WM_MOUSEWHEEL: 757 result = EDIT_WM_MouseWheel(hwnd,es,wParam,lParam); 750 758 break; 751 759 … … 2436 2444 es->flags |= EF_UPDATE; 2437 2445 EDIT_EM_ScrollCaret(hwnd, es); 2438 EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE); 2446 2439 2447 /* FIXME: really inefficient */ 2440 2448 EDIT_Refresh(hwnd,es,TRUE); … … 2875 2883 // es->undo_insert_count, es->undo_text); 2876 2884 2885 if (es->flags & EF_UPDATE) { 2886 es->flags &= ~EF_UPDATE; 2887 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 2888 } 2889 2877 2890 return TRUE; 2878 2891 } … … 2917 2930 EDIT_MoveDown_ML(hwnd, es, FALSE); 2918 2931 } else 2932 { 2919 2933 EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\r\n"); 2934 if (es->flags & EF_UPDATE) { 2935 es->flags &= ~EF_UPDATE; 2936 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 2937 } 2938 } 2920 2939 } 2921 2940 break; 2922 2941 case '\t': 2923 2942 if ((es->style & ES_MULTILINE) && !(es->style & ES_READONLY)) 2943 { 2924 2944 EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\t"); 2945 if (es->flags & EF_UPDATE) { 2946 es->flags &= ~EF_UPDATE; 2947 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 2948 } 2949 } 2925 2950 break; 2926 2951 case VK_BACK: … … 2936 2961 } 2937 2962 break; 2963 //CB: are these three keys documented or Linux style??? 2964 case 0x03: /* ^C */ 2965 SendMessageA(hwnd, WM_COPY, 0, 0); 2966 break; 2967 case 0x16: /* ^V */ 2968 SendMessageA(hwnd, WM_PASTE, 0, 0); 2969 break; 2970 case 0x18: /* ^X */ 2971 SendMessageA(hwnd, WM_CUT, 0, 0); 2972 break; 2973 2938 2974 default: 2939 2975 if (!(es->style & ES_READONLY) && ((BYTE)c >= ' ') && (c != 127)) … … 2949 2985 str[1] = '\0'; 2950 2986 EDIT_EM_ReplaceSel(hwnd, es, TRUE, str); 2987 if (es->flags & EF_UPDATE) 2988 { 2989 es->flags &= ~EF_UPDATE; 2990 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 2991 } 2951 2992 } else MessageBeep(MB_ICONEXCLAMATION); 2952 2993 break; … … 3085 3126 es->selection_start = es->selection_end = 0; 3086 3127 EDIT_EM_ScrollCaret(hwnd, es); 3128 if (es->flags & EF_UPDATE) { 3129 es->flags &= ~EF_UPDATE; 3130 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 3131 } 3087 3132 } 3088 3133 return 0; … … 3097 3142 static void EDIT_WM_Destroy(HWND hwnd, EDITSTATE *es) 3098 3143 { 3144 if (!es) /* Protect against multiple destroy messages */ 3145 return; 3146 3099 3147 if (es->hloc) { 3100 3148 while (LocalUnlock(es->hloc)) ; … … 3311 3359 HWND hLBox; 3312 3360 3361 /******************************************************************** 3362 * This if statement used to check to see if the parent of the 3363 * edit control was a 'combobox' by comparing the ATOM of the parent 3364 * to a table of internal window control ATOMs. However, this check 3365 * would fail if the parent was a superclassed combobox (Although 3366 * having the same basic functionality of a combobox, it has a 3367 * different name and ATOM, thus defeating this check.) 3368 * 3369 * The safe way to determine if the parent is a combobox is to send it 3370 * a message only a combo box would understand. I send it a message 3371 * CB_GETCOUNT, if I get 0 then the parent is not a combobox - 3372 * return FALSE. If I get > 0, then the parent IS a combobox 3373 * (or sub/super classed derrivative thereof) 3374 ********************************************************************/ 3375 #if 0 //CB: our code 3313 3376 if (GetClassWord(GetParent(hwnd),GCW_ATOM) == GlobalFindAtomA(COMBOBOXCLASSNAME) && 3314 (hLBox = COMBO_GetLBWindow(GetParent(hwnd)))) { 3377 (hLBox = COMBO_GetLBWindow(GetParent(hwnd)))) 3378 #else 3379 if ( 3380 ((SendMessageA(GetParent(hwnd), CB_GETCOUNT, 0, 0)) > 0) && 3381 (hLBox = COMBO_GetLBWindow(GetParent(hwnd))) 3382 ) 3383 #endif 3384 { 3315 3385 HWND hCombo = GetParent(hwnd); 3316 3386 BOOL bUIFlip = TRUE; … … 3521 3591 3522 3592 if (!(es->flags & EF_FOCUSED)) 3523 return 0;3593 SetFocus(hwnd); 3524 3594 3525 3595 es->bCaptureState = TRUE; … … 3759 3829 3760 3830 ShowCaret(hwnd); 3831 } 3832 3833 static VOID EDIT_Refresh(HWND hwnd,EDITSTATE *es,BOOL useCache) 3834 { 3835 HDC hdc,hdcCompatible; 3836 HBITMAP bitmap,oldbmp; 3837 RECT rect; 3761 3838 3762 3839 if (es->flags & EF_UPDATE) 3763 3840 { 3764 3841 es->flags &= ~EF_UPDATE; 3765 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);3842 EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE); 3766 3843 } 3767 }3768 3769 static VOID EDIT_Refresh(HWND hwnd,EDITSTATE *es,BOOL useCache)3770 {3771 HDC hdc,hdcCompatible;3772 HBITMAP bitmap,oldbmp;3773 RECT rect;3774 3844 3775 3845 if (!IsWindowVisible(hwnd)) return; … … 3833 3903 EDIT_EM_ReplaceSel(hwnd, es, TRUE, src); 3834 3904 GlobalUnlock(hsrc); 3905 3906 if (es->flags & EF_UPDATE) { 3907 es->flags &= ~EF_UPDATE; 3908 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 3909 } 3835 3910 } 3836 3911 CloseClipboard(); … … 3923 3998 static void EDIT_WM_SetText(HWND hwnd, EDITSTATE *es, LPCSTR text) 3924 3999 { 3925 EDIT_EM_SetSel(hwnd, es, 0, -1, FALSE); 4000 es->selection_start = 0; 4001 es->selection_end = lstrlenA(es->text); 4002 if (es->flags & EF_FOCUSED) 4003 EDIT_SetCaretPos(hwnd, es, es->selection_end, FALSE); 4004 3926 4005 if (text) { 3927 4006 //TRACE_(edit)("\t'%s'\n", text); … … 3941 4020 EDIT_EM_ScrollCaret(hwnd, es); 3942 4021 EDIT_UpdateScrollBars(hwnd,es,TRUE,TRUE); 3943 if (es->flags & EF_UPDATE) EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE); 4022 if (es->flags & EF_UPDATE) 4023 { 4024 EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE); 4025 /* EN_CHANGE notification need to be sent too 4026 Windows doc says it's only done after the display, 4027 the doc is WRONG. EN_CHANGE notification is sent 4028 while processing WM_SETTEXT */ 4029 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE); 4030 es->flags &= EF_UPDATE; 4031 } 3944 4032 } 3945 4033 … … 4117 4205 } 4118 4206 4207 static LRESULT EDIT_WM_MouseWheel(HWND hwnd,EDITSTATE *es,WPARAM wParam,LPARAM lParam) 4208 { 4209 short gcWheelDelta = 0; 4210 UINT pulScrollLines = 3; 4211 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); 4212 4213 if (wParam & (MK_SHIFT | MK_CONTROL)) 4214 return DefWindowProcA(hwnd,WM_MOUSEWHEEL, wParam, lParam); 4215 gcWheelDelta -= (short) HIWORD(wParam); 4216 if (abs(gcWheelDelta) >= WHEEL_DELTA && pulScrollLines) 4217 { 4218 int cLineScroll= (int) min((UINT) es->line_count, pulScrollLines); 4219 4220 cLineScroll *= (gcWheelDelta / WHEEL_DELTA); 4221 return EDIT_EM_LineScroll(hwnd, es, 0, cLineScroll); 4222 } 4223 4224 return 0; 4225 } 4226 4119 4227 BOOL EDIT_Register() 4120 4228 {
Note:
See TracChangeset
for help on using the changeset viewer.