Ignore:
Timestamp:
Sep 5, 2001, 2:05:03 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/rebar.c

    r6380 r6644  
     1/* $Id: rebar.c,v 1.16 2001-09-05 12:05:01 bird Exp $ */
    12/*
    23 *
     
    2122 *   - vertical placement
    2223 *   - ComboBox and ComboBoxEx placement
    23  *   - center image 
     24 *   - center image
    2425 *   - Layout code.
    2526 *   - Display code.
     
    3031 *  rev 2,3,4
    3132 *   - Implement initial version of row grouping, row separators,
    32  *     text and background colors. Support additional messages. 
     33 *     text and background colors. Support additional messages.
    3334 *     Support RBBS_BREAK. Implement ERASEBKGND and improve painting.
    3435 *  rev 5
    3536 *   - implement support for dragging Gripper left or right in a row. Supports
    36  *     WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support 
     37 *     WM_LBUTTONDOWN, WM_LBUTTONUP, and WM_MOUSEMOVE. Also support
    3738 *     RBS_BANDBORDERS.
    3839 *  rev 6
     
    6263 * 12. Correct drawing of rebar borders and handling of RBS_BORDERS.
    6364 * rev 7d
    64  * 13. Support WM_NOTIFYFORMAT (both incoming and outgoing) and do 
     65 * 13. Support WM_NOTIFYFORMAT (both incoming and outgoing) and do
    6566 *     WM_NOTIFY correctly based on results.
    6667 * 14. Implement WM_SETREDRAW.
    6768 * 15. Native WM_ERASEBKGND draws horz and vert separators between bands and
    68  *     rows, and fills in the background color for each band. The gripper, 
     69 *     rows, and fills in the background color for each band. The gripper,
    6970 *     image, and text for each band is drawn by the WM_PAINT process. Change
    7071 *     this code to match.
     
    9596 *  2. Following still not handled: RBBS_FIXEDBMP, RBBS_CHILDEDGE,
    9697 *            RBBS_USECHEVRON
    97  *  3. Following are only partially handled: 
     98 *  3. Following are only partially handled:
    9899 *            RBS_AUTOSIZE, RBBS_VARIABLEHEIGHT
    99100 *  5. Native uses (on each draw!!) SM_CYBORDER (or SM_CXBORDER for CCS_VERT)
    100  *     to set the size of the separator width (the value SEP_WIDTH_SIZE 
     101 *     to set the size of the separator width (the value SEP_WIDTH_SIZE
    101102 *     in here). Should be fixed!!
    102103 *  6. The following messages are not implemented:
     
    211212    BOOL     NtfUnicode;  /* TRUE if parent wants notify in W format */
    212213    BOOL     DoRedraw;    /* TRUE to acutally draw bands */
    213     UINT     fStatus;     /* Status flags (see below)  */ 
     214    UINT     fStatus;     /* Status flags (see below)  */
    214215    HCURSOR  hcurArrow;   /* handle to the arrow cursor */
    215216    HCURSOR  hcurHorz;    /* handle to the EW cursor */
     
    263264
    264265/* This is the increment that is used over the band height */
    265 /* Determined by experiment.                               */ 
     266/* Determined by experiment.                               */
    266267#define REBARSPACE      4
    267268
     
    274275#define rcBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.bottom : b->rcBand.right)
    275276#define rcBw(b)  ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.bottom - b->rcBand.top) : \
    276                   (b->rcBand.right - b->rcBand.left))
     277          (b->rcBand.right - b->rcBand.left))
    277278#define ircBlt(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.left : b->rcBand.top)
    278279#define ircBrb(b) ((infoPtr->dwStyle & CCS_VERT) ? b->rcBand.right : b->rcBand.bottom)
    279280#define ircBw(b)  ((infoPtr->dwStyle & CCS_VERT) ? (b->rcBand.right - b->rcBand.left) : \
    280                   (b->rcBand.bottom - b->rcBand.top))
     281          (b->rcBand.bottom - b->rcBand.top))
    281282
    282283/*  The following define determines if a given band is hidden      */
     
    338339    *line = 0;
    339340    while (band_stylename[i]) {
    340         if (style & (1<<i)) {
    341             if (*line != 0) strcat(line, " | ");
    342             strcat(line, band_stylename[i]);
    343         }
    344         i++;
     341    if (style & (1<<i)) {
     342        if (*line != 0) strcat(line, " | ");
     343        strcat(line, band_stylename[i]);
     344    }
     345    i++;
    345346    }
    346347    return line;
     
    355356    *line = 0;
    356357    while (band_maskname[i]) {
    357         if (mask & (1<<i)) {
    358             if (*line != 0) strcat(line, " | ");
    359             strcat(line, band_maskname[i]);
    360         }
    361         i++;
     358    if (mask & (1<<i)) {
     359        if (*line != 0) strcat(line, " | ");
     360        strcat(line, band_maskname[i]);
     361    }
     362    i++;
    362363    }
    363364    return line;
     
    370371    if( !TRACE_ON(rebar) ) return;
    371372    TRACE("band info: ID=%u, size=%u, child=%04x, clrF=0x%06lx, clrB=0x%06lx\n",
    372           pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack);
     373      pB->wID, pB->cbSize, pB->hwndChild, pB->clrFore, pB->clrBack);
    373374    TRACE("band info: mask=0x%08x (%s)\n", pB->fMask, REBAR_FmtMask(pB->fMask));
    374375    if (pB->fMask & RBBIM_STYLE)
    375         TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));
     376    TRACE("band info: style=0x%08x (%s)\n", pB->fStyle, REBAR_FmtStyle(pB->fStyle));
    376377    if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_HEADERSIZE | RBBIM_LPARAM )) {
    377         TRACE("band info:");
    378         if (pB->fMask & RBBIM_SIZE)
    379             DPRINTF(" cx=%u", pB->cx);
    380         if (pB->fMask & RBBIM_IDEALSIZE)
    381             DPRINTF(" xIdeal=%u", pB->cxIdeal);
    382         if (pB->fMask & RBBIM_HEADERSIZE)
    383             DPRINTF(" xHeader=%u", pB->cxHeader);
    384         if (pB->fMask & RBBIM_LPARAM)
    385             DPRINTF(" lParam=0x%08lx", pB->lParam);
    386         DPRINTF("\n");
     378    TRACE("band info:");
     379    if (pB->fMask & RBBIM_SIZE)
     380        DPRINTF(" cx=%u", pB->cx);
     381    if (pB->fMask & RBBIM_IDEALSIZE)
     382        DPRINTF(" xIdeal=%u", pB->cxIdeal);
     383    if (pB->fMask & RBBIM_HEADERSIZE)
     384        DPRINTF(" xHeader=%u", pB->cxHeader);
     385    if (pB->fMask & RBBIM_LPARAM)
     386        DPRINTF(" lParam=0x%08lx", pB->lParam);
     387    DPRINTF("\n");
    387388    }
    388389    if (pB->fMask & RBBIM_CHILDSIZE)
    389         TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
    390               pB->cxMinChild,
    391               pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
     390    TRACE("band info: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
     391          pB->cxMinChild,
     392          pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
    392393}
    393394
     
    400401    if(! TRACE_ON(rebar) ) return;
    401402
    402     TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n", 
    403           iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,
    404           iP->calcSize.cx, iP->calcSize.cy);
     403    TRACE("hwnd=%04x: color=%08lx/%08lx, bands=%u, rows=%u, cSize=%ld,%ld\n",
     404      iP->hwndSelf, iP->clrText, iP->clrBk, iP->uNumBands, iP->uNumRows,
     405      iP->calcSize.cx, iP->calcSize.cy);
    405406    TRACE("hwnd=%04x: flags=%08x, dragStart=%d,%d, dragNow=%d,%d, ihitBand=%d\n",
    406           iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,
    407           iP->dragNow.x, iP->dragNow.y,
    408           iP->ihitBand);
     407      iP->hwndSelf, iP->fStatus, iP->dragStart.x, iP->dragStart.y,
     408      iP->dragNow.x, iP->dragNow.y,
     409      iP->ihitBand);
    409410    TRACE("hwnd=%04x: style=%08lx, I'm Unicode=%s, notify in Unicode=%s, redraw=%s\n",
    410           iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",
    411           (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE");
     411      iP->hwndSelf, iP->dwStyle, (iP->bUnicode)?"TRUE":"FALSE",
     412      (iP->NtfUnicode)?"TRUE":"FALSE", (iP->DoRedraw)?"TRUE":"FALSE");
    412413    for (i = 0; i < iP->uNumBands; i++) {
    413         pB = &iP->bands[i];
    414         TRACE("band # %u: ID=%u, child=%04x, row=%u, clrF=0x%06lx, clrB=0x%06lx\n",
    415               i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack);
    416         TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask));
    417         if (pB->fMask & RBBIM_STYLE)
    418             TRACE("band # %u: style=0x%08x (%s)\n",
    419                   i, pB->fStyle, REBAR_FmtStyle(pB->fStyle));
    420         TRACE("band # %u: uMinH=%u xHeader=%u",
    421               i, pB->uMinHeight, pB->cxHeader);
    422         if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) {
    423             if (pB->fMask & RBBIM_SIZE)
    424                 DPRINTF(" cx=%u", pB->cx);
    425             if (pB->fMask & RBBIM_IDEALSIZE)
    426                 DPRINTF(" xIdeal=%u", pB->cxIdeal);
    427             if (pB->fMask & RBBIM_LPARAM)
    428                 DPRINTF(" lParam=0x%08lx", pB->lParam);
    429         }
    430         DPRINTF("\n");
    431         if (RBBIM_CHILDSIZE)
    432             TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
    433                   i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
    434         TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n",
    435               i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy);
    436         TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n",
    437               i, pB->fStatus, pB->fDraw,
    438               pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom,
    439               pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom);
    440         TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n",
    441               i,
    442               pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom,
    443               pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom,
    444               pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom);
     414    pB = &iP->bands[i];
     415    TRACE("band # %u: ID=%u, child=%04x, row=%u, clrF=0x%06lx, clrB=0x%06lx\n",
     416          i, pB->wID, pB->hwndChild, pB->iRow, pB->clrFore, pB->clrBack);
     417    TRACE("band # %u: mask=0x%08x (%s)\n", i, pB->fMask, REBAR_FmtMask(pB->fMask));
     418    if (pB->fMask & RBBIM_STYLE)
     419        TRACE("band # %u: style=0x%08x (%s)\n",
     420          i, pB->fStyle, REBAR_FmtStyle(pB->fStyle));
     421    TRACE("band # %u: uMinH=%u xHeader=%u",
     422          i, pB->uMinHeight, pB->cxHeader);
     423    if (pB->fMask & (RBBIM_SIZE | RBBIM_IDEALSIZE | RBBIM_LPARAM )) {
     424        if (pB->fMask & RBBIM_SIZE)
     425        DPRINTF(" cx=%u", pB->cx);
     426        if (pB->fMask & RBBIM_IDEALSIZE)
     427        DPRINTF(" xIdeal=%u", pB->cxIdeal);
     428        if (pB->fMask & RBBIM_LPARAM)
     429        DPRINTF(" lParam=0x%08lx", pB->lParam);
     430    }
     431    DPRINTF("\n");
     432    if (RBBIM_CHILDSIZE)
     433        TRACE("band # %u: xMin=%u, yMin=%u, yChild=%u, yMax=%u, yIntgl=%u\n",
     434          i, pB->cxMinChild, pB->cyMinChild, pB->cyChild, pB->cyMaxChild, pB->cyIntegral);
     435    TRACE("band # %u: lcx=%u, ccx=%u, hcx=%u, lcy=%u, ccy=%u, hcy=%u, offChild=%ld,%ld\n",
     436          i, pB->lcx, pB->ccx, pB->hcx, pB->lcy, pB->ccy, pB->hcy, pB->offChild.cx, pB->offChild.cy);
     437    TRACE("band # %u: fStatus=%08x, fDraw=%08x, Band=(%d,%d)-(%d,%d), Grip=(%d,%d)-(%d,%d)\n",
     438          i, pB->fStatus, pB->fDraw,
     439          pB->rcBand.left, pB->rcBand.top, pB->rcBand.right, pB->rcBand.bottom,
     440          pB->rcGripper.left, pB->rcGripper.top, pB->rcGripper.right, pB->rcGripper.bottom);
     441    TRACE("band # %u: Img=(%d,%d)-(%d,%d), Txt=(%d,%d)-(%d,%d), Child=(%d,%d)-(%d,%d)\n",
     442          i,
     443          pB->rcCapImage.left, pB->rcCapImage.top, pB->rcCapImage.right, pB->rcCapImage.bottom,
     444          pB->rcCapText.left, pB->rcCapText.top, pB->rcCapText.right, pB->rcCapText.bottom,
     445          pB->rcChild.left, pB->rcChild.top, pB->rcChild.right, pB->rcChild.bottom);
    445446    }
    446447
     
    456457    if (!parent) {
    457458        parent = GetParent (infoPtr->hwndSelf);
    458         owner = GetWindow (infoPtr->hwndSelf, GW_OWNER);
    459         if (owner) parent = owner;
     459    owner = GetWindow (infoPtr->hwndSelf, GW_OWNER);
     460    if (owner) parent = owner;
    460461    }
    461462    return parent;
     
    474475
    475476    TRACE("window %04x, code=%08x, %s\n", parent, code,
    476           (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI");
     477      (infoPtr->NtfUnicode) ? "via Unicode" : "via ANSI");
    477478
    478479    if (infoPtr->NtfUnicode)
    479         return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,
    480                              (LPARAM)nmhdr);
     480    return SendMessageW (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,
     481                 (LPARAM)nmhdr);
    481482    else
    482         return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,
    483                              (LPARAM)nmhdr);
     483    return SendMessageA (parent, WM_NOTIFY, (WPARAM) nmhdr->idFrom,
     484                 (LPARAM)nmhdr);
    484485}
    485486
     
    492493    notify_rebar.dwMask = 0;
    493494    if (uBand!=-1) {
    494         lpBand = &infoPtr->bands[uBand];
    495         if (lpBand->fMask & RBBIM_ID) {
    496             notify_rebar.dwMask |= RBNM_ID;
    497             notify_rebar.wID = lpBand->wID;
    498         }
    499         if (lpBand->fMask & RBBIM_LPARAM) {
    500             notify_rebar.dwMask |= RBNM_LPARAM;
    501             notify_rebar.lParam = lpBand->lParam;
    502         }
    503         if (lpBand->fMask & RBBIM_STYLE) {
    504             notify_rebar.dwMask |= RBNM_STYLE;
    505             notify_rebar.fStyle = lpBand->fStyle;
    506         }
     495    lpBand = &infoPtr->bands[uBand];
     496    if (lpBand->fMask & RBBIM_ID) {
     497        notify_rebar.dwMask |= RBNM_ID;
     498        notify_rebar.wID = lpBand->wID;
     499    }
     500    if (lpBand->fMask & RBBIM_LPARAM) {
     501        notify_rebar.dwMask |= RBNM_LPARAM;
     502        notify_rebar.lParam = lpBand->lParam;
     503    }
     504    if (lpBand->fMask & RBBIM_STYLE) {
     505        notify_rebar.dwMask |= RBNM_STYLE;
     506        notify_rebar.fStyle = lpBand->fStyle;
     507    }
    507508    }
    508509    notify_rebar.uBand = uBand;
     
    521522    /* draw caption image */
    522523    if (lpBand->fDraw & DRAW_IMAGE) {
    523         POINT pt;
    524 
    525         /* center image */
    526         pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;
    527         pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;
    528 
    529         ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,
    530                         pt.x, pt.y,
    531                         ILD_TRANSPARENT);
     524    POINT pt;
     525
     526    /* center image */
     527    pt.y = (lpBand->rcCapImage.bottom + lpBand->rcCapImage.top - infoPtr->imageSize.cy)/2;
     528    pt.x = (lpBand->rcCapImage.right + lpBand->rcCapImage.left - infoPtr->imageSize.cx)/2;
     529
     530    ImageList_Draw (infoPtr->himl, lpBand->iImage, hdc,
     531            pt.x, pt.y,
     532            ILD_TRANSPARENT);
    532533    }
    533534
    534535    /* draw caption text */
    535536    if (lpBand->fDraw & DRAW_TEXT) {
    536         HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
    537         INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
    538         COLORREF oldcolor = CLR_NONE;
    539         oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ?
    540                                 lpBand->clrFore : infoPtr->clrBtnText);
    541         DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
    542                    DT_CENTER | DT_VCENTER | DT_SINGLELINE);
    543         if (oldBkMode != TRANSPARENT)
    544             SetBkMode (hdc, oldBkMode);
    545         SetTextColor (hdc, oldcolor);
    546         SelectObject (hdc, hOldFont);
     537    HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
     538    INT oldBkMode = SetBkMode (hdc, TRANSPARENT);
     539    COLORREF oldcolor = CLR_NONE;
     540    oldcolor = SetTextColor (hdc, (lpBand->clrFore != CLR_NONE) ?
     541                lpBand->clrFore : infoPtr->clrBtnText);
     542    DrawTextW (hdc, lpBand->lpText, -1, &lpBand->rcCapText,
     543           DT_CENTER | DT_VCENTER | DT_SINGLELINE);
     544    if (oldBkMode != TRANSPARENT)
     545        SetBkMode (hdc, oldBkMode);
     546    SetTextColor (hdc, oldcolor);
     547    SelectObject (hdc, hOldFont);
    547548    }
    548549}
     
    559560    oldrow = infoPtr->bands[0].iRow;
    560561    for (i = 0; i < infoPtr->uNumBands; i++) {
    561         lpBand = &infoPtr->bands[i];
    562 
    563         if (HIDDENBAND(lpBand)) continue;
    564 
    565         /* now draw the band */
    566         REBAR_DrawBand (hdc, infoPtr, lpBand);
     562    lpBand = &infoPtr->bands[i];
     563
     564    if (HIDDENBAND(lpBand)) continue;
     565
     566    /* now draw the band */
     567    REBAR_DrawBand (hdc, infoPtr, lpBand);
    567568
    568569    }
     
    572573static void
    573574REBAR_FixVert (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend,
    574                    INT mcy)
    575      /* Function:                                                    */ 
     575           INT mcy)
     576     /* Function:                                                    */
    576577     /*   Cycle through bands in row and fix height of each band.    */
    577578     /*   Also determine whether each band has changed.              */
     
    585586    for (i = (INT)rowstart; i<=(INT)rowend; i++) {
    586587        lpBand = &infoPtr->bands[i];
    587         if (HIDDENBAND(lpBand)) continue;
    588 
    589         /* adjust height of bands in row to "mcy" value */
    590         if (infoPtr->dwStyle & CCS_VERT) {
    591             if (lpBand->rcBand.right != lpBand->rcBand.left + mcy)
    592                 lpBand->rcBand.right = lpBand->rcBand.left + mcy;
    593         }
    594         else {
    595             if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy)
    596                 lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;
    597 
    598         }
    599 
    600         /* mark whether we need to invalidate this band and trace */
    601         if ((lpBand->rcoldBand.left !=lpBand->rcBand.left) ||
    602             (lpBand->rcoldBand.top !=lpBand->rcBand.top) ||
    603             (lpBand->rcoldBand.right !=lpBand->rcBand.right) ||
    604             (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) {
    605             lpBand->fDraw |= NTF_INVALIDATE;
    606             TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d) from (%d,%d)-(%d,%d)\n",
    607                   i, lpBand->iRow,
    608                   lpBand->rcBand.left, lpBand->rcBand.top,
    609                   lpBand->rcBand.right, lpBand->rcBand.bottom,
    610                   lpBand->rcoldBand.left, lpBand->rcoldBand.top,
    611                   lpBand->rcoldBand.right, lpBand->rcoldBand.bottom);
    612         }
    613         else
    614             TRACE("band %d row=%d: unchanged (%d,%d)-(%d,%d)\n",
    615                   i, lpBand->iRow,
    616                   lpBand->rcBand.left, lpBand->rcBand.top,
    617                   lpBand->rcBand.right, lpBand->rcBand.bottom);
     588    if (HIDDENBAND(lpBand)) continue;
     589
     590    /* adjust height of bands in row to "mcy" value */
     591    if (infoPtr->dwStyle & CCS_VERT) {
     592        if (lpBand->rcBand.right != lpBand->rcBand.left + mcy)
     593            lpBand->rcBand.right = lpBand->rcBand.left + mcy;
     594    }
     595    else {
     596        if (lpBand->rcBand.bottom != lpBand->rcBand.top + mcy)
     597            lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;
     598
     599    }
     600
     601    /* mark whether we need to invalidate this band and trace */
     602    if ((lpBand->rcoldBand.left !=lpBand->rcBand.left) ||
     603        (lpBand->rcoldBand.top !=lpBand->rcBand.top) ||
     604        (lpBand->rcoldBand.right !=lpBand->rcBand.right) ||
     605        (lpBand->rcoldBand.bottom !=lpBand->rcBand.bottom)) {
     606        lpBand->fDraw |= NTF_INVALIDATE;
     607        TRACE("band %d row=%d: changed to (%d,%d)-(%d,%d) from (%d,%d)-(%d,%d)\n",
     608          i, lpBand->iRow,
     609          lpBand->rcBand.left, lpBand->rcBand.top,
     610          lpBand->rcBand.right, lpBand->rcBand.bottom,
     611          lpBand->rcoldBand.left, lpBand->rcoldBand.top,
     612          lpBand->rcoldBand.right, lpBand->rcoldBand.bottom);
     613    }
     614    else
     615        TRACE("band %d row=%d: unchanged (%d,%d)-(%d,%d)\n",
     616          i, lpBand->iRow,
     617          lpBand->rcBand.left, lpBand->rcBand.top,
     618          lpBand->rcBand.right, lpBand->rcBand.bottom);
    618619    }
    619620}
     
    622623static void
    623624REBAR_AdjustBands (REBAR_INFO *infoPtr, UINT rowstart, UINT rowend,
    624                    INT maxx, INT mcy)
     625           INT maxx, INT mcy)
    625626     /* Function: This routine distributes the extra space in a row. */
    626627     /*  See algorithm below.                                        */
     
    634635
    635636    TRACE("start=%u, end=%u, max x=%d, max y=%d\n",
    636           rowstart, rowend, maxx, mcy);
     637      rowstart, rowend, maxx, mcy);
    637638
    638639    /* *******************  Phase 1  ************************ */
     
    642643    /*         or band's ->ccx reached.                       */
    643644    /*  If any band modified, add any space left to last band */
    644     /*  adjusted.                                             */ 
     645    /*  adjusted.                                             */
    645646    /*                                                        */
    646647    /* ****************************************************** */
     
    650651    last_adjusted = 0;
    651652    for (i=(INT)rowstart; i<=(INT)rowend; i++) {
    652         lpBand = &infoPtr->bands[i];
    653         if (HIDDENBAND(lpBand)) continue;
    654         xsep = (x == 0) ? 0 : SEP_WIDTH;
    655         curwidth = rcBw(lpBand);
    656 
    657         /* set new left/top point */
    658         if (infoPtr->dwStyle & CCS_VERT)
    659             lpBand->rcBand.top = x + xsep;
    660         else
    661             lpBand->rcBand.left = x + xsep;
    662 
    663         /* compute new width */
    664         if (lpBand->hwndChild && extra) {
    665             /* set to the "current" band size less the header */
    666             fudge = lpBand->ccx;
    667             last_adjusted = i;
    668             if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0) &&
    669                 (fudge > curwidth)) {
    670                 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d, extra=%d\n",
    671                       i, fudge-curwidth, fudge, curwidth, extra);
    672                 if ((fudge - curwidth) > extra)
    673                     fudge = curwidth + extra;
    674                 extra -= (fudge - curwidth);
    675                 curwidth = fudge;
    676             }
    677             else {
    678                 TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d\n",
    679                       i, extra, fudge, curwidth);
    680                 curwidth += extra;
    681                 extra = 0;
    682             }
    683         }
    684 
    685         /* set new right/bottom point */
    686         if (infoPtr->dwStyle & CCS_VERT)
    687             lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;
    688         else
    689             lpBand->rcBand.right = lpBand->rcBand.left + curwidth;
    690         TRACE("Phase 1 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",
    691               i, lpBand->rcBand.left, lpBand->rcBand.top,
    692               lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);
    693         x = rcBrb(lpBand);
     653    lpBand = &infoPtr->bands[i];
     654    if (HIDDENBAND(lpBand)) continue;
     655    xsep = (x == 0) ? 0 : SEP_WIDTH;
     656    curwidth = rcBw(lpBand);
     657
     658    /* set new left/top point */
     659    if (infoPtr->dwStyle & CCS_VERT)
     660        lpBand->rcBand.top = x + xsep;
     661    else
     662        lpBand->rcBand.left = x + xsep;
     663
     664    /* compute new width */
     665    if (lpBand->hwndChild && extra) {
     666        /* set to the "current" band size less the header */
     667        fudge = lpBand->ccx;
     668        last_adjusted = i;
     669        if ((lpBand->fMask & RBBIM_SIZE) && (lpBand->cx > 0) &&
     670        (fudge > curwidth)) {
     671        TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d, extra=%d\n",
     672              i, fudge-curwidth, fudge, curwidth, extra);
     673        if ((fudge - curwidth) > extra)
     674            fudge = curwidth + extra;
     675        extra -= (fudge - curwidth);
     676        curwidth = fudge;
     677        }
     678        else {
     679        TRACE("adjusting band %d by %d, fudge=%d, curwidth=%d\n",
     680              i, extra, fudge, curwidth);
     681        curwidth += extra;
     682        extra = 0;
     683        }
     684    }
     685
     686    /* set new right/bottom point */
     687    if (infoPtr->dwStyle & CCS_VERT)
     688        lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;
     689    else
     690        lpBand->rcBand.right = lpBand->rcBand.left + curwidth;
     691    TRACE("Phase 1 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",
     692          i, lpBand->rcBand.left, lpBand->rcBand.top,
     693          lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);
     694    x = rcBrb(lpBand);
    694695    }
    695696    if ((x >= maxx) || last_adjusted) {
    696         if (x > maxx) {
    697             ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n",
    698                 x, maxx,  rowstart, rowend);
    699         }
    700         /* done, so spread extra space */
    701         if (x < maxx) {
    702             fudge = maxx - x;
    703             TRACE("Need to spread %d on last adjusted band %d\n",
    704                 fudge, last_adjusted);
    705             for (i=(INT)last_adjusted; i<=(INT)rowend; i++) {
    706                 lpBand = &infoPtr->bands[i];
    707                 if (HIDDENBAND(lpBand)) continue;
    708 
    709                 /* set right/bottom point */
    710                 if (i != last_adjusted) {
    711                     if (infoPtr->dwStyle & CCS_VERT)
    712                         lpBand->rcBand.top += fudge;
    713                     else
    714                         lpBand->rcBand.left += fudge;
    715                 }
    716 
    717                 /* set left/bottom point */
    718                 if (infoPtr->dwStyle & CCS_VERT)
    719                     lpBand->rcBand.bottom += fudge;
    720                 else
    721                     lpBand->rcBand.right += fudge;
    722             }
    723         }
    724         TRACE("Phase 1 succeeded, used x=%d\n", x);
    725         REBAR_FixVert (infoPtr, rowstart, rowend, mcy);
    726         return;
     697    if (x > maxx) {
     698        ERR("Phase 1 failed, x=%d, maxx=%d, start=%u, end=%u\n",
     699        x, maxx,  rowstart, rowend);
     700    }
     701    /* done, so spread extra space */
     702    if (x < maxx) {
     703        fudge = maxx - x;
     704        TRACE("Need to spread %d on last adjusted band %d\n",
     705        fudge, last_adjusted);
     706        for (i=(INT)last_adjusted; i<=(INT)rowend; i++) {
     707        lpBand = &infoPtr->bands[i];
     708        if (HIDDENBAND(lpBand)) continue;
     709
     710        /* set right/bottom point */
     711        if (i != last_adjusted) {
     712            if (infoPtr->dwStyle & CCS_VERT)
     713            lpBand->rcBand.top += fudge;
     714            else
     715            lpBand->rcBand.left += fudge;
     716        }
     717
     718        /* set left/bottom point */
     719        if (infoPtr->dwStyle & CCS_VERT)
     720            lpBand->rcBand.bottom += fudge;
     721        else
     722            lpBand->rcBand.right += fudge;
     723        }
     724    }
     725    TRACE("Phase 1 succeeded, used x=%d\n", x);
     726    REBAR_FixVert (infoPtr, rowstart, rowend, mcy);
     727    return;
    727728    }
    728729
     
    736737    x = 0;
    737738    for (i=(INT)rowstart; i<=(INT)rowend; i++) {
    738         lpBand = &infoPtr->bands[i];
    739         if (HIDDENBAND(lpBand)) continue;
    740         xsep = (x == 0) ? 0 : SEP_WIDTH;
    741         curwidth = rcBw(lpBand);
    742 
    743         /* set new left/top point */
    744         if (infoPtr->dwStyle & CCS_VERT)
    745             lpBand->rcBand.top = x + xsep;
    746         else
    747             lpBand->rcBand.left = x + xsep;
    748 
    749         /* compute new width */
    750         if (extra) {
    751             curwidth += extra;
    752             extra = 0;
    753         }
    754 
    755         /* set new right/bottom point */
    756         if (infoPtr->dwStyle & CCS_VERT)
    757             lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;
    758         else
    759             lpBand->rcBand.right = lpBand->rcBand.left + curwidth;
    760         TRACE("Phase 2 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",
    761               i, lpBand->rcBand.left, lpBand->rcBand.top,
    762               lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);
    763         x = rcBrb(lpBand);
     739    lpBand = &infoPtr->bands[i];
     740    if (HIDDENBAND(lpBand)) continue;
     741    xsep = (x == 0) ? 0 : SEP_WIDTH;
     742    curwidth = rcBw(lpBand);
     743
     744    /* set new left/top point */
     745    if (infoPtr->dwStyle & CCS_VERT)
     746        lpBand->rcBand.top = x + xsep;
     747    else
     748        lpBand->rcBand.left = x + xsep;
     749
     750    /* compute new width */
     751    if (extra) {
     752        curwidth += extra;
     753        extra = 0;
     754    }
     755
     756    /* set new right/bottom point */
     757    if (infoPtr->dwStyle & CCS_VERT)
     758        lpBand->rcBand.bottom = lpBand->rcBand.top + curwidth;
     759    else
     760        lpBand->rcBand.right = lpBand->rcBand.left + curwidth;
     761    TRACE("Phase 2 band %d, (%d,%d)-(%d,%d), orig x=%d, xsep=%d\n",
     762          i, lpBand->rcBand.left, lpBand->rcBand.top,
     763          lpBand->rcBand.right, lpBand->rcBand.bottom, x, xsep);
     764    x = rcBrb(lpBand);
    764765    }
    765766    if (x >= maxx) {
    766         if (x > maxx) {
    767             ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n",
    768                 x, maxx,  rowstart, rowend);
    769         }
    770         /* done, so spread extra space */
    771         TRACE("Phase 2 succeeded, used x=%d\n", x);
    772         REBAR_FixVert (infoPtr, rowstart, rowend, mcy);
    773         return;
     767    if (x > maxx) {
     768        ERR("Phase 2 failed, x=%d, maxx=%d, start=%u, end=%u\n",
     769        x, maxx,  rowstart, rowend);
     770    }
     771    /* done, so spread extra space */
     772    TRACE("Phase 2 succeeded, used x=%d\n", x);
     773    REBAR_FixVert (infoPtr, rowstart, rowend, mcy);
     774    return;
    774775    }
    775776
     
    781782    lpBand = &infoPtr->bands[rowstart];
    782783    ERR("Serious problem adjusting row %d, start band %d, end band %d\n",
    783         lpBand->iRow, rowstart, rowend);
     784    lpBand->iRow, rowstart, rowend);
    784785    REBAR_DumpBand (infoPtr);
    785786    return;
     
    805806      if (HIDDENBAND(lpBand)) {
    806807          SetRect (&lpBand->rcChild,
    807                    lpBand->rcBand.right, lpBand->rcBand.top,
    808                    lpBand->rcBand.right, lpBand->rcBand.bottom);
    809           continue;
     808           lpBand->rcBand.right, lpBand->rcBand.top,
     809           lpBand->rcBand.right, lpBand->rcBand.bottom);
     810      continue;
    810811      }
    811812
     
    814815      /* set initial gripper rectangle */
    815816      SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top,
    816                lpBand->rcBand.left, lpBand->rcBand.bottom);
     817           lpBand->rcBand.left, lpBand->rcBand.bottom);
    817818
    818819      /* calculate gripper rectangle */
    819820      if ( lpBand->fStatus & HAS_GRIPPER) {
    820           lpBand->fDraw |= DRAW_GRIPPER;
    821           lpBand->rcGripper.left   += REBAR_PRE_GRIPPER;
    822           lpBand->rcGripper.right  = lpBand->rcGripper.left + GRIPPER_WIDTH;
    823           lpBand->rcGripper.top    += 2;
    824           lpBand->rcGripper.bottom -= 2;
    825 
    826           SetRect (&lpBand->rcCapImage,
    827                    lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.top,
    828                    lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.bottom);
     821      lpBand->fDraw |= DRAW_GRIPPER;
     822      lpBand->rcGripper.left   += REBAR_PRE_GRIPPER;
     823      lpBand->rcGripper.right  = lpBand->rcGripper.left + GRIPPER_WIDTH;
     824      lpBand->rcGripper.top    += 2;
     825      lpBand->rcGripper.bottom -= 2;
     826
     827      SetRect (&lpBand->rcCapImage,
     828           lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.top,
     829           lpBand->rcGripper.right+REBAR_ALWAYS_SPACE, lpBand->rcBand.bottom);
    829830      }
    830831      else {  /* no gripper will be drawn */
    831           xoff = 0;
    832           if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
    833               /* if no gripper but either image or text, then leave space */
    834               xoff = REBAR_ALWAYS_SPACE;
    835           SetRect (&lpBand->rcCapImage,
    836                    lpBand->rcBand.left+xoff, lpBand->rcBand.top,
    837                    lpBand->rcBand.left+xoff, lpBand->rcBand.bottom);
     832      xoff = 0;
     833      if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
     834          /* if no gripper but either image or text, then leave space */
     835          xoff = REBAR_ALWAYS_SPACE;
     836      SetRect (&lpBand->rcCapImage,
     837           lpBand->rcBand.left+xoff, lpBand->rcBand.top,
     838           lpBand->rcBand.left+xoff, lpBand->rcBand.bottom);
    838839      }
    839840
    840841      /* image is visible */
    841842      if (lpBand->fStatus & HAS_IMAGE) {
    842           lpBand->fDraw |= DRAW_IMAGE;
    843           lpBand->rcCapImage.right  += infoPtr->imageSize.cx;
    844           lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
    845 
    846           /* set initial caption text rectangle */
    847           SetRect (&lpBand->rcCapText,
    848                    lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1,
    849                    lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
    850           /* update band height
    851           if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {
    852               lpBand->uMinHeight = infoPtr->imageSize.cy + 2;
    853               lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;
    854           }  */
     843      lpBand->fDraw |= DRAW_IMAGE;
     844      lpBand->rcCapImage.right  += infoPtr->imageSize.cx;
     845      lpBand->rcCapImage.bottom = lpBand->rcCapImage.top + infoPtr->imageSize.cy;
     846
     847      /* set initial caption text rectangle */
     848      SetRect (&lpBand->rcCapText,
     849           lpBand->rcCapImage.right+REBAR_POST_IMAGE, lpBand->rcBand.top+1,
     850           lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
     851      /* update band height
     852      if (lpBand->uMinHeight < infoPtr->imageSize.cy + 2) {
     853          lpBand->uMinHeight = infoPtr->imageSize.cy + 2;
     854          lpBand->rcBand.bottom = lpBand->rcBand.top + lpBand->uMinHeight;
     855      }  */
    855856      }
    856857      else {
    857           /* set initial caption text rectangle */
    858           SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1,
    859                    lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
     858      /* set initial caption text rectangle */
     859      SetRect (&lpBand->rcCapText, lpBand->rcCapImage.right, lpBand->rcBand.top+1,
     860           lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.bottom-1);
    860861      }
    861862
    862863      /* text is visible */
    863864      if (lpBand->fStatus & HAS_TEXT) {
    864           lpBand->fDraw |= DRAW_TEXT;
    865           lpBand->rcCapText.right = max(lpBand->rcCapText.left,
    866                                         lpBand->rcCapText.right-REBAR_POST_TEXT);
     865      lpBand->fDraw |= DRAW_TEXT;
     866      lpBand->rcCapText.right = max(lpBand->rcCapText.left,
     867                    lpBand->rcCapText.right-REBAR_POST_TEXT);
    867868      }
    868869
    869870      /* set initial child window rectangle if there is a child */
    870871      if (lpBand->fMask & RBBIM_CHILD) {
    871           xoff = lpBand->offChild.cx;
    872           yoff = lpBand->offChild.cy;
    873           SetRect (&lpBand->rcChild,
    874                    lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top+yoff,
    875                    lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);
     872      xoff = lpBand->offChild.cx;
     873      yoff = lpBand->offChild.cy;
     874      SetRect (&lpBand->rcChild,
     875           lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top+yoff,
     876           lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);
    876877      }
    877878      else {
    878879          SetRect (&lpBand->rcChild,
    879                    lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top,
    880                    lpBand->rcBand.right, lpBand->rcBand.bottom);
     880           lpBand->rcBand.left+lpBand->cxHeader, lpBand->rcBand.top,
     881           lpBand->rcBand.right, lpBand->rcBand.bottom);
    881882      }
    882883
    883884      /* flag if notify required and invalidate rectangle */
    884       if (notify && 
    885           ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||
    886            (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
    887           TRACE("Child rectangle changed for band %u\n", i);
    888           TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
    889                 oldChild.left, oldChild.top,
    890                 oldChild.right, oldChild.bottom,
    891                 lpBand->rcChild.left, lpBand->rcChild.top,
    892                 lpBand->rcChild.right, lpBand->rcChild.bottom);
     885      if (notify &&
     886      ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||
     887       (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
     888      TRACE("Child rectangle changed for band %u\n", i);
     889      TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
     890        oldChild.left, oldChild.top,
     891            oldChild.right, oldChild.bottom,
     892        lpBand->rcChild.left, lpBand->rcChild.top,
     893            lpBand->rcChild.right, lpBand->rcChild.bottom);
    893894      }
    894895      if (lpBand->fDraw & NTF_INVALIDATE) {
    895           TRACE("invalidating (%d,%d)-(%d,%d)\n",
    896                 lpBand->rcBand.left,
    897                 lpBand->rcBand.top,
    898                 lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0),
    899                 lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0));
    900           lpBand->fDraw &= ~NTF_INVALIDATE;
    901           work = lpBand->rcBand;
    902           if (lpBand->fDraw & DRAW_RIGHTSEP) work.right += SEP_WIDTH_SIZE;
    903           if (lpBand->fDraw & DRAW_BOTTOMSEP) work.bottom += SEP_WIDTH_SIZE;
    904           InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
     896      TRACE("invalidating (%d,%d)-(%d,%d)\n",
     897        lpBand->rcBand.left,
     898        lpBand->rcBand.top,
     899        lpBand->rcBand.right + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0),
     900        lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0));
     901      lpBand->fDraw &= ~NTF_INVALIDATE;
     902      work = lpBand->rcBand;
     903      if (lpBand->fDraw & DRAW_RIGHTSEP) work.right += SEP_WIDTH_SIZE;
     904      if (lpBand->fDraw & DRAW_BOTTOMSEP) work.bottom += SEP_WIDTH_SIZE;
     905      InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
    905906      }
    906907
     
    925926
    926927    for(i=rstart; i<rend; i++){
    927         lpBand = &infoPtr->bands[i];
    928         if (HIDDENBAND(lpBand)) continue;
    929         oldChild = lpBand->rcChild;
    930 
    931         /* set initial gripper rectangle */
    932         SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top,
    933                 lpBand->rcBand.right, lpBand->rcBand.top);
    934 
    935         /* calculate gripper rectangle */
    936         if (lpBand->fStatus & HAS_GRIPPER) {
    937             lpBand->fDraw |= DRAW_GRIPPER;
    938 
    939             if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) {
    940                 /*  vertical gripper  */
    941                 lpBand->rcGripper.left   += 3;
    942                 lpBand->rcGripper.right  = lpBand->rcGripper.left + GRIPPER_WIDTH;
    943                 lpBand->rcGripper.top    += REBAR_PRE_GRIPPER;
    944                 lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT;
    945 
    946                 /* initialize Caption image rectangle  */
    947                 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,
    948                         lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,
    949                         lpBand->rcBand.right,
    950                         lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);
    951             }
    952             else {
    953                 /*  horizontal gripper  */
    954                 lpBand->rcGripper.left   += 3;
    955                 lpBand->rcGripper.right  -= 3;
    956                 lpBand->rcGripper.top    += REBAR_PRE_GRIPPER;
    957                 lpBand->rcGripper.bottom  = lpBand->rcGripper.top + GRIPPER_WIDTH;
    958 
    959                 /* initialize Caption image rectangle  */
    960                 SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,
    961                         lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,
    962                         lpBand->rcBand.right,
    963                         lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);
    964             }
    965         }
    966         else {  /* no gripper will be drawn */
    967             xoff = 0;
    968             if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
    969                 /* if no gripper but either image or text, then leave space */
    970                 xoff = REBAR_ALWAYS_SPACE;
    971             /* initialize Caption image rectangle  */
    972             SetRect (&lpBand->rcCapImage,
    973                      lpBand->rcBand.left, lpBand->rcBand.top+xoff,
    974                      lpBand->rcBand.right, lpBand->rcBand.top+xoff);
    975         }
    976 
    977         /* image is visible */
    978         if (lpBand->fStatus & HAS_IMAGE) {
    979             lpBand->fDraw |= DRAW_IMAGE;
    980 
    981             lpBand->rcCapImage.right  = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
    982             lpBand->rcCapImage.bottom += infoPtr->imageSize.cy;
    983 
    984             /* set initial caption text rectangle */
    985             SetRect (&lpBand->rcCapText,
    986                      lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE,
    987                      lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);
    988             /* update band height *
    989                if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {
    990                lpBand->uMinHeight = infoPtr->imageSize.cx + 2;
    991                lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;
    992                } */
    993         }
    994         else {
    995             /* set initial caption text rectangle */
    996             SetRect (&lpBand->rcCapText,
    997                      lpBand->rcBand.left, lpBand->rcCapImage.bottom,
    998                      lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);
    999         }
    1000 
    1001         /* text is visible */
    1002         if (lpBand->fStatus & HAS_TEXT) {
    1003             lpBand->fDraw |= DRAW_TEXT;
    1004             lpBand->rcCapText.bottom = max(lpBand->rcCapText.top,
    1005                                            lpBand->rcCapText.bottom-REBAR_POST_TEXT);
    1006         }
    1007 
    1008         /* set initial child window rectangle if there is a child */
    1009         if (lpBand->fMask & RBBIM_CHILD) {
    1010             yoff = lpBand->offChild.cx;
    1011             xoff = lpBand->offChild.cy;
    1012             SetRect (&lpBand->rcChild,
    1013                      lpBand->rcBand.left+xoff, lpBand->rcBand.top+lpBand->cxHeader,
    1014                      lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);
    1015         }
    1016         else {
    1017             SetRect (&lpBand->rcChild,
    1018                      lpBand->rcBand.left, lpBand->rcBand.top+lpBand->cxHeader,
    1019                      lpBand->rcBand.right, lpBand->rcBand.bottom);
    1020         }
    1021 
    1022         /* flag if notify required and invalidate rectangle */
    1023         if (notify &&
    1024             ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||
    1025              (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
    1026             TRACE("Child rectangle changed for band %u\n", i);
    1027             TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
    1028                   oldChild.left, oldChild.top,
    1029                   oldChild.right, oldChild.bottom,
    1030                   lpBand->rcChild.left, lpBand->rcChild.top,
    1031                   lpBand->rcChild.right, lpBand->rcChild.bottom);
    1032         }
    1033         if (lpBand->fDraw & NTF_INVALIDATE) {
    1034             TRACE("invalidating (%d,%d)-(%d,%d)\n",
    1035                   lpBand->rcBand.left,
    1036                   lpBand->rcBand.top,
    1037                   lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0),
    1038                   lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0));
    1039             lpBand->fDraw &= ~NTF_INVALIDATE;
    1040             work = lpBand->rcBand;
    1041             if (lpBand->fDraw & DRAW_RIGHTSEP) work.bottom += SEP_WIDTH_SIZE;
    1042             if (lpBand->fDraw & DRAW_BOTTOMSEP) work.right += SEP_WIDTH_SIZE;
    1043             InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
    1044         }
     928    lpBand = &infoPtr->bands[i];
     929    if (HIDDENBAND(lpBand)) continue;
     930    oldChild = lpBand->rcChild;
     931
     932    /* set initial gripper rectangle */
     933    SetRect (&lpBand->rcGripper, lpBand->rcBand.left, lpBand->rcBand.top,
     934        lpBand->rcBand.right, lpBand->rcBand.top);
     935
     936    /* calculate gripper rectangle */
     937    if (lpBand->fStatus & HAS_GRIPPER) {
     938        lpBand->fDraw |= DRAW_GRIPPER;
     939
     940        if (infoPtr->dwStyle & RBS_VERTICALGRIPPER) {
     941        /*  vertical gripper  */
     942        lpBand->rcGripper.left   += 3;
     943        lpBand->rcGripper.right  = lpBand->rcGripper.left + GRIPPER_WIDTH;
     944        lpBand->rcGripper.top    += REBAR_PRE_GRIPPER;
     945        lpBand->rcGripper.bottom = lpBand->rcGripper.top + GRIPPER_HEIGHT;
     946
     947        /* initialize Caption image rectangle  */
     948        SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,
     949            lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,
     950            lpBand->rcBand.right,
     951            lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);
     952        }
     953        else {
     954        /*  horizontal gripper  */
     955        lpBand->rcGripper.left   += 3;
     956        lpBand->rcGripper.right  -= 3;
     957        lpBand->rcGripper.top    += REBAR_PRE_GRIPPER;
     958        lpBand->rcGripper.bottom  = lpBand->rcGripper.top + GRIPPER_WIDTH;
     959
     960        /* initialize Caption image rectangle  */
     961        SetRect (&lpBand->rcCapImage, lpBand->rcBand.left,
     962            lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE,
     963            lpBand->rcBand.right,
     964            lpBand->rcGripper.bottom + REBAR_ALWAYS_SPACE);
     965        }
     966    }
     967    else {  /* no gripper will be drawn */
     968        xoff = 0;
     969        if (lpBand->fStatus & (HAS_IMAGE | HAS_TEXT))
     970        /* if no gripper but either image or text, then leave space */
     971        xoff = REBAR_ALWAYS_SPACE;
     972        /* initialize Caption image rectangle  */
     973        SetRect (&lpBand->rcCapImage,
     974             lpBand->rcBand.left, lpBand->rcBand.top+xoff,
     975             lpBand->rcBand.right, lpBand->rcBand.top+xoff);
     976    }
     977
     978    /* image is visible */
     979    if (lpBand->fStatus & HAS_IMAGE) {
     980        lpBand->fDraw |= DRAW_IMAGE;
     981
     982        lpBand->rcCapImage.right  = lpBand->rcCapImage.left + infoPtr->imageSize.cx;
     983        lpBand->rcCapImage.bottom += infoPtr->imageSize.cy;
     984
     985        /* set initial caption text rectangle */
     986        SetRect (&lpBand->rcCapText,
     987             lpBand->rcBand.left, lpBand->rcCapImage.bottom+REBAR_POST_IMAGE,
     988             lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);
     989        /* update band height *
     990           if (lpBand->uMinHeight < infoPtr->imageSize.cx + 2) {
     991           lpBand->uMinHeight = infoPtr->imageSize.cx + 2;
     992           lpBand->rcBand.right = lpBand->rcBand.left + lpBand->uMinHeight;
     993           } */
     994    }
     995    else {
     996        /* set initial caption text rectangle */
     997        SetRect (&lpBand->rcCapText,
     998             lpBand->rcBand.left, lpBand->rcCapImage.bottom,
     999             lpBand->rcBand.right, lpBand->rcBand.top+lpBand->cxHeader);
     1000    }
     1001
     1002    /* text is visible */
     1003    if (lpBand->fStatus & HAS_TEXT) {
     1004        lpBand->fDraw |= DRAW_TEXT;
     1005        lpBand->rcCapText.bottom = max(lpBand->rcCapText.top,
     1006                       lpBand->rcCapText.bottom-REBAR_POST_TEXT);
     1007    }
     1008
     1009    /* set initial child window rectangle if there is a child */
     1010    if (lpBand->fMask & RBBIM_CHILD) {
     1011        yoff = lpBand->offChild.cx;
     1012        xoff = lpBand->offChild.cy;
     1013        SetRect (&lpBand->rcChild,
     1014             lpBand->rcBand.left+xoff, lpBand->rcBand.top+lpBand->cxHeader,
     1015             lpBand->rcBand.right-xoff, lpBand->rcBand.bottom-yoff);
     1016    }
     1017    else {
     1018        SetRect (&lpBand->rcChild,
     1019             lpBand->rcBand.left, lpBand->rcBand.top+lpBand->cxHeader,
     1020             lpBand->rcBand.right, lpBand->rcBand.bottom);
     1021    }
     1022
     1023    /* flag if notify required and invalidate rectangle */
     1024    if (notify &&
     1025        ((oldChild.right-oldChild.left != lpBand->rcChild.right-lpBand->rcChild.left) ||
     1026         (oldChild.bottom-oldChild.top != lpBand->rcChild.bottom-lpBand->rcChild.top))) {
     1027        TRACE("Child rectangle changed for band %u\n", i);
     1028        TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
     1029          oldChild.left, oldChild.top,
     1030          oldChild.right, oldChild.bottom,
     1031          lpBand->rcChild.left, lpBand->rcChild.top,
     1032          lpBand->rcChild.right, lpBand->rcChild.bottom);
     1033    }
     1034    if (lpBand->fDraw & NTF_INVALIDATE) {
     1035        TRACE("invalidating (%d,%d)-(%d,%d)\n",
     1036          lpBand->rcBand.left,
     1037          lpBand->rcBand.top,
     1038          lpBand->rcBand.right + ((lpBand->fDraw & DRAW_BOTTOMSEP) ? SEP_WIDTH_SIZE : 0),
     1039          lpBand->rcBand.bottom + ((lpBand->fDraw & DRAW_RIGHTSEP) ? SEP_WIDTH_SIZE : 0));
     1040        lpBand->fDraw &= ~NTF_INVALIDATE;
     1041        work = lpBand->rcBand;
     1042        if (lpBand->fDraw & DRAW_RIGHTSEP) work.bottom += SEP_WIDTH_SIZE;
     1043        if (lpBand->fDraw & DRAW_BOTTOMSEP) work.right += SEP_WIDTH_SIZE;
     1044        InvalidateRect(infoPtr->hwndSelf, &work, TRUE);
     1045    }
    10451046
    10461047    }
     
    10631064
    10641065    TRACE( " old [%ld x %ld], new [%ld x %ld], client [%d x %d]\n",
    1065            infoPtr->oldSize.cx, infoPtr->oldSize.cy,
    1066            infoPtr->calcSize.cx, infoPtr->calcSize.cy,
    1067            rc.right, rc.bottom);
     1066       infoPtr->oldSize.cx, infoPtr->oldSize.cy,
     1067       infoPtr->calcSize.cx, infoPtr->calcSize.cy,
     1068       rc.right, rc.bottom);
    10681069
    10691070    /* If we need to shrink client, then skip size test */
    10701071    if ((infoPtr->calcSize.cy >= rc.bottom) &&
    1071         (infoPtr->calcSize.cx >= rc.right)) {
    1072 
    1073         /* if size did not change then skip process */
    1074         if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) &&
    1075             (infoPtr->oldSize.cy == infoPtr->calcSize.cy) &&
    1076             !(infoPtr->fStatus & RESIZE_ANYHOW))
    1077             {
    1078                 TRACE("skipping reset\n");
    1079                 return;
    1080             }
     1072    (infoPtr->calcSize.cx >= rc.right)) {
     1073
     1074    /* if size did not change then skip process */
     1075    if ((infoPtr->oldSize.cx == infoPtr->calcSize.cx) &&
     1076        (infoPtr->oldSize.cy == infoPtr->calcSize.cy) &&
     1077        !(infoPtr->fStatus & RESIZE_ANYHOW))
     1078        {
     1079        TRACE("skipping reset\n");
     1080        return;
     1081        }
    10811082    }
    10821083
     
    10941095#if 0
    10951096    if (GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE) & WS_BORDER) {
    1096         InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
     1097    InflateRect (&rc, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
    10971098    }
    10981099#endif
    10991100
    11001101    TRACE("setting to (0,0)-(%d,%d)\n",
    1101           rc.right - rc.left, rc.bottom - rc.top);
     1102      rc.right - rc.left, rc.bottom - rc.top);
    11021103    SetWindowPos (infoPtr->hwndSelf, 0, 0, 0,
    1103                     rc.right - rc.left, rc.bottom - rc.top,
    1104                     SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);
     1104            rc.right - rc.left, rc.bottom - rc.top,
     1105            SWP_NOMOVE | SWP_NOZORDER | SWP_SHOWWINDOW);
    11051106}
    11061107
     
    11201121
    11211122    for (i = start; i < endplus; i++) {
    1122         lpBand = &infoPtr->bands[i];
    1123 
    1124         if (HIDDENBAND(lpBand)) continue;
    1125         if (lpBand->hwndChild) {
    1126             TRACE("hwndChild = %x\n", lpBand->hwndChild);
    1127 
    1128             /* Always geterate the RBN_CHILDSIZE even it child
    1129                    did not change */
    1130             rbcz.uBand = i;
    1131             rbcz.wID = lpBand->wID;
    1132             rbcz.rcChild = lpBand->rcChild;
    1133             rbcz.rcBand = lpBand->rcBand;
    1134             rbcz.rcBand.left += lpBand->cxHeader;
    1135             REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE);
    1136             if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) {
    1137                 TRACE("Child rect changed by NOTIFY for band %u\n", i);
    1138                 TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
    1139                       lpBand->rcChild.left, lpBand->rcChild.top,
    1140                       lpBand->rcChild.right, lpBand->rcChild.bottom,
    1141                       rbcz.rcChild.left, rbcz.rcChild.top,
    1142                       rbcz.rcChild.right, rbcz.rcChild.bottom);
    1143             }
    1144 
    1145             GetClassNameA (lpBand->hwndChild, szClassName, 40);
    1146             if (!lstrcmpA (szClassName, "ComboBox") ||
    1147                 !lstrcmpA (szClassName, WC_COMBOBOXEXA)) {
    1148                 INT nEditHeight, yPos;
    1149                 RECT rc;
    1150 
    1151                 /* special placement code for combo or comboex box */
    1152 
    1153 
    1154                 /* get size of edit line */
    1155                 GetWindowRect (lpBand->hwndChild, &rc);
    1156                 nEditHeight = rc.bottom - rc.top;
    1157                 yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
    1158 
    1159                 /* center combo box inside child area */
    1160                 TRACE("moving child (Combo(Ex)) %04x to (%d,%d) for (%d,%d)\n",
    1161                       lpBand->hwndChild,
    1162                       lpBand->rcChild.left, yPos,
    1163                       lpBand->rcChild.right - lpBand->rcChild.left,
    1164                       nEditHeight);
    1165                 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,
    1166                                            lpBand->rcChild.left,
    1167                                            /*lpBand->rcChild.top*/ yPos,
    1168                                            lpBand->rcChild.right - lpBand->rcChild.left,
    1169                                            nEditHeight,
    1170                                            SWP_NOZORDER);
    1171                 if (!deferpos)
    1172                     ERR("DeferWindowPos returned NULL\n");
    1173             }
    1174             else {
    1175                 TRACE("moving child (Other) %04x to (%d,%d) for (%d,%d)\n",
    1176                       lpBand->hwndChild,
    1177                       lpBand->rcChild.left, lpBand->rcChild.top,
    1178                       lpBand->rcChild.right - lpBand->rcChild.left,
    1179                       lpBand->rcChild.bottom - lpBand->rcChild.top);
    1180                 deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,
    1181                                            lpBand->rcChild.left,
    1182                                            lpBand->rcChild.top,
    1183                                            lpBand->rcChild.right - lpBand->rcChild.left,
    1184                                            lpBand->rcChild.bottom - lpBand->rcChild.top,
    1185                                            SWP_NOZORDER);
    1186                 if (!deferpos)
    1187                     ERR("DeferWindowPos returned NULL\n");
    1188             }
    1189         }
     1123    lpBand = &infoPtr->bands[i];
     1124
     1125    if (HIDDENBAND(lpBand)) continue;
     1126    if (lpBand->hwndChild) {
     1127        TRACE("hwndChild = %x\n", lpBand->hwndChild);
     1128
     1129        /* Always geterate the RBN_CHILDSIZE even it child
     1130           did not change */
     1131        rbcz.uBand = i;
     1132        rbcz.wID = lpBand->wID;
     1133        rbcz.rcChild = lpBand->rcChild;
     1134        rbcz.rcBand = lpBand->rcBand;
     1135        rbcz.rcBand.left += lpBand->cxHeader;
     1136        REBAR_Notify ((NMHDR *)&rbcz, infoPtr, RBN_CHILDSIZE);
     1137        if (!EqualRect (&lpBand->rcChild, &rbcz.rcChild)) {
     1138        TRACE("Child rect changed by NOTIFY for band %u\n", i);
     1139        TRACE("    from (%d,%d)-(%d,%d)  to (%d,%d)-(%d,%d)\n",
     1140              lpBand->rcChild.left, lpBand->rcChild.top,
     1141              lpBand->rcChild.right, lpBand->rcChild.bottom,
     1142              rbcz.rcChild.left, rbcz.rcChild.top,
     1143              rbcz.rcChild.right, rbcz.rcChild.bottom);
     1144        }
     1145
     1146        GetClassNameA (lpBand->hwndChild, szClassName, 40);
     1147        if (!lstrcmpA (szClassName, "ComboBox") ||
     1148        !lstrcmpA (szClassName, WC_COMBOBOXEXA)) {
     1149        INT nEditHeight, yPos;
     1150        RECT rc;
     1151
     1152        /* special placement code for combo or comboex box */
     1153
     1154
     1155        /* get size of edit line */
     1156        GetWindowRect (lpBand->hwndChild, &rc);
     1157        nEditHeight = rc.bottom - rc.top;
     1158        yPos = (lpBand->rcChild.bottom + lpBand->rcChild.top - nEditHeight)/2;
     1159
     1160        /* center combo box inside child area */
     1161        TRACE("moving child (Combo(Ex)) %04x to (%d,%d) for (%d,%d)\n",
     1162              lpBand->hwndChild,
     1163              lpBand->rcChild.left, yPos,
     1164              lpBand->rcChild.right - lpBand->rcChild.left,
     1165              nEditHeight);
     1166        deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,
     1167                       lpBand->rcChild.left,
     1168                       /*lpBand->rcChild.top*/ yPos,
     1169                       lpBand->rcChild.right - lpBand->rcChild.left,
     1170                       nEditHeight,
     1171                       SWP_NOZORDER);
     1172        if (!deferpos)
     1173            ERR("DeferWindowPos returned NULL\n");
     1174        }
     1175        else {
     1176        TRACE("moving child (Other) %04x to (%d,%d) for (%d,%d)\n",
     1177              lpBand->hwndChild,
     1178              lpBand->rcChild.left, lpBand->rcChild.top,
     1179              lpBand->rcChild.right - lpBand->rcChild.left,
     1180              lpBand->rcChild.bottom - lpBand->rcChild.top);
     1181        deferpos = DeferWindowPos (deferpos, lpBand->hwndChild, HWND_TOP,
     1182                       lpBand->rcChild.left,
     1183                       lpBand->rcChild.top,
     1184                       lpBand->rcChild.right - lpBand->rcChild.left,
     1185                       lpBand->rcChild.bottom - lpBand->rcChild.top,
     1186                       SWP_NOZORDER);
     1187        if (!deferpos)
     1188            ERR("DeferWindowPos returned NULL\n");
     1189        }
     1190    }
    11901191    }
    11911192    if (!EndDeferWindowPos(deferpos))
     
    12121213
    12131214    if (!(infoPtr->fStatus & BAND_NEEDS_LAYOUT)) {
    1214         TRACE("no layout done. No band changed.\n");
    1215         REBAR_DumpBand (infoPtr);
    1216         return;
     1215    TRACE("no layout done. No band changed.\n");
     1216    REBAR_DumpBand (infoPtr);
     1217    return;
    12171218    }
    12181219    infoPtr->fStatus &= ~BAND_NEEDS_LAYOUT;
     
    12211222    GetClientRect (infoPtr->hwndSelf, &rcClient);
    12221223    TRACE("Client is (%d,%d)-(%d,%d)\n",
    1223           rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
     1224      rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
    12241225
    12251226    if (lpRect) {
    1226         rcAdj = *lpRect;
    1227         TRACE("adjustment rect is (%d,%d)-(%d,%d)\n",
    1228               rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom);
     1227    rcAdj = *lpRect;
     1228    TRACE("adjustment rect is (%d,%d)-(%d,%d)\n",
     1229          rcAdj.left, rcAdj.top, rcAdj.right, rcAdj.bottom);
    12291230    }
    12301231    else {
     
    12431244
    12441245    if (!infoPtr->DoRedraw && (clientcx == 0) && (clientcy == 0)) {
    1245         ERR("no redraw and client is zero, skip layout\n");
    1246         infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
    1247         return;
     1246    ERR("no redraw and client is zero, skip layout\n");
     1247    infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
     1248    return;
    12481249    }
    12491250
    12501251    /* save height of original control */
    1251     if (infoPtr->dwStyle & CCS_VERT) 
     1252    if (infoPtr->dwStyle & CCS_VERT)
    12521253        origheight = infoPtr->calcSize.cx;
    12531254    else
     
    12581259
    12591260    TRACE("band loop constants, clientcx=%d, clientcy=%d\n",
    1260           clientcx, clientcy);
     1261      clientcx, clientcy);
    12611262    x = 0;
    12621263    y = 0;
     
    12681269
    12691270    for (i = 0; i < infoPtr->uNumBands; i++) {
    1270         lpBand = &infoPtr->bands[i];
    1271         lpBand->fDraw = 0;
    1272         lpBand->iRow = row;
    1273 
    1274         if (HIDDENBAND(lpBand)) continue;
    1275 
    1276         lpBand->rcoldBand = lpBand->rcBand;
    1277 
    1278         /* separator from previous band */
    1279         cxsep = ( ((infoPtr->dwStyle & CCS_VERT) ? y : x)==0) ? 0 : SEP_WIDTH; 
    1280 
    1281         /* Header: includes gripper, text, image */
    1282         cx = lpBand->cxHeader;   
    1283         if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx;
    1284 
    1285         if (infoPtr->dwStyle & CCS_VERT)
    1286             dobreak = (y + cx + cxsep > adjcy);
     1271    lpBand = &infoPtr->bands[i];
     1272    lpBand->fDraw = 0;
     1273    lpBand->iRow = row;
     1274
     1275    if (HIDDENBAND(lpBand)) continue;
     1276
     1277    lpBand->rcoldBand = lpBand->rcBand;
     1278
     1279    /* separator from previous band */
     1280    cxsep = ( ((infoPtr->dwStyle & CCS_VERT) ? y : x)==0) ? 0 : SEP_WIDTH;
     1281
     1282    /* Header: includes gripper, text, image */
     1283    cx = lpBand->cxHeader;
     1284    if (lpBand->fStyle & RBBS_FIXEDSIZE) cx = lpBand->lcx;
     1285
     1286    if (infoPtr->dwStyle & CCS_VERT)
     1287        dobreak = (y + cx + cxsep > adjcy);
    12871288        else
    1288             dobreak = (x + cx + cxsep > adjcx);
    1289 
    1290         /* This is the check for whether we need to start a new row */
    1291         if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) ||
    1292              ( ((infoPtr->dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) {
    1293 
    1294             for (j = rowstart; j < i; j++) {
    1295                 REBAR_BAND *lpB;
    1296                 lpB = &infoPtr->bands[j];
    1297                 if (infoPtr->dwStyle & CCS_VERT) {
    1298                     lpB->rcBand.right  = lpB->rcBand.left + mcy;
    1299                 }
    1300                 else {
    1301                     lpB->rcBand.bottom = lpB->rcBand.top + mcy;
    1302                 }
    1303             }
    1304 
    1305             TRACE("Spliting to new row %d on band %u\n", row+1, i);
    1306             if (infoPtr->dwStyle & CCS_VERT) {
    1307                 y = 0;
    1308                 x += (mcy + SEP_WIDTH);
    1309             }
    1310             else {
    1311                 x = 0;
    1312                 y += (mcy + SEP_WIDTH);
    1313             }
    1314 
    1315             mcy = 0;
    1316             cxsep = 0;
    1317             row++;
    1318             lpBand->iRow = row;
    1319             prevBand = NULL;
    1320             rowstart = i;
    1321         }
    1322 
    1323         if (mcy < lpBand->lcy + REBARSPACE) mcy = lpBand->lcy + REBARSPACE;
    1324 
    1325         /* if boundary rect specified then limit mcy */
    1326         if (lpRect) {
    1327             if (infoPtr->dwStyle & CCS_VERT) {
    1328                 if (x+mcy > adjcx) {
    1329                     mcy = adjcx - x;
    1330                     TRACE("row %u limiting mcy=%d, adjcx=%d, x=%d\n",
    1331                           i, mcy, adjcx, x);
    1332                 }
    1333             }
    1334             else {
    1335                 if (y+mcy > adjcy) {
    1336                     mcy = adjcy - y;
    1337                     TRACE("row %u limiting mcy=%d, adjcy=%d, y=%d\n",
    1338                           i, mcy, adjcy, y);
    1339                 }
    1340             }
    1341         }
    1342 
    1343         TRACE("band %u, row %d, x=%d, y=%d, cxsep=%d, cx=%d\n",
    1344               i, row,
    1345               x, y, cxsep, cx);
    1346         if (infoPtr->dwStyle & CCS_VERT) {
    1347             /* bound the bottom side if we have a bounding rectangle */
    1348             rightx = clientcx;
    1349             bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx;
    1350             lpBand->rcBand.left   = x;
    1351             lpBand->rcBand.right  = x + min(mcy, lpBand->lcy+REBARSPACE);
    1352             lpBand->rcBand.top    = min(bottomy, y + cxsep);
    1353             lpBand->rcBand.bottom = bottomy;
    1354             lpBand->uMinHeight = lpBand->lcy;
    1355             y = bottomy;
    1356         }
    1357         else {
    1358             /* bound the right side if we have a bounding rectangle */
    1359             rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx;
    1360             bottomy = clientcy;
    1361             lpBand->rcBand.left   = min(rightx, x + cxsep);
    1362             lpBand->rcBand.right  = rightx;
    1363             lpBand->rcBand.top    = y;
    1364             lpBand->rcBand.bottom = y + min(mcy, lpBand->lcy+REBARSPACE);
    1365             lpBand->uMinHeight = lpBand->lcy;
    1366             x = rightx;
    1367         }
    1368         TRACE("band %u, row %d, (%d,%d)-(%d,%d)\n",
    1369               i, row,
    1370               lpBand->rcBand.left, lpBand->rcBand.top,
    1371               lpBand->rcBand.right, lpBand->rcBand.bottom);
    1372         prevBand = lpBand;
     1289        dobreak = (x + cx + cxsep > adjcx);
     1290
     1291    /* This is the check for whether we need to start a new row */
     1292    if ( ( (lpBand->fStyle & RBBS_BREAK) && (i != 0) ) ||
     1293         ( ((infoPtr->dwStyle & CCS_VERT) ? (y != 0) : (x != 0)) && dobreak)) {
     1294
     1295        for (j = rowstart; j < i; j++) {
     1296        REBAR_BAND *lpB;
     1297        lpB = &infoPtr->bands[j];
     1298        if (infoPtr->dwStyle & CCS_VERT) {
     1299            lpB->rcBand.right  = lpB->rcBand.left + mcy;
     1300        }
     1301        else {
     1302            lpB->rcBand.bottom = lpB->rcBand.top + mcy;
     1303        }
     1304        }
     1305
     1306        TRACE("Spliting to new row %d on band %u\n", row+1, i);
     1307        if (infoPtr->dwStyle & CCS_VERT) {
     1308        y = 0;
     1309        x += (mcy + SEP_WIDTH);
     1310        }
     1311        else {
     1312        x = 0;
     1313        y += (mcy + SEP_WIDTH);
     1314        }
     1315
     1316        mcy = 0;
     1317        cxsep = 0;
     1318        row++;
     1319        lpBand->iRow = row;
     1320        prevBand = NULL;
     1321        rowstart = i;
     1322    }
     1323
     1324    if (mcy < lpBand->lcy + REBARSPACE) mcy = lpBand->lcy + REBARSPACE;
     1325
     1326    /* if boundary rect specified then limit mcy */
     1327    if (lpRect) {
     1328        if (infoPtr->dwStyle & CCS_VERT) {
     1329            if (x+mcy > adjcx) {
     1330            mcy = adjcx - x;
     1331            TRACE("row %u limiting mcy=%d, adjcx=%d, x=%d\n",
     1332              i, mcy, adjcx, x);
     1333        }
     1334        }
     1335        else {
     1336            if (y+mcy > adjcy) {
     1337            mcy = adjcy - y;
     1338            TRACE("row %u limiting mcy=%d, adjcy=%d, y=%d\n",
     1339              i, mcy, adjcy, y);
     1340        }
     1341        }
     1342    }
     1343
     1344    TRACE("band %u, row %d, x=%d, y=%d, cxsep=%d, cx=%d\n",
     1345          i, row,
     1346          x, y, cxsep, cx);
     1347    if (infoPtr->dwStyle & CCS_VERT) {
     1348        /* bound the bottom side if we have a bounding rectangle */
     1349        rightx = clientcx;
     1350        bottomy = (lpRect) ? min(clientcy, y+cxsep+cx) : y+cxsep+cx;
     1351        lpBand->rcBand.left   = x;
     1352        lpBand->rcBand.right  = x + min(mcy, lpBand->lcy+REBARSPACE);
     1353        lpBand->rcBand.top    = min(bottomy, y + cxsep);
     1354        lpBand->rcBand.bottom = bottomy;
     1355        lpBand->uMinHeight = lpBand->lcy;
     1356        y = bottomy;
     1357    }
     1358    else {
     1359        /* bound the right side if we have a bounding rectangle */
     1360        rightx = (lpRect) ? min(clientcx, x+cxsep+cx) : x+cxsep+cx;
     1361        bottomy = clientcy;
     1362        lpBand->rcBand.left   = min(rightx, x + cxsep);
     1363        lpBand->rcBand.right  = rightx;
     1364        lpBand->rcBand.top    = y;
     1365        lpBand->rcBand.bottom = y + min(mcy, lpBand->lcy+REBARSPACE);
     1366        lpBand->uMinHeight = lpBand->lcy;
     1367        x = rightx;
     1368    }
     1369    TRACE("band %u, row %d, (%d,%d)-(%d,%d)\n",
     1370          i, row,
     1371          lpBand->rcBand.left, lpBand->rcBand.top,
     1372          lpBand->rcBand.right, lpBand->rcBand.bottom);
     1373    prevBand = lpBand;
    13731374
    13741375    } /* for (i = 0; i < infoPtr->uNumBands... */
     
    13801381
    13811382    for (j = rowstart; j < infoPtr->uNumBands; j++) {
    1382         lpBand = &infoPtr->bands[j];
    1383         if (infoPtr->dwStyle & CCS_VERT) {
    1384             lpBand->rcBand.right  = lpBand->rcBand.left + mcy;
    1385         }
    1386         else {
    1387             lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;
    1388         }
     1383    lpBand = &infoPtr->bands[j];
     1384    if (infoPtr->dwStyle & CCS_VERT) {
     1385        lpBand->rcBand.right  = lpBand->rcBand.left + mcy;
     1386    }
     1387    else {
     1388        lpBand->rcBand.bottom = lpBand->rcBand.top + mcy;
     1389    }
    13891390    }
    13901391
     
    13991400    mmcy = 0;
    14001401    if (!(infoPtr->dwStyle & RBS_VARHEIGHT)) {
    1401         INT xy;
    1402 
    1403         /* get the max height of all bands */
    1404         for (i=0; i<infoPtr->uNumBands; i++) {
    1405             lpBand = &infoPtr->bands[i];
    1406             if (HIDDENBAND(lpBand)) continue;
    1407             if (infoPtr->dwStyle & CCS_VERT)
    1408                 mmcy = max(mmcy, lpBand->rcBand.right - lpBand->rcBand.left);
    1409             else
    1410                 mmcy = max(mmcy, lpBand->rcBand.bottom - lpBand->rcBand.top);
    1411         }
    1412 
    1413         /* now adjust all rectangles by using the height found above */
    1414         xy = 0;
    1415         row = 1;
    1416         for (i=0; i<infoPtr->uNumBands; i++) {
    1417             lpBand = &infoPtr->bands[i];
    1418             if (HIDDENBAND(lpBand)) continue;
    1419             if (lpBand->iRow != row)
    1420                 xy += (mmcy + SEP_WIDTH);
    1421             if (infoPtr->dwStyle & CCS_VERT) {
    1422                 lpBand->rcBand.left = xy;
    1423                 lpBand->rcBand.right = xy + mmcy;
    1424             }
    1425             else {
    1426                 lpBand->rcBand.top = xy;
    1427                 lpBand->rcBand.bottom = xy + mmcy;
    1428             }
    1429         }
    1430 
    1431         /* set the x/y values to the correct maximum */
    1432         if (infoPtr->dwStyle & CCS_VERT)
    1433             x = xy + mmcy;
    1434         else
    1435             y = xy + mmcy;
     1402    INT xy;
     1403
     1404    /* get the max height of all bands */
     1405    for (i=0; i<infoPtr->uNumBands; i++) {
     1406        lpBand = &infoPtr->bands[i];
     1407        if (HIDDENBAND(lpBand)) continue;
     1408        if (infoPtr->dwStyle & CCS_VERT)
     1409        mmcy = max(mmcy, lpBand->rcBand.right - lpBand->rcBand.left);
     1410        else
     1411        mmcy = max(mmcy, lpBand->rcBand.bottom - lpBand->rcBand.top);
     1412    }
     1413
     1414    /* now adjust all rectangles by using the height found above */
     1415    xy = 0;
     1416    row = 1;
     1417    for (i=0; i<infoPtr->uNumBands; i++) {
     1418        lpBand = &infoPtr->bands[i];
     1419        if (HIDDENBAND(lpBand)) continue;
     1420        if (lpBand->iRow != row)
     1421        xy += (mmcy + SEP_WIDTH);
     1422        if (infoPtr->dwStyle & CCS_VERT) {
     1423        lpBand->rcBand.left = xy;
     1424        lpBand->rcBand.right = xy + mmcy;
     1425        }
     1426        else {
     1427        lpBand->rcBand.top = xy;
     1428        lpBand->rcBand.bottom = xy + mmcy;
     1429        }
     1430    }
     1431
     1432    /* set the x/y values to the correct maximum */
     1433    if (infoPtr->dwStyle & CCS_VERT)
     1434        x = xy + mmcy;
     1435    else
     1436        y = xy + mmcy;
    14361437    }
    14371438
     
    14451446    if (lpRect) {
    14461447        INT i, j, prev_rh, new_rh, adj_rh, prev_idx, current_idx;
    1447         REBAR_BAND *prev, *current, *walk;
     1448    REBAR_BAND *prev, *current, *walk;
    14481449
    14491450/* FIXME:  problem # 2 */
    1450         if (((infoPtr->dwStyle & CCS_VERT) ?
     1451    if (((infoPtr->dwStyle & CCS_VERT) ?
    14511452#if PROBLEM2
    1452              (x < adjcx) : (y < adjcy)
     1453         (x < adjcx) : (y < adjcy)
    14531454#else
    1454              (adjcx - x > 4) : (adjcy - y > 4)
     1455         (adjcx - x > 4) : (adjcy - y > 4)
    14551456#endif
    1456              ) &&
    1457             (infoPtr->uNumBands > 1)) {
    1458             for (i=(INT)infoPtr->uNumBands-2; i>=0; i--) {
    1459                 TRACE("adjcx=%d, adjcy=%d, x=%d, y=%d\n",
    1460                       adjcx, adjcy, x, y);
    1461 
    1462                 /* find the current band (starts at i+1) */
    1463                 current = &infoPtr->bands[i+1];
    1464                 current_idx = i+1;
    1465                 while (HIDDENBAND(current)) {
    1466                     i--;
    1467                     if (i < 0) break; /* out of bands */
    1468                     current = &infoPtr->bands[i+1];
    1469                     current_idx = i+1;
    1470                 }
    1471                 if (i < 0) break; /* out of bands */
    1472 
    1473                 /* now find the prev band (starts at i) */
    1474                 prev = &infoPtr->bands[i];
    1475                 prev_idx = i;
    1476                 while (HIDDENBAND(prev)) {
    1477                     i--;
    1478                     if (i < 0) break; /* out of bands */
    1479                     prev = &infoPtr->bands[i];
    1480                     prev_idx = i;
    1481                 }
    1482                 if (i < 0) break; /* out of bands */
    1483 
    1484                 prev_rh = ircBw(prev);
    1485                 if (prev->iRow == current->iRow) {
    1486                     new_rh = (infoPtr->dwStyle & RBS_VARHEIGHT) ?
    1487                         current->lcy + REBARSPACE :
    1488                         mmcy;
    1489                     adj_rh = new_rh + SEP_WIDTH;
    1490                     infoPtr->uNumRows++;
    1491                     current->fDraw |= NTF_INVALIDATE;
    1492                     current->iRow++;
    1493                     if (infoPtr->dwStyle & CCS_VERT) {
    1494                         current->rcBand.top = 0;
    1495                         current->rcBand.bottom = clientcy;
    1496                         current->rcBand.left += (prev_rh + SEP_WIDTH);
    1497                         current->rcBand.right = current->rcBand.left + new_rh;
    1498                         x += adj_rh;
    1499                     }
    1500                     else {
    1501                         current->rcBand.left = 0;
    1502                         current->rcBand.right = clientcx;
    1503                         current->rcBand.top += (prev_rh + SEP_WIDTH);
    1504                         current->rcBand.bottom = current->rcBand.top + new_rh;
    1505                         y += adj_rh;
    1506                     }
    1507                     TRACE("moving band %d to own row at (%d,%d)-(%d,%d)\n",
    1508                           current_idx,
    1509                           current->rcBand.left, current->rcBand.top,
    1510                           current->rcBand.right, current->rcBand.bottom);
    1511                     TRACE("prev band %d at (%d,%d)-(%d,%d)\n",
    1512                           prev_idx,
    1513                           prev->rcBand.left, prev->rcBand.top,
    1514                           prev->rcBand.right, prev->rcBand.bottom);
    1515                     TRACE("values: prev_rh=%d, new_rh=%d, adj_rh=%d\n",
    1516                           prev_rh, new_rh, adj_rh);
    1517                     /* for bands below current adjust row # and top/bottom */
    1518                     for (j = current_idx+1; j<infoPtr->uNumBands; j++) {
    1519                         walk = &infoPtr->bands[j];
    1520                         if (HIDDENBAND(walk)) continue;
    1521                         walk->fDraw |= NTF_INVALIDATE;
    1522                         walk->iRow++;
    1523                         if (infoPtr->dwStyle & CCS_VERT) {
    1524                             walk->rcBand.left += adj_rh;
    1525                             walk->rcBand.right += adj_rh;
    1526                         }
    1527                         else {
    1528                             walk->rcBand.top += adj_rh;
    1529                             walk->rcBand.bottom += adj_rh;
    1530                         }
    1531                     }
    1532                     if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy))
    1533                         break; /* all done */
    1534                 }
    1535             }
    1536         }
     1457         ) &&
     1458        (infoPtr->uNumBands > 1)) {
     1459        for (i=(INT)infoPtr->uNumBands-2; i>=0; i--) {
     1460        TRACE("adjcx=%d, adjcy=%d, x=%d, y=%d\n",
     1461              adjcx, adjcy, x, y);
     1462
     1463        /* find the current band (starts at i+1) */
     1464        current = &infoPtr->bands[i+1];
     1465        current_idx = i+1;
     1466        while (HIDDENBAND(current)) {
     1467            i--;
     1468            if (i < 0) break; /* out of bands */
     1469            current = &infoPtr->bands[i+1];
     1470            current_idx = i+1;
     1471        }
     1472        if (i < 0) break; /* out of bands */
     1473
     1474        /* now find the prev band (starts at i) */
     1475            prev = &infoPtr->bands[i];
     1476        prev_idx = i;
     1477        while (HIDDENBAND(prev)) {
     1478            i--;
     1479            if (i < 0) break; /* out of bands */
     1480            prev = &infoPtr->bands[i];
     1481            prev_idx = i;
     1482        }
     1483        if (i < 0) break; /* out of bands */
     1484
     1485        prev_rh = ircBw(prev);
     1486        if (prev->iRow == current->iRow) {
     1487            new_rh = (infoPtr->dwStyle & RBS_VARHEIGHT) ?
     1488            current->lcy + REBARSPACE :
     1489            mmcy;
     1490            adj_rh = new_rh + SEP_WIDTH;
     1491            infoPtr->uNumRows++;
     1492            current->fDraw |= NTF_INVALIDATE;
     1493            current->iRow++;
     1494            if (infoPtr->dwStyle & CCS_VERT) {
     1495                current->rcBand.top = 0;
     1496            current->rcBand.bottom = clientcy;
     1497            current->rcBand.left += (prev_rh + SEP_WIDTH);
     1498            current->rcBand.right = current->rcBand.left + new_rh;
     1499            x += adj_rh;
     1500            }
     1501            else {
     1502                current->rcBand.left = 0;
     1503            current->rcBand.right = clientcx;
     1504            current->rcBand.top += (prev_rh + SEP_WIDTH);
     1505            current->rcBand.bottom = current->rcBand.top + new_rh;
     1506            y += adj_rh;
     1507            }
     1508            TRACE("moving band %d to own row at (%d,%d)-(%d,%d)\n",
     1509              current_idx,
     1510              current->rcBand.left, current->rcBand.top,
     1511              current->rcBand.right, current->rcBand.bottom);
     1512            TRACE("prev band %d at (%d,%d)-(%d,%d)\n",
     1513              prev_idx,
     1514              prev->rcBand.left, prev->rcBand.top,
     1515              prev->rcBand.right, prev->rcBand.bottom);
     1516            TRACE("values: prev_rh=%d, new_rh=%d, adj_rh=%d\n",
     1517              prev_rh, new_rh, adj_rh);
     1518            /* for bands below current adjust row # and top/bottom */
     1519            for (j = current_idx+1; j<infoPtr->uNumBands; j++) {
     1520                walk = &infoPtr->bands[j];
     1521            if (HIDDENBAND(walk)) continue;
     1522            walk->fDraw |= NTF_INVALIDATE;
     1523            walk->iRow++;
     1524            if (infoPtr->dwStyle & CCS_VERT) {
     1525                walk->rcBand.left += adj_rh;
     1526                walk->rcBand.right += adj_rh;
     1527            }
     1528            else {
     1529                walk->rcBand.top += adj_rh;
     1530                walk->rcBand.bottom += adj_rh;
     1531            }
     1532            }
     1533            if ((infoPtr->dwStyle & CCS_VERT) ? (x >= adjcx) : (y >= adjcy))
     1534                break; /* all done */
     1535        }
     1536        }
     1537    }
    15371538    }
    15381539
     
    15451546    /*   clientcy/clientcx     height/width of client area           */
    15461547
    1547     /* **** FIXME FIXME FIXME 
     1548    /* **** FIXME FIXME FIXME
    15481549     *   this does not take into account that more than one band
    15491550     *   is in a row!!!!!!!!!
     
    15511552
    15521553    if (((infoPtr->dwStyle & CCS_VERT) ? clientcx > x : clientcy > y) &&
    1553         infoPtr->uNumBands) {
    1554         INT diff, i, j;
    1555 
    1556         diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y;
    1557         for (i = infoPtr->uNumBands-1; i >= 0; i--) {
    1558             lpBand = &infoPtr->bands[i];
    1559             if(HIDDENBAND(lpBand)) continue;
    1560             if (!lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
    1561             if (((INT)lpBand->cyMaxChild < 1) ||
    1562                 ((INT)lpBand->cyIntegral < 1)) {
    1563                 if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue;
    1564                 ERR("band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n",
    1565                     i, lpBand->cyMaxChild, lpBand->cyIntegral);
    1566                 continue;
    1567             }
    1568             /* j is now the maximum height/width in the client area */
    1569             j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) +
    1570                 ircBw(lpBand);
    1571             if (j > lpBand->cyMaxChild + REBARSPACE)
    1572                 j = lpBand->cyMaxChild + REBARSPACE;
    1573             diff -= (j - ircBw(lpBand));
    1574             if (infoPtr->dwStyle & CCS_VERT)
    1575                 lpBand->rcBand.right = lpBand->rcBand.left + j;
    1576             else
    1577                 lpBand->rcBand.bottom = lpBand->rcBand.top + j;
    1578             TRACE("P2a band %d, row %d changed to (%d,%d)-(%d,%d)\n",
    1579                   i, lpBand->iRow,
    1580                   lpBand->rcBand.left, lpBand->rcBand.top,
    1581                   lpBand->rcBand.right, lpBand->rcBand.bottom);
    1582             if (diff <= 0) break;
    1583         }
    1584         if (diff < 0) {
    1585             ERR("allocated more than available, diff=%d\n", diff);
    1586             diff = 0;
    1587         }
    1588         if (infoPtr->dwStyle & CCS_VERT)
    1589             x = clientcx - diff;
    1590         else
    1591             y = clientcy - diff;
     1554    infoPtr->uNumBands) {
     1555    INT diff, i, j;
     1556
     1557    diff = (infoPtr->dwStyle & CCS_VERT) ? clientcx - x : clientcy - y;
     1558    for (i = infoPtr->uNumBands-1; i >= 0; i--) {
     1559        lpBand = &infoPtr->bands[i];
     1560        if(HIDDENBAND(lpBand)) continue;
     1561        if (!lpBand->fMask & RBBS_VARIABLEHEIGHT) continue;
     1562        if (((INT)lpBand->cyMaxChild < 1) ||
     1563        ((INT)lpBand->cyIntegral < 1)) {
     1564        if (lpBand->cyMaxChild + lpBand->cyIntegral == 0) continue;
     1565        ERR("band %u RBBS_VARIABLEHEIGHT set but cyMax=%d, cyInt=%d\n",
     1566            i, lpBand->cyMaxChild, lpBand->cyIntegral);
     1567        continue;
     1568        }
     1569        /* j is now the maximum height/width in the client area */
     1570        j = ((diff / lpBand->cyIntegral) * lpBand->cyIntegral) +
     1571        ircBw(lpBand);
     1572        if (j > lpBand->cyMaxChild + REBARSPACE)
     1573        j = lpBand->cyMaxChild + REBARSPACE;
     1574        diff -= (j - ircBw(lpBand));
     1575        if (infoPtr->dwStyle & CCS_VERT)
     1576        lpBand->rcBand.right = lpBand->rcBand.left + j;
     1577        else
     1578        lpBand->rcBand.bottom = lpBand->rcBand.top + j;
     1579        TRACE("P2a band %d, row %d changed to (%d,%d)-(%d,%d)\n",
     1580          i, lpBand->iRow,
     1581          lpBand->rcBand.left, lpBand->rcBand.top,
     1582          lpBand->rcBand.right, lpBand->rcBand.bottom);
     1583        if (diff <= 0) break;
     1584    }
     1585    if (diff < 0) {
     1586        ERR("allocated more than available, diff=%d\n", diff);
     1587        diff = 0;
     1588    }
     1589    if (infoPtr->dwStyle & CCS_VERT)
     1590        x = clientcx - diff;
     1591    else
     1592        y = clientcy - diff;
    15921593    }
    15931594
     
    15981599
    15991600    if (infoPtr->uNumBands) {
    1600         INT bandnum, bandnum_start, bandnum_end;
    1601 
    1602         /* If RBS_BANDBORDERS set then indicate to draw bottom separator */
    1603         /* on all bands in all rows but last row.                        */
    1604         /* Also indicate to draw the right separator for each band in    */
    1605         /* each row but the rightmost band.                              */
    1606         if (infoPtr->dwStyle & RBS_BANDBORDERS) {
    1607             REBAR_BAND *prevband;
    1608             INT currow;
    1609 
    1610             prevband = NULL;
    1611             currow = -1;
    1612             for (i = 0; i < infoPtr->uNumBands; i++) {
    1613                 lpBand = &infoPtr->bands[i];
    1614                 if (HIDDENBAND(lpBand)) continue;
    1615 
    1616                 if (lpBand->iRow < infoPtr->uNumRows)
    1617                     lpBand->fDraw |= DRAW_BOTTOMSEP;
    1618 
    1619                 if (lpBand->iRow != currow) prevband = NULL;
    1620                 currow = lpBand->iRow;
    1621                 if (prevband) prevband->fDraw |= DRAW_RIGHTSEP;
    1622                 prevband = lpBand;
    1623             }
    1624         }
    1625 
    1626         /* Distribute the extra space on the horizontal and adjust  */
    1627         /* all bands in row to same height.                         */
    1628         bandnum = 0;
    1629         for (i=1; i<=infoPtr->uNumRows; i++) {
    1630             bandnum_start = -1;
    1631             bandnum_end = -1;
    1632             mcy = 0;
    1633             TRACE("processing row %d, starting band %d\n", i, bandnum);
    1634             while (TRUE) {
    1635                 lpBand = &infoPtr->bands[bandnum];
    1636                 if ((bandnum >= infoPtr->uNumBands) ||
    1637                     ((lpBand->iRow != i) &&
    1638                      !HIDDENBAND(lpBand))) {
    1639                     if ((bandnum_start == -1) ||
    1640                         (bandnum_end == -1)) {
    1641                         ERR("logic error? bands=%d, rows=%d, start=%d, end=%d\n",
    1642                             infoPtr->uNumBands, infoPtr->uNumRows,
    1643                             (INT)bandnum_start, (INT)bandnum_end);
    1644                         ERR("  current row=%d, band=%d\n",
    1645                             i, bandnum);
    1646                         break;
    1647                     }
    1648                     REBAR_AdjustBands (infoPtr, bandnum_start, bandnum_end,
    1649                                        (infoPtr->dwStyle & CCS_VERT) ?
    1650                                        clientcy : clientcx, mcy);
    1651                     break;
    1652                 }
    1653                 if (!HIDDENBAND(lpBand)) {
    1654                     if (bandnum_start == -1) bandnum_start = bandnum;
    1655                     if (bandnum_end < bandnum) bandnum_end = bandnum;
    1656                     if (mcy < ircBw(lpBand))
    1657                         mcy = ircBw(lpBand);
    1658                 }
    1659                 bandnum++;
    1660                 TRACE("point 1, bandnum=%d\n", bandnum);
    1661             }
    1662             TRACE("point 2, i=%d, numrows=%d, bandnum=%d\n",
    1663                   i, infoPtr->uNumRows, bandnum);
    1664         }
    1665         TRACE("point 3\n");
    1666 
    1667         /* Calculate the other rectangles in each band */
    1668         if (infoPtr->dwStyle & CCS_VERT) {
    1669             REBAR_CalcVertBand (infoPtr, 0, infoPtr->uNumBands,
    1670                                 notify);
    1671         }
    1672         else {
    1673             REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands,
    1674                                 notify);
    1675         }
     1601    INT bandnum, bandnum_start, bandnum_end;
     1602
     1603    /* If RBS_BANDBORDERS set then indicate to draw bottom separator */
     1604    /* on all bands in all rows but last row.                        */
     1605    /* Also indicate to draw the right separator for each band in    */
     1606    /* each row but the rightmost band.                              */
     1607    if (infoPtr->dwStyle & RBS_BANDBORDERS) {
     1608        REBAR_BAND *prevband;
     1609        INT currow;
     1610
     1611        prevband = NULL;
     1612        currow = -1;
     1613        for (i = 0; i < infoPtr->uNumBands; i++) {
     1614            lpBand = &infoPtr->bands[i];
     1615        if (HIDDENBAND(lpBand)) continue;
     1616
     1617        if (lpBand->iRow < infoPtr->uNumRows)
     1618            lpBand->fDraw |= DRAW_BOTTOMSEP;
     1619
     1620        if (lpBand->iRow != currow) prevband = NULL;
     1621        currow = lpBand->iRow;
     1622        if (prevband) prevband->fDraw |= DRAW_RIGHTSEP;
     1623        prevband = lpBand;
     1624        }
     1625    }
     1626
     1627    /* Distribute the extra space on the horizontal and adjust  */
     1628    /* all bands in row to same height.                         */
     1629    bandnum = 0;
     1630    for (i=1; i<=infoPtr->uNumRows; i++) {
     1631        bandnum_start = -1;
     1632        bandnum_end = -1;
     1633        mcy = 0;
     1634        TRACE("processing row %d, starting band %d\n", i, bandnum);
     1635        while (TRUE) {
     1636        lpBand = &infoPtr->bands[bandnum];
     1637        if ((bandnum >= infoPtr->uNumBands) ||
     1638            ((lpBand->iRow != i) &&
     1639             !HIDDENBAND(lpBand))) {
     1640            if ((bandnum_start == -1) ||
     1641            (bandnum_end == -1)) {
     1642            ERR("logic error? bands=%d, rows=%d, start=%d, end=%d\n",
     1643                infoPtr->uNumBands, infoPtr->uNumRows,
     1644                (INT)bandnum_start, (INT)bandnum_end);
     1645            ERR("  current row=%d, band=%d\n",
     1646                i, bandnum);
     1647            break;
     1648            }
     1649            REBAR_AdjustBands (infoPtr, bandnum_start, bandnum_end,
     1650                       (infoPtr->dwStyle & CCS_VERT) ?
     1651                       clientcy : clientcx, mcy);
     1652            break;
     1653        }
     1654        if (!HIDDENBAND(lpBand)) {
     1655            if (bandnum_start == -1) bandnum_start = bandnum;
     1656            if (bandnum_end < bandnum) bandnum_end = bandnum;
     1657            if (mcy < ircBw(lpBand))
     1658            mcy = ircBw(lpBand);
     1659        }
     1660        bandnum++;
     1661        TRACE("point 1, bandnum=%d\n", bandnum);
     1662        }
     1663        TRACE("point 2, i=%d, numrows=%d, bandnum=%d\n",
     1664          i, infoPtr->uNumRows, bandnum);
     1665    }
     1666    TRACE("point 3\n");
     1667
     1668    /* Calculate the other rectangles in each band */
     1669    if (infoPtr->dwStyle & CCS_VERT) {
     1670        REBAR_CalcVertBand (infoPtr, 0, infoPtr->uNumBands,
     1671                notify);
     1672    }
     1673    else {
     1674        REBAR_CalcHorzBand (infoPtr, 0, infoPtr->uNumBands,
     1675                notify);
     1676    }
    16761677    }
    16771678
     
    16811682    infoPtr->oldSize = infoPtr->calcSize;
    16821683    if (infoPtr->dwStyle & CCS_VERT) {
    1683         infoPtr->calcSize.cx = x;
    1684         infoPtr->calcSize.cy = clientcy;
    1685         TRACE("vert, notify=%d, x=%d, origheight=%d\n",
    1686               notify, x, origheight);
    1687         if (notify && (x != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;
     1684    infoPtr->calcSize.cx = x;
     1685    infoPtr->calcSize.cy = clientcy;
     1686    TRACE("vert, notify=%d, x=%d, origheight=%d\n",
     1687          notify, x, origheight);
     1688    if (notify && (x != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;
    16881689    }
    16891690    else {
    1690         infoPtr->calcSize.cx = clientcx;
    1691         infoPtr->calcSize.cy = y;
    1692         TRACE("horz, notify=%d, y=%d, origheight=%d\n",
    1693               notify, y, origheight);
    1694         if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;
     1691    infoPtr->calcSize.cx = clientcx;
     1692    infoPtr->calcSize.cy = y;
     1693    TRACE("horz, notify=%d, y=%d, origheight=%d\n",
     1694          notify, y, origheight);
     1695    if (notify && (y != origheight)) infoPtr->fStatus |= NTF_HGHTCHG;
    16951696    }
    16961697
     
    17491750    /* calculate gripper rectangle */
    17501751    if (  (!(lpBand->fStyle & RBBS_NOGRIPPER)) &&
    1751           ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
    1752             ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (infoPtr->uNumBands > 1)))
     1752      ( (lpBand->fStyle & RBBS_GRIPPERALWAYS) ||
     1753        ( !(lpBand->fStyle & RBBS_FIXEDSIZE) && (infoPtr->uNumBands > 1)))
    17531754       ) {
    1754         lpBand->fStatus |= HAS_GRIPPER;
     1755    lpBand->fStatus |= HAS_GRIPPER;
    17551756        if (infoPtr->dwStyle & CCS_VERT)
    1756             if (infoPtr->dwStyle & RBS_VERTICALGRIPPER)
     1757        if (infoPtr->dwStyle & RBS_VERTICALGRIPPER)
    17571758                header += (GRIPPER_HEIGHT + REBAR_PRE_GRIPPER);
    17581759            else
    1759                 header += (GRIPPER_WIDTH + REBAR_PRE_GRIPPER);
     1760            header += (GRIPPER_WIDTH + REBAR_PRE_GRIPPER);
    17601761        else
    17611762            header += (REBAR_PRE_GRIPPER + GRIPPER_WIDTH);
     
    17661767    /* image is visible */
    17671768    if ((lpBand->fMask & RBBIM_IMAGE) && (infoPtr->himl)) {
    1768         lpBand->fStatus |= HAS_IMAGE;
     1769    lpBand->fStatus |= HAS_IMAGE;
    17691770        if (infoPtr->dwStyle & CCS_VERT) {
    1770            header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE);
    1771            lpBand->lcy = infoPtr->imageSize.cx + 2;
    1772         }
    1773         else {
    1774            header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE);
    1775            lpBand->lcy = infoPtr->imageSize.cy + 2;
    1776         }
     1771       header += (infoPtr->imageSize.cy + REBAR_POST_IMAGE);
     1772       lpBand->lcy = infoPtr->imageSize.cx + 2;
     1773    }
     1774    else {
     1775       header += (infoPtr->imageSize.cx + REBAR_POST_IMAGE);
     1776       lpBand->lcy = infoPtr->imageSize.cy + 2;
     1777    }
    17771778    }
    17781779
    17791780    /* text is visible */
    17801781    if ((lpBand->fMask & RBBIM_TEXT) && (lpBand->lpText)) {
    1781         HDC hdc = GetDC (0);
    1782         HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
    1783         SIZE size;
    1784 
    1785         lpBand->fStatus |= HAS_TEXT;
    1786         GetTextExtentPoint32W (hdc, lpBand->lpText,
    1787                                lstrlenW (lpBand->lpText), &size);
    1788         header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT));
    1789         textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy;
    1790 
    1791         SelectObject (hdc, hOldFont);
    1792         ReleaseDC (0, hdc);
     1782    HDC hdc = GetDC (0);
     1783    HFONT hOldFont = SelectObject (hdc, infoPtr->hFont);
     1784    SIZE size;
     1785
     1786    lpBand->fStatus |= HAS_TEXT;
     1787    GetTextExtentPoint32W (hdc, lpBand->lpText,
     1788                   lstrlenW (lpBand->lpText), &size);
     1789    header += ((infoPtr->dwStyle & CCS_VERT) ? (size.cy + REBAR_POST_TEXT) : (size.cx + REBAR_POST_TEXT));
     1790    textheight = (infoPtr->dwStyle & CCS_VERT) ? 0 : size.cy;
     1791
     1792    SelectObject (hdc, hOldFont);
     1793    ReleaseDC (0, hdc);
    17931794    }
    17941795
    17951796    /* if no gripper but either image or text, then leave space */
    17961797    if ((lpBand->fStatus & (HAS_IMAGE | HAS_TEXT)) &&
    1797         !(lpBand->fStatus & HAS_GRIPPER)) {
    1798         header += REBAR_ALWAYS_SPACE;
     1798    !(lpBand->fStatus & HAS_GRIPPER)) {
     1799    header += REBAR_ALWAYS_SPACE;
    17991800    }
    18001801
     
    18101811    lpBand->ccy = lpBand->lcy;
    18111812    if (lpBand->fMask & RBBIM_CHILDSIZE) {
    1812         if (!(lpBand->fStyle & RBBS_FIXEDSIZE)) {
    1813             lpBand->offChild.cx = 4;
    1814             lpBand->offChild.cy = 2;
     1813    if (!(lpBand->fStyle & RBBS_FIXEDSIZE)) {
     1814        lpBand->offChild.cx = 4;
     1815        lpBand->offChild.cy = 2;
    18151816        }
    18161817        lpBand->lcx = lpBand->cxMinChild;
    18171818
    1818         /* Set the .cy values for CHILDSIZE case */
     1819    /* Set the .cy values for CHILDSIZE case */
    18191820        lpBand->lcy = max(lpBand->lcy, lpBand->cyMinChild);
    1820         lpBand->ccy = lpBand->lcy;
     1821    lpBand->ccy = lpBand->lcy;
    18211822        lpBand->hcy = lpBand->lcy;
    18221823        if (lpBand->cyMaxChild != 0xffffffff) {
    1823             lpBand->hcy = lpBand->cyMaxChild;
    1824         }
    1825         if (lpBand->cyChild != 0xffffffff)
    1826             lpBand->ccy = max (lpBand->cyChild, lpBand->lcy);
     1824        lpBand->hcy = lpBand->cyMaxChild;
     1825        }
     1826    if (lpBand->cyChild != 0xffffffff)
     1827        lpBand->ccy = max (lpBand->cyChild, lpBand->lcy);
    18271828
    18281829        TRACE("_CHILDSIZE\n");
     
    18511852
    18521853    if (lprbbi->fMask & RBBIM_STYLE)
    1853         lpBand->fStyle = lprbbi->fStyle;
     1854    lpBand->fStyle = lprbbi->fStyle;
    18541855
    18551856    if (lprbbi->fMask & RBBIM_COLORS) {
    1856         lpBand->clrFore = lprbbi->clrFore;
    1857         lpBand->clrBack = lprbbi->clrBack;
     1857    lpBand->clrFore = lprbbi->clrFore;
     1858    lpBand->clrBack = lprbbi->clrBack;
    18581859    }
    18591860
    18601861    if (lprbbi->fMask & RBBIM_IMAGE)
    1861         lpBand->iImage = lprbbi->iImage;
     1862    lpBand->iImage = lprbbi->iImage;
    18621863
    18631864    if (lprbbi->fMask & RBBIM_CHILD) {
    1864         if (lprbbi->hwndChild) {
    1865             lpBand->hwndChild = lprbbi->hwndChild;
    1866             lpBand->hwndPrevParent =
    1867                 SetParent (lpBand->hwndChild, hwnd);
    1868             /* below in trace fro WinRAR */
    1869             ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL);
    1870             /* above in trace fro WinRAR */
    1871         }
    1872         else {
    1873             TRACE("child: 0x%x  prev parent: 0x%x\n",
    1874                    lpBand->hwndChild, lpBand->hwndPrevParent);
    1875             lpBand->hwndChild = 0;
    1876             lpBand->hwndPrevParent = 0;
    1877         }
     1865    if (lprbbi->hwndChild) {
     1866        lpBand->hwndChild = lprbbi->hwndChild;
     1867        lpBand->hwndPrevParent =
     1868        SetParent (lpBand->hwndChild, hwnd);
     1869        /* below in trace fro WinRAR */
     1870        ShowWindow(lpBand->hwndChild, SW_SHOWNOACTIVATE | SW_SHOWNORMAL);
     1871        /* above in trace fro WinRAR */
     1872    }
     1873    else {
     1874        TRACE("child: 0x%x  prev parent: 0x%x\n",
     1875           lpBand->hwndChild, lpBand->hwndPrevParent);
     1876        lpBand->hwndChild = 0;
     1877        lpBand->hwndPrevParent = 0;
     1878    }
    18781879    }
    18791880
    18801881    if (lprbbi->fMask & RBBIM_CHILDSIZE) {
    1881         lpBand->cxMinChild = lprbbi->cxMinChild;
    1882         lpBand->cyMinChild = lprbbi->cyMinChild;
    1883         if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
    1884             lpBand->cyChild    = lprbbi->cyChild;
    1885             lpBand->cyMaxChild = lprbbi->cyMaxChild;
    1886             lpBand->cyIntegral = lprbbi->cyIntegral;
    1887         }
    1888         else { /* special case - these should be zeroed out since   */
    1889                /* RBBIM_CHILDSIZE added these in WIN32_IE >= 0x0400 */
    1890             lpBand->cyChild    = 0;
    1891             lpBand->cyMaxChild = 0;
    1892             lpBand->cyIntegral = 0;
    1893         }
     1882    lpBand->cxMinChild = lprbbi->cxMinChild;
     1883    lpBand->cyMinChild = lprbbi->cyMinChild;
     1884    if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
     1885        lpBand->cyChild    = lprbbi->cyChild;
     1886        lpBand->cyMaxChild = lprbbi->cyMaxChild;
     1887        lpBand->cyIntegral = lprbbi->cyIntegral;
     1888    }
     1889    else { /* special case - these should be zeroed out since   */
     1890           /* RBBIM_CHILDSIZE added these in WIN32_IE >= 0x0400 */
     1891        lpBand->cyChild    = 0;
     1892        lpBand->cyMaxChild = 0;
     1893        lpBand->cyIntegral = 0;
     1894    }
    18941895    }
    18951896
    18961897    if (lprbbi->fMask & RBBIM_SIZE)
    1897         lpBand->cx = lprbbi->cx;
     1898    lpBand->cx = lprbbi->cx;
    18981899
    18991900    if (lprbbi->fMask & RBBIM_BACKGROUND)
    1900         lpBand->hbmBack = lprbbi->hbmBack;
     1901    lpBand->hbmBack = lprbbi->hbmBack;
    19011902
    19021903    if (lprbbi->fMask & RBBIM_ID)
    1903         lpBand->wID = lprbbi->wID;
     1904    lpBand->wID = lprbbi->wID;
    19041905
    19051906    /* check for additional data */
    19061907    if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
    1907         if (lprbbi->fMask & RBBIM_IDEALSIZE)
    1908             lpBand->cxIdeal = lprbbi->cxIdeal;
    1909 
    1910         if (lprbbi->fMask & RBBIM_LPARAM)
    1911             lpBand->lParam = lprbbi->lParam;
    1912 
    1913         if (lprbbi->fMask & RBBIM_HEADERSIZE)
    1914             lpBand->cxHeader = lprbbi->cxHeader;
     1908    if (lprbbi->fMask & RBBIM_IDEALSIZE)
     1909        lpBand->cxIdeal = lprbbi->cxIdeal;
     1910
     1911    if (lprbbi->fMask & RBBIM_LPARAM)
     1912        lpBand->lParam = lprbbi->lParam;
     1913
     1914    if (lprbbi->fMask & RBBIM_HEADERSIZE)
     1915        lpBand->cxHeader = lprbbi->cxHeader;
    19151916    }
    19161917}
     
    19321933    for(i=0; i<infoPtr->uNumBands; i++) {
    19331934        lpBand = &infoPtr->bands[i];
    1934         if (HIDDENBAND(lpBand)) continue;
    1935 
    1936         /* draw band separator between rows */
    1937         if (lpBand->iRow != oldrow) {
    1938             oldrow = lpBand->iRow;
    1939             if (lpBand->fDraw & DRAW_BOTTOMSEP) {
    1940                 RECT rcRowSep;
    1941                 rcRowSep = lpBand->rcBand;
    1942                 if (infoPtr->dwStyle & CCS_VERT) {
    1943                     rcRowSep.right += SEP_WIDTH_SIZE;
    1944                     rcRowSep.bottom = infoPtr->calcSize.cy;
    1945                     DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT);
    1946                 }
    1947                 else {
    1948                     rcRowSep.bottom += SEP_WIDTH_SIZE;
    1949                     rcRowSep.right = infoPtr->calcSize.cx;
    1950                     DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM);
    1951                 }
    1952                 TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n",
    1953                        rcRowSep.left, rcRowSep.top,
    1954                        rcRowSep.right, rcRowSep.bottom);
    1955             }
    1956         }
    1957 
    1958         /* draw band separator between bands in a row */
    1959         if (lpBand->fDraw & DRAW_RIGHTSEP) {
    1960             RECT rcSep;
    1961             rcSep = lpBand->rcBand;
    1962             if (infoPtr->dwStyle & CCS_VERT) {
    1963                 rcSep.bottom += SEP_WIDTH_SIZE;
    1964                 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM);
    1965             }
    1966             else {
    1967                 rcSep.right += SEP_WIDTH_SIZE;
    1968                 DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT);
    1969             }
    1970             TRACE("drawing band separator right (%d,%d)-(%d,%d)\n",
    1971                   rcSep.left, rcSep.top, rcSep.right, rcSep.bottom);
    1972         }
    1973 
    1974         /* draw the actual background */
    1975         if (lpBand->clrBack != CLR_NONE)
    1976             new = lpBand->clrBack;
    1977         else
    1978             new = infoPtr->clrBtnFace;
    1979         rect = lpBand->rcBand;
    1980         old = SetBkColor (hdc, new);
    1981         TRACE("%s backround color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n",
    1982               (lpBand->clrBack == CLR_NONE) ? "std" : "",
    1983               new,
    1984               lpBand->rcBand.left,lpBand->rcBand.top,
    1985               lpBand->rcBand.right,lpBand->rcBand.bottom,
    1986               clip->left, clip->top,
    1987               clip->right, clip->bottom);
    1988         ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0);
    1989         SetBkColor (hdc, old);
     1935    if (HIDDENBAND(lpBand)) continue;
     1936
     1937    /* draw band separator between rows */
     1938    if (lpBand->iRow != oldrow) {
     1939        oldrow = lpBand->iRow;
     1940        if (lpBand->fDraw & DRAW_BOTTOMSEP) {
     1941        RECT rcRowSep;
     1942        rcRowSep = lpBand->rcBand;
     1943        if (infoPtr->dwStyle & CCS_VERT) {
     1944            rcRowSep.right += SEP_WIDTH_SIZE;
     1945            rcRowSep.bottom = infoPtr->calcSize.cy;
     1946            DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_RIGHT);
     1947        }
     1948        else {
     1949            rcRowSep.bottom += SEP_WIDTH_SIZE;
     1950            rcRowSep.right = infoPtr->calcSize.cx;
     1951            DrawEdge (hdc, &rcRowSep, EDGE_ETCHED, BF_BOTTOM);
     1952        }
     1953        TRACE ("drawing band separator bottom (%d,%d)-(%d,%d)\n",
     1954               rcRowSep.left, rcRowSep.top,
     1955               rcRowSep.right, rcRowSep.bottom);
     1956        }
     1957    }
     1958
     1959    /* draw band separator between bands in a row */
     1960    if (lpBand->fDraw & DRAW_RIGHTSEP) {
     1961        RECT rcSep;
     1962        rcSep = lpBand->rcBand;
     1963        if (infoPtr->dwStyle & CCS_VERT) {
     1964        rcSep.bottom += SEP_WIDTH_SIZE;
     1965        DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_BOTTOM);
     1966        }
     1967        else {
     1968        rcSep.right += SEP_WIDTH_SIZE;
     1969        DrawEdge (hdc, &rcSep, EDGE_ETCHED, BF_RIGHT);
     1970        }
     1971        TRACE("drawing band separator right (%d,%d)-(%d,%d)\n",
     1972          rcSep.left, rcSep.top, rcSep.right, rcSep.bottom);
     1973    }
     1974
     1975    /* draw the actual background */
     1976    if (lpBand->clrBack != CLR_NONE)
     1977        new = lpBand->clrBack;
     1978    else
     1979        new = infoPtr->clrBtnFace;
     1980    rect = lpBand->rcBand;
     1981    old = SetBkColor (hdc, new);
     1982    TRACE("%s backround color=0x%06lx, band (%d,%d)-(%d,%d), clip (%d,%d)-(%d,%d)\n",
     1983          (lpBand->clrBack == CLR_NONE) ? "std" : "",
     1984          new,
     1985          lpBand->rcBand.left,lpBand->rcBand.top,
     1986          lpBand->rcBand.right,lpBand->rcBand.bottom,
     1987          clip->left, clip->top,
     1988          clip->right, clip->bottom);
     1989    ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0);
     1990    SetBkColor (hdc, old);
    19901991    }
    19911992    return TRUE;
     
    20042005    if (PtInRect (&rect, *lpPt))
    20052006    {
    2006         if (infoPtr->uNumBands == 0) {
    2007             *pFlags = RBHT_NOWHERE;
    2008             if (pBand)
    2009                 *pBand = -1;
    2010             TRACE("NOWHERE\n");
    2011             return;
    2012         }
    2013         else {
    2014             /* somewhere inside */
    2015             infoPtr->ihitBand = -1;
    2016             for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
    2017                 lpBand = &infoPtr->bands[iCount];
    2018                 if (HIDDENBAND(lpBand)) continue;
    2019                 if (PtInRect (&lpBand->rcBand, *lpPt)) {
    2020                     if (pBand)
    2021                         *pBand = iCount;
    2022                     if (PtInRect (&lpBand->rcGripper, *lpPt)) {
    2023                         *pFlags = RBHT_GRABBER;
    2024                         infoPtr->ihitBand = iCount;
    2025                         TRACE("ON GRABBER %d\n", iCount);
    2026                         return;
    2027                     }
    2028                     else if (PtInRect (&lpBand->rcCapImage, *lpPt)) {
    2029                         *pFlags = RBHT_CAPTION;
    2030                         TRACE("ON CAPTION %d\n", iCount);
    2031                         return;
    2032                     }
    2033                     else if (PtInRect (&lpBand->rcCapText, *lpPt)) {
    2034                         *pFlags = RBHT_CAPTION;
    2035                         TRACE("ON CAPTION %d\n", iCount);
    2036                         return;
    2037                     }
    2038                     else if (PtInRect (&lpBand->rcChild, *lpPt)) {
    2039                         *pFlags = RBHT_CLIENT;
    2040                         TRACE("ON CLIENT %d\n", iCount);
    2041                         return;
    2042                     }
    2043                     else {
    2044                         *pFlags = RBHT_NOWHERE;
    2045                         TRACE("NOWHERE %d\n", iCount);
    2046                         return;
    2047                     }
    2048                 }
    2049             }
    2050 
    2051             *pFlags = RBHT_NOWHERE;
    2052             if (pBand)
    2053                 *pBand = -1;
    2054 
    2055             TRACE("NOWHERE\n");
    2056             return;
    2057         }
     2007    if (infoPtr->uNumBands == 0) {
     2008        *pFlags = RBHT_NOWHERE;
     2009        if (pBand)
     2010        *pBand = -1;
     2011        TRACE("NOWHERE\n");
     2012        return;
    20582013    }
    20592014    else {
    2060         *pFlags = RBHT_NOWHERE;
    2061         if (pBand)
    2062             *pBand = -1;
    2063         TRACE("NOWHERE\n");
    2064         return;
     2015        /* somewhere inside */
     2016        infoPtr->ihitBand = -1;
     2017        for (iCount = 0; iCount < infoPtr->uNumBands; iCount++) {
     2018        lpBand = &infoPtr->bands[iCount];
     2019        if (HIDDENBAND(lpBand)) continue;
     2020        if (PtInRect (&lpBand->rcBand, *lpPt)) {
     2021            if (pBand)
     2022            *pBand = iCount;
     2023            if (PtInRect (&lpBand->rcGripper, *lpPt)) {
     2024            *pFlags = RBHT_GRABBER;
     2025            infoPtr->ihitBand = iCount;
     2026            TRACE("ON GRABBER %d\n", iCount);
     2027            return;
     2028            }
     2029            else if (PtInRect (&lpBand->rcCapImage, *lpPt)) {
     2030            *pFlags = RBHT_CAPTION;
     2031            TRACE("ON CAPTION %d\n", iCount);
     2032            return;
     2033            }
     2034            else if (PtInRect (&lpBand->rcCapText, *lpPt)) {
     2035            *pFlags = RBHT_CAPTION;
     2036            TRACE("ON CAPTION %d\n", iCount);
     2037            return;
     2038            }
     2039            else if (PtInRect (&lpBand->rcChild, *lpPt)) {
     2040            *pFlags = RBHT_CLIENT;
     2041            TRACE("ON CLIENT %d\n", iCount);
     2042            return;
     2043            }
     2044            else {
     2045            *pFlags = RBHT_NOWHERE;
     2046            TRACE("NOWHERE %d\n", iCount);
     2047            return;
     2048            }
     2049        }
     2050        }
     2051
     2052        *pFlags = RBHT_NOWHERE;
     2053        if (pBand)
     2054        *pBand = -1;
     2055
     2056        TRACE("NOWHERE\n");
     2057        return;
     2058    }
     2059    }
     2060    else {
     2061    *pFlags = RBHT_NOWHERE;
     2062    if (pBand)
     2063        *pBand = -1;
     2064    TRACE("NOWHERE\n");
     2065    return;
    20652066    }
    20662067
     
    20912092        /* if this band is not shrinkable, then just move it */
    20922093        Leadjust = Readjust = movement;
    2093         ret = movement;
     2094    ret = movement;
    20942095    }
    20952096    else {
    20962097        if (movement < 0) {
    2097             /* Drag to left */
    2098             if (avail <= abs(movement)) {
    2099                 Readjust = movement;
    2100                 Leadjust = movement + avail;
    2101                 ret = Leadjust;
    2102             }
    2103             else {
    2104                 Readjust = movement;
    2105                 Leadjust = 0;
    2106                 ret = 0;
    2107             }
    2108         }
    2109         else {
    2110             /* Drag to right */
    2111             if (avail <= abs(movement)) {
    2112                 Leadjust = movement;
    2113                 Readjust = movement - avail;
    2114                 ret = Readjust;
    2115             }
    2116             else {
    2117                 Leadjust = movement;
    2118                 Readjust = 0;
    2119                 ret = 0;
    2120             }
    2121         }
     2098        /* Drag to left */
     2099        if (avail <= abs(movement)) {
     2100            Readjust = movement;
     2101        Leadjust = movement + avail;
     2102        ret = Leadjust;
     2103        }
     2104        else {
     2105            Readjust = movement;
     2106        Leadjust = 0;
     2107        ret = 0;
     2108        }
     2109    }
     2110    else {
     2111        /* Drag to right */
     2112        if (avail <= abs(movement)) {
     2113            Leadjust = movement;
     2114        Readjust = movement - avail;
     2115        ret = Readjust;
     2116        }
     2117        else {
     2118            Leadjust = movement;
     2119        Readjust = 0;
     2120        ret = 0;
     2121        }
     2122    }
    21222123    }
    21232124
     
    21252126    if (rcBlt(band) + Leadjust < 0) {
    21262127        ERR("adjustment will fail, band %d: left=%d, right=%d, move=%d, rtn=%d\n",
    2127             i, Leadjust, Readjust, movement, ret);
     2128        i, Leadjust, Readjust, movement, ret);
    21282129    }
    21292130
     
    21322133
    21332134    TRACE("band %d:  left=%d, right=%d, move=%d, rtn=%d, rcBand=(%d,%d)-(%d,%d)\n",
    2134           i, Leadjust, Readjust, movement, ret,
    2135           band->rcBand.left, band->rcBand.top,
    2136           band->rcBand.right, band->rcBand.bottom);
     2135      i, Leadjust, Readjust, movement, ret,
     2136      band->rcBand.left, band->rcBand.top,
     2137      band->rcBand.right, band->rcBand.bottom);
    21372138    return ret;
    21382139}
     
    21572158
    21582159    if (!(infoPtr->fStatus & BEGIN_DRAG_ISSUED)) {
    2159         if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) {
    2160             /* Notify returned TRUE - abort drag */
    2161             infoPtr->dragStart.x = 0;
    2162             infoPtr->dragStart.y = 0;
    2163             infoPtr->dragNow = infoPtr->dragStart;
    2164             infoPtr->ihitBand = -1;
    2165             ReleaseCapture ();
    2166             return ;
    2167         }
    2168         infoPtr->fStatus |= BEGIN_DRAG_ISSUED;
     2160    if (REBAR_Notify_NMREBAR (infoPtr, -1, RBN_BEGINDRAG)) {
     2161        /* Notify returned TRUE - abort drag */
     2162        infoPtr->dragStart.x = 0;
     2163        infoPtr->dragStart.y = 0;
     2164        infoPtr->dragNow = infoPtr->dragStart;
     2165        infoPtr->ihitBand = -1;
     2166        ReleaseCapture ();
     2167        return ;
     2168    }
     2169    infoPtr->fStatus |= BEGIN_DRAG_ISSUED;
    21692170    }
    21702171
     
    21762177    for (i=0; i<infoPtr->uNumBands; i++) {
    21772178        band = &infoPtr->bands[i];
    2178         if (HIDDENBAND(band)) continue;
    2179         if (band->iRow == hitBand->iRow) {
    2180             imaxdBand = i;
    2181             if (imindBand == -1) imindBand = i;
    2182             /* minimum size of each band is size of header plus            */
    2183             /* size of minimum child plus offset of child from header plus */
    2184             /* a one to separate each band.                                */
    2185             if (i < ihitBand)
    2186                 LHeaderSum += (band->lcx + SEP_WIDTH);
    2187             else
    2188                 RHeaderSum += (band->lcx + SEP_WIDTH);
    2189 
    2190         }
     2179    if (HIDDENBAND(band)) continue;
     2180    if (band->iRow == hitBand->iRow) {
     2181        imaxdBand = i;
     2182        if (imindBand == -1) imindBand = i;
     2183        /* minimum size of each band is size of header plus            */
     2184        /* size of minimum child plus offset of child from header plus */
     2185        /* a one to separate each band.                                */
     2186        if (i < ihitBand)
     2187            LHeaderSum += (band->lcx + SEP_WIDTH);
     2188        else
     2189            RHeaderSum += (band->lcx + SEP_WIDTH);
     2190
     2191    }
    21912192    }
    21922193    if (RHeaderSum) RHeaderSum -= SEP_WIDTH; /* no separator afterlast band */
     
    22002201    /* limit movement to inside adjustable bands - Left */
    22012202    if ( (ptsmove->x < mindBand->rcBand.left) ||
    2202         (ptsmove->x > maxdBand->rcBand.right) ||
    2203         (ptsmove->y < mindBand->rcBand.top) ||
    2204         (ptsmove->y > maxdBand->rcBand.bottom))
     2203    (ptsmove->x > maxdBand->rcBand.right) ||
     2204    (ptsmove->y < mindBand->rcBand.top) ||
     2205    (ptsmove->y > maxdBand->rcBand.bottom))
    22052206        return; /* should swap bands */
    22062207
    22072208    if (infoPtr->dwStyle & CCS_VERT)
    22082209        movement = ptsmove->y - ((hitBand->rcBand.top+REBAR_PRE_GRIPPER) -
    2209                              infoPtr->ihitoffset);
     2210                 infoPtr->ihitoffset);
    22102211    else
    22112212        movement = ptsmove->x - ((hitBand->rcBand.left+REBAR_PRE_GRIPPER) -
    2212                              infoPtr->ihitoffset);
     2213                 infoPtr->ihitoffset);
    22132214    infoPtr->dragNow = *ptsmove;
    22142215
    22152216    TRACE("before: movement=%d (%d,%d), imindBand=%d, ihitBand=%d, imaxdBand=%d, LSum=%d, RSum=%d\n",
    2216           movement, ptsmove->x, ptsmove->y, imindBand, ihitBand,
    2217           imaxdBand, LHeaderSum, RHeaderSum);
     2217      movement, ptsmove->x, ptsmove->y, imindBand, ihitBand,
     2218      imaxdBand, LHeaderSum, RHeaderSum);
    22182219    REBAR_DumpBand (infoPtr);
    22192220
    2220     if (movement < 0) { 
     2221    if (movement < 0) {
    22212222
    22222223        /* ***  Drag left/up *** */
    22232224        compress = rcBlt(hitBand) - rcBlt(mindBand) -
    2224                    LHeaderSum;
    2225         if (compress < abs(movement)) {
    2226             TRACE("limiting left drag, was %d changed to %d\n",
    2227                   movement, -compress);
    2228             movement = -compress;
    2229         }
     2225               LHeaderSum;
     2226    if (compress < abs(movement)) {
     2227        TRACE("limiting left drag, was %d changed to %d\n",
     2228          movement, -compress);
     2229        movement = -compress;
     2230    }
    22302231
    22312232        for (i=ihitBand; i>=imindBand; i--) {
    2232             band = &infoPtr->bands[i];
    2233             if (HIDDENBAND(band)) continue;
    2234             if (i == ihitBand) {
    2235                 LEADJ(band, movement)
    2236             }
    2237             else
    2238                 movement = REBAR_Shrink (infoPtr, band, movement, i);
    2239             band->ccx = rcBw(band);
    2240         }
     2233        band = &infoPtr->bands[i];
     2234        if (HIDDENBAND(band)) continue;
     2235        if (i == ihitBand) {
     2236        LEADJ(band, movement)
     2237        }
     2238        else
     2239            movement = REBAR_Shrink (infoPtr, band, movement, i);
     2240        band->ccx = rcBw(band);
     2241    }
    22412242    }
    22422243    else {
    2243         BOOL first = TRUE;
     2244    BOOL first = TRUE;
    22442245
    22452246        /* ***  Drag right/down *** */
    22462247        compress = rcBrb(maxdBand) - rcBlt(hitBand) -
    2247                    RHeaderSum;
    2248         if (compress < abs(movement)) {
    2249             TRACE("limiting right drag, was %d changed to %d\n",
    2250                   movement, compress);
    2251             movement = compress;
    2252         }
     2248               RHeaderSum;
     2249    if (compress < abs(movement)) {
     2250        TRACE("limiting right drag, was %d changed to %d\n",
     2251          movement, compress);
     2252        movement = compress;
     2253    }
    22532254        for (i=ihitBand-1; i<=imaxdBand; i++) {
    2254             band = &infoPtr->bands[i];
    2255             if (HIDDENBAND(band)) continue;
    2256             if (first) {
    2257                 first = FALSE;
    2258                 READJ(band, movement)
    2259             }
    2260             else
    2261                 movement = REBAR_Shrink (infoPtr, band, movement, i);
    2262             band->ccx = rcBw(band);
    2263         }
     2255        band = &infoPtr->bands[i];
     2256        if (HIDDENBAND(band)) continue;
     2257        if (first) {
     2258        first = FALSE;
     2259        READJ(band, movement)
     2260        }
     2261        else
     2262            movement = REBAR_Shrink (infoPtr, band, movement, i);
     2263        band->ccx = rcBw(band);
     2264    }
    22642265    }
    22652266
    22662267    /* recompute all rectangles */
    22672268    if (infoPtr->dwStyle & CCS_VERT) {
    2268         REBAR_CalcVertBand (infoPtr, imindBand, imaxdBand+1,
    2269                             FALSE);
     2269    REBAR_CalcVertBand (infoPtr, imindBand, imaxdBand+1,
     2270                FALSE);
    22702271    }
    22712272    else {
    2272         REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1,
    2273                             FALSE);
     2273    REBAR_CalcHorzBand (infoPtr, imindBand, imaxdBand+1,
     2274                FALSE);
    22742275    }
    22752276
    22762277    TRACE("bands after adjustment, see band # %d, %d\n",
    2277           imindBand, imaxdBand);
     2278      imindBand, imaxdBand);
    22782279    REBAR_DumpBand (infoPtr);
    22792280
    2280     SetRect (&newrect, 
    2281              mindBand->rcBand.left,
    2282              mindBand->rcBand.top,
    2283              maxdBand->rcBand.right,
    2284              maxdBand->rcBand.bottom);
     2281    SetRect (&newrect,
     2282         mindBand->rcBand.left,
     2283         mindBand->rcBand.top,
     2284         maxdBand->rcBand.right,
     2285         maxdBand->rcBand.bottom);
    22852286
    22862287    REBAR_MoveChildWindows (infoPtr, imindBand, imaxdBand+1);
     
    23042305
    23052306    if (uBand >= infoPtr->uNumBands)
    2306         return FALSE;
     2307    return FALSE;
    23072308
    23082309    TRACE("deleting band %u!\n", uBand);
     
    23112312
    23122313    if (infoPtr->uNumBands == 1) {
    2313         TRACE(" simple delete!\n");
    2314         if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)
    2315             childhwnd = lpBand->hwndChild;
    2316         COMCTL32_Free (infoPtr->bands);
    2317         infoPtr->bands = NULL;
    2318         infoPtr->uNumBands = 0;
     2314    TRACE(" simple delete!\n");
     2315    if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)
     2316        childhwnd = lpBand->hwndChild;
     2317    COMCTL32_Free (infoPtr->bands);
     2318    infoPtr->bands = NULL;
     2319    infoPtr->uNumBands = 0;
    23192320    }
    23202321    else {
    2321         REBAR_BAND *oldBands = infoPtr->bands;
     2322    REBAR_BAND *oldBands = infoPtr->bands;
    23222323        TRACE("complex delete! [uBand=%u]\n", uBand);
    23232324
    2324         if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)
    2325             childhwnd = lpBand->hwndChild;
    2326 
    2327         infoPtr->uNumBands--;
    2328         infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
     2325    if ((lpBand->fMask & RBBIM_CHILD) && lpBand->hwndChild)
     2326        childhwnd = lpBand->hwndChild;
     2327
     2328    infoPtr->uNumBands--;
     2329    infoPtr->bands = COMCTL32_Alloc (sizeof (REBAR_BAND) * infoPtr->uNumBands);
    23292330        if (uBand > 0) {
    23302331            memcpy (&infoPtr->bands[0], &oldBands[0],
     
    23372338        }
    23382339
    2339         COMCTL32_Free (oldBands);
     2340    COMCTL32_Free (oldBands);
    23402341    }
    23412342
     
    23692370
    23702371    if (!lParam)
    2371         return 0;
     2372    return 0;
    23722373    if ((UINT)wParam >= infoPtr->uNumBands)
    2373         return 0;
     2374    return 0;
    23742375
    23752376    lpBand = &infoPtr->bands[(UINT)wParam];
     
    23812382    /* style.  -  GA                                                   */
    23822383    if (infoPtr->dwStyle & RBS_BANDBORDERS) {
    2383         if (infoPtr->dwStyle & CCS_VERT) {
    2384             lpRect->left = 1;
    2385             lpRect->top = lpBand->cxHeader + 4;
    2386             lpRect->right = 1;
    2387             lpRect->bottom = 0;
    2388         }
    2389         else {
    2390             lpRect->left = lpBand->cxHeader + 4;
    2391             lpRect->top = 1;
    2392             lpRect->right = 0;
    2393             lpRect->bottom = 1;
    2394         }
     2384    if (infoPtr->dwStyle & CCS_VERT) {
     2385        lpRect->left = 1;
     2386        lpRect->top = lpBand->cxHeader + 4;
     2387        lpRect->right = 1;
     2388        lpRect->bottom = 0;
    23952389    }
    23962390    else {
    2397         lpRect->left = lpBand->cxHeader;
     2391        lpRect->left = lpBand->cxHeader + 4;
     2392        lpRect->top = 1;
     2393        lpRect->right = 0;
     2394        lpRect->bottom = 1;
     2395    }
     2396    }
     2397    else {
     2398    lpRect->left = lpBand->cxHeader;
    23982399    }
    23992400    return 0;
     
    24172418
    24182419    if (lprbbi == NULL)
    2419         return FALSE;
     2420    return FALSE;
    24202421    if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
    2421         return FALSE;
     2422    return FALSE;
    24222423    if ((UINT)wParam >= infoPtr->uNumBands)
    2423         return FALSE;
     2424    return FALSE;
    24242425
    24252426    TRACE("index %u\n", (UINT)wParam);
     
    24292430
    24302431    if (lprbbi->fMask & RBBIM_STYLE)
    2431         lprbbi->fStyle = lpBand->fStyle;
     2432    lprbbi->fStyle = lpBand->fStyle;
    24322433
    24332434    if (lprbbi->fMask & RBBIM_COLORS) {
    2434         lprbbi->clrFore = lpBand->clrFore;
    2435         lprbbi->clrBack = lpBand->clrBack;
    2436         if (lprbbi->clrBack == CLR_NONE)
    2437             lprbbi->clrBack = infoPtr->clrBtnFace;
     2435    lprbbi->clrFore = lpBand->clrFore;
     2436    lprbbi->clrBack = lpBand->clrBack;
     2437    if (lprbbi->clrBack == CLR_NONE)
     2438        lprbbi->clrBack = infoPtr->clrBtnFace;
    24382439    }
    24392440
     
    24452446              lprbbi->lpText[lprbbi->cch-1] = 0;
    24462447      }
    2447       else 
    2448         *lprbbi->lpText = 0;
     2448      else
     2449    *lprbbi->lpText = 0;
    24492450    }
    24502451
    24512452    if (lprbbi->fMask & RBBIM_IMAGE) {
    24522453      if (lpBand->fMask & RBBIM_IMAGE)
    2453         lprbbi->iImage = lpBand->iImage;
     2454    lprbbi->iImage = lpBand->iImage;
    24542455      else
    2455         lprbbi->iImage = -1;
     2456    lprbbi->iImage = -1;
    24562457    }
    24572458
    24582459    if (lprbbi->fMask & RBBIM_CHILD)
    2459         lprbbi->hwndChild = lpBand->hwndChild;
     2460    lprbbi->hwndChild = lpBand->hwndChild;
    24602461
    24612462    if (lprbbi->fMask & RBBIM_CHILDSIZE) {
    2462         lprbbi->cxMinChild = lpBand->cxMinChild;
    2463         lprbbi->cyMinChild = lpBand->cyMinChild;
    2464         if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
    2465             lprbbi->cyChild    = lpBand->cyChild;
    2466             lprbbi->cyMaxChild = lpBand->cyMaxChild;
    2467             lprbbi->cyIntegral = lpBand->cyIntegral;
    2468         }
     2463    lprbbi->cxMinChild = lpBand->cxMinChild;
     2464    lprbbi->cyMinChild = lpBand->cyMinChild;
     2465    if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
     2466        lprbbi->cyChild    = lpBand->cyChild;
     2467        lprbbi->cyMaxChild = lpBand->cyMaxChild;
     2468        lprbbi->cyIntegral = lpBand->cyIntegral;
     2469    }
    24692470    }
    24702471
    24712472    if (lprbbi->fMask & RBBIM_SIZE)
    2472         lprbbi->cx = lpBand->cx;
     2473    lprbbi->cx = lpBand->cx;
    24732474
    24742475    if (lprbbi->fMask & RBBIM_BACKGROUND)
    2475         lprbbi->hbmBack = lpBand->hbmBack;
     2476    lprbbi->hbmBack = lpBand->hbmBack;
    24762477
    24772478    if (lprbbi->fMask & RBBIM_ID)
    2478         lprbbi->wID = lpBand->wID;
     2479    lprbbi->wID = lpBand->wID;
    24792480
    24802481    /* check for additional data */
    24812482    if (lprbbi->cbSize >= sizeof (REBARBANDINFOA)) {
    2482         if (lprbbi->fMask & RBBIM_IDEALSIZE)
    2483             lprbbi->cxIdeal = lpBand->cxIdeal;
    2484 
    2485         if (lprbbi->fMask & RBBIM_LPARAM)
    2486             lprbbi->lParam = lpBand->lParam;
    2487 
    2488         if (lprbbi->fMask & RBBIM_HEADERSIZE)
    2489             lprbbi->cxHeader = lpBand->cxHeader;
     2483    if (lprbbi->fMask & RBBIM_IDEALSIZE)
     2484        lprbbi->cxIdeal = lpBand->cxIdeal;
     2485
     2486    if (lprbbi->fMask & RBBIM_LPARAM)
     2487        lprbbi->lParam = lpBand->lParam;
     2488
     2489    if (lprbbi->fMask & RBBIM_HEADERSIZE)
     2490        lprbbi->cxHeader = lpBand->cxHeader;
    24902491    }
    24912492
     
    25032504
    25042505    if (lprbbi == NULL)
    2505         return FALSE;
     2506    return FALSE;
    25062507    if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
    2507         return FALSE;
     2508    return FALSE;
    25082509    if ((UINT)wParam >= infoPtr->uNumBands)
    2509         return FALSE;
     2510    return FALSE;
    25102511
    25112512    TRACE("index %u\n", (UINT)wParam);
     
    25152516
    25162517    if (lprbbi->fMask & RBBIM_STYLE)
    2517         lprbbi->fStyle = lpBand->fStyle;
     2518    lprbbi->fStyle = lpBand->fStyle;
    25182519
    25192520    if (lprbbi->fMask & RBBIM_COLORS) {
    2520         lprbbi->clrFore = lpBand->clrFore;
    2521         lprbbi->clrBack = lpBand->clrBack;
    2522         if (lprbbi->clrBack == CLR_NONE)
    2523             lprbbi->clrBack = infoPtr->clrBtnFace;
     2521    lprbbi->clrFore = lpBand->clrFore;
     2522    lprbbi->clrBack = lpBand->clrBack;
     2523    if (lprbbi->clrBack == CLR_NONE)
     2524        lprbbi->clrBack = infoPtr->clrBtnFace;
    25242525    }
    25252526
    25262527    if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
    25272528      if (lpBand->lpText && (lpBand->fMask & RBBIM_TEXT))
    2528         lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
    2529       else 
    2530         *lprbbi->lpText = 0;
     2529    lstrcpynW (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
     2530      else
     2531    *lprbbi->lpText = 0;
    25312532    }
    25322533
    25332534    if (lprbbi->fMask & RBBIM_IMAGE) {
    25342535      if (lpBand->fMask & RBBIM_IMAGE)
    2535         lprbbi->iImage = lpBand->iImage;
     2536    lprbbi->iImage = lpBand->iImage;
    25362537      else
    2537         lprbbi->iImage = -1;
     2538    lprbbi->iImage = -1;
    25382539    }
    25392540
    25402541    if (lprbbi->fMask & RBBIM_CHILD)
    2541         lprbbi->hwndChild = lpBand->hwndChild;
     2542    lprbbi->hwndChild = lpBand->hwndChild;
    25422543
    25432544    if (lprbbi->fMask & RBBIM_CHILDSIZE) {
    2544         lprbbi->cxMinChild = lpBand->cxMinChild;
    2545         lprbbi->cyMinChild = lpBand->cyMinChild;
    2546         if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {
    2547             lprbbi->cyChild    = lpBand->cyChild;
    2548             lprbbi->cyMaxChild = lpBand->cyMaxChild;
    2549             lprbbi->cyIntegral = lpBand->cyIntegral;
    2550         }
     2545    lprbbi->cxMinChild = lpBand->cxMinChild;
     2546    lprbbi->cyMinChild = lpBand->cyMinChild;
     2547    if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {
     2548        lprbbi->cyChild    = lpBand->cyChild;
     2549        lprbbi->cyMaxChild = lpBand->cyMaxChild;
     2550        lprbbi->cyIntegral = lpBand->cyIntegral;
     2551    }
    25512552    }
    25522553
    25532554    if (lprbbi->fMask & RBBIM_SIZE)
    2554         lprbbi->cx = lpBand->cx;
     2555    lprbbi->cx = lpBand->cx;
    25552556
    25562557    if (lprbbi->fMask & RBBIM_BACKGROUND)
    2557         lprbbi->hbmBack = lpBand->hbmBack;
     2558    lprbbi->hbmBack = lpBand->hbmBack;
    25582559
    25592560    if (lprbbi->fMask & RBBIM_ID)
    2560         lprbbi->wID = lpBand->wID;
     2561    lprbbi->wID = lpBand->wID;
    25612562
    25622563    /* check for additional data */
    25632564    if (lprbbi->cbSize >= sizeof (REBARBANDINFOW)) {
    2564         if (lprbbi->fMask & RBBIM_IDEALSIZE)
    2565             lprbbi->cxIdeal = lpBand->cxIdeal;
    2566 
    2567         if (lprbbi->fMask & RBBIM_LPARAM)
    2568             lprbbi->lParam = lpBand->lParam;
    2569 
    2570         if (lprbbi->fMask & RBBIM_HEADERSIZE)
    2571             lprbbi->cxHeader = lpBand->cxHeader;
     2565    if (lprbbi->fMask & RBBIM_IDEALSIZE)
     2566        lprbbi->cxIdeal = lpBand->cxIdeal;
     2567
     2568    if (lprbbi->fMask & RBBIM_LPARAM)
     2569        lprbbi->lParam = lpBand->lParam;
     2570
     2571    if (lprbbi->fMask & RBBIM_HEADERSIZE)
     2572        lprbbi->cxHeader = lpBand->cxHeader;
    25722573    }
    25732574
     
    25972598
    25982599    if (lpInfo == NULL)
    2599         return FALSE;
     2600    return FALSE;
    26002601
    26012602    if (lpInfo->cbSize < sizeof (REBARINFO))
    2602         return FALSE;
     2603    return FALSE;
    26032604
    26042605    TRACE("getting bar info!\n");
    26052606
    26062607    if (infoPtr->himl) {
    2607         lpInfo->himl = infoPtr->himl;
    2608         lpInfo->fMask |= RBIM_IMAGELIST;
     2608    lpInfo->himl = infoPtr->himl;
     2609    lpInfo->fMask |= RBIM_IMAGELIST;
    26092610    }
    26102611
     
    26482649
    26492650    if ((iBand < 0) && ((UINT)iBand >= infoPtr->uNumBands))
    2650         return FALSE;
     2651    return FALSE;
    26512652    if (!lprc)
    2652         return FALSE;
     2653    return FALSE;
    26532654
    26542655    lpBand = &infoPtr->bands[iBand];
     
    26562657
    26572658    TRACE("band %d, (%d,%d)-(%d,%d)\n", iBand,
    2658           lprc->left, lprc->top, lprc->right, lprc->bottom);
     2659      lprc->left, lprc->top, lprc->right, lprc->bottom);
    26592660
    26602661    return TRUE;
     
    26802681
    26812682    for (i=0; i<infoPtr->uNumBands; i++) {
    2682         lpBand = &infoPtr->bands[i];
    2683         if (HIDDENBAND(lpBand)) continue;
    2684         if (lpBand->iRow != iRow) continue;
    2685         if (infoPtr->dwStyle & CCS_VERT)
    2686             j = lpBand->rcBand.right - lpBand->rcBand.left;
    2687         else
    2688             j = lpBand->rcBand.bottom - lpBand->rcBand.top;
    2689         if (j > ret) ret = j;
     2683    lpBand = &infoPtr->bands[i];
     2684    if (HIDDENBAND(lpBand)) continue;
     2685    if (lpBand->iRow != iRow) continue;
     2686    if (infoPtr->dwStyle & CCS_VERT)
     2687        j = lpBand->rcBand.right - lpBand->rcBand.left;
     2688    else
     2689        j = lpBand->rcBand.bottom - lpBand->rcBand.top;
     2690    if (j > ret) ret = j;
    26902691    }
    26912692
     
    27152716REBAR_GetUnicodeFormat (REBAR_INFO *infoPtr)
    27162717{
    2717     TRACE("%s hwnd=0x%x\n", 
    2718           infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);
     2718    TRACE("%s hwnd=0x%x\n",
     2719      infoPtr->bUnicode ? "TRUE" : "FALSE", infoPtr->hwndSelf);
    27192720
    27202721    return infoPtr->bUnicode;
     
    27332734REBAR_HitTest (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
    27342735{
    2735     LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam; 
     2736    LPRBHITTESTINFO lprbht = (LPRBHITTESTINFO)lParam;
    27362737
    27372738    if (!lprbht)
    2738         return -1;
     2739    return -1;
    27392740
    27402741    REBAR_InternalHitTest (infoPtr, &lprbht->pt, &lprbht->flags, &lprbht->iBand);
     
    27502751
    27512752    if (infoPtr == NULL)
    2752         return -1;
     2753    return -1;
    27532754
    27542755    if (infoPtr->uNumBands < 1)
    2755         return -1;
     2756    return -1;
    27562757
    27572758    for (i = 0; i < infoPtr->uNumBands; i++) {
    2758         if (infoPtr->bands[i].wID == (UINT)wParam) {
    2759             TRACE("id %u is band %u found!\n", (UINT)wParam, i);
    2760             return i;
    2761         }
     2759    if (infoPtr->bands[i].wID == (UINT)wParam) {
     2760        TRACE("id %u is band %u found!\n", (UINT)wParam, i);
     2761        return i;
     2762    }
    27622763    }
    27632764
     
    27752776
    27762777    if (infoPtr == NULL)
    2777         return FALSE;
     2778    return FALSE;
    27782779    if (lprbbi == NULL)
    2779         return FALSE;
     2780    return FALSE;
    27802781    if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
    2781         return FALSE;
     2782    return FALSE;
    27822783
    27832784    /* trace the index as signed to see the -1 */
     
    27862787
    27872788    if (infoPtr->uNumBands == 0) {
    2788         infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
    2789         uIndex = 0;
     2789    infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
     2790    uIndex = 0;
    27902791    }
    27912792    else {
    2792         REBAR_BAND *oldBands = infoPtr->bands;
    2793         infoPtr->bands =
    2794             (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
    2795         if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
    2796             uIndex = infoPtr->uNumBands;
    2797 
    2798         /* pre insert copy */
    2799         if (uIndex > 0) {
    2800             memcpy (&infoPtr->bands[0], &oldBands[0],
    2801                     uIndex * sizeof(REBAR_BAND));
    2802         }
    2803 
    2804         /* post copy */
    2805         if (uIndex < infoPtr->uNumBands - 1) {
    2806             memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
    2807                     (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
    2808         }
    2809 
    2810         COMCTL32_Free (oldBands);
     2793    REBAR_BAND *oldBands = infoPtr->bands;
     2794    infoPtr->bands =
     2795        (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
     2796    if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
     2797        uIndex = infoPtr->uNumBands;
     2798
     2799    /* pre insert copy */
     2800    if (uIndex > 0) {
     2801        memcpy (&infoPtr->bands[0], &oldBands[0],
     2802            uIndex * sizeof(REBAR_BAND));
     2803    }
     2804
     2805    /* post copy */
     2806    if (uIndex < infoPtr->uNumBands - 1) {
     2807        memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
     2808            (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
     2809    }
     2810
     2811    COMCTL32_Free (oldBands);
    28112812    }
    28122813
     
    28312832            lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR));
    28322833            MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len );
    2833         }
     2834    }
    28342835    }
    28352836
     
    28372838    /* On insert of second band, revalidate band 1 to possible add gripper */
    28382839    if (infoPtr->uNumBands == 2)
    2839         REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
     2840    REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
    28402841
    28412842    REBAR_DumpBand (infoPtr);
     
    28552856
    28562857    if (infoPtr == NULL)
    2857         return FALSE;
     2858    return FALSE;
    28582859    if (lprbbi == NULL)
    2859         return FALSE;
     2860    return FALSE;
    28602861    if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
    2861         return FALSE;
     2862    return FALSE;
    28622863
    28632864    /* trace the index as signed to see the -1 */
     
    28662867
    28672868    if (infoPtr->uNumBands == 0) {
    2868         infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
    2869         uIndex = 0;
     2869    infoPtr->bands = (REBAR_BAND *)COMCTL32_Alloc (sizeof (REBAR_BAND));
     2870    uIndex = 0;
    28702871    }
    28712872    else {
    2872         REBAR_BAND *oldBands = infoPtr->bands;
    2873         infoPtr->bands =
    2874             (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
    2875         if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
    2876             uIndex = infoPtr->uNumBands;
    2877 
    2878         /* pre insert copy */
    2879         if (uIndex > 0) {
    2880             memcpy (&infoPtr->bands[0], &oldBands[0],
    2881                     uIndex * sizeof(REBAR_BAND));
    2882         }
    2883 
    2884         /* post copy */
    2885         if (uIndex < infoPtr->uNumBands - 1) {
    2886             memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
    2887                     (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
    2888         }
    2889 
    2890         COMCTL32_Free (oldBands);
     2873    REBAR_BAND *oldBands = infoPtr->bands;
     2874    infoPtr->bands =
     2875        (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
     2876    if (((INT)uIndex == -1) || (uIndex > infoPtr->uNumBands))
     2877        uIndex = infoPtr->uNumBands;
     2878
     2879    /* pre insert copy */
     2880    if (uIndex > 0) {
     2881        memcpy (&infoPtr->bands[0], &oldBands[0],
     2882            uIndex * sizeof(REBAR_BAND));
     2883    }
     2884
     2885    /* post copy */
     2886    if (uIndex < infoPtr->uNumBands - 1) {
     2887        memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex],
     2888            (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND));
     2889    }
     2890
     2891    COMCTL32_Free (oldBands);
    28912892    }
    28922893
     
    29072908    lpBand->lpText = NULL;
    29082909    if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
    2909         INT len = lstrlenW (lprbbi->lpText);
    2910         if (len > 0) {
    2911             lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    2912             strcpyW (lpBand->lpText, lprbbi->lpText);
    2913         }
     2910    INT len = lstrlenW (lprbbi->lpText);
     2911    if (len > 0) {
     2912        lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     2913        strcpyW (lpBand->lpText, lprbbi->lpText);
     2914    }
    29142915    }
    29152916
     
    29172918    /* On insert of second band, revalidate band 1 to possible add gripper */
    29182919    if (infoPtr->uNumBands == 2)
    2919         REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
     2920    REBAR_ValidateBand (infoPtr, &infoPtr->bands[0]);
    29202921
    29212922    REBAR_DumpBand (infoPtr);
     
    29312932{
    29322933    FIXME("(uBand = %u fIdeal = %s) stub\n",
    2933            (UINT)wParam, lParam ? "TRUE" : "FALSE");
     2934       (UINT)wParam, lParam ? "TRUE" : "FALSE");
    29342935
    29352936    return 0;
     
    29542955    /* Validate */
    29552956    if ((infoPtr->uNumBands == 0) ||
    2956         ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) {
    2957         /* error !!! */
    2958         ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n",
    2959               (INT)uBand, infoPtr->uNumBands);
    2960         return FALSE;
     2957    ((INT)uBand < 0) || (uBand >= infoPtr->uNumBands)) {
     2958    /* error !!! */
     2959    ERR("Illegal MinimizeBand, requested=%d, current band count=%d\n",
     2960          (INT)uBand, infoPtr->uNumBands);
     2961        return FALSE;
    29612962    }
    29622963
     
    29652966
    29662967    if (infoPtr->dwStyle & CCS_VERT)
    2967         movement = lpBand->rcBand.bottom - lpBand->rcBand.top -
    2968             lpBand->cxHeader;
     2968    movement = lpBand->rcBand.bottom - lpBand->rcBand.top -
     2969        lpBand->cxHeader;
    29692970    else
    2970         movement = lpBand->rcBand.right - lpBand->rcBand.left -
    2971             lpBand->cxHeader;
     2971    movement = lpBand->rcBand.right - lpBand->rcBand.left -
     2972        lpBand->cxHeader;
    29722973    if (movement < 0) {
    2973         ERR("something is wrong, band=(%d,%d)-(%d,%d), cxheader=%d\n",
    2974             lpBand->rcBand.left, lpBand->rcBand.top,
    2975             lpBand->rcBand.right, lpBand->rcBand.bottom,
    2976             lpBand->cxHeader);
    2977         return FALSE;
     2974    ERR("something is wrong, band=(%d,%d)-(%d,%d), cxheader=%d\n",
     2975        lpBand->rcBand.left, lpBand->rcBand.top,
     2976        lpBand->rcBand.right, lpBand->rcBand.bottom,
     2977        lpBand->cxHeader);
     2978    return FALSE;
    29782979    }
    29792980
     
    29852986    for (i=0; i<infoPtr->uNumBands; i++) {
    29862987        band = &infoPtr->bands[i];
    2987         if (HIDDENBAND(band)) continue;
    2988         if (band->iRow == lpBand->iRow) {
    2989             imaxdBand = i;
    2990             if (imindBand == -1) imindBand = i;
    2991         }
     2988    if (HIDDENBAND(band)) continue;
     2989    if (band->iRow == lpBand->iRow) {
     2990        imaxdBand = i;
     2991        if (imindBand == -1) imindBand = i;
     2992    }
    29922993    }
    29932994
     
    29952996    /* next visible band                                        */
    29962997    if (imindBand == uBand) {
    2997         band = NULL;
    2998         movement = -movement;
    2999         /* find the first visible band to the right of the selected band */
    3000         for (i=uBand+1; i<=imaxdBand; i++) {
    3001             band = &infoPtr->bands[i];
    3002             if (!HIDDENBAND(band)) {
    3003                 iprevBand = i;
    3004                 LEADJ(band, movement);
    3005                 band->ccx = rcBw(band);
    3006                 break;
    3007             }
    3008         }
    3009         /* what case is this */
    3010         if (iprevBand == -1) {
    3011             ERR("no previous visible band\n");
    3012             return FALSE;
    3013         }
    3014         startBand = uBand;
    3015         endBand = iprevBand;
    3016         SetRect (&newrect,
    3017                 lpBand->rcBand.left,
    3018                 lpBand->rcBand.top,
    3019                 band->rcBand.right,
    3020                 band->rcBand.bottom);
     2998    band = NULL;
     2999    movement = -movement;
     3000    /* find the first visible band to the right of the selected band */
     3001    for (i=uBand+1; i<=imaxdBand; i++) {
     3002        band = &infoPtr->bands[i];
     3003        if (!HIDDENBAND(band)) {
     3004        iprevBand = i;
     3005        LEADJ(band, movement);
     3006        band->ccx = rcBw(band);
     3007        break;
     3008        }
     3009    }
     3010    /* what case is this */
     3011    if (iprevBand == -1) {
     3012        ERR("no previous visible band\n");
     3013        return FALSE;
     3014    }
     3015    startBand = uBand;
     3016    endBand = iprevBand;
     3017    SetRect (&newrect,
     3018        lpBand->rcBand.left,
     3019        lpBand->rcBand.top,
     3020        band->rcBand.right,
     3021        band->rcBand.bottom);
    30213022    }
    30223023    /* otherwise expand previous visible band                   */
    30233024    else {
    3024         band = NULL;
    3025         /* find the first visible band to the left of the selected band */
    3026         for (i=uBand-1; i>=imindBand; i--) {
    3027             band = &infoPtr->bands[i];
    3028             if (!HIDDENBAND(band)) {
    3029                 iprevBand = i;
    3030                 READJ(band, movement);
    3031                 band->ccx = rcBw(band);
    3032                 break;
    3033             }
    3034         }
    3035         /* what case is this */
    3036         if (iprevBand == -1) {
    3037             ERR("no previous visible band\n");
    3038             return FALSE;
    3039         }
    3040         startBand = iprevBand;
    3041         endBand = uBand;
    3042         SetRect (&newrect,
    3043                 band->rcBand.left,
    3044                 band->rcBand.top,
    3045                 lpBand->rcBand.right,
    3046                 lpBand->rcBand.bottom);
     3025    band = NULL;
     3026    /* find the first visible band to the left of the selected band */
     3027    for (i=uBand-1; i>=imindBand; i--) {
     3028        band = &infoPtr->bands[i];
     3029        if (!HIDDENBAND(band)) {
     3030        iprevBand = i;
     3031        READJ(band, movement);
     3032        band->ccx = rcBw(band);
     3033        break;
     3034        }
     3035    }
     3036    /* what case is this */
     3037    if (iprevBand == -1) {
     3038        ERR("no previous visible band\n");
     3039        return FALSE;
     3040    }
     3041    startBand = iprevBand;
     3042    endBand = uBand;
     3043    SetRect (&newrect,
     3044        band->rcBand.left,
     3045        band->rcBand.top,
     3046        lpBand->rcBand.right,
     3047        lpBand->rcBand.bottom);
    30473048    }
    30483049
     
    30513052    /* recompute all rectangles */
    30523053    if (infoPtr->dwStyle & CCS_VERT) {
    3053         REBAR_CalcVertBand (infoPtr, startBand, endBand+1,
    3054                             FALSE);
     3054    REBAR_CalcVertBand (infoPtr, startBand, endBand+1,
     3055                FALSE);
    30553056    }
    30563057    else {
    3057         REBAR_CalcHorzBand (infoPtr, startBand, endBand+1,
    3058                             FALSE);
     3058    REBAR_CalcHorzBand (infoPtr, startBand, endBand+1,
     3059                FALSE);
    30593060    }
    30603061
    30613062    TRACE("bands after minimize, see band # %d, %d\n",
    3062           startBand, endBand);
     3063      startBand, endBand);
    30633064    REBAR_DumpBand (infoPtr);
    30643065
     
    30813082    /* Validate */
    30823083    if ((infoPtr->uNumBands == 0) ||
    3083         ((INT)uFrom < 0) || (uFrom >= infoPtr->uNumBands) ||
    3084         ((INT)uTo < 0)   || (uTo >= infoPtr->uNumBands)) {
    3085         /* error !!! */
    3086         ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n",
    3087               (INT)uFrom, (INT)uTo, infoPtr->uNumBands);
    3088         return FALSE;
     3084    ((INT)uFrom < 0) || (uFrom >= infoPtr->uNumBands) ||
     3085    ((INT)uTo < 0)   || (uTo >= infoPtr->uNumBands)) {
     3086    /* error !!! */
     3087    ERR("Illegal MoveBand, from=%d, to=%d, current band count=%d\n",
     3088          (INT)uFrom, (INT)uTo, infoPtr->uNumBands);
     3089        return FALSE;
    30893090    }
    30903091
     
    30943095    /* close up rest of bands (psuedo delete) */
    30953096    if (uFrom < infoPtr->uNumBands - 1) {
    3096         memcpy (&oldBands[uFrom], &oldBands[uFrom+1],
    3097                 (infoPtr->uNumBands - uFrom - 1) * sizeof(REBAR_BAND));
     3097    memcpy (&oldBands[uFrom], &oldBands[uFrom+1],
     3098        (infoPtr->uNumBands - uFrom - 1) * sizeof(REBAR_BAND));
    30983099    }
    30993100
    31003101    /* allocate new space and copy rest of bands into it */
    31013102    infoPtr->bands =
    3102         (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));
     3103    (REBAR_BAND *)COMCTL32_Alloc ((infoPtr->uNumBands)*sizeof(REBAR_BAND));
    31033104
    31043105    /* pre insert copy */
    31053106    if (uTo > 0) {
    3106         memcpy (&infoPtr->bands[0], &oldBands[0],
    3107                 uTo * sizeof(REBAR_BAND));
     3107    memcpy (&infoPtr->bands[0], &oldBands[0],
     3108        uTo * sizeof(REBAR_BAND));
    31083109    }
    31093110
     
    31133114    /* post copy */
    31143115    if (uTo < infoPtr->uNumBands - 1) {
    3115         memcpy (&infoPtr->bands[uTo+1], &oldBands[uTo],
    3116                 (infoPtr->uNumBands - uTo - 1) * sizeof(REBAR_BAND));
     3116    memcpy (&infoPtr->bands[uTo+1], &oldBands[uTo],
     3117        (infoPtr->uNumBands - uTo - 1) * sizeof(REBAR_BAND));
    31173118    }
    31183119
     
    31433144
    31443145    if (lprbbi == NULL)
    3145         return FALSE;
     3146    return FALSE;
    31463147    if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEA)
    3147         return FALSE;
     3148    return FALSE;
    31483149    if ((UINT)wParam >= infoPtr->uNumBands)
    3149         return FALSE;
     3150    return FALSE;
    31503151
    31513152    TRACE("index %u\n", (UINT)wParam);
     
    31573158    REBAR_CommonSetupBand (infoPtr->hwndSelf, lprbbi, lpBand);
    31583159    if (lprbbi->fMask & RBBIM_TEXT) {
    3159         if (lpBand->lpText) {
    3160             COMCTL32_Free (lpBand->lpText);
    3161             lpBand->lpText = NULL;
    3162         }
    3163         if (lprbbi->lpText) {
     3160    if (lpBand->lpText) {
     3161        COMCTL32_Free (lpBand->lpText);
     3162        lpBand->lpText = NULL;
     3163    }
     3164    if (lprbbi->lpText) {
    31643165            INT len = MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, NULL, 0 );
    31653166            lpBand->lpText = (LPWSTR)COMCTL32_Alloc (len*sizeof(WCHAR));
    31663167            MultiByteToWideChar( CP_ACP, 0, lprbbi->lpText, -1, lpBand->lpText, len );
    3167         }
     3168    }
    31683169    }
    31693170
     
    31733174
    31743175    if (lprbbi->fMask & (RBBIM_CHILDSIZE | RBBIM_SIZE))
    3175           REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
     3176      REBAR_Layout (infoPtr, NULL, TRUE, FALSE);
    31763177
    31773178    return TRUE;
     
    31863187
    31873188    if (lprbbi == NULL)
    3188         return FALSE;
     3189    return FALSE;
    31893190    if (lprbbi->cbSize < REBARBANDINFO_V3_SIZEW)
    3190         return FALSE;
     3191    return FALSE;
    31913192    if ((UINT)wParam >= infoPtr->uNumBands)
    3192         return FALSE;
     3193    return FALSE;
    31933194
    31943195    TRACE("index %u\n", (UINT)wParam);
     
    32003201    REBAR_CommonSetupBand (infoPtr->hwndSelf, (LPREBARBANDINFOA)lprbbi, lpBand);
    32013202    if (lprbbi->fMask & RBBIM_TEXT) {
    3202         if (lpBand->lpText) {
    3203             COMCTL32_Free (lpBand->lpText);
    3204             lpBand->lpText = NULL;
    3205         }
    3206         if (lprbbi->lpText) {
    3207             INT len = lstrlenW (lprbbi->lpText);
    3208             lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
    3209             strcpyW (lpBand->lpText, lprbbi->lpText);
    3210         }
     3203    if (lpBand->lpText) {
     3204        COMCTL32_Free (lpBand->lpText);
     3205        lpBand->lpText = NULL;
     3206    }
     3207    if (lprbbi->lpText) {
     3208        INT len = lstrlenW (lprbbi->lpText);
     3209        lpBand->lpText = (LPWSTR)COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
     3210        strcpyW (lpBand->lpText, lprbbi->lpText);
     3211    }
    32113212    }
    32123213
     
    32303231
    32313232    if (lpInfo == NULL)
    3232         return FALSE;
     3233    return FALSE;
    32333234
    32343235    if (lpInfo->cbSize < sizeof (REBARINFO))
    3235         return FALSE;
     3236    return FALSE;
    32363237
    32373238    TRACE("setting bar info!\n");
    32383239
    32393240    if (lpInfo->fMask & RBIM_IMAGELIST) {
    3240         infoPtr->himl = lpInfo->himl;
    3241         if (infoPtr->himl) {
     3241    infoPtr->himl = lpInfo->himl;
     3242    if (infoPtr->himl) {
    32423243            INT cx, cy;
    3243             ImageList_GetIconSize (infoPtr->himl, &cx, &cy);
    3244             infoPtr->imageSize.cx = cx;
    3245             infoPtr->imageSize.cy = cy;
    3246         }
    3247         else {
    3248             infoPtr->imageSize.cx = 0;
    3249             infoPtr->imageSize.cy = 0;
    3250         }
    3251         TRACE("new image cx=%ld, cy=%ld\n", infoPtr->imageSize.cx,
    3252               infoPtr->imageSize.cy);
     3244        ImageList_GetIconSize (infoPtr->himl, &cx, &cy);
     3245        infoPtr->imageSize.cx = cx;
     3246        infoPtr->imageSize.cy = cy;
     3247    }
     3248    else {
     3249        infoPtr->imageSize.cx = 0;
     3250        infoPtr->imageSize.cy = 0;
     3251    }
     3252    TRACE("new image cx=%ld, cy=%ld\n", infoPtr->imageSize.cx,
     3253          infoPtr->imageSize.cy);
    32533254    }
    32543255
     
    32563257    for (i=0; i<infoPtr->uNumBands; i++) {
    32573258        lpBand = &infoPtr->bands[i];
    3258         REBAR_ValidateBand (infoPtr, lpBand);
     3259    REBAR_ValidateBand (infoPtr, lpBand);
    32593260    }
    32603261
     
    33143315    BOOL bTemp = infoPtr->bUnicode;
    33153316
    3316     TRACE("to %s hwnd=0x%04x, was %s\n", 
    3317           ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf,
    3318           (bTemp) ? "TRUE" : "FALSE");
     3317    TRACE("to %s hwnd=0x%04x, was %s\n",
     3318      ((BOOL)wParam) ? "TRUE" : "FALSE", infoPtr->hwndSelf,
     3319      (bTemp) ? "TRUE" : "FALSE");
    33193320
    33203321    infoPtr->bUnicode = (BOOL)wParam;
    3321  
     3322
    33223323   return bTemp;
    33233324}
     
    33303331
    33313332    if (iVersion > COMCTL32_VERSION)
    3332         return -1;
     3333    return -1;
    33333334
    33343335    infoPtr->iVersion = iVersion;
     
    33463347
    33473348    if (((INT)wParam < 0) || ((INT)wParam > infoPtr->uNumBands))
    3348         return FALSE;
     3349    return FALSE;
    33493350
    33503351    lpBand = &infoPtr->bands[(INT)wParam];
    33513352
    33523353    if ((BOOL)lParam) {
    3353         TRACE("show band %d\n", (INT)wParam);
    3354         lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;
    3355         if (IsWindow (lpBand->hwndChild))
    3356             ShowWindow (lpBand->hwndChild, SW_SHOW);
     3354    TRACE("show band %d\n", (INT)wParam);
     3355    lpBand->fStyle = lpBand->fStyle & ~RBBS_HIDDEN;
     3356    if (IsWindow (lpBand->hwndChild))
     3357        ShowWindow (lpBand->hwndChild, SW_SHOW);
    33573358    }
    33583359    else {
    3359         TRACE("hide band %d\n", (INT)wParam);
    3360         lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;
    3361         if (IsWindow (lpBand->hwndChild))
    3362             ShowWindow (lpBand->hwndChild, SW_HIDE);
     3360    TRACE("hide band %d\n", (INT)wParam);
     3361    lpBand->fStyle = lpBand->fStyle | RBBS_HIDDEN;
     3362    if (IsWindow (lpBand->hwndChild))
     3363        ShowWindow (lpBand->hwndChild, SW_HIDE);
    33633364    }
    33643365
     
    33793380
    33803381    TRACE("[%d %d %d %d]\n",
    3381           lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
     3382      lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
    33823383
    33833384    /*  what is going on???? */
    33843385    GetWindowRect(infoPtr->hwndSelf, &t1);
    33853386    TRACE("window rect [%d %d %d %d]\n",
    3386           t1.left, t1.top, t1.right, t1.bottom);
     3387      t1.left, t1.top, t1.right, t1.bottom);
    33873388    GetClientRect(infoPtr->hwndSelf, &t1);
    33883389    TRACE("client rect [%d %d %d %d]\n",
    3389           t1.left, t1.top, t1.right, t1.bottom);
     3390      t1.left, t1.top, t1.right, t1.bottom);
    33903391
    33913392    /* force full _Layout processing */
     
    34063407
    34073408    if (TRACE_ON(rebar)) {
    3408         GetWindowRect(infoPtr->hwndSelf, &wnrc1);
    3409         GetClientRect(infoPtr->hwndSelf, &clrc1);
    3410         TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
    3411               wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
    3412               clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
    3413               cs->x, cs->y, cs->cx, cs->cy);
     3409    GetWindowRect(infoPtr->hwndSelf, &wnrc1);
     3410    GetClientRect(infoPtr->hwndSelf, &clrc1);
     3411    TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
     3412          wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
     3413          clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
     3414          cs->x, cs->y, cs->cx, cs->cy);
    34143415    }
    34153416
     
    34283429    /* free rebar bands */
    34293430    if ((infoPtr->uNumBands > 0) && infoPtr->bands) {
    3430         /* clean up each band */
    3431         for (i = 0; i < infoPtr->uNumBands; i++) {
    3432             lpBand = &infoPtr->bands[i];
    3433 
    3434             /* delete text strings */
    3435             if (lpBand->lpText) {
    3436                 COMCTL32_Free (lpBand->lpText);
    3437                 lpBand->lpText = NULL;
    3438             }
    3439             /* destroy child window */
    3440             DestroyWindow (lpBand->hwndChild);
    3441         }
    3442 
    3443         /* free band array */
    3444         COMCTL32_Free (infoPtr->bands);
    3445         infoPtr->bands = NULL;
     3431    /* clean up each band */
     3432    for (i = 0; i < infoPtr->uNumBands; i++) {
     3433        lpBand = &infoPtr->bands[i];
     3434
     3435        /* delete text strings */
     3436        if (lpBand->lpText) {
     3437        COMCTL32_Free (lpBand->lpText);
     3438        lpBand->lpText = NULL;
     3439        }
     3440        /* destroy child window */
     3441        DestroyWindow (lpBand->hwndChild);
     3442    }
     3443
     3444    /* free band array */
     3445    COMCTL32_Free (infoPtr->bands);
     3446    infoPtr->bands = NULL;
    34463447    }
    34473448
     
    35223523    if (infoPtr->fStatus & BEGIN_DRAG_ISSUED) {
    35233524        REBAR_Notify((NMHDR *) &layout, infoPtr, RBN_LAYOUTCHANGED);
    3524         REBAR_Notify_NMREBAR (infoPtr, ihitBand, RBN_ENDDRAG);
    3525         infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED;
     3525    REBAR_Notify_NMREBAR (infoPtr, ihitBand, RBN_ENDDRAG);
     3526    infoPtr->fStatus &= ~BEGIN_DRAG_ISSUED;
    35263527    }
    35273528
     
    35473548    /* if mouse did not move much, exit */
    35483549    if ((abs(ptsmove.x - infoPtr->dragNow.x) <= mindragx) &&
    3549         (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
     3550    (abs(ptsmove.y - infoPtr->dragNow.y) <= mindragy)) return 0;
    35503551
    35513552    band1 = &infoPtr->bands[infoPtr->ihitBand-1];
     
    35543555    /* Test for valid drag case - must not be first band in row */
    35553556    if (infoPtr->dwStyle & CCS_VERT) {
    3556         if ((ptsmove.x < band2->rcBand.left) ||
    3557             (ptsmove.x > band2->rcBand.right) ||
    3558             ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) {
    3559             FIXME("Cannot drag to other rows yet!!\n");
    3560         }
    3561         else {
    3562             REBAR_HandleLRDrag (infoPtr, &ptsmove);
    3563         }
     3557    if ((ptsmove.x < band2->rcBand.left) ||
     3558        (ptsmove.x > band2->rcBand.right) ||
     3559        ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) {
     3560        FIXME("Cannot drag to other rows yet!!\n");
    35643561    }
    35653562    else {
    3566         if ((ptsmove.y < band2->rcBand.top) ||
    3567             (ptsmove.y > band2->rcBand.bottom) ||
    3568             ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) {
    3569             FIXME("Cannot drag to other rows yet!!\n");
    3570         }
    3571         else {
    3572             REBAR_HandleLRDrag (infoPtr, &ptsmove);
    3573         }
     3563        REBAR_HandleLRDrag (infoPtr, &ptsmove);
     3564    }
     3565    }
     3566    else {
     3567    if ((ptsmove.y < band2->rcBand.top) ||
     3568        (ptsmove.y > band2->rcBand.bottom) ||
     3569        ((infoPtr->ihitBand > 0) && (band1->iRow != band2->iRow))) {
     3570        FIXME("Cannot drag to other rows yet!!\n");
     3571    }
     3572    else {
     3573        REBAR_HandleLRDrag (infoPtr, &ptsmove);
     3574    }
    35743575    }
    35753576    return 0;
     
    35883589#if 0
    35893590    if (GetWindowLongA (infoPtr->hwndSelf, GWL_STYLE) & WS_BORDER) {
    3590         ((LPRECT)lParam)->left   += GetSystemMetrics(SM_CXEDGE);
    3591         ((LPRECT)lParam)->top    += GetSystemMetrics(SM_CYEDGE);
    3592         ((LPRECT)lParam)->right  -= GetSystemMetrics(SM_CXEDGE);
    3593         ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE);
     3591    ((LPRECT)lParam)->left   += GetSystemMetrics(SM_CXEDGE);
     3592    ((LPRECT)lParam)->top    += GetSystemMetrics(SM_CYEDGE);
     3593    ((LPRECT)lParam)->right  -= GetSystemMetrics(SM_CXEDGE);
     3594    ((LPRECT)lParam)->bottom -= GetSystemMetrics(SM_CYEDGE);
    35943595    }
    35953596#endif
     
    36083609
    36093610    if (infoPtr != NULL) {
    3610         ERR("Strange info structure pointer *not* NULL\n");
    3611         return FALSE;
     3611    ERR("Strange info structure pointer *not* NULL\n");
     3612    return FALSE;
    36123613    }
    36133614
    36143615    if (TRACE_ON(rebar)) {
    3615         GetWindowRect(hwnd, &wnrc1);
    3616         GetClientRect(hwnd, &clrc1);
    3617         TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
    3618               wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
    3619               clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
    3620               cs->x, cs->y, cs->cx, cs->cy);
     3616    GetWindowRect(hwnd, &wnrc1);
     3617    GetClientRect(hwnd, &clrc1);
     3618    TRACE("window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d) cs=(%d,%d %dx%d)\n",
     3619          wnrc1.left, wnrc1.top, wnrc1.right, wnrc1.bottom,
     3620          clrc1.left, clrc1.top, clrc1.right, clrc1.bottom,
     3621          cs->x, cs->y, cs->cx, cs->cy);
    36213622    }
    36223623
     
    36463647    /* issue WM_NOTIFYFORMAT to get unicode status of parent */
    36473648    i = SendMessageA(REBAR_GetNotifyParent (infoPtr),
    3648                      WM_NOTIFYFORMAT, hwnd, NF_QUERY);
     3649             WM_NOTIFYFORMAT, hwnd, NF_QUERY);
    36493650    if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
    3650         ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
    3651             i);
    3652         i = NFR_ANSI;
     3651    ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
     3652        i);
     3653    i = NFR_ANSI;
    36533654    }
    36543655    infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
     
    36593660
    36603661/* native does:
    3661             GetSysColor (numerous);
    3662             GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE);
    3663             GetStockObject (SYSTEM_FONT);
    3664            *SetWindowLong (hwnd, 0, info ptr);
    3665            *WM_NOTIFYFORMAT;
    3666            *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001);
     3662        GetSysColor (numerous);
     3663        GetSysColorBrush (numerous) (see WM_SYSCOLORCHANGE);
     3664        GetStockObject (SYSTEM_FONT);
     3665       *SetWindowLong (hwnd, 0, info ptr);
     3666       *WM_NOTIFYFORMAT;
     3667       *SetWindowLong (hwnd, GWL_STYLE, style+0x10000001);
    36673668                                    WS_VISIBLE = 0x10000000;
    36683669                                    CCS_TOP    = 0x00000001;
    3669             SystemParametersInfo (SPI_GETNONCLIENTMETRICS...);
    3670             CreateFontIndirect (lfCaptionFont from above);
    3671             GetDC ();
    3672             SelectObject (hdc, fontabove);
    3673             GetTextMetrics (hdc, );    guessing is tmHeight
    3674             SelectObject (hdc, oldfont);
    3675             ReleaseDC ();
    3676             GetWindowRect ();
    3677             MapWindowPoints (0, parent, rectabove, 2);
    3678             GetWindowRect ();
    3679             GetClientRect ();
    3680             ClientToScreen (clientrect);
    3681             SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER);
     3670        SystemParametersInfo (SPI_GETNONCLIENTMETRICS...);
     3671        CreateFontIndirect (lfCaptionFont from above);
     3672        GetDC ();
     3673        SelectObject (hdc, fontabove);
     3674        GetTextMetrics (hdc, );    guessing is tmHeight
     3675        SelectObject (hdc, oldfont);
     3676        ReleaseDC ();
     3677        GetWindowRect ();
     3678        MapWindowPoints (0, parent, rectabove, 2);
     3679        GetWindowRect ();
     3680        GetClientRect ();
     3681        ClientToScreen (clientrect);
     3682        SetWindowPos (hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER);
    36823683 */
    36833684    return TRUE;
     
    37073708    clpt = pt;
    37083709    ScreenToClient (infoPtr->hwndSelf, &clpt);
    3709     REBAR_InternalHitTest (infoPtr, &clpt, &scrap, 
    3710                            (INT *)&nmmouse.dwItemSpec);
     3710    REBAR_InternalHitTest (infoPtr, &clpt, &scrap,
     3711               (INT *)&nmmouse.dwItemSpec);
    37113712    nmmouse.dwItemData = 0;
    37123713    nmmouse.pt = clpt;
    37133714    nmmouse.dwHitInfo = 0;
    37143715    if ((i = REBAR_Notify((NMHDR *) &nmmouse, infoPtr, NM_NCHITTEST))) {
    3715         TRACE("notify changed return value from %ld to %d\n",
    3716               ret, i);
    3717         ret = (LRESULT) i;
     3716    TRACE("notify changed return value from %ld to %d\n",
     3717          ret, i);
     3718    ret = (LRESULT) i;
    37183719    }
    37193720    TRACE("returning %ld, client point (%ld,%ld)\n", ret, clpt.x, clpt.y);
     
    37293730
    37303731    if (infoPtr->dwStyle & WS_MINIMIZE)
    3731         return 0; /* Nothing to do */
     3732    return 0; /* Nothing to do */
    37323733
    37333734    DefWindowProcA (infoPtr->hwndSelf, WM_NCPAINT, wParam, lParam);
    37343735
    37353736    if (!(hdc = GetDCEx( infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW )))
    3736         return 0;
     3737    return 0;
    37373738
    37383739    if (infoPtr->dwStyle & WS_BORDER) {
    3739         GetWindowRect (infoPtr->hwndSelf, &rcWindow);
    3740         OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
    3741         TRACE("rect (%d,%d)-(%d,%d)\n",
    3742               rcWindow.left, rcWindow.top,
    3743               rcWindow.right, rcWindow.bottom);
    3744         /* see comments in _NCCalcSize for reason this is not done */
    3745         /* DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); */
    3746         DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP | BF_BOTTOM);
     3740    GetWindowRect (infoPtr->hwndSelf, &rcWindow);
     3741    OffsetRect (&rcWindow, -rcWindow.left, -rcWindow.top);
     3742    TRACE("rect (%d,%d)-(%d,%d)\n",
     3743          rcWindow.left, rcWindow.top,
     3744          rcWindow.right, rcWindow.bottom);
     3745    /* see comments in _NCCalcSize for reason this is not done */
     3746    /* DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_RECT); */
     3747    DrawEdge (hdc, &rcWindow, EDGE_ETCHED, BF_TOP | BF_BOTTOM);
    37473748    }
    37483749
     
    37593760
    37603761    if (lParam == NF_REQUERY) {
    3761         i = SendMessageA(REBAR_GetNotifyParent (infoPtr),
    3762                         WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);
    3763         if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
    3764             ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
    3765                 i);
    3766             i = NFR_ANSI;
    3767         }
    3768         infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
    3769         return (LRESULT)i;
     3762    i = SendMessageA(REBAR_GetNotifyParent (infoPtr),
     3763            WM_NOTIFYFORMAT, infoPtr->hwndSelf, NF_QUERY);
     3764    if ((i < NFR_ANSI) || (i > NFR_UNICODE)) {
     3765        ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n",
     3766        i);
     3767        i = NFR_ANSI;
     3768    }
     3769    infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0;
     3770    return (LRESULT)i;
    37703771    }
    37713772    return (LRESULT)((infoPtr->bUnicode) ? NFR_UNICODE : NFR_ANSI);
     
    37843785
    37853786    TRACE("painting (%d,%d)-(%d,%d) client (%d,%d)-(%d,%d)\n",
    3786           ps.rcPaint.left, ps.rcPaint.top,
    3787           ps.rcPaint.right, ps.rcPaint.bottom,
    3788           rc.left, rc.top, rc.right, rc.bottom);
     3787      ps.rcPaint.left, ps.rcPaint.top,
     3788      ps.rcPaint.right, ps.rcPaint.bottom,
     3789      rc.left, rc.top, rc.right, rc.bottom);
    37893790
    37903791    if (ps.fErase) {
    3791         /* Erase area of paint if requested */
     3792    /* Erase area of paint if requested */
    37923793        REBAR_InternalEraseBkGnd (infoPtr, wParam, lParam, &ps.rcPaint);
    37933794    }
     
    37953796    REBAR_Refresh (infoPtr, hdc);
    37963797    if (!wParam)
    3797         EndPaint (infoPtr->hwndSelf, &ps);
     3798    EndPaint (infoPtr->hwndSelf, &ps);
    37983799    return 0;
    37993800}
     
    38143815
    38153816    if (flags == RBHT_GRABBER) {
    3816         if ((infoPtr->dwStyle & CCS_VERT) &&
    3817             !(infoPtr->dwStyle & RBS_VERTICALGRIPPER))
    3818             SetCursor (infoPtr->hcurVert);
    3819         else
    3820             SetCursor (infoPtr->hcurHorz);
     3817    if ((infoPtr->dwStyle & CCS_VERT) &&
     3818        !(infoPtr->dwStyle & RBS_VERTICALGRIPPER))
     3819        SetCursor (infoPtr->hcurVert);
     3820    else
     3821        SetCursor (infoPtr->hcurHorz);
    38213822    }
    38223823    else if (flags != RBHT_CLIENT)
    3823         SetCursor (infoPtr->hcurArrow);
     3824    SetCursor (infoPtr->hcurArrow);
    38243825
    38253826    return 0;
     
    38393840    for (i=0; i<infoPtr->uNumBands; i++) {
    38403841        lpBand = &infoPtr->bands[i];
    3841         REBAR_ValidateBand (infoPtr, lpBand);
     3842    REBAR_ValidateBand (infoPtr, lpBand);
    38423843    }
    38433844
     
    38603861      *
    38613862      * Documentation:
    3862       *  According to testing V4.71 of COMCTL32 returns the 
     3863      *  According to testing V4.71 of COMCTL32 returns the
    38633864      *  *previous* status of the redraw flag (either 0 or -1)
    38643865      *  instead of the MSDN documented value of 0 if handled
     
    38683869    BOOL oldredraw = infoPtr->DoRedraw;
    38693870
    3870     TRACE("set to %s, fStatus=%08x\n", 
    3871           (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus);
     3871    TRACE("set to %s, fStatus=%08x\n",
     3872      (wParam) ? "TRUE" : "FALSE", infoPtr->fStatus);
    38723873    infoPtr->DoRedraw = (BOOL) wParam;
    38733874    if (wParam) {
    3874         if (infoPtr->fStatus & BAND_NEEDS_REDRAW) {
    3875             REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands);
    3876             REBAR_ForceResize (infoPtr);
    3877             InvalidateRect (infoPtr->hwndSelf, 0, TRUE);
    3878         }
    3879         infoPtr->fStatus &= ~BAND_NEEDS_REDRAW;
     3875    if (infoPtr->fStatus & BAND_NEEDS_REDRAW) {
     3876        REBAR_MoveChildWindows (infoPtr, 0, infoPtr->uNumBands);
     3877        REBAR_ForceResize (infoPtr);
     3878        InvalidateRect (infoPtr->hwndSelf, 0, TRUE);
     3879    }
     3880    infoPtr->fStatus &= ~BAND_NEEDS_REDRAW;
    38803881    }
    38813882    return (oldredraw) ? -1 : 0;
     
    38903891    /* auto resize deadlock check */
    38913892    if (infoPtr->fStatus & AUTO_RESIZE) {
    3892         infoPtr->fStatus &= ~AUTO_RESIZE;
    3893         TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",
    3894               infoPtr->fStatus, lParam);
    3895         return 0;
     3893    infoPtr->fStatus &= ~AUTO_RESIZE;
     3894    TRACE("AUTO_RESIZE was set, reset, fStatus=%08x lparam=%08lx\n",
     3895          infoPtr->fStatus, lParam);
     3896    return 0;
    38963897    }
    38973898
    38983899    if (infoPtr->fStatus & CREATE_RUNNING) {
    3899         /* still in CreateWindow */
    3900         RECT rcWin;
    3901 
    3902         TRACE("still in CreateWindow\n");
    3903         infoPtr->fStatus &= ~CREATE_RUNNING;
    3904         GetWindowRect ( infoPtr->hwndSelf, &rcWin);
    3905         TRACE("win rect (%d,%d)-(%d,%d)\n",
    3906               rcWin.left, rcWin.top, rcWin.right, rcWin.bottom);
    3907 
    3908         if ((lParam == 0) && (rcWin.right-rcWin.left == 0) &&
    3909             (rcWin.bottom-rcWin.top == 0)) {
    3910             /* native control seems to do this */
    3911             GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient);
    3912             TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n",
    3913                   rcClient.right, rcClient.bottom);
    3914         }
    3915         else {
    3916             INT cx, cy;
    3917 
    3918             cx = rcWin.right - rcWin.left;
    3919             cy = rcWin.bottom - rcWin.top;
    3920             if ((cx == LOWORD(lParam)) && (cy == HIWORD(lParam))) {
    3921                 return 0;
    3922             }
    3923 
    3924             /* do the actual WM_SIZE request */
    3925             GetClientRect (infoPtr->hwndSelf, &rcClient);
    3926             TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n",
    3927                   infoPtr->calcSize.cx, infoPtr->calcSize.cy,
    3928                   LOWORD(lParam), HIWORD(lParam),
    3929                   rcClient.right, rcClient.bottom);
    3930         }
     3900    /* still in CreateWindow */
     3901    RECT rcWin;
     3902
     3903    TRACE("still in CreateWindow\n");
     3904    infoPtr->fStatus &= ~CREATE_RUNNING;
     3905    GetWindowRect ( infoPtr->hwndSelf, &rcWin);
     3906    TRACE("win rect (%d,%d)-(%d,%d)\n",
     3907          rcWin.left, rcWin.top, rcWin.right, rcWin.bottom);
     3908
     3909    if ((lParam == 0) && (rcWin.right-rcWin.left == 0) &&
     3910        (rcWin.bottom-rcWin.top == 0)) {
     3911        /* native control seems to do this */
     3912        GetClientRect (GetParent(infoPtr->hwndSelf), &rcClient);
     3913        TRACE("sizing rebar, message and client zero, parent client (%d,%d)\n",
     3914          rcClient.right, rcClient.bottom);
    39313915    }
    39323916    else {
    3933         /* Handle cases when outside of the CreateWindow process */
    3934 
    3935         GetClientRect (infoPtr->hwndSelf, &rcClient);
    3936         if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) &&
    3937             (infoPtr->dwStyle & RBS_AUTOSIZE)) {
    3938             /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */
    3939             /* native seems to use the current client rect for the size      */
    3940             infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
    3941             TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n",
    3942                   rcClient.right, rcClient.bottom);
    3943         }
    3944         else {
    3945             TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n",
    3946                   infoPtr->calcSize.cx, infoPtr->calcSize.cy,
    3947                   LOWORD(lParam), HIWORD(lParam),
    3948                   rcClient.right, rcClient.bottom);
    3949         }
     3917        INT cx, cy;
     3918
     3919        cx = rcWin.right - rcWin.left;
     3920        cy = rcWin.bottom - rcWin.top;
     3921        if ((cx == LOWORD(lParam)) && (cy == HIWORD(lParam))) {
     3922        return 0;
     3923        }
     3924
     3925        /* do the actual WM_SIZE request */
     3926        GetClientRect (infoPtr->hwndSelf, &rcClient);
     3927        TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n",
     3928          infoPtr->calcSize.cx, infoPtr->calcSize.cy,
     3929          LOWORD(lParam), HIWORD(lParam),
     3930          rcClient.right, rcClient.bottom);
     3931    }
     3932    }
     3933    else {
     3934    /* Handle cases when outside of the CreateWindow process */
     3935
     3936    GetClientRect (infoPtr->hwndSelf, &rcClient);
     3937    if ((lParam == 0) && (rcClient.right + rcClient.bottom != 0) &&
     3938        (infoPtr->dwStyle & RBS_AUTOSIZE)) {
     3939        /* on a WM_SIZE to zero and current client not zero and AUTOSIZE */
     3940        /* native seems to use the current client rect for the size      */
     3941        infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
     3942        TRACE("sizing rebar to client (%d,%d) size is zero but AUTOSIZE set\n",
     3943          rcClient.right, rcClient.bottom);
     3944    }
     3945    else {
     3946        TRACE("sizing rebar from (%ld,%ld) to (%d,%d), client (%d,%d)\n",
     3947          infoPtr->calcSize.cx, infoPtr->calcSize.cy,
     3948          LOWORD(lParam), HIWORD(lParam),
     3949          rcClient.right, rcClient.bottom);
     3950    }
    39503951    }
    39513952
    39523953    if (infoPtr->dwStyle & RBS_AUTOSIZE) {
    3953         NMRBAUTOSIZE autosize;
    3954 
    3955         GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget);
    3956         autosize.fChanged = 0;  /* ??? */
    3957         autosize.rcActual = autosize.rcTarget;  /* ??? */
    3958         REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE);
    3959         TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n",
    3960               autosize.rcTarget.right, autosize.rcTarget.bottom, lParam);
     3954    NMRBAUTOSIZE autosize;
     3955
     3956    GetClientRect(infoPtr->hwndSelf, &autosize.rcTarget);
     3957    autosize.fChanged = 0;  /* ??? */
     3958    autosize.rcActual = autosize.rcTarget;  /* ??? */
     3959    REBAR_Notify((NMHDR *) &autosize, infoPtr, RBN_AUTOSIZE);
     3960    TRACE("RBN_AUTOSIZE client=(%d,%d), lp=%08lx\n",
     3961          autosize.rcTarget.right, autosize.rcTarget.bottom, lParam);
    39613962    }
    39623963
    39633964    if ((infoPtr->calcSize.cx != rcClient.right) ||
    3964         (infoPtr->calcSize.cy != rcClient.bottom))
    3965         infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
     3965    (infoPtr->calcSize.cy != rcClient.bottom))
     3966    infoPtr->fStatus |= BAND_NEEDS_LAYOUT;
    39663967
    39673968    REBAR_Layout (infoPtr, &rcClient, TRUE, TRUE);
     
    39783979
    39793980    TRACE("current style=%08lx, styleOld=%08lx, style being set to=%08lx\n",
    3980           infoPtr->dwStyle, ss->styleOld, ss->styleNew);
     3981      infoPtr->dwStyle, ss->styleOld, ss->styleNew);
    39813982    infoPtr->dwStyle = ss->styleNew;
    39823983
     
    39903991    REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd);
    39913992
    3992     TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n", 
    3993           hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
     3993    TRACE("hwnd=%x msg=%x wparam=%x lparam=%lx\n",
     3994      hwnd, uMsg, /* SPY_GetMsgName(uMsg), */ wParam, lParam);
    39943995    if (!infoPtr && (uMsg != WM_NCCREATE))
    3995             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     3996        return DefWindowProcA (hwnd, uMsg, wParam, lParam);
    39963997    switch (uMsg)
    39973998    {
    3998 /*      case RB_BEGINDRAG: */
    3999 
    4000         case RB_DELETEBAND:
    4001             return REBAR_DeleteBand (infoPtr, wParam, lParam);
    4002 
    4003 /*      case RB_DRAGMOVE: */
    4004 /*      case RB_ENDDRAG: */
    4005 
    4006         case RB_GETBANDBORDERS:
    4007             return REBAR_GetBandBorders (infoPtr, wParam, lParam);
    4008 
    4009         case RB_GETBANDCOUNT:
    4010             return REBAR_GetBandCount (infoPtr);
    4011 
    4012         case RB_GETBANDINFO:    /* obsoleted after IE3, but we have to
    4013                                    support it anyway. */
    4014         case RB_GETBANDINFOA:
    4015             return REBAR_GetBandInfoA (infoPtr, wParam, lParam);
    4016 
    4017         case RB_GETBANDINFOW:
    4018             return REBAR_GetBandInfoW (infoPtr, wParam, lParam);
    4019 
    4020         case RB_GETBARHEIGHT:
    4021             return REBAR_GetBarHeight (infoPtr, wParam, lParam);
    4022 
    4023         case RB_GETBARINFO:
    4024             return REBAR_GetBarInfo (infoPtr, wParam, lParam);
    4025 
    4026         case RB_GETBKCOLOR:
    4027             return REBAR_GetBkColor (infoPtr);
    4028 
    4029 /*      case RB_GETCOLORSCHEME: */
    4030 /*      case RB_GETDROPTARGET: */
    4031 
    4032         case RB_GETPALETTE:
    4033             return REBAR_GetPalette (infoPtr, wParam, lParam);
    4034 
    4035         case RB_GETRECT:
    4036             return REBAR_GetRect (infoPtr, wParam, lParam);
    4037 
    4038         case RB_GETROWCOUNT:
    4039             return REBAR_GetRowCount (infoPtr);
    4040 
    4041         case RB_GETROWHEIGHT:
    4042             return REBAR_GetRowHeight (infoPtr, wParam, lParam);
    4043 
    4044         case RB_GETTEXTCOLOR:
    4045             return REBAR_GetTextColor (infoPtr);
    4046 
    4047         case RB_GETTOOLTIPS:
    4048             return REBAR_GetToolTips (infoPtr);
    4049 
    4050         case RB_GETUNICODEFORMAT:
    4051             return REBAR_GetUnicodeFormat (infoPtr);
    4052 
    4053         case CCM_GETVERSION:
    4054             return REBAR_GetVersion (infoPtr);
    4055 
    4056         case RB_HITTEST:
    4057             return REBAR_HitTest (infoPtr, wParam, lParam);
    4058 
    4059         case RB_IDTOINDEX:
    4060             return REBAR_IdToIndex (infoPtr, wParam, lParam);
    4061 
    4062         case RB_INSERTBANDA:
    4063             return REBAR_InsertBandA (infoPtr, wParam, lParam);
    4064 
    4065         case RB_INSERTBANDW:
    4066             return REBAR_InsertBandW (infoPtr, wParam, lParam);
    4067 
    4068         case RB_MAXIMIZEBAND:
    4069             return REBAR_MaximizeBand (infoPtr, wParam, lParam);
    4070 
    4071         case RB_MINIMIZEBAND:
    4072             return REBAR_MinimizeBand (infoPtr, wParam, lParam);
    4073 
    4074         case RB_MOVEBAND:
    4075             return REBAR_MoveBand (infoPtr, wParam, lParam);
    4076 
    4077         case RB_SETBANDINFOA:
    4078             return REBAR_SetBandInfoA (infoPtr, wParam, lParam);
    4079 
    4080         case RB_SETBANDINFOW:
    4081             return REBAR_SetBandInfoW (infoPtr, wParam, lParam);
    4082 
    4083         case RB_SETBARINFO:
    4084             return REBAR_SetBarInfo (infoPtr, wParam, lParam);
    4085 
    4086         case RB_SETBKCOLOR:
    4087             return REBAR_SetBkColor (infoPtr, wParam, lParam);
    4088 
    4089 /*      case RB_SETCOLORSCHEME: */
    4090 /*      case RB_SETPALETTE: */
    4091 /*          return REBAR_GetPalette (infoPtr, wParam, lParam); */
    4092 
    4093         case RB_SETPARENT:
    4094             return REBAR_SetParent (infoPtr, wParam, lParam);
    4095 
    4096         case RB_SETTEXTCOLOR:
    4097             return REBAR_SetTextColor (infoPtr, wParam, lParam);
    4098 
    4099 /*      case RB_SETTOOLTIPS: */
    4100 
    4101         case RB_SETUNICODEFORMAT:
    4102             return REBAR_SetUnicodeFormat (infoPtr, wParam);
    4103 
    4104         case CCM_SETVERSION:
    4105             return REBAR_SetVersion (infoPtr, (INT)wParam);
    4106 
    4107         case RB_SHOWBAND:
    4108             return REBAR_ShowBand (infoPtr, wParam, lParam);
    4109 
    4110         case RB_SIZETORECT:
    4111             return REBAR_SizeToRect (infoPtr, wParam, lParam);
     3999/*  case RB_BEGINDRAG: */
     4000
     4001    case RB_DELETEBAND:
     4002        return REBAR_DeleteBand (infoPtr, wParam, lParam);
     4003
     4004/*  case RB_DRAGMOVE: */
     4005/*  case RB_ENDDRAG: */
     4006
     4007    case RB_GETBANDBORDERS:
     4008        return REBAR_GetBandBorders (infoPtr, wParam, lParam);
     4009
     4010    case RB_GETBANDCOUNT:
     4011        return REBAR_GetBandCount (infoPtr);
     4012
     4013    case RB_GETBANDINFO:    /* obsoleted after IE3, but we have to
     4014                   support it anyway. */
     4015    case RB_GETBANDINFOA:
     4016        return REBAR_GetBandInfoA (infoPtr, wParam, lParam);
     4017
     4018    case RB_GETBANDINFOW:
     4019        return REBAR_GetBandInfoW (infoPtr, wParam, lParam);
     4020
     4021    case RB_GETBARHEIGHT:
     4022        return REBAR_GetBarHeight (infoPtr, wParam, lParam);
     4023
     4024    case RB_GETBARINFO:
     4025        return REBAR_GetBarInfo (infoPtr, wParam, lParam);
     4026
     4027    case RB_GETBKCOLOR:
     4028        return REBAR_GetBkColor (infoPtr);
     4029
     4030/*  case RB_GETCOLORSCHEME: */
     4031/*  case RB_GETDROPTARGET: */
     4032
     4033    case RB_GETPALETTE:
     4034        return REBAR_GetPalette (infoPtr, wParam, lParam);
     4035
     4036    case RB_GETRECT:
     4037        return REBAR_GetRect (infoPtr, wParam, lParam);
     4038
     4039    case RB_GETROWCOUNT:
     4040        return REBAR_GetRowCount (infoPtr);
     4041
     4042    case RB_GETROWHEIGHT:
     4043        return REBAR_GetRowHeight (infoPtr, wParam, lParam);
     4044
     4045    case RB_GETTEXTCOLOR:
     4046        return REBAR_GetTextColor (infoPtr);
     4047
     4048    case RB_GETTOOLTIPS:
     4049        return REBAR_GetToolTips (infoPtr);
     4050
     4051    case RB_GETUNICODEFORMAT:
     4052        return REBAR_GetUnicodeFormat (infoPtr);
     4053
     4054    case CCM_GETVERSION:
     4055        return REBAR_GetVersion (infoPtr);
     4056
     4057    case RB_HITTEST:
     4058        return REBAR_HitTest (infoPtr, wParam, lParam);
     4059
     4060    case RB_IDTOINDEX:
     4061        return REBAR_IdToIndex (infoPtr, wParam, lParam);
     4062
     4063    case RB_INSERTBANDA:
     4064        return REBAR_InsertBandA (infoPtr, wParam, lParam);
     4065
     4066    case RB_INSERTBANDW:
     4067        return REBAR_InsertBandW (infoPtr, wParam, lParam);
     4068
     4069    case RB_MAXIMIZEBAND:
     4070        return REBAR_MaximizeBand (infoPtr, wParam, lParam);
     4071
     4072    case RB_MINIMIZEBAND:
     4073        return REBAR_MinimizeBand (infoPtr, wParam, lParam);
     4074
     4075    case RB_MOVEBAND:
     4076        return REBAR_MoveBand (infoPtr, wParam, lParam);
     4077
     4078    case RB_SETBANDINFOA:
     4079        return REBAR_SetBandInfoA (infoPtr, wParam, lParam);
     4080
     4081    case RB_SETBANDINFOW:
     4082        return REBAR_SetBandInfoW (infoPtr, wParam, lParam);
     4083
     4084    case RB_SETBARINFO:
     4085        return REBAR_SetBarInfo (infoPtr, wParam, lParam);
     4086
     4087    case RB_SETBKCOLOR:
     4088        return REBAR_SetBkColor (infoPtr, wParam, lParam);
     4089
     4090/*  case RB_SETCOLORSCHEME: */
     4091/*  case RB_SETPALETTE: */
     4092/*      return REBAR_GetPalette (infoPtr, wParam, lParam); */
     4093
     4094    case RB_SETPARENT:
     4095        return REBAR_SetParent (infoPtr, wParam, lParam);
     4096
     4097    case RB_SETTEXTCOLOR:
     4098        return REBAR_SetTextColor (infoPtr, wParam, lParam);
     4099
     4100/*  case RB_SETTOOLTIPS: */
     4101
     4102    case RB_SETUNICODEFORMAT:
     4103        return REBAR_SetUnicodeFormat (infoPtr, wParam);
     4104
     4105    case CCM_SETVERSION:
     4106        return REBAR_SetVersion (infoPtr, (INT)wParam);
     4107
     4108    case RB_SHOWBAND:
     4109        return REBAR_ShowBand (infoPtr, wParam, lParam);
     4110
     4111    case RB_SIZETORECT:
     4112        return REBAR_SizeToRect (infoPtr, wParam, lParam);
    41124113
    41134114
    41144115/*    Messages passed to parent */
    4115         case WM_COMMAND:
    4116         case WM_DRAWITEM:
    4117         case WM_NOTIFY:
    4118             if (infoPtr->NtfUnicode)
    4119                 return SendMessageW (REBAR_GetNotifyParent (infoPtr),
    4120                                      uMsg, wParam, lParam);
    4121             else
    4122                 return SendMessageA (REBAR_GetNotifyParent (infoPtr),
    4123                                      uMsg, wParam, lParam);
     4116    case WM_COMMAND:
     4117    case WM_DRAWITEM:
     4118    case WM_NOTIFY:
     4119        if (infoPtr->NtfUnicode)
     4120        return SendMessageW (REBAR_GetNotifyParent (infoPtr),
     4121                     uMsg, wParam, lParam);
     4122        else
     4123        return SendMessageA (REBAR_GetNotifyParent (infoPtr),
     4124                     uMsg, wParam, lParam);
    41244125
    41254126
    41264127/*      case WM_CHARTOITEM:     supported according to ControlSpy */
    41274128
    4128         case WM_CREATE:
    4129             return REBAR_Create (infoPtr, wParam, lParam);
    4130 
    4131         case WM_DESTROY:
    4132             return REBAR_Destroy (infoPtr, wParam, lParam);
     4129    case WM_CREATE:
     4130        return REBAR_Create (infoPtr, wParam, lParam);
     4131
     4132    case WM_DESTROY:
     4133        return REBAR_Destroy (infoPtr, wParam, lParam);
    41334134
    41344135        case WM_ERASEBKGND:
    4135             return REBAR_EraseBkGnd (infoPtr, wParam, lParam);
    4136 
    4137         case WM_GETFONT:
    4138             return REBAR_GetFont (infoPtr, wParam, lParam);
     4136        return REBAR_EraseBkGnd (infoPtr, wParam, lParam);
     4137
     4138    case WM_GETFONT:
     4139        return REBAR_GetFont (infoPtr, wParam, lParam);
    41394140
    41404141/*      case WM_LBUTTONDBLCLK:  supported according to ControlSpy */
    41414142
    4142         case WM_LBUTTONDOWN:
    4143             return REBAR_LButtonDown (infoPtr, wParam, lParam);
    4144 
    4145         case WM_LBUTTONUP:
    4146             return REBAR_LButtonUp (infoPtr, wParam, lParam);
     4143    case WM_LBUTTONDOWN:
     4144        return REBAR_LButtonDown (infoPtr, wParam, lParam);
     4145
     4146    case WM_LBUTTONUP:
     4147        return REBAR_LButtonUp (infoPtr, wParam, lParam);
    41474148
    41484149/*      case WM_MEASUREITEM:    supported according to ControlSpy */
    41494150
    4150         case WM_MOUSEMOVE:
    4151             return REBAR_MouseMove (infoPtr, wParam, lParam);
    4152 
    4153         case WM_NCCALCSIZE:
    4154             return REBAR_NCCalcSize (infoPtr, wParam, lParam);
     4151    case WM_MOUSEMOVE:
     4152        return REBAR_MouseMove (infoPtr, wParam, lParam);
     4153
     4154    case WM_NCCALCSIZE:
     4155        return REBAR_NCCalcSize (infoPtr, wParam, lParam);
    41554156
    41564157        case WM_NCCREATE:
    4157             return REBAR_NCCreate (hwnd, wParam, lParam);
     4158        return REBAR_NCCreate (hwnd, wParam, lParam);
    41584159
    41594160        case WM_NCHITTEST:
    4160             return REBAR_NCHitTest (infoPtr, wParam, lParam);
    4161 
    4162         case WM_NCPAINT:
    4163             return REBAR_NCPaint (infoPtr, wParam, lParam);
     4161        return REBAR_NCHitTest (infoPtr, wParam, lParam);
     4162
     4163    case WM_NCPAINT:
     4164        return REBAR_NCPaint (infoPtr, wParam, lParam);
    41644165
    41654166        case WM_NOTIFYFORMAT:
    4166             return REBAR_NotifyFormat (infoPtr, wParam, lParam);
    4167 
    4168         case WM_PAINT:
    4169             return REBAR_Paint (infoPtr, wParam, lParam);
     4167        return REBAR_NotifyFormat (infoPtr, wParam, lParam);
     4168
     4169    case WM_PAINT:
     4170        return REBAR_Paint (infoPtr, wParam, lParam);
    41704171
    41714172/*      case WM_PALETTECHANGED: supported according to ControlSpy */
     
    41754176/*      case WM_RBUTTONUP:      supported according to ControlSpy */
    41764177
    4177         case WM_SETCURSOR:
    4178             return REBAR_SetCursor (infoPtr, wParam, lParam);
    4179 
    4180         case WM_SETFONT:
    4181             return REBAR_SetFont (infoPtr, wParam, lParam);
     4178    case WM_SETCURSOR:
     4179        return REBAR_SetCursor (infoPtr, wParam, lParam);
     4180
     4181    case WM_SETFONT:
     4182        return REBAR_SetFont (infoPtr, wParam, lParam);
    41824183
    41834184        case WM_SETREDRAW:
    4184             return REBAR_SetRedraw (infoPtr, wParam, lParam);
    4185 
    4186         case WM_SIZE:
    4187             return REBAR_Size (infoPtr, wParam, lParam);
     4185        return REBAR_SetRedraw (infoPtr, wParam, lParam);
     4186
     4187    case WM_SIZE:
     4188        return REBAR_Size (infoPtr, wParam, lParam);
    41884189
    41894190        case WM_STYLECHANGED:
    4190             return REBAR_StyleChanged (infoPtr, wParam, lParam);
     4191        return REBAR_StyleChanged (infoPtr, wParam, lParam);
    41914192
    41924193/*      case WM_SYSCOLORCHANGE: supported according to ControlSpy */
    41934194/*      "Applications that have brushes using the existing system colors
    4194          should delete those brushes and recreate them using the new 
     4195         should delete those brushes and recreate them using the new
    41954196         system colors."  per MSDN                                */
    41964197
    41974198/*      case WM_VKEYTOITEM:     supported according to ControlSpy */
    4198 /*      case WM_WININICHANGE: */
    4199 
    4200         default:
    4201             if (uMsg >= WM_USER)
    4202                 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
    4203                      uMsg, wParam, lParam);
     4199/*  case WM_WININICHANGE: */
     4200
     4201    default:
     4202        if (uMsg >= WM_USER)
     4203        ERR("unknown msg %04x wp=%08x lp=%08lx\n",
     4204             uMsg, wParam, lParam);
    42044205#ifdef __WIN32OS2__
    42054206            return defComCtl32ProcA (hwnd, uMsg, wParam, lParam);
    42064207#else
    4207             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
     4208        return DefWindowProcA (hwnd, uMsg, wParam, lParam);
    42084209#endif
    42094210    }
     
    42254226    wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
    42264227    wndClass.lpszClassName = REBARCLASSNAMEA;
    4227  
     4228
    42284229    RegisterClassA (&wndClass);
    42294230
Note: See TracChangeset for help on using the changeset viewer.