Ignore:
Timestamp:
Aug 17, 2002, 12:33:54 PM (23 years ago)
Author:
sandervl
Message:

YD: Merged latest Rewind edit control code

File:
1 edited

Legend:

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

    r8814 r9023  
    1 /* $Id: edit.cpp,v 1.45 2002-07-01 14:07:22 sandervl Exp $ */
     1/* $Id: edit.cpp,v 1.46 2002-08-17 10:33:54 sandervl Exp $ */
    22/*
    33 *      Edit control
     
    188188static void     EDIT_MoveWordForward(HWND hwnd, EDITSTATE *es, BOOL extend);
    189189static void     EDIT_PaintLine(HWND hwnd, EDITSTATE *es, HDC hdc, INT line, BOOL rev);
    190 static VOID     EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev);
     190static INT      EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC hdc, INT x, INT y, INT line, INT col, INT count, BOOL rev);
    191191static void     EDIT_SetCaretPos(HWND hwnd, EDITSTATE *es, INT pos, BOOL after_wrap);
    192192static void     EDIT_SetRectNP(HWND hwnd, EDITSTATE *es, LPRECT lprc);
     
    725725                 */
    726726                //DPRINTF_EDIT_MSG32("WM_MOUSEACTIVATE");
     727                SetFocus(hwnd);
    727728                result = MA_ACTIVATE;
    728729                break;
     
    16611662        e = MIN(li + ll, MAX(li, e));
    16621663
     1664        if (rev && (s != e) &&
     1665                        ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) {
     1666                x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, s - li, FALSE);
     1667                x += EDIT_PaintText(hwnd, es, dc, x, y, line, s - li, e - s, TRUE);
     1668                x += EDIT_PaintText(hwnd, es, dc, x, y, line, e - li, li + ll - e, FALSE);
     1669        } else
     1670                x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, ll, FALSE);
     1671#if 0
    16631672        if (rev && (s != e) && ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL)))
    16641673        {
     
    17181727          }
    17191728        } else  EDIT_PaintText(hwnd, es, dc, x, y, line, 0, ll, FALSE);
     1729#endif // 0
    17201730}
    17211731
     
    17261736 *
    17271737 */
    1728 static VOID EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)
     1738static INT EDIT_PaintText(HWND hwnd, EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col, INT count, BOOL rev)
    17291739{
    17301740        COLORREF BkColor;
    17311741        COLORREF TextColor;
    1732         INT li;
     1742        INT ret;
     1743        INT li;
     1744        INT BkMode;
     1745        SIZE size;
    17331746
    17341747        if (!count)
    1735                 return;
     1748                return 0;
     1749        BkMode = GetBkMode(dc);
    17361750        BkColor = GetBkColor(dc);
    17371751        TextColor = GetTextColor(dc);
     
    17401754                SetBkColor(dc, GetSysColor(COLOR_HIGHLIGHT));
    17411755                SetTextColor(dc, GetSysColor(COLOR_HIGHLIGHTTEXT));
     1756                SetBkMode( dc, OPAQUE);
    17421757        }
    17431758        li = EDIT_EM_LineIndex(hwnd, es, line);
    17441759        if (es->style & ES_MULTILINE)
    17451760        {
    1746                 TabbedTextOutA(dc, x, y, es->text + li + col, count,
    1747                                es->tabs_count, es->tabs, es->format_rect.left - es->x_offset);
     1761                //TabbedTextOutA(dc, x, y, es->text + li + col, count,
     1762                //               es->tabs_count, es->tabs, es->format_rect.left - es->x_offset);
     1763                ret = (INT)LOWORD(TabbedTextOutA(dc, x, y, (LPCSTR) (es->text + li + col), count,
     1764                                        es->tabs_count, es->tabs, es->format_rect.left - es->x_offset));
    17481765        } else
    17491766        {
     
    17521769
    17531770          TextOutA(dc,x,y,text+li+col,count);
     1771                GetTextExtentPoint32A(dc, text + li + col, count, &size);
     1772                ret = size.cx;
    17541773          if (es->style & ES_PASSWORD)
    17551774            HeapFree(es->heap, 0, text);
     
    17591778                SetBkColor(dc, BkColor);
    17601779                SetTextColor(dc, TextColor);
    1761         }
     1780                SetBkMode( dc, BkMode);
     1781        }
     1782        return ret;
    17621783}
    17631784
     
    32523273         */
    32533274        FillRect(dc, &rc, brush);
    3254 
    3255         ShowCaret(hwnd);
    3256 
    32573275        return -1;
    32583276}
     
    36483666
    36493667        if (!(es->flags & EF_FOCUSED))
    3650           SetFocus(hwnd);
     3668          return 0;
    36513669
    36523670        es->bCaptureState = TRUE;
     
    39363954static void EDIT_WM_Paint(HWND hwnd, EDITSTATE *es,WPARAM wParam)
    39373955{
    3938   PAINTSTRUCT ps;
    3939   HDC hdc;
    3940 
    3941   if (!wParam) hdc = BeginPaint(hwnd, &ps);
    3942   else hdc = (HDC) wParam;
    3943 
    3944   EDIT_Draw(hwnd,es,hdc,FALSE);
    3945 
    3946   if (!wParam) EndPaint(hwnd, &ps);
     3956        PAINTSTRUCT ps;
     3957        INT i;
     3958        HDC dc;
     3959        HFONT old_font = 0;
     3960        RECT rc;
     3961        RECT rcLine;
     3962        RECT rcRgn;
     3963        BOOL rev = es->bEnableState &&
     3964                                ((es->flags & EF_FOCUSED) ||
     3965                                        (es->style & ES_NOHIDESEL));
     3966        if (!wParam)
     3967            dc = BeginPaint(hwnd, &ps);
     3968        else
     3969            dc = (HDC) wParam;
     3970        if(es->style & WS_BORDER) {
     3971                GetClientRect(hwnd, &rc);
     3972                if(es->style & ES_MULTILINE) {
     3973                        if(es->style & WS_HSCROLL) rc.bottom++;
     3974                        if(es->style & WS_VSCROLL) rc.right++;
     3975                }
     3976                Rectangle(dc, rc.left, rc.top, rc.right, rc.bottom);
     3977        }
     3978        IntersectClipRect(dc, es->format_rect.left,
     3979                                es->format_rect.top,
     3980                                es->format_rect.right,
     3981                                es->format_rect.bottom);
     3982        if (es->style & ES_MULTILINE) {
     3983                GetClientRect(hwnd, &rc);
     3984                IntersectClipRect(dc, rc.left, rc.top, rc.right, rc.bottom);
     3985        }
     3986        if (es->font)
     3987                old_font = SelectObject(dc, es->font);
     3988        if (!es->bEnableState || (es->style & ES_READONLY))
     3989                EDIT_SEND_CTLCOLORSTATIC(hwnd, dc);
     3990        else
     3991                EDIT_SEND_CTLCOLOR(hwnd, dc);
     3992
     3993        if (!es->bEnableState)
     3994                SetTextColor(dc, GetSysColor(COLOR_GRAYTEXT));
     3995        GetClipBox(dc, &rcRgn);
     3996        if (es->style & ES_MULTILINE) {
     3997                INT vlc = (es->format_rect.bottom - es->format_rect.top) / es->line_height;
     3998                for (i = es->y_offset ; i <= min(es->y_offset + vlc, es->y_offset + es->line_count - 1) ; i++) {
     3999                        EDIT_GetLineRect(hwnd, dc, es, i, 0, -1, &rcLine);
     4000                        if (IntersectRect(&rc, &rcRgn, &rcLine))
     4001                                EDIT_PaintLine(hwnd, es, dc, i, rev);
     4002                }
     4003        } else {
     4004                EDIT_GetLineRect(hwnd, dc, es, 0, 0, -1, &rcLine);
     4005                if (IntersectRect(&rc, &rcRgn, &rcLine))
     4006                        EDIT_PaintLine(hwnd, es, dc, 0, rev);
     4007        }
     4008        if (es->font)
     4009                SelectObject(dc, old_font);
     4010
     4011        if (!wParam)
     4012            EndPaint(hwnd, &ps);
    39474013}
    39484014
     
    39574023        HGLOBAL hsrc;
    39584024        LPSTR src;
     4025
     4026        /* Protect read-only edit control from modification */
     4027        if(es->style & ES_READONLY)
     4028            return;
    39594029
    39604030        OpenClipboard(hwnd);
Note: See TracChangeset for help on using the changeset viewer.