Changeset 221 for trunk/src


Ignore:
Timestamp:
Jun 26, 1999, 5:29:11 PM (26 years ago)
Author:
achimha
Message:

Fix for DrawEdge

File:
1 edited

Legend:

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

    r161 r221  
    1 /* $Id: uitools.cpp,v 1.2 1999-06-23 16:36:56 achimha Exp $ */
     1/* $Id: uitools.cpp,v 1.3 1999-06-26 15:29:11 achimha Exp $ */
    22/*
    33 * User Interface Functions
     
    66 * Copyright 1997 Bertho A. Stultiens
    77 * Copyright 1999 Achim Hasenmueller
     8 * Copyright 1999 Christoph Bratschi
    89 */
    910
     
    100101 * See also comments with UITOOLS_DrawRectEdge()
    101102 */
    102 static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc, 
    103                                      UINT uType, UINT uFlags)
     103static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
     104                                     UINT uType, UINT uFlags)
    104105{
    105106    POINT Points[4];
     
    119120            + (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
    120121
     122    if (IsRectEmpty(rc)) return retval; //nothing to do
     123
    121124    /* Init some vars */
    122125    OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN);
    123126    SavePen = (HPEN)SelectObject(hdc, InnerPen);
    124127    spx = spy = epx = epy = 0; /* Satisfy the compiler... */
    125    
     128
    126129    /* Determine the colors of the edges */
    127130    if(uFlags & BF_MONO)
     
    184187        epy = rc->bottom;
    185188        spy = epy - SmallDiam;
     189        epx++;
     190        epy--;
    186191        break;
    187192
     
    193198        epy = rc->top-1;
    194199        spy = epy + SmallDiam;
     200        epx++;
     201        epy++;
    195202        break;
    196203
     
    210217        spy = rc->bottom-1;
    211218        epy = spy - SmallDiam;
     219        epx--;
     220        epy++;
    212221        break;
    213222    }
     
    312321        HBRUSH hbsave;
    313322        HBRUSH hb = GetSysColorBrush(uFlags & BF_MONO ? COLOR_WINDOW
    314                                         :COLOR_BTNFACE);
     323                                        :COLOR_BTNFACE);
    315324        HPEN hpsave;
    316325        HPEN hp = GetSysColorPen(uFlags & BF_MONO ? COLOR_WINDOW
    317                                      : COLOR_BTNFACE);
     326                                     : COLOR_BTNFACE);
    318327        hbsave = (HBRUSH)SelectObject(hdc, hb);
    319328        hpsave = (HPEN)SelectObject(hdc, hp);
     
    345354 *
    346355 * 23-Nov-1997: Changed by Bertho Stultiens
     356 * 25-June-1999: Changed by Christoph Bratschi
     357 *
     358 * Attention: only draw in the rect's range!
     359 *   left to right-1
     360 *   top to bottom-1
    347361 *
    348362 * Well, I started testing this and found out that there are a few things
     
    413427
    414428
    415 static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc, 
    416                                      UINT uType, UINT uFlags)
     429static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
     430                                     UINT uType, UINT uFlags)
    417431{
    418432    char LTInnerI, LTOuterI;
     
    430444                       || (uType & BDR_OUTER) == BDR_OUTER)
    431445                      && !(uFlags & (BF_FLAT|BF_MONO)) );
    432        
     446
     447    if  (IsRectEmpty(rc)) return retval; //nothing to do
     448
    433449    /* Init some vars */
    434450    LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
     
    473489    if((uFlags & BF_MIDDLE) && retval)
    474490    {
    475         FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ? 
    476                                             COLOR_WINDOW : COLOR_BTNFACE));
     491        FillRect(hdc, &InnerRect, GetSysColorBrush(uFlags & BF_MONO ?
     492                                            COLOR_WINDOW : COLOR_BTNFACE));
    477493    }
    478494
     
    484500    {
    485501        MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
    486         LineTo(hdc, InnerRect.right, InnerRect.top);
     502        LineTo(hdc, InnerRect.right-1, InnerRect.top);
    487503    }
    488504    if(uFlags & BF_LEFT)
    489505    {
    490506        MoveToEx(hdc, InnerRect.left, InnerRect.top, NULL);
    491         LineTo(hdc, InnerRect.left, InnerRect.bottom);
    492     }
     507        LineTo(hdc, InnerRect.left, InnerRect.bottom-1);
     508    }
     509
    493510    SelectObject(hdc, RBOuterPen);
    494511    if(uFlags & BF_BOTTOM)
    495512    {
    496513        MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
    497         LineTo(hdc, InnerRect.left-1, InnerRect.bottom-1);
     514        LineTo(hdc, InnerRect.left, InnerRect.bottom-1);
    498515    }
    499516    if(uFlags & BF_RIGHT)
    500517    {
    501518        MoveToEx(hdc, InnerRect.right-1, InnerRect.bottom-1, NULL);
    502         LineTo(hdc, InnerRect.right-1, InnerRect.top-1);
     519        LineTo(hdc, InnerRect.right-1, InnerRect.top);
    503520    }
    504521
     
    508525    {
    509526        MoveToEx(hdc, InnerRect.left+LTpenplus, InnerRect.top+1, NULL);
    510         LineTo(hdc, InnerRect.right-RTpenplus, InnerRect.top+1);
     527        LineTo(hdc, InnerRect.right-RTpenplus-1, InnerRect.top+1);
    511528    }
    512529    if(uFlags & BF_LEFT)
    513530    {
    514531        MoveToEx(hdc, InnerRect.left+1, InnerRect.top+LTpenplus, NULL);
    515         LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus);
     532        LineTo(hdc, InnerRect.left+1, InnerRect.bottom-LBpenplus-1);
    516533    }
    517534    SelectObject(hdc, RBInnerPen);
     
    519536    {
    520537        MoveToEx(hdc, InnerRect.right-1-RBpenplus, InnerRect.bottom-2, NULL);
    521         LineTo(hdc, InnerRect.left-1+LBpenplus, InnerRect.bottom-2);
     538        LineTo(hdc, InnerRect.left+LBpenplus, InnerRect.bottom-2);
    522539    }
    523540    if(uFlags & BF_RIGHT)
    524541    {
    525542        MoveToEx(hdc, InnerRect.right-2, InnerRect.bottom-1-RBpenplus, NULL);
    526         LineTo(hdc, InnerRect.right-2, InnerRect.top-1+RTpenplus);
     543        LineTo(hdc, InnerRect.right-2, InnerRect.top+RTpenplus);
    527544    }
    528545
     
    551568{
    552569
    553     if(flags & BF_DIAGONAL)
     570    if (flags & BF_DIAGONAL)
    554571      return UITOOLS95_DrawDiagEdge(hdc, rc, edge, flags);
    555572    else
     
    558575
    559576/************************************************************************
    560  *      UITOOLS_MakeSquareRect
     577 *      UITOOLS_MakeSquareRect
    561578 *
    562579 * Utility to create a square rectangle and returning the width
     
    587604
    588605/************************************************************************
    589  *      UITOOLS_DFC_ButtonPush
     606 *      UITOOLS_DFC_ButtonPush
    590607 *
    591608 * Draw a push button coming from DrawFrameControl()
     
    657674
    658675/************************************************************************
    659  *      UITOOLS_DFC_ButtonChcek
     676 *      UITOOLS_DFC_ButtonChcek
    660677 *
    661678 * Draw a check/3state button coming from DrawFrameControl()
     
    767784
    768785/************************************************************************
    769  *      UITOOLS_DFC_ButtonRadio
     786 *      UITOOLS_DFC_ButtonRadio
    770787 *
    771788 * Draw a radio/radioimage/radiomask button coming from DrawFrameControl()
     
    13401357    if(GetMapMode(hdc) != MM_TEXT)
    13411358        return FALSE;
    1342        
     1359
    13431360    switch(uType)
    13441361    {
     
    13531370//    default:
    13541371//      WARN("(%x,%p,%d,%x), bad type!\n",
    1355 //         hdc,rc,uType,uState );
     1372//         hdc,rc,uType,uState );
    13561373    }
    13571374    return FALSE;
Note: See TracChangeset for help on using the changeset viewer.