Changeset 95 for trunk/src/helpers/winh.c
- Timestamp:
- Aug 7, 2001, 11:34:30 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/winh.c
r91 r95 1362 1362 * this func after you have received SPBN_UP/DOWNARROW, 1363 1363 * the spin button's value will always in/decrease 1364 * in steps of 100. 1364 * so that the spin button's value is a multiple of 100. 1365 * 1366 * By contrast, if (lGrid < 0), this will not really 1367 * snap the value to a multiple of -lGrid, but instead 1368 * in/decrease the value by -lGrid. The value will not 1369 * necessarily be a multiple of the grid. (0.9.14) 1365 1370 * 1366 1371 * This returns the "snapped" value to which the spin … … 1368 1373 * 1369 1374 * If you specify lGrid == 0, this returns the spin 1370 * button's value only (V0.9.0).1375 * button's value only without snapping (V0.9.0). 1371 1376 * 1372 1377 *@@changed V0.9.0 [umoeller]: added check for lGrid == 0 (caused division by zero previously) 1378 *@@changed V0.9.14 (2001-08-03) [umoeller]: added fixes for age-old problems with wrap around 1379 *@@changed V0.9.14 (2001-08-03) [umoeller]: added lGrid < 0 mode 1373 1380 */ 1374 1381 … … 1380 1387 HWND hwndSpin = WinWindowFromID(hwndDlg, usItemID); 1381 1388 LONG lBottom, lTop, lValue; 1389 1382 1390 // get value, which has already increased / 1383 1391 // decreased by 1 … … 1397 1405 // manually enters something (SPBN_CHANGE), 1398 1406 // we'll accept that value 1399 lValue = (lValue / lGrid) * lGrid; 1400 // add /subtract grid 1401 if (usNotifyCode == SPBN_UPARROW) 1402 lValue += lGrid; 1403 // else we'll have -= lGrid already 1407 LONG lChanged = (usNotifyCode == SPBN_UPARROW) 1408 // if the spin button went up, subtract 1 1409 ? -1 1410 : +1; 1411 LONG lPrev = lValue + lChanged; 1412 1413 // if grid is negative, it is assumed to 1414 // not be a "real" grid but jump in those 1415 // steps only 1416 if (lGrid < 0) 1417 { 1418 // add /subtract grid 1419 if (usNotifyCode == SPBN_UPARROW) 1420 lValue = lPrev - lGrid; 1421 else 1422 lValue = lPrev + lGrid; 1423 1424 // lValue = (lValue / lGrid) * lGrid; 1425 } 1426 else 1427 { 1428 // add /subtract grid 1429 if (usNotifyCode == SPBN_UPARROW) 1430 lValue = lPrev + lGrid; 1431 else 1432 lValue = lPrev - lGrid; 1433 1434 lValue = (lValue / lGrid) * lGrid; 1435 } 1404 1436 1405 1437 // balance with spin button limits
Note:
See TracChangeset
for help on using the changeset viewer.