comctl32/trackbar: Reduce parameter count for some helpers.

This commit is contained in:
Nikolay Sivov 2009-09-02 16:16:52 +04:00 committed by Alexandre Julliard
parent 6f395805b1
commit 4845dc36e4
1 changed files with 26 additions and 26 deletions

View File

@ -185,12 +185,12 @@ static void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
(in range of trackbar) */
static inline LONG
TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO *infoPtr, int place, int vertical)
TRACKBAR_ConvertPlaceToPosition (const TRACKBAR_INFO *infoPtr, int place)
{
double range, width, pos, offsetthumb;
range = infoPtr->lRangeMax - infoPtr->lRangeMin;
if (vertical) {
if (infoPtr->dwStyle & TBS_VERT) {
offsetthumb = (infoPtr->rcThumb.bottom - infoPtr->rcThumb.top)/2;
width = infoPtr->rcChannel.bottom - infoPtr->rcChannel.top - (offsetthumb * 2) - 1;
pos = (range*(place - infoPtr->rcChannel.top - offsetthumb)) / width;
@ -233,8 +233,8 @@ TRACKBAR_GetAutoPageDirection (const TRACKBAR_INFO *infoPtr, POINT clickPoint)
{
int clickPlace = (infoPtr->dwStyle & TBS_VERT) ? clickPoint.y : clickPoint.x;
LONG clickPos = TRACKBAR_ConvertPlaceToPosition(infoPtr, clickPlace,
infoPtr->dwStyle & TBS_VERT);
LONG clickPos = TRACKBAR_ConvertPlaceToPosition(infoPtr, clickPlace);
return clickPos - infoPtr->lPos;
}
@ -469,7 +469,7 @@ TRACKBAR_AutoPage (TRACKBAR_INFO *infoPtr, POINT clickPoint)
/* Trackbar drawing code. I like my spaghetti done milanese. */
static void
TRACKBAR_DrawChannel (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
TRACKBAR_DrawChannel (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
RECT rcChannel = infoPtr->rcChannel;
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
@ -483,7 +483,7 @@ TRACKBAR_DrawChannel (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
else
{
DrawEdge (hdc, &rcChannel, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
if (dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
if (infoPtr->dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
FillRect (hdc, &rcChannel, GetStockObject(WHITE_BRUSH));
if (TRACKBAR_HasSelection(infoPtr))
FillRect (hdc, &infoPtr->rcSelection, GetSysColorBrush(COLOR_HIGHLIGHT));
@ -577,17 +577,17 @@ TRACKBAR_DrawTic (const TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
}
static void
TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
unsigned int i;
int ticFlags = dwStyle & 0x0f;
int ticFlags = infoPtr->dwStyle & 0x0f;
LOGPEN ticPen = { PS_SOLID, {1, 0}, GetSysColor (COLOR_3DDKSHADOW) };
HPEN hOldPen, hTicPen;
HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
if (theme)
{
int part = (dwStyle & TBS_VERT) ? TKP_TICSVERT : TKP_TICS;
int part = (infoPtr->dwStyle & TBS_VERT) ? TKP_TICSVERT : TKP_TICS;
GetThemeColor (theme, part, TSS_NORMAL, TMT_COLOR, &ticPen.lopnColor);
}
/* create the pen to draw the tics with */
@ -601,7 +601,7 @@ TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lRangeMin, ticFlags | TIC_EDGE);
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lRangeMax, ticFlags | TIC_EDGE);
if ((dwStyle & TBS_ENABLESELRANGE) && TRACKBAR_HasSelection(infoPtr)) {
if ((infoPtr->dwStyle & TBS_ENABLESELRANGE) && TRACKBAR_HasSelection(infoPtr)) {
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lSelMin,
ticFlags | TIC_SELECTIONMARKMIN);
TRACKBAR_DrawTic (infoPtr, hdc, infoPtr->lSelMax,
@ -616,7 +616,7 @@ TRACKBAR_DrawTics (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
}
static void
TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc)
{
HBRUSH oldbr;
HPEN oldpen;
@ -632,14 +632,14 @@ TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
{
int partId;
int stateId;
if (dwStyle & TBS_BOTH)
partId = (dwStyle & TBS_VERT) ? TKP_THUMBVERT : TKP_THUMB;
else if (dwStyle & TBS_LEFT)
partId = (dwStyle & TBS_VERT) ? TKP_THUMBLEFT : TKP_THUMBTOP;
if (infoPtr->dwStyle & TBS_BOTH)
partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBVERT : TKP_THUMB;
else if (infoPtr->dwStyle & TBS_LEFT)
partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBLEFT : TKP_THUMBTOP;
else
partId = (dwStyle & TBS_VERT) ? TKP_THUMBRIGHT : TKP_THUMBBOTTOM;
partId = (infoPtr->dwStyle & TBS_VERT) ? TKP_THUMBRIGHT : TKP_THUMBBOTTOM;
if (dwStyle & WS_DISABLED)
if (infoPtr->dwStyle & WS_DISABLED)
stateId = TUS_DISABLED;
else if (infoPtr->flags & TB_DRAG_MODE)
stateId = TUS_PRESSED;
@ -657,7 +657,7 @@ TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
oldbr = SelectObject (hdc, GetSysColorBrush(fillClr));
SetPolyFillMode (hdc, WINDING);
if (dwStyle & TBS_BOTH)
if (infoPtr->dwStyle & TBS_BOTH)
{
points[0].x=thumb.right;
points[0].y=thumb.top;
@ -674,10 +674,10 @@ TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
}
else
{
if (dwStyle & TBS_VERT)
if (infoPtr->dwStyle & TBS_VERT)
{
PointDepth = (thumb.bottom - thumb.top) / 2;
if (dwStyle & TBS_LEFT)
if (infoPtr->dwStyle & TBS_LEFT)
{
points[0].x=thumb.right;
points[0].y=thumb.top;
@ -712,7 +712,7 @@ TRACKBAR_DrawThumb (const TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
else
{
PointDepth = (thumb.right - thumb.left) / 2;
if (dwStyle & TBS_TOP)
if (infoPtr->dwStyle & TBS_TOP)
{
points[0].x=(thumb.right - thumb.left) / 2 + thumb.left + 1;
points[0].y=thumb.top;
@ -885,7 +885,7 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
TRACKBAR_DrawChannel (infoPtr, hdc, infoPtr->dwStyle);
TRACKBAR_DrawChannel (infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
@ -900,7 +900,7 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->dwStyle);
TRACKBAR_DrawTics (infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
@ -915,7 +915,7 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
icdrf = notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPREPAINT);
} else icdrf = CDRF_DODEFAULT;
if ( !(icdrf & CDRF_SKIPDEFAULT) ) {
TRACKBAR_DrawThumb(infoPtr, hdc, infoPtr->dwStyle);
TRACKBAR_DrawThumb(infoPtr, hdc);
if (icdrf & CDRF_NOTIFYPOSTPAINT)
notify_customdraw(infoPtr, &nmcd, CDDS_ITEMPOSTPAINT);
}
@ -1648,8 +1648,8 @@ TRACKBAR_MouseMove (TRACKBAR_INFO *infoPtr, INT x, INT y)
return TRUE;
}
dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace,
infoPtr->dwStyle & TBS_VERT);
dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace);
if (dragPos == oldPos) return TRUE;
infoPtr->lPos = dragPos;