Ignore:
Timestamp:
Dec 2, 1999, 5:34:43 PM (26 years ago)
Author:
cbratschi
Message:

Show/HideCaret fix, removed TextOut workaround

File:
1 edited

Legend:

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

    r1922 r1944  
    1 /* $Id: edit.cpp,v 1.20 1999-12-01 18:23:27 cbratschi Exp $ */
     1/* $Id: edit.cpp,v 1.21 1999-12-02 16:34:43 cbratschi Exp $ */
    22/*
    33 *      Edit control
     
    2121    new in Win98, Win2k: for single line too
    2222  - WinNT/Win2k: higher size limits (single: 0x7FFFFFFE, multi: none)
    23   - problems with OS/2 PM font kerning:
    24     TabbedTextOutA
    25     GetTextExtentPoint32A
    26     WINE code uses relative positions -> rewrite to absolute!
     23  - problems with selection update: perhaps an Open32 bug
     24    TextOutA: draws at wrong position
     25    I've removed the workarounds, it makes no sense to fix GDI32 bugs here
     26    -> rewrite TextOut and TabbedTextOut
    2727*/
    2828
     
    10321032                rc->top = es->format_rect.top;
    10331033        rc->bottom = rc->top + es->line_height;
     1034
    10341035        rc->left = (scol == 0) ? es->format_rect.left : SLOWORD(EDIT_EM_PosFromChar(hwnd, es, line_index + scol, TRUE));
    10351036        rc->right = (ecol == -1) ? es->format_rect.right : SLOWORD(EDIT_EM_PosFromChar(hwnd, es, line_index + ecol, TRUE))+1;
     
    10991100
    11001101        EDIT_GetLineRect(hwnd, es, 0, start, end, &line_rect);
    1101 
    1102         //CB: fix 1 pixel vertical line bug
    1103         line_rect.left--;
    1104         line_rect.right++;
    11051102
    11061103        if (IntersectRect(&rc, &line_rect, &es->format_rect))
     
    11521149        if (sl == el) {
    11531150                EDIT_GetLineRect(hwnd, es, sl, sc, ec, &rcLine);
    1154 
    1155                 //CB: fix 1 pixel vertical line bug
    1156                 rcLine.left--;
    1157                 rcLine.right++;
    1158 
    11591151
    11601152                if (IntersectRect(&rcUpdate, &rcWnd, &rcLine))
     
    15821574        s = MIN(li + ll, MAX(li, s));
    15831575        e = MIN(li + ll, MAX(li, e));
     1576
    15841577        if (rev && (s != e) &&
    1585                         ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL))) {
    1586                 x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, s - li, FALSE);
    1587                 x += EDIT_PaintText(hwnd, es, dc, x, y, line, s - li, e - s, TRUE);
    1588                 x += EDIT_PaintText(hwnd, es, dc, x, y, line, e - li, li + ll - e, FALSE);
    1589         } else
    1590                 x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, ll, FALSE);
     1578                        ((es->flags & EF_FOCUSED) || (es->style & ES_NOHIDESEL)))
     1579        {
     1580          x += EDIT_PaintText(hwnd, es, dc, x, y, line, 0, s - li, FALSE);
     1581          x += EDIT_PaintText(hwnd, es, dc, x, y, line, s - li, e - s, TRUE);
     1582          x += EDIT_PaintText(hwnd, es, dc, x, y, line, e - li, li + ll - e, FALSE);
     1583        } else EDIT_PaintText(hwnd, es, dc, x, y, line, 0, ll, FALSE);
    15911584}
    15921585
     
    16031596        INT ret;
    16041597        INT li;
    1605         SIZE size;
    16061598
    16071599        if (!count)
     
    16171609                ret = (INT)LOWORD(TabbedTextOutA(dc, x, y, es->text + li + col, count,
    16181610                                        es->tabs_count, es->tabs, es->format_rect.left - es->x_offset));
    1619         } else {
    1620                 LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
    1621                 TextOutA(dc, x, y, text + li + col, count);
    1622                 GetTextExtentPoint32A(dc, text + li + col, count, &size);
    1623                 ret = size.cx;
    1624                 if (es->style & ES_PASSWORD)
    1625                         HeapFree(es->heap, 0, text);
     1611        } else
     1612        {
     1613          LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
     1614          POINT pt;
     1615          UINT oldAlign = GetTextAlign(dc);
     1616
     1617          MoveToEx(dc,x,y,NULL);
     1618          SetTextAlign(dc,(oldAlign & ~TA_NOUPDATECP) | TA_UPDATECP);
     1619
     1620          TextOutA(dc,x,y,text+li+col,count);
     1621          GetCurrentPositionEx(dc,&pt);
     1622          SetTextAlign(dc,oldAlign);
     1623          ret = pt.x-x;
     1624          if (es->style & ES_PASSWORD)
     1625            HeapFree(es->heap, 0, text);
    16261626        }
    16271627        if (rev) {
     
    21972197                x = LOWORD(GetTabbedTextExtentA(dc, es->text + li, index - li,
    21982198                                es->tabs_count, es->tabs)) - es->x_offset;
    2199         } else {
    2200                 LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
    2201                 if (index < es->x_offset) {
    2202                         GetTextExtentPoint32A(dc, text + index,
    2203                                         es->x_offset - index, &size);
    2204                         x = -size.cx;
    2205                 } else {
    2206                         GetTextExtentPoint32A(dc, text + es->x_offset,
    2207                                         index - es->x_offset, &size);
    2208                          x = size.cx;
    2209                 }
    2210                 y = 0;
    2211                 if (es->style & ES_PASSWORD)
    2212                         HeapFree(es->heap, 0 ,text);
     2199        } else
     2200        {
     2201          LPSTR text = EDIT_GetPasswordPointer_SL(hwnd, es);
     2202
     2203          GetTextExtentPoint32A(dc,text,index,&size);
     2204          x = size.cx;
     2205          if (es->x_offset)
     2206          {
     2207            GetTextExtentPoint32A(dc,text,es->x_offset,&size);
     2208            x -= size.cx;
     2209          }
     2210          y = 0;
     2211          if (es->style & ES_PASSWORD)
     2212            HeapFree(es->heap, 0 ,text);
    22132213        }
    22142214        x += es->format_rect.left;
     
    37783778        if (!GetTextMetricsA(dc, &tm))
    37793779        {
    3780           SelectObject(dc,old_font);
     3780          if (font) SelectObject(dc,old_font);
    37813781          ReleaseDC(hwnd,dc);
    37823782
Note: See TracChangeset for help on using the changeset viewer.