Changeset 12530


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

Show/HideCaret fix, removed TextOut workaround

Location:
tags/trunk/src/user32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/user32/button.cpp

    r12414 r12530  
    1 /* $Id: button.cpp,v 1.20 1999-11-24 18:21:34 cbratschi Exp $ */
     1/* $Id: button.cpp,v 1.21 1999-12-02 16:34:42 cbratschi Exp $ */
    22/* File: button.cpp -- Button type widgets
    33 *
     
    10211021    parent = GetParent(hwnd);
    10221022    /* assure that starting control is not disabled or invisible */
    1023     start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
     1023    //start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );
    10241024    //@YD: bugfix
    10251025    //CB: doesn't work!
    1026     //start = sibling = GetNextDlgGroupItem( parent, hwnd, FALSE );
     1026    start = sibling = GetNextDlgGroupItem( parent, hwnd, FALSE );
    10271027    do
    10281028    {
  • TabularUnified tags/trunk/src/user32/caret.cpp

    r12034 r12530  
    1 /* $Id: caret.cpp,v 1.7 1999-10-25 20:17:16 sandervl Exp $ */
     1/* $Id: caret.cpp,v 1.8 1999-12-02 16:34:43 cbratschi Exp $ */
    22
    33/*
     
    3737static int CaretWidth, CaretHeight;
    3838static int CaretPosX, CaretPosY;
    39 static BOOL CaretIsVisible;
     39static INT CaretIsVisible; //visible if > 0
    4040
    4141#pragma data_seg()
     
    6262       if (rc)
    6363       {
    64            hwndCaret   = hwnd;
    65            hbmCaret    = hBmp;
    66            CaretWidth  = width;
    67            CaretHeight = height;
     64           hwndCaret      = hwnd;
     65           hbmCaret       = hBmp;
     66           CaretWidth     = width;
     67           CaretHeight    = height;
     68           CaretIsVisible = 0;
    6869       }
    6970
     
    8384   CaretWidth     = 0;
    8485   CaretHeight    = 0;
    85    CaretIsVisible = FALSE;
     86   CaretIsVisible = 0;
    8687
    8788   rc = _DestroyCaret();
     
    218219   dprintf(("USER32:  ShowCaret %x", hwnd));
    219220
    220    CaretIsVisible = TRUE;
    221    rc = _ShowCaret (Win32BaseWindow::Win32ToOS2Handle (hwnd));
     221   CaretIsVisible++;
     222   if (CaretIsVisible == 1)
     223     rc = _ShowCaret (Win32BaseWindow::Win32ToOS2Handle (hwnd));
     224   else
     225     rc = TRUE;
    222226
    223227   return (rc);
     
    230234   dprintf(("USER32:  HideCaret"));
    231235
    232    CaretIsVisible = FALSE;
    233    rc = _HideCaret (Win32BaseWindow::Win32ToOS2Handle (hwnd));
     236   CaretIsVisible--;
     237   if (CaretIsVisible == 0)
     238     rc = _HideCaret (Win32BaseWindow::Win32ToOS2Handle (hwnd));
     239   else
     240     rc = TRUE;
    234241
    235242   return (rc);
     
    239246{
    240247   CURSORINFO cursorInfo;
     248   INT x;
    241249
    242250   if ((hwndFocus != 0) && (hwndCaret == hwndFocus) &&
     
    247255      CreateCaret (hwndCaret, hbmCaret, CaretWidth, CaretHeight);
    248256      SetCaretPos (CaretPosX, CaretPosY);
    249       if (CaretIsVisible)
    250          ShowCaret (hwndCaret);
    251    }
    252 }
     257      if (CaretIsVisible > 0)
     258        _ShowCaret(Win32BaseWindow::Win32ToOS2Handle(hwndCaret));
     259   }
     260}
  • TabularUnified tags/trunk/src/user32/edit.cpp

    r12508 r12530  
    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.