Changeset 2221 for trunk/src/comctl32


Ignore:
Timestamp:
Dec 27, 1999, 11:54:49 PM (26 years ago)
Author:
cbratschi
Message:

* empty log message *

File:
1 edited

Legend:

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

    r1762 r2221  
    1 /* $Id: trackbar.c,v 1.23 1999-11-17 17:06:23 cbratschi Exp $ */
     1/* $Id: trackbar.c,v 1.24 1999-12-27 22:54:49 cbratschi Exp $ */
    22/*
    33 * Trackbar control
     
    9595      for (i = 0;i < infoPtr->uNumTics;i++)
    9696      {
    97         if (infoPtr->tics[i] >= infoPtr->nRangeMin && infoPtr->tics[i] <= infoPtr->nRangeMax)
     97        if ((infoPtr->tics[i] >= infoPtr->nRangeMin) && (infoPtr->tics[i] <= infoPtr->nRangeMax))
    9898        {
    9999          oldTics[count] = infoPtr->tics[i];
     
    109109    }
    110110
    111     if (infoPtr->uTicFreq && infoPtr->nRangeMax > infoPtr->nRangeMin && (dwStyle & TBS_AUTOTICKS))
     111    if (infoPtr->uTicFreq && (infoPtr->nRangeMax > infoPtr->nRangeMin) && (dwStyle & TBS_AUTOTICKS))
    112112    {
    113113      //Tics without start and end tic
     
    191191      channel->bottom = lpRect.bottom-CHANNEL_SPACE;
    192192
    193       if (dwStyle & TBS_BOTH || dwStyle & TBS_NOTICKS)
     193      if ((dwStyle & TBS_BOTH) || (dwStyle & TBS_NOTICKS))
    194194      { //center
    195195        channel->left  = (lpRect.right-channelSize)/2;
     
    208208      channel->left = lpRect.left+CHANNEL_SPACE;
    209209      channel->right = lpRect.right-CHANNEL_SPACE;
    210       if (dwStyle & TBS_BOTH || dwStyle & TBS_NOTICKS)
     210      if ((dwStyle & TBS_BOTH) || (dwStyle & TBS_NOTICKS))
    211211      { //center
    212212        channel->top    = (lpRect.bottom-channelSize)/2;
     
    281281    range = infoPtr->nRangeMax-infoPtr->nRangeMin;
    282282
    283     if (range <= 0 || selMin == selMax) SetRectEmpty(selection);
     283    if ((range <= 0) || (selMin == selMax)) SetRectEmpty(selection);
    284284    else
    285285        if (!(GetWindowLongA(hwnd, GWL_STYLE) & TBS_VERT))
     
    494494      RECT thumb = infoPtr->rcThumb;
    495495
    496       if (infoPtr->flags & TB_DRAG_MODE || !IsWindowEnabled(hwnd)) hbr = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT));
     496      if ((infoPtr->flags & TB_DRAG_MODE) || !IsWindowEnabled(hwnd)) hbr = CreateSolidBrush(GetSysColor(COLOR_3DHILIGHT));
    497497      else hbr = CreateSolidBrush(GetSysColor(COLOR_3DFACE));
    498498      hbrOld = SelectObject(hdc,hbr);
     
    803803
    804804        //check if maximum of visible marks is reached
    805         if (dwStyle & TBS_AUTOTICKS && infoPtr->uNumTics > 1 && (INT)(width*infoPtr->tics[0]/range) == (INT)(width*infoPtr->tics[1]/range))
     805        if ((dwStyle & TBS_AUTOTICKS) && (infoPtr->uNumTics > 1) && ((INT)(width*infoPtr->tics[0]/range) == (INT)(width*infoPtr->tics[1]/range)))
    806806        {
    807807          //draw all pixels at once -> much faster
     
    902902     infoPtr->flags &= ~TB_DRAGPOSVALID;
    903903   }
    904    if (!mustRedraw && infoPtr->nPos == lastPos) return;
     904   if (!mustRedraw && (infoPtr->nPos == lastPos)) return;
    905905
    906906   if (dwStyle & TBS_NOTHUMB) return;
     
    931931   if (dwStyle & TBS_VERT)
    932932   {
    933      if (lastRect.top > newRect.top && lastRect.top < newRect.bottom)
     933     if ((lastRect.top > newRect.top) && (lastRect.top < newRect.bottom))
    934934       BitBlt(hdc,newRect.left,newRect.top,newRect.right-newRect.left,lastRect.bottom-newRect.top,hdcCompatible,newRect.left,newRect.top,SRCCOPY);
    935      else if (lastRect.bottom < newRect.bottom && lastRect.bottom > newRect.top)
     935     else if ((lastRect.bottom < newRect.bottom) && (lastRect.bottom > newRect.top))
    936936       BitBlt(hdc,lastRect.left,lastRect.top,lastRect.right-lastRect.left,newRect.bottom-lastRect.top,hdcCompatible,lastRect.left,lastRect.top,SRCCOPY);
    937937     else
     
    942942   } else
    943943   {
    944      if (lastRect.right > newRect.left && lastRect.right < newRect.right)
     944     if ((lastRect.right > newRect.left) && (lastRect.right < newRect.right))
    945945       BitBlt(hdc,lastRect.left,lastRect.top,newRect.right-lastRect.left,lastRect.bottom-lastRect.top,hdcCompatible,lastRect.left,lastRect.top,SRCCOPY);
    946      else if (lastRect.left < newRect.right && lastRect.left > newRect.left)
     946     else if ((lastRect.left < newRect.right) && (lastRect.left > newRect.left))
    947947       BitBlt(hdc,newRect.left,newRect.top,lastRect.right-newRect.left,newRect.bottom-newRect.top,hdcCompatible,newRect.left,newRect.top,SRCCOPY);
    948948     else
     
    13271327      newMax = x;
    13281328    }
    1329     if (newMin == infoPtr->nRangeMin && newMax == infoPtr->nRangeMax) return 0;
     1329    if ((newMin == infoPtr->nRangeMin) && (newMax == infoPtr->nRangeMax)) return 0;
    13301330
    13311331    infoPtr->nRangeMin = newMin;
     
    14541454    newMax = (INT)HIWORD(lParam);
    14551455
    1456     if (infoPtr->nSelMin == newMin && infoPtr->nSelMax == newMax) return 0;
     1456    if ((infoPtr->nSelMin == newMin) && (infoPtr->nSelMax == newMax)) return 0;
    14571457    infoPtr->nSelMin = newMin;
    14581458    infoPtr->nSelMax = newMax;
     
    14671467    if (!GetWindowLongA(hwnd, GWL_STYLE) & TBS_ENABLESELRANGE) return 0;
    14681468
    1469     if (oldMin != newMin || oldMax != newMax)
     1469    if ((oldMin != newMin) || (oldMax != newMax))
    14701470    {
    14711471      infoPtr->flags |= TB_SELECTIONCHANGED;
     
    16131613    if (dwStyle & TBS_VERT)
    16141614    {
    1615       if (wParam == TBTS_LEFT || wParam == TBTS_RIGHT) infoPtr->fLocation = (INT)wParam;
     1615      if ((wParam == TBTS_LEFT) || (wParam == TBTS_RIGHT)) infoPtr->fLocation = (INT)wParam;
    16161616    } else
    16171617    {
    1618       if (wParam == TBTS_TOP || wParam == TBTS_BOTTOM) infoPtr->fLocation = (INT)wParam;
     1618      if ((wParam == TBTS_TOP) || (wParam == TBTS_BOTTOM)) infoPtr->fLocation = (INT)wParam;
    16191619    }
    16201620
     
    18151815    fullThumb = infoPtr->rcFullThumb;
    18161816    if ((vertical &&
    1817          clickPoint.y >= thumb.top &&
    1818          clickPoint.y <= thumb.bottom &&
    1819          ((dwStyle & TBS_BOTH &&
    1820            clickPoint.x >= thumb.left &&
    1821            clickPoint.x <= thumb.right
     1817         (clickPoint.y >= thumb.top) &&
     1818         (clickPoint.y <= thumb.bottom) &&
     1819         (((dwStyle & TBS_BOTH) &&
     1820           (clickPoint.x >= thumb.left) &&
     1821           (clickPoint.x <= thumb.right)
    18221822          ) ||
    1823           (dwStyle & TBS_LEFT &&
    1824            clickPoint.x <= thumb.right &&
    1825            (clickPoint.x >= thumb.left ||
    1826             (clickPoint.x >= fullThumb.left &&
    1827              (thumb.left-clickPoint.x <= clickPoint.y-thumb.top &&
    1828               thumb.left-clickPoint.x <= thumb.bottom-clickPoint.y
     1823          ((dwStyle & TBS_LEFT) &&
     1824           (clickPoint.x <= thumb.right) &&
     1825           ((clickPoint.x >= thumb.left) ||
     1826            ((clickPoint.x >= fullThumb.left) &&
     1827             ((thumb.left-clickPoint.x <= clickPoint.y-thumb.top) &&
     1828              (thumb.left-clickPoint.x <= thumb.bottom-clickPoint.y)
    18291829             )
    18301830            )
     
    18321832          ) ||
    18331833          (!(dwStyle & (TBS_BOTH | TBS_LEFT)) &&
    1834            clickPoint.x >= thumb.left &&
    1835            (clickPoint.x <= thumb.right ||
    1836             (clickPoint.x <= fullThumb.right &&
    1837              (clickPoint.x-thumb.right <= clickPoint.y-thumb.top &&
    1838               clickPoint.x-thumb.right <= thumb.bottom-clickPoint.y
     1834           (clickPoint.x >= thumb.left) &&
     1835           ((clickPoint.x <= thumb.right) ||
     1836            ((clickPoint.x <= fullThumb.right) &&
     1837             ((clickPoint.x-thumb.right <= clickPoint.y-thumb.top) &&
     1838              (clickPoint.x-thumb.right <= thumb.bottom-clickPoint.y)
    18391839             )
    18401840            )
     
    18431843        ) ||
    18441844        (!vertical &&
    1845          clickPoint.x >= thumb.left &&
    1846          clickPoint.x <= thumb.right &&
    1847          ((dwStyle & TBS_BOTH &&
    1848            clickPoint.y >= thumb.top &&
    1849            clickPoint.y <= thumb.bottom
     1845         (clickPoint.x >= thumb.left) &&
     1846         (clickPoint.x <= thumb.right) &&
     1847         (((dwStyle & TBS_BOTH) &&
     1848           (clickPoint.y >= thumb.top) &&
     1849           (clickPoint.y <= thumb.bottom)
    18501850          ) ||
    1851           (dwStyle & TBS_TOP &&
    1852            clickPoint.y <= thumb.bottom &&
    1853            (clickPoint.y >= thumb.top ||
    1854             (clickPoint.y >= fullThumb.top &&
    1855              (thumb.top-clickPoint.y <= clickPoint.x-thumb.left &&
    1856               thumb.top-clickPoint.y <= thumb.right-clickPoint.x
     1851          ((dwStyle & TBS_TOP) &&
     1852           (clickPoint.y <= thumb.bottom) &&
     1853           ((clickPoint.y >= thumb.top) ||
     1854            ((clickPoint.y >= fullThumb.top) &&
     1855             ((thumb.top-clickPoint.y <= clickPoint.x-thumb.left) &&
     1856              (thumb.top-clickPoint.y <= thumb.right-clickPoint.x)
    18571857             )
    18581858            )
     
    18601860          ) ||
    18611861          (!(dwStyle & (TBS_BOTH | TBS_TOP)) &&
    1862            clickPoint.y >= thumb.top &&
    1863            (clickPoint.y <= thumb.bottom ||
    1864             (clickPoint.y <= fullThumb.bottom &&
    1865              (clickPoint.y-thumb.bottom <= clickPoint.x-thumb.left &&
    1866               clickPoint.y-thumb.bottom <= thumb.right-clickPoint.x
     1862           (clickPoint.y >= thumb.top) &&
     1863           ((clickPoint.y <= thumb.bottom) ||
     1864            ((clickPoint.y <= fullThumb.bottom) &&
     1865             ((clickPoint.y-thumb.bottom <= clickPoint.x-thumb.left) &&
     1866              (clickPoint.y-thumb.bottom <= thumb.right-clickPoint.x)
    18671867             )
    18681868            )
Note: See TracChangeset for help on using the changeset viewer.