Ignore:
Timestamp:
Feb 21, 2000, 6:25:33 PM (26 years ago)
Author:
cbratschi
Message:

merged with Corel WINE 20000212, added WS_EX_CONTEXTHELP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/edit.cpp

    r2834 r2852  
    1 /* $Id: edit.cpp,v 1.34 2000-02-20 18:28:31 cbratschi Exp $ */
     1/* $Id: edit.cpp,v 1.35 2000-02-21 17:25:26 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    99 *      Copyright  1999 Christoph Bratschi
    1010 *
     11 * Corel version: 20000212
    1112 * WINE version: 991212
    1213 *
     
    257258static void     EDIT_WM_Timer(HWND hwnd, EDITSTATE *es, INT id, TIMERPROC timer_proc);
    258259static LRESULT  EDIT_WM_VScroll(HWND hwnd, EDITSTATE *es, INT action, INT pos, HWND scroll_bar);
    259 
     260static LRESULT EDIT_WM_MouseWheel(HWND hwnd,EDITSTATE *es,WPARAM wParam,LPARAM lParam);
    260261
    261262/*********************************************************************
     
    290291{
    291292        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        }
    292297}
    293298
     
    693698                 */
    694699                //DPRINTF_EDIT_MSG32("WM_MOUSEACTIVATE");
    695                 SetFocus(hwnd);
    696700                result = MA_ACTIVATE;
    697701                break;
     
    748752                //DPRINTF_EDIT_MSG32("WM_VSCROLL");
    749753                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);
    750758                break;
    751759
     
    24362444        es->flags |= EF_UPDATE;
    24372445        EDIT_EM_ScrollCaret(hwnd, es);
    2438         EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE);
     2446
    24392447        /* FIXME: really inefficient */
    24402448        EDIT_Refresh(hwnd,es,TRUE);
     
    28752883        //                es->undo_insert_count, es->undo_text);
    28762884
     2885        if (es->flags & EF_UPDATE) {
     2886                es->flags &= ~EF_UPDATE;
     2887                EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     2888        }
     2889
    28772890        return TRUE;
    28782891}
     
    29172930                                EDIT_MoveDown_ML(hwnd, es, FALSE);
    29182931                        } else
     2932                        {
    29192933                                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                        }
    29202939                }
    29212940                break;
    29222941        case '\t':
    29232942                if ((es->style & ES_MULTILINE) && !(es->style & ES_READONLY))
     2943                {
    29242944                        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                }
    29252950                break;
    29262951        case VK_BACK:
     
    29362961                }
    29372962                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
    29382974        default:
    29392975                if (!(es->style & ES_READONLY) && ((BYTE)c >= ' ') && (c != 127))
     
    29492985                  str[1] = '\0';
    29502986                  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                  }
    29512992                } else MessageBeep(MB_ICONEXCLAMATION);
    29522993                break;
     
    30853126           es->selection_start = es->selection_end = 0;
    30863127           EDIT_EM_ScrollCaret(hwnd, es);
     3128           if (es->flags & EF_UPDATE) {
     3129                es->flags &= ~EF_UPDATE;
     3130                EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     3131           }
    30873132       }
    30883133       return 0;
     
    30973142static void EDIT_WM_Destroy(HWND hwnd, EDITSTATE *es)
    30983143{
     3144        if (!es) /* Protect against multiple destroy messages */
     3145            return;
     3146
    30993147        if (es->hloc) {
    31003148                while (LocalUnlock(es->hloc)) ;
     
    33113359        HWND hLBox;
    33123360
     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
    33133376        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        {
    33153385                HWND hCombo = GetParent(hwnd);
    33163386                BOOL bUIFlip = TRUE;
     
    35213591
    35223592        if (!(es->flags & EF_FOCUSED))
    3523                 return 0;
     3593          SetFocus(hwnd);
    35243594
    35253595        es->bCaptureState = TRUE;
     
    37593829
    37603830  ShowCaret(hwnd);
     3831}
     3832
     3833static VOID EDIT_Refresh(HWND hwnd,EDITSTATE *es,BOOL useCache)
     3834{
     3835  HDC hdc,hdcCompatible;
     3836  HBITMAP bitmap,oldbmp;
     3837  RECT rect;
    37613838
    37623839  if (es->flags & EF_UPDATE)
    37633840  {
    37643841    es->flags &= ~EF_UPDATE;
    3765     EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     3842    EDIT_NOTIFY_PARENT(hwnd,EN_UPDATE);
    37663843  }
    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;
    37743844
    37753845  if (!IsWindowVisible(hwnd)) return;
     
    38333903                EDIT_EM_ReplaceSel(hwnd, es, TRUE, src);
    38343904                GlobalUnlock(hsrc);
     3905
     3906                if (es->flags & EF_UPDATE) {
     3907                        es->flags &= ~EF_UPDATE;
     3908                        EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
     3909                }
    38353910        }
    38363911        CloseClipboard();
     
    39233998static void EDIT_WM_SetText(HWND hwnd, EDITSTATE *es, LPCSTR text)
    39243999{
    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
    39264005        if (text) {
    39274006                //TRACE_(edit)("\t'%s'\n", text);
     
    39414020        EDIT_EM_ScrollCaret(hwnd, es);
    39424021        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        }
    39444032}
    39454033
     
    41174205}
    41184206
     4207static 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
    41194227BOOL EDIT_Register()
    41204228{
Note: See TracChangeset for help on using the changeset viewer.