mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 08:49:15 +00:00
Greatly improved drawing code: eliminates all flicker, faster, cleaner
tics drawing, better tooltip positioning, code cleanups and simplifications.
This commit is contained in:
parent
318817f723
commit
0c6dd5b9e0
1 changed files with 98 additions and 114 deletions
|
@ -66,7 +66,7 @@ DEFINE_COMMON_NOTIFICATIONS(TRACKBAR_INFO, hwndSelf);
|
||||||
#define TB_REFRESH_TIMER 1
|
#define TB_REFRESH_TIMER 1
|
||||||
#define TB_REFRESH_DELAY 500
|
#define TB_REFRESH_DELAY 500
|
||||||
|
|
||||||
#define TOOLTIP_OFFSET 15 /* distance from thumb to tooltip */
|
#define TOOLTIP_OFFSET 2 /* distance from ctrl edge to tooltip */
|
||||||
|
|
||||||
/* Used by TRACKBAR_Refresh to find out which parts of the control
|
/* Used by TRACKBAR_Refresh to find out which parts of the control
|
||||||
need to be recalculated */
|
need to be recalculated */
|
||||||
|
@ -276,6 +276,12 @@ TRACKBAR_UpdateThumb (TRACKBAR_INFO *infoPtr)
|
||||||
TRACKBAR_CalcThumb(infoPtr, infoPtr->lPos, &infoPtr->rcThumb);
|
TRACKBAR_CalcThumb(infoPtr, infoPtr->lPos, &infoPtr->rcThumb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
TRACKBAR_InvalidateAll(TRACKBAR_INFO * infoPtr)
|
||||||
|
{
|
||||||
|
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
TRACKBAR_InvalidateThumbMove (TRACKBAR_INFO *infoPtr, LONG oldPos, LONG newPos)
|
TRACKBAR_InvalidateThumbMove (TRACKBAR_INFO *infoPtr, LONG oldPos, LONG newPos)
|
||||||
{
|
{
|
||||||
|
@ -286,8 +292,8 @@ TRACKBAR_InvalidateThumbMove (TRACKBAR_INFO *infoPtr, LONG oldPos, LONG newPos)
|
||||||
TRACKBAR_CalcThumb(infoPtr, newPos, &newThumb);
|
TRACKBAR_CalcThumb(infoPtr, newPos, &newThumb);
|
||||||
InflateRect(&oldThumb, 1, 1);
|
InflateRect(&oldThumb, 1, 1);
|
||||||
InflateRect(&newThumb, 1, 1);
|
InflateRect(&newThumb, 1, 1);
|
||||||
InvalidateRect(infoPtr->hwndSelf, &oldThumb, TRUE);
|
InvalidateRect(infoPtr->hwndSelf, &oldThumb, FALSE);
|
||||||
InvalidateRect(infoPtr->hwndSelf, &newThumb, TRUE);
|
InvalidateRect(infoPtr->hwndSelf, &newThumb, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL inline
|
static BOOL inline
|
||||||
|
@ -355,8 +361,7 @@ TRACKBAR_AutoPage (TRACKBAR_INFO *infoPtr, POINT clickPoint)
|
||||||
static void
|
static void
|
||||||
TRACKBAR_DrawTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
|
TRACKBAR_DrawTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
|
||||||
{
|
{
|
||||||
int x, y, range, side, offset = 5, indent = 0, len = 3, i;
|
int x, y, ox, oy, range, side, offset = 5, indent = 0, len = 3;
|
||||||
COLORREF clrTic = GetTextColor(hdc);
|
|
||||||
RECT rcTics;
|
RECT rcTics;
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
@ -400,29 +405,28 @@ TRACKBAR_DrawTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
|
||||||
y -= (offset + 2) * side;
|
y -= (offset + 2) * side;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < len; i++) {
|
ox = x;
|
||||||
SetPixel(hdc, x, y, clrTic);
|
oy = y;
|
||||||
if (flags & TBS_VERT) x += side;
|
MoveToEx(hdc, x, y, 0);
|
||||||
else y += side;
|
if (flags & TBS_VERT) x += len * side;
|
||||||
}
|
else y += len * side;
|
||||||
|
LineTo(hdc, x, y);
|
||||||
|
|
||||||
if (flags & TIC_SELECTIONMARK) {
|
if (flags & TIC_SELECTIONMARK) {
|
||||||
if (flags & TBS_VERT) {
|
if (flags & TBS_VERT) {
|
||||||
x -= 2 * side;
|
x -= side;
|
||||||
y += indent;
|
|
||||||
SetPixel(hdc, x, y, clrTic);
|
|
||||||
x += side;
|
|
||||||
SetPixel(hdc, x, y, clrTic);
|
|
||||||
y += indent;
|
|
||||||
} else {
|
} else {
|
||||||
x += indent;
|
y -= side;
|
||||||
y -= 2 * side;
|
|
||||||
SetPixel(hdc, x, y, clrTic);
|
|
||||||
y += side;
|
|
||||||
SetPixel(hdc, x, y, clrTic);
|
|
||||||
x += indent;
|
|
||||||
}
|
}
|
||||||
SetPixel(hdc, x, y, clrTic);
|
MoveToEx(hdc, x, y, 0);
|
||||||
|
if (flags & TBS_VERT) {
|
||||||
|
y += 2 * indent;
|
||||||
|
} else {
|
||||||
|
x += 2 * indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
LineTo(hdc, x, y);
|
||||||
|
LineTo(hdc, ox, oy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,16 +446,16 @@ TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos, int flags)
|
||||||
static void
|
static void
|
||||||
TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
|
TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
|
||||||
{
|
{
|
||||||
HBRUSH oldbr,hbr = GetSysColorBrush(COLOR_BTNFACE);
|
HBRUSH oldbr;
|
||||||
HPEN oldpen=(HPEN)NULL,hpn;
|
HPEN oldpen;
|
||||||
RECT thumb = infoPtr->rcThumb;
|
RECT thumb = infoPtr->rcThumb;
|
||||||
int BlackUntil=3;
|
int BlackUntil = 3;
|
||||||
int PointCount=6;
|
int PointCount = 6;
|
||||||
POINT points[6];
|
POINT points[6];
|
||||||
|
|
||||||
static INT PointDepth = 4;
|
static INT PointDepth = 4;
|
||||||
|
|
||||||
oldbr = SelectObject (hdc, hbr);
|
oldbr = SelectObject (hdc, GetSysColorBrush(COLOR_BTNFACE));
|
||||||
SetPolyFillMode (hdc, WINDING);
|
SetPolyFillMode (hdc, WINDING);
|
||||||
|
|
||||||
if (dwStyle & TBS_BOTH)
|
if (dwStyle & TBS_BOTH)
|
||||||
|
@ -542,37 +546,14 @@ TRACKBAR_DrawThumb(TRACKBAR_INFO *infoPtr, HDC hdc, DWORD dwStyle)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Draw the thumb now */
|
||||||
* Fill the shape
|
|
||||||
*/
|
|
||||||
Polygon (hdc, points, PointCount);
|
Polygon (hdc, points, PointCount);
|
||||||
|
oldpen = SelectObject(hdc, GetStockObject(BLACK_PEN));
|
||||||
/*
|
Polyline(hdc,points, BlackUntil);
|
||||||
* Draw the edge
|
SelectObject(hdc, GetStockObject(WHITE_PEN));
|
||||||
*/
|
|
||||||
hpn = GetStockObject(BLACK_PEN);
|
|
||||||
oldpen = SelectObject(hdc,hpn);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Black part
|
|
||||||
*/
|
|
||||||
Polyline(hdc,points,BlackUntil);
|
|
||||||
|
|
||||||
SelectObject(hdc,oldpen);
|
|
||||||
hpn = GetStockObject(WHITE_PEN);
|
|
||||||
SelectObject(hdc,hpn);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* White Part
|
|
||||||
*/
|
|
||||||
Polyline(hdc, &points[BlackUntil-1], PointCount+1-BlackUntil);
|
Polyline(hdc, &points[BlackUntil-1], PointCount+1-BlackUntil);
|
||||||
|
SelectObject(hdc, oldpen);
|
||||||
/*
|
SelectObject(hdc, oldbr);
|
||||||
* restore the brush and pen
|
|
||||||
*/
|
|
||||||
SelectObject(hdc,oldbr);
|
|
||||||
if (oldpen)
|
|
||||||
SelectObject(hdc,oldpen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -598,6 +579,7 @@ TRACKBAR_UpdateToolTip (TRACKBAR_INFO *infoPtr)
|
||||||
WCHAR buf[80], fmt[] = { '%', 'l', 'd', 0 };
|
WCHAR buf[80], fmt[] = { '%', 'l', 'd', 0 };
|
||||||
TTTOOLINFOW ti;
|
TTTOOLINFOW ti;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
RECT rcClient;
|
||||||
LRESULT size;
|
LRESULT size;
|
||||||
|
|
||||||
if (!infoPtr->hwndToolTip) return;
|
if (!infoPtr->hwndToolTip) return;
|
||||||
|
@ -611,18 +593,19 @@ TRACKBAR_UpdateToolTip (TRACKBAR_INFO *infoPtr)
|
||||||
ti.lpszText = buf;
|
ti.lpszText = buf;
|
||||||
SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
|
SendMessageW (infoPtr->hwndToolTip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
|
||||||
|
|
||||||
|
GetClientRect (infoPtr->hwndSelf, &rcClient);
|
||||||
size = SendMessageW (infoPtr->hwndToolTip, TTM_GETBUBBLESIZE, 0, (LPARAM)&ti);
|
size = SendMessageW (infoPtr->hwndToolTip, TTM_GETBUBBLESIZE, 0, (LPARAM)&ti);
|
||||||
if (dwStyle & TBS_VERT) {
|
if (dwStyle & TBS_VERT) {
|
||||||
if (infoPtr->fLocation == TBTS_LEFT)
|
if (infoPtr->fLocation == TBTS_LEFT)
|
||||||
pt.x = infoPtr->rcThumb.left - LOWORD(size) - TOOLTIP_OFFSET;
|
pt.x = 0 - LOWORD(size) - TOOLTIP_OFFSET;
|
||||||
else
|
else
|
||||||
pt.x = infoPtr->rcThumb.right + TOOLTIP_OFFSET;
|
pt.x = rcClient.right + TOOLTIP_OFFSET;
|
||||||
pt.y = (infoPtr->rcThumb.top + infoPtr->rcThumb.bottom - HIWORD(size))/2;
|
pt.y = (infoPtr->rcThumb.top + infoPtr->rcThumb.bottom - HIWORD(size))/2;
|
||||||
} else {
|
} else {
|
||||||
if (infoPtr->fLocation == TBTS_TOP)
|
if (infoPtr->fLocation == TBTS_TOP)
|
||||||
pt.y = infoPtr->rcThumb.top - HIWORD(size) - TOOLTIP_OFFSET;
|
pt.y = 0 - HIWORD(size) - TOOLTIP_OFFSET;
|
||||||
else
|
else
|
||||||
pt.y = infoPtr->rcThumb.bottom + TOOLTIP_OFFSET;
|
pt.y = rcClient.bottom + TOOLTIP_OFFSET;
|
||||||
pt.x = (infoPtr->rcThumb.left + infoPtr->rcThumb.right - LOWORD(size))/2;
|
pt.x = (infoPtr->rcThumb.left + infoPtr->rcThumb.right - LOWORD(size))/2;
|
||||||
}
|
}
|
||||||
ClientToScreen(infoPtr->hwndSelf, &pt);
|
ClientToScreen(infoPtr->hwndSelf, &pt);
|
||||||
|
@ -633,10 +616,12 @@ TRACKBAR_UpdateToolTip (TRACKBAR_INFO *infoPtr)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdc)
|
TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdcDst)
|
||||||
{
|
{
|
||||||
DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
|
DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
|
||||||
RECT rcChannel = infoPtr->rcChannel;
|
RECT rcClient, rcChannel = infoPtr->rcChannel;
|
||||||
|
HDC hdc;
|
||||||
|
HBITMAP hOldBmp = 0, hOffScreenBmp = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (infoPtr->flags & TB_THUMBCHANGED) {
|
if (infoPtr->flags & TB_THUMBCHANGED) {
|
||||||
|
@ -650,12 +635,29 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdc)
|
||||||
if (infoPtr->flags & TB_DRAG_MODE)
|
if (infoPtr->flags & TB_DRAG_MODE)
|
||||||
TRACKBAR_UpdateToolTip (infoPtr);
|
TRACKBAR_UpdateToolTip (infoPtr);
|
||||||
|
|
||||||
|
GetClientRect (infoPtr->hwndSelf, &rcClient);
|
||||||
|
|
||||||
|
/* try to render offscreen, if we fail, carrry onscreen */
|
||||||
|
hdc = CreateCompatibleDC(hdcDst);
|
||||||
|
if (hdc) {
|
||||||
|
hOffScreenBmp = CreateCompatibleBitmap(hdcDst, rcClient.right, rcClient.bottom);
|
||||||
|
if (hOffScreenBmp) {
|
||||||
|
hOldBmp = SelectObject(hdc, hOffScreenBmp);
|
||||||
|
} else {
|
||||||
|
DeleteObject(hdc);
|
||||||
|
hdc = hdcDst;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hdc = hdcDst;
|
||||||
|
}
|
||||||
|
|
||||||
infoPtr->flags &= ~ (TB_THUMBCHANGED | TB_SELECTIONCHANGED);
|
infoPtr->flags &= ~ (TB_THUMBCHANGED | TB_SELECTIONCHANGED);
|
||||||
|
|
||||||
|
/* Erase backbround */
|
||||||
|
FillRect (hdc, &rcClient, GetSysColorBrush(COLOR_BTNFACE));
|
||||||
|
|
||||||
/* draw channel */
|
/* draw channel */
|
||||||
|
|
||||||
DrawEdge (hdc, &rcChannel, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
DrawEdge (hdc, &rcChannel, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
||||||
|
|
||||||
if (dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
|
if (dwStyle & TBS_ENABLESELRANGE) { /* fill the channel */
|
||||||
FillRect (hdc, &rcChannel, GetStockObject(WHITE_BRUSH));
|
FillRect (hdc, &rcChannel, GetStockObject(WHITE_BRUSH));
|
||||||
if (TRACKBAR_HasSelection(infoPtr))
|
if (TRACKBAR_HasSelection(infoPtr))
|
||||||
|
@ -664,10 +666,13 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdc)
|
||||||
|
|
||||||
|
|
||||||
/* draw tics */
|
/* draw tics */
|
||||||
|
|
||||||
if (!(dwStyle & TBS_NOTICKS)) {
|
if (!(dwStyle & TBS_NOTICKS)) {
|
||||||
int ticFlags = dwStyle & 0x0f;
|
int ticFlags = dwStyle & 0x0f;
|
||||||
COLORREF oldFg = SetTextColor(hdc, GetSysColor (COLOR_3DDKSHADOW));
|
LOGPEN ticPen = { PS_SOLID, {1, 0}, GetSysColor (COLOR_3DDKSHADOW) };
|
||||||
|
HPEN hOldPen, hTicPen;
|
||||||
|
|
||||||
|
hTicPen = CreatePenIndirect(&ticPen);
|
||||||
|
hOldPen = hTicPen ? SelectObject(hdc, hTicPen) : 0;
|
||||||
|
|
||||||
for (i=0; i<infoPtr->uNumTics; i++)
|
for (i=0; i<infoPtr->uNumTics; i++)
|
||||||
TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->tics[i], ticFlags);
|
TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->tics[i], ticFlags);
|
||||||
|
@ -681,14 +686,20 @@ TRACKBAR_Refresh (TRACKBAR_INFO *infoPtr, HDC hdc)
|
||||||
TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->lSelMax,
|
TRACKBAR_DrawTics (infoPtr, hdc, infoPtr->lSelMax,
|
||||||
ticFlags | TIC_SELECTIONMARKMAX);
|
ticFlags | TIC_SELECTIONMARKMAX);
|
||||||
}
|
}
|
||||||
SetTextColor(hdc, oldFg);
|
if (hTicPen) SelectObject(hdc, hOldPen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw thumb */
|
/* draw thumb */
|
||||||
|
|
||||||
if (!(dwStyle & TBS_NOTHUMB))
|
if (!(dwStyle & TBS_NOTHUMB))
|
||||||
TRACKBAR_DrawThumb(infoPtr,hdc,dwStyle);
|
TRACKBAR_DrawThumb(infoPtr, hdc, dwStyle);
|
||||||
|
|
||||||
|
/* cleanup, if we rendered offscreen */
|
||||||
|
if (hdc != hdcDst) {
|
||||||
|
BitBlt(hdcDst, 0, 0, rcClient.right, rcClient.bottom, hdc, 0, 0, SRCCOPY);
|
||||||
|
SelectObject(hdc, hOldBmp);
|
||||||
|
DeleteObject(hOffScreenBmp);
|
||||||
|
DeleteObject(hdc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -752,8 +763,7 @@ TRACKBAR_ClearSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw)
|
||||||
infoPtr->lSelMax = 0;
|
infoPtr->lSelMax = 0;
|
||||||
infoPtr->flags |= TB_SELECTIONCHANGED;
|
infoPtr->flags |= TB_SELECTIONCHANGED;
|
||||||
|
|
||||||
if (fRedraw)
|
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -768,8 +778,7 @@ TRACKBAR_ClearTics (TRACKBAR_INFO *infoPtr, BOOL fRedraw)
|
||||||
infoPtr->uNumTics = 0;
|
infoPtr->uNumTics = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fRedraw)
|
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -886,6 +895,7 @@ TRACKBAR_SetPageSize (TRACKBAR_INFO *infoPtr, LONG lPageSize)
|
||||||
static LRESULT inline
|
static LRESULT inline
|
||||||
TRACKBAR_SetPos (TRACKBAR_INFO *infoPtr, BOOL fPosition, LONG lPosition)
|
TRACKBAR_SetPos (TRACKBAR_INFO *infoPtr, BOOL fPosition, LONG lPosition)
|
||||||
{
|
{
|
||||||
|
LONG oldPos = infoPtr->lPos;
|
||||||
infoPtr->lPos = lPosition;
|
infoPtr->lPos = lPosition;
|
||||||
|
|
||||||
if (infoPtr->lPos < infoPtr->lRangeMin)
|
if (infoPtr->lPos < infoPtr->lRangeMin)
|
||||||
|
@ -895,8 +905,7 @@ TRACKBAR_SetPos (TRACKBAR_INFO *infoPtr, BOOL fPosition, LONG lPosition)
|
||||||
infoPtr->lPos = infoPtr->lRangeMax;
|
infoPtr->lPos = infoPtr->lRangeMax;
|
||||||
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
||||||
|
|
||||||
if (fPosition)
|
if (fPosition) TRACKBAR_InvalidateThumbMove(infoPtr, oldPos, lPosition);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -921,8 +930,7 @@ TRACKBAR_SetRange (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lRange)
|
||||||
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
|
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
|
||||||
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
|
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
|
||||||
|
|
||||||
if (fRedraw)
|
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -940,8 +948,7 @@ TRACKBAR_SetRangeMax (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMax)
|
||||||
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
|
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
|
||||||
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
|
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
|
||||||
|
|
||||||
if (fRedraw)
|
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -959,8 +966,7 @@ TRACKBAR_SetRangeMin (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMin)
|
||||||
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
|
infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5;
|
||||||
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
|
if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1;
|
||||||
|
|
||||||
if (fRedraw)
|
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -981,8 +987,7 @@ TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
|
||||||
if (infoPtr->lSelMax > infoPtr->lRangeMax)
|
if (infoPtr->lSelMax > infoPtr->lRangeMax)
|
||||||
infoPtr->lSelMax = infoPtr->lRangeMax;
|
infoPtr->lSelMax = infoPtr->lRangeMax;
|
||||||
|
|
||||||
if (fRedraw)
|
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1000,8 +1005,7 @@ TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
|
||||||
if (infoPtr->lSelMax > infoPtr->lRangeMax)
|
if (infoPtr->lSelMax > infoPtr->lRangeMax)
|
||||||
infoPtr->lSelMax = infoPtr->lRangeMax;
|
infoPtr->lSelMax = infoPtr->lRangeMax;
|
||||||
|
|
||||||
if (fRedraw)
|
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1019,8 +1023,7 @@ TRACKBAR_SetSelStart (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lStart)
|
||||||
if (infoPtr->lSelMin < infoPtr->lRangeMin)
|
if (infoPtr->lSelMin < infoPtr->lRangeMin)
|
||||||
infoPtr->lSelMin = infoPtr->lRangeMin;
|
infoPtr->lSelMin = infoPtr->lRangeMin;
|
||||||
|
|
||||||
if (fRedraw)
|
if (fRedraw) TRACKBAR_InvalidateAll(infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1034,7 +1037,7 @@ TRACKBAR_SetThumbLength (TRACKBAR_INFO *infoPtr, UINT iLength)
|
||||||
|
|
||||||
infoPtr->flags |= TB_THUMBSIZECHANGED;
|
infoPtr->flags |= TB_THUMBSIZECHANGED;
|
||||||
|
|
||||||
InvalidateRect (infoPtr->hwndSelf, &infoPtr->rcThumb, TRUE);
|
InvalidateRect (infoPtr->hwndSelf, &infoPtr->rcThumb, FALSE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1061,7 +1064,7 @@ TRACKBAR_SetTic (TRACKBAR_INFO *infoPtr, LONG lPos)
|
||||||
}
|
}
|
||||||
infoPtr->tics[infoPtr->uNumTics-1] = lPos;
|
infoPtr->tics[infoPtr->uNumTics-1] = lPos;
|
||||||
|
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
TRACKBAR_InvalidateAll(infoPtr);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1073,7 +1076,7 @@ TRACKBAR_SetTicFreq (TRACKBAR_INFO *infoPtr, WORD wFreq)
|
||||||
if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_AUTOTICKS) {
|
if (GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_AUTOTICKS) {
|
||||||
infoPtr->uTicFreq = wFreq;
|
infoPtr->uTicFreq = wFreq;
|
||||||
TRACKBAR_RecalculateTics (infoPtr);
|
TRACKBAR_RecalculateTics (infoPtr);
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
TRACKBAR_InvalidateAll(infoPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1201,31 +1204,12 @@ TRACKBAR_Destroy (TRACKBAR_INFO *infoPtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
|
||||||
TRACKBAR_EraseBkgnd (TRACKBAR_INFO *infoPtr, HDC hdc)
|
|
||||||
{
|
|
||||||
NMCUSTOMDRAW nmcd;
|
|
||||||
|
|
||||||
ZeroMemory(&nmcd, sizeof(NMCUSTOMDRAW));
|
|
||||||
nmcd.hdc = hdc;
|
|
||||||
|
|
||||||
nmcd.dwDrawStage = CDDS_PREERASE;
|
|
||||||
if (send_notify(infoPtr->hwndSelf, NM_CUSTOMDRAW, &nmcd.hdr) != CDRF_SKIPDEFAULT)
|
|
||||||
DefWindowProcW (infoPtr->hwndSelf, WM_ERASEBKGND, (WPARAM)hdc, 0);
|
|
||||||
|
|
||||||
nmcd.dwDrawStage = CDDS_POSTERASE;
|
|
||||||
send_notify(infoPtr->hwndSelf, NM_CUSTOMDRAW, &nmcd.hdr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_KillFocus (TRACKBAR_INFO *infoPtr, HWND hwndGetFocus)
|
TRACKBAR_KillFocus (TRACKBAR_INFO *infoPtr, HWND hwndGetFocus)
|
||||||
{
|
{
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
TRACKBAR_InvalidateAll(infoPtr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1305,7 +1289,7 @@ TRACKBAR_SetFocus (TRACKBAR_INFO *infoPtr, HWND hwndLoseFocus)
|
||||||
{
|
{
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
InvalidateRect (infoPtr->hwndSelf, NULL, TRUE);
|
TRACKBAR_InvalidateAll(infoPtr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1592,7 +1576,7 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
/* case WM_ENABLE: */
|
/* case WM_ENABLE: */
|
||||||
|
|
||||||
case WM_ERASEBKGND:
|
case WM_ERASEBKGND:
|
||||||
return TRACKBAR_EraseBkgnd(infoPtr, (HDC)wParam);
|
return 0;
|
||||||
|
|
||||||
case WM_GETDLGCODE:
|
case WM_GETDLGCODE:
|
||||||
return DLGC_WANTARROWS;
|
return DLGC_WANTARROWS;
|
||||||
|
|
Loading…
Reference in a new issue