Changeset 1705 for trunk/src


Ignore:
Timestamp:
Nov 11, 1999, 6:13:45 PM (26 years ago)
Author:
cbratschi
Message:

some edit fixes

Location:
trunk/src/user32
Files:
2 edited

Legend:

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

    r1637 r1705  
    1 /* $Id: edit.cpp,v 1.11 1999-11-08 14:12:44 phaller Exp $ */
     1/* $Id: edit.cpp,v 1.12 1999-11-11 17:13:45 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    8888        INT y_offset;                   /* scroll offset in number of lines */
    8989        BOOL bCaptureState; /* flag indicating whether mouse was captured */
    90         BOOL bEnableState;             /* flag keeping the enable state */
     90        BOOL bEnableState;             /* flag keeping the enable state */
    9191        /*
    9292         *      only for multi line controls
     
    114114        (SendMessageA(GetParent(hwnd), WM_CTLCOLOREDIT, \
    115115                        (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))
    121119
    122120/*********************************************************************
     
    11751173                return TRUE;
    11761174        if (size > es->buffer_limit) {
    1177                 EDIT_NOTIFY_PARENT(hwnd, EN_MAXTEXT, "EN_MAXTEXT");
     1175                EDIT_NOTIFY_PARENT(hwnd, EN_MAXTEXT);
    11781176                return FALSE;
    11791177        }
     
    12021200                EDIT_LockBuffer(hwnd, es);
    12031201                //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);
    12051203                return FALSE;
    12061204        } else {
     
    12981296        INT e;
    12991297
    1300         /* Pass a high value in x to make sure of receiving the en of the line */
    1301         if (es->style & ES_MULTILINE)
    1302                 e = EDIT_CharFromPos(hwnd, es, 0x3fffffff,
    1303                         HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);
     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);
    13041302        else
    13051303                e = lstrlenA(es->text);
     
    13431341        INT e;
    13441342
    1345         /* Pass the x_offset in x to make sure of receiving the first position of the line */
    1346         if (es->style & ES_MULTILINE)
    1347                 e = EDIT_CharFromPos(hwnd, es, -es->x_offset,
    1348                         HIWORD(EDIT_EM_PosFromChar(hwnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);
    1349         else
    1350                 e = 0;
    1351         EDIT_EM_SetSel(hwnd, es, extend ? es->selection_start : e, e, FALSE);
     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);
    13521350        EDIT_EM_ScrollCaret(hwnd, es);
    13531351}
     
    18521850        //SvL: Shouldn't this be *lpch-1? For terminating 0
    18531851        //len = MIN(*(WORD *)lpch-1, EDIT_EM_LineLength(hwnd, es, i));
    1854         len = MIN(*(WORD *)lpch, EDIT_EM_LineLength(hwnd, es, i));
     1852        len = MIN(*(WORD *)lpch, EDIT_EM_LineLength(hwnd, es, i));
    18551853        for (i = 0 ; i < len ; i++) {
    18561854                *lpch = *src;
     
    20282026                GetClientRect(hwnd, &rc1);
    20292027                IntersectRect(&rc, &rc1, &es->format_rect);
     2028                rc.top--; //CB: top line not moved/refreshed
    20302029                ScrollWindowEx(hwnd, -dx, dy,
    20312030                                NULL, &rc, (HRGN)NULL, NULL, SW_INVALIDATE);
     
    20342033        }
    20352034        if (dx && !(es->flags & EF_HSCROLL_TRACK))
    2036                 EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL, "EN_HSCROLL");
     2035                EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL);
    20372036        if (dy && !(es->flags & EF_VSCROLL_TRACK))
    2038                 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL, "EN_VSCROLL");
     2037                EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL);
    20392038        return TRUE;
    20402039}
     
    22452244        if (dy) {
    22462245                EDIT_EM_LineScroll(hwnd, es, 0, dy);
    2247                 EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL, "EN_VSCROLL");
     2246                EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL);
    22482247        }
    22492248        return MAKELONG((INT16)dy, (BOOL16)TRUE);
     
    24712470        ORDER_UINT(start, old_start);
    24722471        ORDER_UINT(old_start, old_end);
     2472        if (es->flags & EF_FOCUSED) HideCaret(hwnd);
    24732473        if (end != old_start)
    24742474        {
     
    24922492        }
    24932493        else EDIT_InvalidateText(hwnd, es, start, old_end);
     2494        if (es->flags & EF_FOCUSED) ShowCaret(hwnd);
    24942495}
    24952496
     
    25732574        switch (c) {
    25742575        case '\r':
    2575             /* If the edit doesn't want the return, do nothing */
    2576             if(!(es->style & ES_WANTRETURN))
    2577                 break;
     2576            /* If the edit doesn't want the return, do nothing */
     2577            if(!(es->style & ES_WANTRETURN))
     2578                break;
    25782579        case '\n':
    25792580                if (es->style & ES_MULTILINE) {
     
    25892590                        EDIT_EM_ReplaceSel(hwnd, es, TRUE, "\t");
    25902591                break;
    2591         case VK_BACK:
    2592                 if (!(es->style & ES_READONLY) && !control) {
    2593                         if (es->selection_start != es->selection_end)
    2594                                 EDIT_WM_Clear(hwnd, es);
    2595                         else {
    2596                                 /* delete character left of caret */
    2597                                 EDIT_EM_SetSel(hwnd, es, -1, 0, FALSE);
    2598                                 EDIT_MoveBackward(hwnd, es, TRUE);
    2599                                 EDIT_WM_Clear(hwnd, es);
    2600                         }
    2601                 }
    2602                 break;
     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;
    26032604        default:
    26042605                if (!(es->style & ES_READONLY) && ((BYTE)c >= ' ') && (c != 127)) {
     
    27212722/*********************************************************************
    27222723 *
    2723  *      WM_CREATE
     2724 *      WM_CREATE
    27242725 *
    27252726 */
     
    27272728{
    27282729       /*
    2729         *       To initialize some final structure members, we call some helper
    2730         *       functions.  However, since the EDITSTATE is not consistent (i.e.
    2731         *       not fully initialized), we should be very careful which
    2732         *       functions can be called, and in what order.
     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.
    27332734        */
    27342735        EDIT_WM_SetFont(hwnd, es, 0, FALSE);
    27352736        EDIT_EM_EmptyUndoBuffer(hwnd, es);
    27362737       if (cs->lpszName && *(cs->lpszName) != '\0') {
    2737            EDIT_EM_ReplaceSel(hwnd, es, FALSE, cs->lpszName);
    2738            /* if we insert text to the editline, the text scrolls out
     2738           EDIT_EM_ReplaceSel(hwnd, es, FALSE, cs->lpszName);
     2739           /* if we insert text to the editline, the text scrolls out
    27392740            * of the window, as the caret is placed after the insert
    27402741            * pos normally; thus we reset es->selection... to 0 and
    27412742            * update caret
    27422743            */
    2743            es->selection_start = es->selection_end = 0;
    2744            EDIT_EM_ScrollCaret(hwnd, es);
     2744           es->selection_start = es->selection_end = 0;
     2745           EDIT_EM_ScrollCaret(hwnd, es);
    27452746       }
    27462747       return 0;
     
    28712872                es->flags &= ~EF_HSCROLL_TRACK;
    28722873                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);
    28742875                break;
    28752876        case SB_ENDSCROLL:
     
    29402941                if (!(dx = pos - es->x_offset)) {
    29412942                        SetScrollPos(hwnd, SB_HORZ, pos, TRUE);
    2942                         EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL, "EN_HSCROLL");
     2943                        EDIT_NOTIFY_PARENT(hwnd, EN_HSCROLL);
    29432944                }
    29442945                break;
     
    31003101                        EDIT_WM_Copy(hwnd, es);
    31013102                break;
    3102         case VK_RETURN:
    3103             /* If the edit doesn't want the return send a message to the default object */
    3104             if(!(es->style & ES_WANTRETURN))
    3105             {
    3106                 HWND hwndParent = GetParent(hwnd);
    3107                 DWORD dw = SendMessageA( hwndParent, DM_GETDEFID, 0, 0 );
    3108                 if (HIWORD(dw) == DC_HASDEFID)
    3109                 {
    3110                     SendMessageA( hwndParent, WM_COMMAND,
    3111                                   MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
    3112                               (LPARAM)GetDlgItem( hwndParent, LOWORD(dw) ) );
    3113                 }
    3114             }
    3115             break;
     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;
    31163117        }
    31173118        return 0;
     
    31303131        if(!(es->style & ES_NOHIDESEL))
    31313132                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);
    31333134        return 0;
    31343135}
     
    32313232        EDIT_EM_SetSel(hwnd, es, es->selection_start, e, after_wrap);
    32323233
    3233         return 1; //SvL: Bugfix -> PMWINDOW expects non-zero return value if
     3234        return 1; //SvL: Bugfix -> PMWINDOW expects non-zero return value if
    32343235                  //               we want to restore the default mouse cursor
    32353236}
     
    33443345
    33453346        if (es->flags & EF_UPDATE)
    3346                 EDIT_NOTIFY_PARENT(hwnd, EN_UPDATE, "EN_UPDATE");
     3347                EDIT_NOTIFY_PARENT(hwnd, EN_UPDATE);
    33473348
    33483349        if (!wParam)
     
    34193420        if (es->flags & EF_UPDATE) {
    34203421                es->flags &= ~EF_UPDATE;
    3421                 EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE, "EN_CHANGE");
     3422                EDIT_NOTIFY_PARENT(hwnd, EN_CHANGE);
    34223423        }
    34233424}
     
    34593460                EDIT_InvalidateText(hwnd, es, es->selection_start, es->selection_end);
    34603461        ShowCaret(hwnd);
    3461         EDIT_NOTIFY_PARENT(hwnd, EN_SETFOCUS, "EN_SETFOCUS");
     3462        EDIT_NOTIFY_PARENT(hwnd, EN_SETFOCUS);
    34623463}
    34633464
     
    34973498                EDIT_EM_SetMargins(hwnd, es, EC_LEFTMARGIN | EC_RIGHTMARGIN,
    34983499                                   EC_USEFONTINFO, EC_USEFONTINFO);
    3499         /* Force the recalculation of the format rect for each font change */
    3500         GetClientRect(hwnd, &r);
    3501         EDIT_SetRectNP(hwnd, es, &r);
     3500        /* Force the recalculation of the format rect for each font change */
     3501        GetClientRect(hwnd, &r);
     3502        EDIT_SetRectNP(hwnd, es, &r);
    35023503        if (es->style & ES_MULTILINE)
    35033504                EDIT_BuildLineDefs_ML(hwnd, es);
     
    36433644                es->flags &= ~EF_VSCROLL_TRACK;
    36443645                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);
    36463647                break;
    36473648        case SB_ENDSCROLL:
     
    36993700                if (!(dy = pos - es->y_offset)) {
    37003701                        SetScrollPos(hwnd, SB_VERT, pos, TRUE);
    3701                         EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL, "EN_VSCROLL");
     3702                        EDIT_NOTIFY_PARENT(hwnd, EN_VSCROLL);
    37023703                }
    37033704                break;
  • trunk/src/user32/pmframe.cpp

    r1704 r1705  
    1 /* $Id: pmframe.cpp,v 1.23 1999-11-11 13:17:30 sandervl Exp $ */
     1/* $Id: pmframe.cpp,v 1.24 1999-11-11 17:13:45 cbratschi Exp $ */
    22/*
    33 * Win32 Frame Managment Code for OS/2
     
    643643    {
    644644      WinSetParent(win32wnd->getHorzScrollHandle(),fShow ? win32wnd->getOS2FrameWindowHandle():HWND_OBJECT,FALSE);
    645       updateFlags = FCF_HORZSCROLL;
     645      updateFlags |= FCF_HORZSCROLL;
    646646    }
    647647  }
Note: See TracChangeset for help on using the changeset viewer.