Ignore:
Timestamp:
Jun 26, 1999, 4:20:32 PM (26 years ago)
Author:
cbratschi
Message:

Updates for new DrawEdge and colors

File:
1 edited

Legend:

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

    r180 r219  
    1 /* $Id: trackbar.c,v 1.7 1999-06-24 16:37:45 cbratschi Exp $ */
     1/* $Id: trackbar.c,v 1.8 1999-06-26 14:20:32 cbratschi Exp $ */
    22/*
    33 * Trackbar control
     
    1111 * TODO:
    1212 *
    13  *   - more notifications.
    14  *   - Fix Odin32/WINE DrawEdge() bugs
     13 *   - more notifications. (CB: should be complete)
     14 *   - TRACKBAR_UpdateThumb, TRACKBAR_UpdateThumbPosition:
     15 *     use a memory dc to avoid flickering by short movements
    1516 */
    1617
     
    449450      if (dwStyle & TBS_BOTH)
    450451      {
    451         DrawEdge (hdc,&thumb,EDGE_RAISED,BF_RECT | BF_ADJUST);
    452         FillRect (hdc,&thumb,hbr);
     452        DrawEdge(hdc,&thumb,EDGE_RAISED,BF_RECT | BF_ADJUST);
     453        FillRect(hdc,&thumb,hbr);
    453454      } else
    454455      {
     
    462463          if (dwStyle & TBS_LEFT)
    463464          {
     465            HPEN oldPen,pen;
     466
    464467            //Outline
    465468
     
    477480            points[5].x = points[0].x;
    478481            points[5].y = points[0].y;
    479             Polygon (hdc,points,6);
     482            Polygon(hdc,points,6);
    480483
    481484            //Edge
     
    487490            //Draw notch
    488491
    489             triangle.right = points[0].x-1;
    490             triangle.top = points[0].y+1+1;
     492            triangle.right = points[0].x;
     493            triangle.top = points[0].y;
    491494            triangle.left = points[1].x;
    492             triangle.bottom = points[1].y+1; //Odin32 fix
    493             DrawEdge(hdc,&triangle,EDGE_SUNKEN,BF_DIAGONAL | BF_DIAGONAL_ENDBOTTOMLEFT);
    494             triangle.right = points[2].x;
    495             triangle.bottom = points[2].y;
    496             triangle.left = points[1].x;
    497             triangle.top = points[1].y; //Odin32 bug: wrong lines
    498             DrawEdge(hdc,&triangle,EDGE_SUNKEN,BF_DIAGONAL | BF_DIAGONAL_ENDTOPLEFT);
    499 
     495            triangle.bottom = points[1].y;
     496            DrawEdge(hdc,&triangle,EDGE_RAISED,BF_DIAGONAL | BF_DIAGONAL_ENDTOPRIGHT);
     497
     498            //draw this line direct, DrawEdge not useful
     499            pen = GetSysColorPen(COLOR_3DDKSHADOW);
     500            oldPen = SelectObject(hdc,pen);
     501            MoveToEx(hdc,points[1].x,points[1].y,NULL);
     502            LineTo(hdc,points[2].x-1,points[2].y-1);
     503            pen = GetSysColorPen(COLOR_BTNSHADOW);
     504            SelectObject(hdc,pen);
     505            MoveToEx(hdc,points[1].x+1,points[1].y,NULL);
     506            LineTo(hdc,points[2].x,points[2].y-1);
     507            SelectObject(hdc,oldPen);
    500508
    501509          } else //Right
    502510          {
     511            HPEN oldPen,pen;
     512
    503513            //Outline
    504514
     
    516526            points[5].x = points[0].x;
    517527            points[5].y = points[0].y;
    518             Polygon (hdc,points,6);
     528            Polygon(hdc,points,6);
    519529
    520530            //Edge
     
    525535            //Draw notch
    526536
    527             triangle.left = points[4].x;
    528             triangle.top = points[4].y;
     537            //draw this line direct, DrawEdge not useful
     538            pen = GetSysColorPen(COLOR_3DLIGHT);
     539            oldPen = SelectObject(hdc,pen);
     540            MoveToEx(hdc,points[4].x,points[4].y,NULL);
     541            LineTo(hdc,points[3].x-1,points[3].y-1);
     542            pen = GetSysColorPen(COLOR_BTNHIGHLIGHT);
     543            SelectObject(hdc,pen);
     544            MoveToEx(hdc,points[4].x,points[4].y+1,NULL);
     545            LineTo(hdc,points[3].x-2,points[3].y-1);
     546            SelectObject(hdc,oldPen);
     547
    529548            triangle.right = points[3].x;
    530             triangle.bottom = points[3].y;
    531             DrawEdge(hdc,&triangle,EDGE_SUNKEN,BF_DIAGONAL | BF_DIAGONAL_ENDBOTTOMRIGHT);
     549            triangle.top = points[3].y;
    532550            triangle.left = points[2].x;
    533551            triangle.bottom = points[2].y;
    534             triangle.right = points[3].x;
    535             triangle.top = points[3].y; //Odin32: pixel bug
    536             DrawEdge(hdc,&triangle,EDGE_SUNKEN,BF_DIAGONAL | BF_DIAGONAL_ENDTOPRIGHT);
     552            DrawEdge(hdc,&triangle,EDGE_RAISED,BF_DIAGONAL | BF_DIAGONAL_ENDBOTTOMLEFT);
    537553          }
    538554        } else
     
    556572            points[5].x = points[0].x;
    557573            points[5].y = points[0].y;
    558             Polygon (hdc,points,6);
     574            Polygon(hdc,points,6);
    559575
    560576            //Edge
     
    571587            triangle.top = points[1].y;
    572588            DrawEdge(hdc,&triangle,EDGE_RAISED,BF_DIAGONAL | BF_DIAGONAL_ENDTOPRIGHT);
    573             triangle.right = points[1].x;
    574             triangle.bottom = points[1].y;
    575             triangle.left = points[2].x-1;
    576             triangle.top = points[2].y-1;
    577             DrawEdge(hdc,&triangle,EDGE_SUNKEN,BF_DIAGONAL | BF_DIAGONAL_ENDTOPLEFT);
     589
     590
     591            triangle.left = points[1].x;
     592            triangle.top = points[1].y;
     593            triangle.right = points[2].x;
     594            triangle.bottom = points[2].y;
     595            DrawEdge(hdc,&triangle,EDGE_RAISED,BF_DIAGONAL | BF_DIAGONAL_ENDBOTTOMRIGHT);
    578596
    579597          } else //Bottom
     
    595613            points[5].x = points[0].x;
    596614            points[5].y = points[0].y;
    597             Polygon (hdc,points,6);
     615            Polygon(hdc,points,6);
    598616
    599617            //Edge
     
    605623            //Draw notch
    606624
    607             triangle.left = points[4].x;
    608             triangle.top = points[4].y; //Odin32: wrong pixel at .y-1!
     625            triangle.right = points[2].x;
     626            triangle.top = points[2].y;
     627            triangle.left = points[3].x;
     628            triangle.bottom = points[3].y;
     629            DrawEdge(hdc,&triangle,EDGE_RAISED,BF_DIAGONAL | BF_DIAGONAL_ENDBOTTOMLEFT);
    609630            triangle.right = points[3].x;
    610631            triangle.bottom = points[3].y;
    611             DrawEdge(hdc,&triangle,EDGE_SUNKEN,BF_DIAGONAL | BF_DIAGONAL_ENDBOTTOMRIGHT);
    612             triangle.left = points[3].x-1; //Odin32: wrong pixel at .x-2!
    613             triangle.bottom = points[3].y+1;
    614             triangle.right = points[2].x-1;
    615             triangle.top = points[2].y+1;
    616             DrawEdge(hdc,&triangle,EDGE_SUNKEN,BF_DIAGONAL | BF_DIAGONAL_ENDTOPRIGHT);
     632            triangle.left = points[4].x;
     633            triangle.top = points[4].y;
     634            DrawEdge(hdc,&triangle,EDGE_RAISED,BF_DIAGONAL | BF_DIAGONAL_ENDTOPLEFT);
    617635
    618636          }
     
    629647{
    630648    TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
    631     DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
    632     RECT rcClient, rcChannel, rcSelection;
    633     HBRUSH hBrush = CreateSolidBrush (infoPtr->clrBk);
     649    DWORD dwStyle = GetWindowLongA(hwnd, GWL_STYLE);
     650    RECT rcClient,rcChannel,rcSelection;
     651    HBRUSH hBrush = CreateSolidBrush(infoPtr->clrBk);
    634652    int i;
    635653
    636     GetClientRect (hwnd, &rcClient);
     654    GetClientRect(hwnd,&rcClient);
    637655
    638656    //Background
     
    659677    rcChannel = infoPtr->rcChannel;
    660678    rcSelection = infoPtr->rcSelection;
    661     DrawEdge (hdc,&rcChannel,EDGE_SUNKEN,BF_RECT | BF_ADJUST);
     679    DrawEdge(hdc,&rcChannel,EDGE_SUNKEN,BF_RECT | BF_ADJUST);
    662680
    663681    if (dwStyle & TBS_ENABLESELRANGE)           /* fill the channel */
     
    680698    {
    681699      int ticFlags = dwStyle & 0x0f;
    682       COLORREF clrTic = RGB(0,0,0);//CB: black instead of GetSysColor(COLOR_3DDKSHADOW);
     700      COLORREF clrTic = GetSysColor(COLOR_3DDKSHADOW);
    683701
    684702      for (i = 0;i < infoPtr->uNumTics;i++)
     
    737755   newRect.right++;
    738756   newRect.bottom++;
    739    //Odin32 pixel bugs
    740    lastRect.top--;
    741    lastRect.left--;
    742    newRect.top--;
    743    newRect.left--;
    744757
    745758   hdc = GetDC(hwnd);
     
    17751788    PAINTSTRUCT ps;
    17761789
    1777     hdc = wParam==0 ? BeginPaint (hwnd, &ps) : (HDC)wParam;
     1790    hdc = wParam == 0 ? BeginPaint(hwnd,&ps) : (HDC)wParam;
    17781791    TRACKBAR_Draw(hwnd,hdc);
    1779     if (!wParam) EndPaint (hwnd, &ps);
     1792    if (!wParam) EndPaint(hwnd,&ps);
    17801793    return 0;
    17811794}
Note: See TracChangeset for help on using the changeset viewer.