Ignore:
Timestamp:
Sep 7, 2000, 8:16:52 PM (25 years ago)
Author:
sandervl
Message:

toolbar fixes (MFC assertions failed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/toolbar.cpp

    r3970 r4204  
    1 /* $Id: toolbar.cpp,v 1.10 2000-08-08 17:05:00 cbratschi Exp $ */
     1/* $Id: toolbar.cpp,v 1.11 2000-09-07 18:16:52 sandervl Exp $ */
    22/*
    33 * Toolbar control
     
    29972997    if (((INT)LOWORD(lParam) <= 0) || ((INT)HIWORD(lParam) <= 0)) return FALSE;
    29982998
     2999//SvL: Old code causes assertion failures in MFC apps; this is from the latest
     3000//     Wine sources
     3001#if 1
     3002    if (infoPtr->nNumButtons > 0)
     3003        dprintf(("TOOLBAR_SetBitmapSize: %d buttons, undoc increase to bitmap size : %d-%d -> %d-%d\n",
     3004             infoPtr->nNumButtons,
     3005             infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
     3006             LOWORD(lParam), HIWORD(lParam)));
     3007#else
    29993008    /* Bitmap size can only be set before adding any button to the toolbar
    30003009       according to the documentation.  */
    30013010    if( infoPtr->nNumButtons != 0 )
    30023011        return FALSE;
     3012#endif
    30033013
    30043014    infoPtr->nBitmapWidth = (INT)LOWORD(lParam);
     
    31113121    if (((INT)LOWORD(lParam) <= 0) || ((INT)HIWORD(lParam) <= 0)) return FALSE;
    31123122
     3123#if 1
     3124    //SvL: Same for MFC apps (assertion failed when returning FALSE
     3125    /* Button size can only be set before adding any button to the toolbar
     3126       according to the documentation.  */
     3127    /* this appears to be wrong. WINZIP32.EXE (ver 8) calls this on
     3128       one of its buttons after adding it to the toolbar, and it
     3129       checks that the return value is nonzero - mjm */
     3130    if( infoPtr->nNumButtons != 0 )
     3131    {
     3132        dprintf(("TOOLBAR_SetButtonSize: Button size set after button in toolbar\n"));
     3133        return TRUE;
     3134    }
     3135#else
    31133136    /* Button size can only be set before adding any button to the toolbar
    31143137       according to the documentation.  */
    31153138    if( infoPtr->nNumButtons != 0 )
    31163139        return FALSE;
     3140#endif
    31173141
    31183142    infoPtr->nButtonWidth = (INT)LOWORD(lParam);
     
    39073931        y = parent_rect.top;
    39083932
     3933//SvL: Latest Wine
     3934#if 1
     3935    RECT window_rect;
     3936        if (dwStyle & CCS_NORESIZE) {
     3937            uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE);
     3938
     3939            /*
     3940             * this sets the working width of the toolbar, and
     3941             * Calc Toolbar will not adjust it, only the height
     3942             */
     3943            infoPtr->nWidth = parent_rect.right - parent_rect.left;
     3944            cy = infoPtr->nHeight;
     3945            cx = infoPtr->nWidth;
     3946            TOOLBAR_CalcToolbar (hwnd);
     3947            infoPtr->nWidth = cx;
     3948            infoPtr->nHeight = cy;
     3949        }
     3950        else {
     3951            infoPtr->nWidth = parent_rect.right - parent_rect.left;
     3952            TOOLBAR_CalcToolbar (hwnd);
     3953            cy = infoPtr->nHeight;
     3954            cx = infoPtr->nWidth;
     3955
     3956            if (dwStyle & CCS_NOMOVEY) {
     3957                GetWindowRect(hwnd, &window_rect);
     3958                ScreenToClient(parent, (LPPOINT)&window_rect.left);
     3959                y = window_rect.top;
     3960            }
     3961        }
     3962#else
    39093963        if (dwStyle & CCS_NORESIZE) {
    39103964            uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE);
     
    39233977            cx = infoPtr->nWidth;
    39243978        }
    3925 
     3979#endif
    39263980        if (dwStyle & CCS_NOPARENTALIGN) {
    39273981            uPosFlags |= SWP_NOMOVE;
Note: See TracChangeset for help on using the changeset viewer.