Ignore:
Timestamp:
Jun 16, 1999, 10:25:45 PM (26 years ago)
Author:
cbratschi
Message:

comctl32 wine conversion bugs fixed
trackbar: TRACKBAR_Draw prototype

File:
1 edited

Legend:

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

    r94 r110  
    1 /* $Id: updown.c,v 1.3 1999-06-10 16:22:04 achimha Exp $ */
    2 /*             
     1/* $Id: updown.c,v 1.4 1999-06-16 20:25:45 cbratschi Exp $ */
     2/*
    33 * Updown control
    44 *
    55 * Copyright 1997 Dimitrie O. Paun
    66 * Copyright 1999 Achim Hasenmueller
     7 * Copyright 1999 Christoph Bratschi
    78 *
    89 * TODO:
     
    6768//#define UNKNOWN_PARAM(msg, wParam, lParam) WARN(updown, \
    6869//        "UpDown Ctrl: Unknown parameter(s) for message " #msg     \
    69 //      "(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam);
     70//      "(%04x): wp=%04x lp=%08lx\n", msg, wParam, lParam);
    7071#define UNKNOWN_PARAM(msg, wParam, lParam)
    7172
     
    101102    {
    102103      delta += (delta < 0 ? -1 : 1) *
    103         (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1) *
    104         (infoPtr->MinVal - infoPtr->MaxVal) +
    105         (delta < 0 ? 1 : -1);
     104        (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1) *
     105        (infoPtr->MinVal - infoPtr->MaxVal) +
     106        (delta < 0 ? 1 : -1);
    106107    }
    107108    else
     
    119120 * incr     - TRUE  get the "increment" rect (up or right)
    120121 *            FALSE get the "decrement" rect (down or left)
    121  *         
     122 *
    122123 */
    123124static void UPDOWN_GetArrowRect (HWND hwnd, RECT *rect, BOOL incr)
     
    130131    len = rect->right - rect->left; /* compute the width */
    131132    if (incr)
    132       rect->left = len/2+1; 
     133      rect->left = len/2+1;
    133134    else
    134135      rect->right = len/2;
     
    169170  char sep[2];
    170171
    171   if(GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, 
    172                       sep, sizeof(sep)) != 1)
     172  if(GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND,
     173                      sep, sizeof(sep)) != 1)
    173174    return ',';
    174175
     
    204205      return FALSE;
    205206
    206     sep = UPDOWN_GetThousandSep(); 
     207    sep = UPDOWN_GetThousandSep();
    207208
    208209    /* now get rid of the separators */
    209210    for(src = dst = txt; *src; src++)
    210211      if(*src != sep)
    211         *dst++ = *src;
     212        *dst++ = *src;
    212213    *dst = 0;
    213214
    214215    /* try to convert the number and validate it */
    215216    newVal = strtol(txt, &src, infoPtr->Base);
    216     if(*src || !UPDOWN_InBounds (hwnd, newVal)) 
     217    if(*src || !UPDOWN_InBounds (hwnd, newVal))
    217218      return FALSE;
    218219
    219 //    TRACE(updown, "new value(%d) read from buddy (old=%d)\n", 
    220 //              newVal, infoPtr->CurVal);
    221   }
    222  
     220//    TRACE(updown, "new value(%d) read from buddy (old=%d)\n",
     221//              newVal, infoPtr->CurVal);
     222  }
     223
    223224  infoPtr->CurVal = newVal;
    224225  return TRUE;
     
    239240  int len;
    240241
    241   if (!IsWindow(infoPtr->Buddy)) 
     242  if (!IsWindow(infoPtr->Buddy))
    242243    return FALSE;
    243244
    244245//  TRACE(updown, "set new value(%d) to buddy.\n",
    245 //             infoPtr->CurVal);
     246//             infoPtr->CurVal);
    246247
    247248  /*if the buddy is a list window, we must set curr index */
     
    252253    len = sprintf(txt1, (infoPtr->Base==16) ? "%X" : "%d", infoPtr->CurVal);
    253254
    254     sep = UPDOWN_GetThousandSep(); 
     255    sep = UPDOWN_GetThousandSep();
    255256
    256257    /* Do thousands seperation if necessary */
     
    258259      char txt2[20], *src = txt1, *dst = txt2;
    259260      if(len%3 > 0){
    260         lstrcpynA (dst, src, len%3 + 1);      /* need to include the null */
    261         dst += len%3;
    262         src += len%3;
     261        lstrcpynA (dst, src, len%3 + 1);      /* need to include the null */
     262        dst += len%3;
     263        src += len%3;
    263264      }
    264265      for(len=0; *src; len++){
    265         if(len%3==0)
    266           *dst++ = sep;
    267         *dst++ = *src++;
     266        if(len%3==0)
     267          *dst++ = sep;
     268        *dst++ = *src++;
    268269      }
    269270      *dst = 0;           /* null terminate it */
     
    274275
    275276  return TRUE;
    276 } 
     277}
    277278
    278279/***********************************************************************
     
    287288  BOOL prssed;
    288289  RECT rect;
    289  
     290
    290291  /* Draw the incr button */
    291292  UPDOWN_GetArrowRect (hwnd, &rect, TRUE);
    292293  prssed = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN);
    293   DrawFrameControl(hdc, &rect, DFC_SCROLL, 
    294         (dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLUP) |
    295         (prssed ? DFCS_PUSHED : 0) |
    296         (dwStyle&WS_DISABLED ? DFCS_INACTIVE : 0) );
     294  DrawFrameControl(hdc, &rect, DFC_SCROLL,
     295        (dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLUP) |
     296        (prssed ? DFCS_PUSHED : 0) |
     297        (dwStyle&WS_DISABLED ? DFCS_INACTIVE : 0) );
    297298
    298299  /* Draw the space between the buttons */
    299300  rect.top = rect.bottom; rect.bottom++;
    300301  DrawEdge(hdc, &rect, 0, BF_MIDDLE);
    301                    
     302
    302303  /* Draw the decr button */
    303304  UPDOWN_GetArrowRect(hwnd, &rect, FALSE);
    304305  prssed = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN);
    305   DrawFrameControl(hdc, &rect, DFC_SCROLL, 
    306         (dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLDOWN) |
    307         (prssed ? DFCS_PUSHED : 0) |
    308         (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
     306  DrawFrameControl(hdc, &rect, DFC_SCROLL,
     307        (dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLDOWN) |
     308        (prssed ? DFCS_PUSHED : 0) |
     309        (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) );
    309310}
    310311
     
    318319{
    319320    HDC hdc;
    320  
     321
    321322    hdc = GetDC (hwnd);
    322323    UPDOWN_Draw (hwnd, hdc);
     
    335336    PAINTSTRUCT ps;
    336337    HDC hdc;
    337  
     338
    338339    hdc = BeginPaint (hwnd, &ps);
    339340    UPDOWN_Draw (hwnd, hdc);
     
    345346 * Tests if 'hwndBud' is a valid window handle. If not, returns FALSE.
    346347 * Else, sets it as a new Buddy.
    347  * Then, it should subclass the buddy 
     348 * Then, it should subclass the buddy
    348349 * If window has the UDS_ARROWKEYS, it subcalsses the buddy window to
    349350 * process the UP/DOWN arrow keys.
     
    353354static BOOL UPDOWN_SetBuddy (HWND hwnd, HWND hwndBud)
    354355{
    355   UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); 
     356  UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
    356357  DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
    357358  RECT budRect; /* new coord for the buddy */
    358359  int x;          /* new x position and width for the up-down */
    359          
     360
    360361  *infoPtr->szBuddyClass = '\0';
    361362
     
    380381  GetWindowRect(infoPtr->Buddy, &budRect);
    381382  MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Buddy),
    382                   (POINT *)(&budRect.left), 2);
     383                  (POINT *)(&budRect.left), 2);
    383384
    384385  /* now do the positioning */
     
    394395  /* first adjust the buddy to accomodate the up/down */
    395396  SetWindowPos(infoPtr->Buddy, 0, budRect.left, budRect.top,
    396                budRect.right  - budRect.left, budRect.bottom - budRect.top,
    397                SWP_NOACTIVATE|SWP_NOZORDER);
     397               budRect.right  - budRect.left, budRect.bottom - budRect.top,
     398               SWP_NOACTIVATE|SWP_NOZORDER);
    398399
    399400  /* now position the up/down */
     
    402403
    403404  SetWindowPos (hwnd, 0, x, budRect.top-DEFAULT_ADDTOP,DEFAULT_WIDTH,
    404                 (budRect.bottom-budRect.top)+DEFAULT_ADDTOP+DEFAULT_ADDBOT,
    405                 SWP_NOACTIVATE|SWP_NOZORDER);
     405                (budRect.bottom-budRect.top)+DEFAULT_ADDTOP+DEFAULT_ADDBOT,
     406                SWP_NOACTIVATE|SWP_NOZORDER);
    406407
    407408  return TRUE;
    408 }         
     409}
    409410
    410411/***********************************************************************
    411412 *           UPDOWN_DoAction
    412413 *
    413  * This function increments/decrements the CurVal by the 
     414 * This function increments/decrements the CurVal by the
    414415 * 'delta' amount according to the 'incr' flag
    415416 * It notifies the parent as required.
     
    419420static void UPDOWN_DoAction (HWND hwnd, int delta, BOOL incr)
    420421{
    421   UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); 
     422  UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
    422423  DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
    423424  int old_val = infoPtr->CurVal;
     
    440441  ni.hdr.hwndFrom = hwnd;
    441442  ni.hdr.idFrom   = GetWindowLongA (hwnd, GWL_ID);
    442   ni.hdr.code = UDN_DELTAPOS; 
     443  ni.hdr.code = UDN_DELTAPOS;
    443444  if (SendMessageA(GetParent (hwnd), WM_NOTIFY,
    444                    (WPARAM)ni.hdr.idFrom, (LPARAM)&ni))
     445                   (WPARAM)ni.hdr.idFrom, (LPARAM)&ni))
    445446    return; /* we are not allowed to change */
    446  
     447
    447448  /* Now adjust value with (maybe new) delta */
    448449  if (!UPDOWN_OffsetVal (hwnd, ni.iDelta))
     
    450451
    451452  /* Now take care about our buddy */
    452   if(!IsWindow(infoPtr->Buddy)) 
     453  if(!IsWindow(infoPtr->Buddy))
    453454    return; /* Nothing else to do */
    454455
     
    461462            we do not have the UDS_SETBUDDYINT style set? */
    462463
    463   SendMessageA (GetParent (hwnd), 
    464                 dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
    465                 MAKELONG(incr ? SB_LINEUP : SB_LINEDOWN, infoPtr->CurVal),
    466                 hwnd);
     464  SendMessageA (GetParent (hwnd),
     465                dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL,
     466                MAKELONG(incr ? SB_LINEUP : SB_LINEDOWN, infoPtr->CurVal),
     467                hwnd);
    467468}
    468469
     
    487488 * Deletes any timers, releases the mouse and does  redraw if necessary.
    488489 * If the control is not in "capture" mode, it does nothing.
    489  * If the control was not in cancel mode, it returns FALSE. 
     490 * If the control was not in cancel mode, it returns FALSE.
    490491 * If the control was in cancel mode, it returns TRUE.
    491492 */
     
    493494{
    494495  UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
    495  
     496
    496497  /* if not in 'capture' mode, do nothing */
    497498  if(!(infoPtr->Flags & FLAG_CLICKED))
     
    500501  KillTimer (hwnd, TIMERID1); /* kill all possible timers */
    501502  KillTimer (hwnd, TIMERID2);
    502  
     503
    503504  if (GetCapture() == hwnd)    /* let the mouse go         */
    504     ReleaseCapture();          /* if we still have it      */ 
    505  
     505    ReleaseCapture();          /* if we still have it      */
     506
    506507  infoPtr->Flags = 0;          /* get rid of any flags     */
    507508  UPDOWN_Refresh (hwnd);       /* redraw the control just in case */
    508  
     509
    509510  return TRUE;
    510511}
     
    515516 * Handle a mouse event for the updown.
    516517 * 'pt' is the location of the mouse event in client or
    517  * windows coordinates. 
     518 * windows coordinates.
    518519 */
    519520static void UPDOWN_HandleMouseEvent (HWND hwnd, UINT msg, POINT pt)
     
    529530      /* If we are already in the 'clicked' mode, then nothing to do */
    530531      if(infoPtr->Flags & FLAG_CLICKED)
    531         return;
     532        return;
    532533
    533534      /* If the buddy is an edit, will set focus to it */
    534535      if (!lstrcmpA (infoPtr->szBuddyClass, "Edit"))
    535         SetFocus(infoPtr->Buddy);
     536        SetFocus(infoPtr->Buddy);
    536537
    537538      /* Now see which one is the 'active' arrow */
     
    540541      /* Update the CurVal if necessary */
    541542      if (dwStyle & UDS_SETBUDDYINT)
    542         UPDOWN_GetBuddyInt (hwnd);
    543        
     543        UPDOWN_GetBuddyInt (hwnd);
     544
    544545      /* Before we proceed, see if we can spin... */
    545546      if(!(dwStyle & UDS_WRAP))
    546         if(( temp && infoPtr->CurVal==infoPtr->MaxVal) ||
    547            (!temp && infoPtr->CurVal==infoPtr->MinVal))
    548           return;
     547        if(( temp && infoPtr->CurVal==infoPtr->MaxVal) ||
     548           (!temp && infoPtr->CurVal==infoPtr->MinVal))
     549          return;
    549550
    550551      /* Set up the correct flags */
    551       infoPtr->Flags  = 0; 
     552      infoPtr->Flags  = 0;
    552553      infoPtr->Flags |= temp ? FLAG_INCR : FLAG_DECR;
    553554      infoPtr->Flags |= FLAG_MOUSEIN;
    554      
     555
    555556      /* repaint the control */
    556557      UPDOWN_Refresh (hwnd);
     
    563564
    564565      /* and startup the first timer */
    565       SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); 
     566      SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0);
    566567      break;
    567568
     
    569570      /* If we are not in the 'clicked' mode, then nothing to do */
    570571      if(!(infoPtr->Flags & FLAG_CLICKED))
    571         return;
     572        return;
    572573
    573574      /* save the flags to see if any got modified */
     
    576577      /* Now get the 'active' arrow rectangle */
    577578      if (infoPtr->Flags & FLAG_INCR)
    578         UPDOWN_GetArrowRect (hwnd, &rect, TRUE);
     579        UPDOWN_GetArrowRect (hwnd, &rect, TRUE);
    579580      else
    580         UPDOWN_GetArrowRect (hwnd, &rect, FALSE);
     581        UPDOWN_GetArrowRect (hwnd, &rect, FALSE);
    581582
    582583      /* Update the flags if we are in/out */
    583584      if(PtInRect(&rect, pt))
    584         infoPtr->Flags |=  FLAG_MOUSEIN;
     585        infoPtr->Flags |=  FLAG_MOUSEIN;
    585586      else{
    586         infoPtr->Flags &= ~FLAG_MOUSEIN;
    587         if(accelIndex != -1) /* if we have accel info */
    588           accelIndex = 0;    /* reset it              */
     587        infoPtr->Flags &= ~FLAG_MOUSEIN;
     588        if(accelIndex != -1) /* if we have accel info */
     589          accelIndex = 0;    /* reset it              */
    589590      }
    590591      /* If state changed, redraw the control */
    591592      if(temp != infoPtr->Flags)
    592         UPDOWN_Refresh (hwnd);
     593        UPDOWN_Refresh (hwnd);
    593594      break;
    594595
    595596      default:
    596 //      ERR(updown, "Impossible case!\n");
     597//      ERR(updown, "Impossible case!\n");
    597598        break;
    598599    }
     
    604605 */
    605606LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam,
    606                                 LPARAM lParam)
     607                                LPARAM lParam)
    607608{
    608609  UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
     
    622623
    623624      /* initialize the info struct */
    624       infoPtr->AccelCount=0; infoPtr->AccelVect=0; 
     625      infoPtr->AccelCount=0; infoPtr->AccelVect=0;
    625626      infoPtr->CurVal=0; infoPtr->MinVal=0; infoPtr->MaxVal=100; /*FIXME*/
    626627      infoPtr->Base  = 10; /* Default to base 10  */
     
    630631      /* Do we pick the buddy win ourselves? */
    631632      if (dwStyle & UDS_AUTOBUDDY)
    632         UPDOWN_SetBuddy (hwnd, GetWindow (hwnd, GW_HWNDPREV));
    633        
     633        UPDOWN_SetBuddy (hwnd, GetWindow (hwnd, GW_HWNDPREV));
     634
    634635//      TRACE(updown, "UpDown Ctrl creation, hwnd=%04x\n", hwnd);
    635636      break;
    636    
     637
    637638    case WM_DESTROY:
    638639      if(infoPtr->AccelVect)
    639         COMCTL32_Free (infoPtr->AccelVect);
     640        COMCTL32_Free (infoPtr->AccelVect);
    640641
    641642      COMCTL32_Free (infoPtr);
     
    643644//      TRACE(updown, "UpDown Ctrl destruction, hwnd=%04x\n", hwnd);
    644645      break;
    645        
     646
    646647    case WM_ENABLE:
    647648      if (dwStyle & WS_DISABLED)
    648         UPDOWN_CancelMode (hwnd);
     649        UPDOWN_CancelMode (hwnd);
    649650      UPDOWN_Paint (hwnd);
    650651      break;
     
    653654      /* if initial timer, kill it and start the repeat timer */
    654655      if(wParam == TIMERID1){
    655         KillTimer(hwnd, TIMERID1);
    656         /* if no accel info given, used default timer */
    657         if(infoPtr->AccelCount==0 || infoPtr->AccelVect==0){
    658           accelIndex = -1;
    659           temp = REPEAT_DELAY;
    660         }
    661         else{
    662           accelIndex = 0; /* otherwise, use it */
    663           temp = infoPtr->AccelVect[accelIndex].nSec * 1000 + 1;
    664         }
    665         SetTimer(hwnd, TIMERID2, temp, 0);
     656        KillTimer(hwnd, TIMERID1);
     657        /* if no accel info given, used default timer */
     658        if(infoPtr->AccelCount==0 || infoPtr->AccelVect==0){
     659          accelIndex = -1;
     660          temp = REPEAT_DELAY;
     661        }
     662        else{
     663          accelIndex = 0; /* otherwise, use it */
     664          temp = infoPtr->AccelVect[accelIndex].nSec * 1000 + 1;
     665        }
     666        SetTimer(hwnd, TIMERID2, temp, 0);
    666667      }
    667668
    668669      /* now, if the mouse is above us, do the thing...*/
    669670      if(infoPtr->Flags & FLAG_MOUSEIN){
    670         temp = accelIndex==-1 ? 1 : infoPtr->AccelVect[accelIndex].nInc;
    671         UPDOWN_DoAction(hwnd, temp, infoPtr->Flags & FLAG_INCR);
    672        
    673         if(accelIndex!=-1 && accelIndex < infoPtr->AccelCount-1){
    674           KillTimer(hwnd, TIMERID2);
    675           accelIndex++; /* move to the next accel info */
    676           temp = infoPtr->AccelVect[accelIndex].nSec * 1000 + 1;
    677           /* make sure we have at least 1ms intervals */
    678           SetTimer(hwnd, TIMERID2, temp, 0);       
    679         }
     671        temp = accelIndex==-1 ? 1 : infoPtr->AccelVect[accelIndex].nInc;
     672        UPDOWN_DoAction(hwnd, temp, infoPtr->Flags & FLAG_INCR);
     673
     674        if(accelIndex!=-1 && accelIndex < infoPtr->AccelCount-1){
     675          KillTimer(hwnd, TIMERID2);
     676          accelIndex++; /* move to the next accel info */
     677          temp = infoPtr->AccelVect[accelIndex].nSec * 1000 + 1;
     678          /* make sure we have at least 1ms intervals */
     679          SetTimer(hwnd, TIMERID2, temp, 0);
     680        }
    680681      }
    681682      break;
     
    687688    case WM_LBUTTONUP:
    688689      if(!UPDOWN_CancelMode(hwnd))
    689         break;
     690        break;
    690691      /*If we released the mouse and our buddy is an edit */
    691692      /* we must select all text in it.                   */
    692693      if (!lstrcmpA (infoPtr->szBuddyClass, "Edit"))
    693           SendMessageA(infoPtr->Buddy, EM_SETSEL, 0, MAKELONG(0, -1));
    694       break;
    695      
     694          SendMessageA(infoPtr->Buddy, EM_SETSEL, 0, MAKELONG(0, -1));
     695      break;
     696
    696697    case WM_LBUTTONDOWN:
    697698    case WM_MOUSEMOVE:
    698699      if(UPDOWN_IsEnabled(hwnd)){
    699         POINT pt;
    700         CONV_POINT16TO32( (POINT16 *)&lParam, &pt );
    701         UPDOWN_HandleMouseEvent (hwnd, message, pt );
     700        POINT pt;
     701        CONV_POINT16TO32( (POINT16 *)&lParam, &pt );
     702        UPDOWN_HandleMouseEvent (hwnd, message, pt );
    702703      }
    703704    break;
     
    705706    case WM_KEYDOWN:
    706707      if((dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(hwnd)){
    707         switch(wParam){
    708         case VK_UP: 
    709         case VK_DOWN:
    710           UPDOWN_GetBuddyInt (hwnd);
    711           UPDOWN_DoAction (hwnd, 1, wParam==VK_UP);
    712           break;
    713         }
    714       }
    715       break;
    716      
     708        switch(wParam){
     709        case VK_UP:
     710        case VK_DOWN:
     711          UPDOWN_GetBuddyInt (hwnd);
     712          UPDOWN_DoAction (hwnd, 1, wParam==VK_UP);
     713          break;
     714        }
     715      }
     716      break;
     717
    717718    case WM_PAINT:
    718719      UPDOWN_Paint (hwnd);
    719720      break;
    720    
     721
    721722    case UDM_GETACCEL:
    722723      if (wParam==0 && lParam==0)    /*if both zero, */
    723         return infoPtr->AccelCount;  /*just return the accel count*/
     724        return infoPtr->AccelCount;  /*just return the accel count*/
    724725      if (wParam || lParam){
    725         UNKNOWN_PARAM(UDM_GETACCEL, wParam, lParam);
    726         return 0;
     726        UNKNOWN_PARAM(UDM_GETACCEL, wParam, lParam);
     727        return 0;
    727728      }
    728729      temp = MIN(infoPtr->AccelCount, wParam);
     
    733734//      TRACE(updown, "UpDown Ctrl new accel info, hwnd=%04x\n", hwnd);
    734735      if(infoPtr->AccelVect){
    735         COMCTL32_Free (infoPtr->AccelVect);
    736         infoPtr->AccelCount = 0;
    737         infoPtr->AccelVect  = 0;
     736        COMCTL32_Free (infoPtr->AccelVect);
     737        infoPtr->AccelCount = 0;
     738        infoPtr->AccelVect  = 0;
    738739      }
    739740      if(wParam==0)
    740         return TRUE;
     741        return TRUE;
    741742      infoPtr->AccelVect = COMCTL32_Alloc (wParam*sizeof(UDACCEL));
    742743      if(infoPtr->AccelVect==0)
    743         return FALSE;
     744        return FALSE;
    744745      memcpy(infoPtr->AccelVect, (void*)lParam, wParam*sizeof(UDACCEL));
    745746      return TRUE;
     
    747748    case UDM_GETBASE:
    748749      if (wParam || lParam)
    749         UNKNOWN_PARAM(UDM_GETBASE, wParam, lParam);
     750        UNKNOWN_PARAM(UDM_GETBASE, wParam, lParam);
    750751      return infoPtr->Base;
    751752
    752753    case UDM_SETBASE:
    753 //      TRACE(updown, "UpDown Ctrl new base(%d), hwnd=%04x\n", 
    754 //                   wParam, hwnd);
     754//      TRACE(updown, "UpDown Ctrl new base(%d), hwnd=%04x\n",
     755//                   wParam, hwnd);
    755756      if ( !(wParam==10 || wParam==16) || lParam)
    756         UNKNOWN_PARAM(UDM_SETBASE, wParam, lParam);
     757        UNKNOWN_PARAM(UDM_SETBASE, wParam, lParam);
    757758      if (wParam==10 || wParam==16){
    758         temp = infoPtr->Base;
    759         infoPtr->Base = wParam;
    760         return temp;       /* return the prev base */
     759        temp = infoPtr->Base;
     760        infoPtr->Base = wParam;
     761        return temp;       /* return the prev base */
    761762      }
    762763      break;
     
    764765    case UDM_GETBUDDY:
    765766      if (wParam || lParam)
    766         UNKNOWN_PARAM(UDM_GETBUDDY, wParam, lParam);
     767        UNKNOWN_PARAM(UDM_GETBUDDY, wParam, lParam);
    767768      return infoPtr->Buddy;
    768769
    769770    case UDM_SETBUDDY:
    770771      if (lParam)
    771         UNKNOWN_PARAM(UDM_SETBUDDY, wParam, lParam);
     772        UNKNOWN_PARAM(UDM_SETBUDDY, wParam, lParam);
    772773      temp = infoPtr->Buddy;
    773774      infoPtr->Buddy = wParam;
    774775      UPDOWN_SetBuddy (hwnd, wParam);
    775 //      TRACE(updown, "UpDown Ctrl new buddy(%04x), hwnd=%04x\n", 
    776 //                   infoPtr->Buddy, hwnd);
     776//      TRACE(updown, "UpDown Ctrl new buddy(%04x), hwnd=%04x\n",
     777//                   infoPtr->Buddy, hwnd);
    777778      return temp;
    778779
    779780    case UDM_GETPOS:
    780781      if (wParam || lParam)
    781         UNKNOWN_PARAM(UDM_GETPOS, wParam, lParam);
     782        UNKNOWN_PARAM(UDM_GETPOS, wParam, lParam);
    782783      temp = UPDOWN_GetBuddyInt (hwnd);
    783784      return MAKELONG(infoPtr->CurVal, temp ? 0 : 1);
     
    785786    case UDM_SETPOS:
    786787      if (wParam || HIWORD(lParam))
    787         UNKNOWN_PARAM(UDM_GETPOS, wParam, lParam);
     788        UNKNOWN_PARAM(UDM_GETPOS, wParam, lParam);
    788789      temp = SLOWORD(lParam);
    789790//      TRACE(updown, "UpDown Ctrl new value(%d), hwnd=%04x\n",
    790 //                   temp, hwnd);
     791//                   temp, hwnd);
    791792      if(!UPDOWN_InBounds(hwnd, temp)){
    792         if(temp < infoPtr->MinVal) 
    793           temp = infoPtr->MinVal;
    794         if(temp > infoPtr->MaxVal)
    795           temp = infoPtr->MaxVal;
     793        if(temp < infoPtr->MinVal)
     794          temp = infoPtr->MinVal;
     795        if(temp > infoPtr->MaxVal)
     796          temp = infoPtr->MaxVal;
    796797      }
    797798      wParam = infoPtr->CurVal; /* save prev value   */
    798799      infoPtr->CurVal = temp;   /* set the new value */
    799800      if(dwStyle & UDS_SETBUDDYINT)
    800         UPDOWN_SetBuddyInt (hwnd);
     801        UPDOWN_SetBuddyInt (hwnd);
    801802      return wParam;            /* return prev value */
    802      
     803
    803804    case UDM_GETRANGE:
    804805      if (wParam || lParam)
    805         UNKNOWN_PARAM(UDM_GETRANGE, wParam, lParam);
     806        UNKNOWN_PARAM(UDM_GETRANGE, wParam, lParam);
    806807      return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal);
    807808
    808809    case UDM_SETRANGE:
    809810      if (wParam)
    810         UNKNOWN_PARAM(UDM_SETRANGE, wParam, lParam); /* we must have:     */
     811        UNKNOWN_PARAM(UDM_SETRANGE, wParam, lParam); /* we must have:     */
    811812      infoPtr->MaxVal = SLOWORD(lParam); /* UD_MINVAL <= Max <= UD_MAXVAL */
    812813      infoPtr->MinVal = SHIWORD(lParam); /* UD_MINVAL <= Min <= UD_MAXVAL */
    813814                                         /* |Max-Min| <= UD_MAXVAL        */
    814 //      TRACE(updown, "UpDown Ctrl new range(%d to %d), hwnd=%04x\n", 
    815 //                   infoPtr->MinVal, infoPtr->MaxVal, hwnd);
    816       break;                             
     815//      TRACE(updown, "UpDown Ctrl new range(%d to %d), hwnd=%04x\n",
     816//                   infoPtr->MinVal, infoPtr->MaxVal, hwnd);
     817      break;
    817818
    818819    case UDM_GETRANGE32:
    819820      if (wParam)
    820         *(LPINT)wParam = infoPtr->MinVal;
     821        *(LPINT)wParam = infoPtr->MinVal;
    821822      if (lParam)
    822         *(LPINT)lParam = infoPtr->MaxVal;
     823        *(LPINT)lParam = infoPtr->MaxVal;
    823824      break;
    824825
     
    827828      infoPtr->MaxVal = (INT)lParam;
    828829      if (infoPtr->MaxVal <= infoPtr->MinVal)
    829         infoPtr->MaxVal = infoPtr->MinVal + 1;
    830 //      TRACE(updown, "UpDown Ctrl new range(%d to %d), hwnd=%04x\n", 
    831 //                   infoPtr->MinVal, infoPtr->MaxVal, hwnd);
    832       break;
    833 
    834     default: 
    835       if (message >= WM_USER)
    836 //      ERR (updown, "unknown msg %04x wp=%04x lp=%08lx\n",
    837 //           message, wParam, lParam);
    838       return DefWindowProcA (hwnd, message, wParam, lParam); 
    839     } 
     830        infoPtr->MaxVal = infoPtr->MinVal + 1;
     831//      TRACE(updown, "UpDown Ctrl new range(%d to %d), hwnd=%04x\n",
     832//                   infoPtr->MinVal, infoPtr->MaxVal, hwnd);
     833      break;
     834
     835    default:
     836//      if (message >= WM_USER)
     837//      ERR (updown, "unknown msg %04x wp=%04x lp=%08lx\n",
     838//           message, wParam, lParam);
     839      return DefWindowProcA (hwnd, message, wParam, lParam);
     840    }
    840841
    841842    return 0;
     
    844845
    845846/***********************************************************************
    846  *              UPDOWN_Register [Internal]
     847 *              UPDOWN_Register [Internal]
    847848 *
    848849 * Registers the updown window class.
     
    864865    wndClass.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
    865866    wndClass.lpszClassName = UPDOWN_CLASSA;
    866  
     867
    867868    RegisterClassA( &wndClass );
    868869}
     
    870871
    871872/***********************************************************************
    872  *              UPDOWN_Unregister       [Internal]
     873 *              UPDOWN_Unregister       [Internal]
    873874 *
    874875 * Unregisters the updown window class.
     
    879880{
    880881    if (GlobalFindAtomA (UPDOWN_CLASSA))
    881         UnregisterClassA (UPDOWN_CLASSA, (HINSTANCE)NULL);
    882 }
    883 
     882        UnregisterClassA (UPDOWN_CLASSA, (HINSTANCE)NULL);
     883}
     884
Note: See TracChangeset for help on using the changeset viewer.