Removed the timer that was used to queue TRACKBAR_Refresh calls.
Removed all direct calls to TRACKBAR_Refresh (except from within the WM_PAINT handling section) and replaced them by calls to InvalidateRect. Fixed a bug in the TRACKBAR_SetPos function. Fixed the behavior for different types of mouse input.
This commit is contained in:
parent
ccfb1824cd
commit
3d35e9894c
|
@ -42,12 +42,9 @@ DEFAULT_DEBUG_CHANNEL(trackbar)
|
||||||
#define TB_THUMBSIZECHANGED 2
|
#define TB_THUMBSIZECHANGED 2
|
||||||
#define TB_THUMBCHANGED (TB_THUMBPOSCHANGED | TB_THUMBPOSCHANGED)
|
#define TB_THUMBCHANGED (TB_THUMBPOSCHANGED | TB_THUMBPOSCHANGED)
|
||||||
#define TB_SELECTIONCHANGED 4
|
#define TB_SELECTIONCHANGED 4
|
||||||
|
|
||||||
#define TB_DRAG_MODE 16 /* we're dragging the slider */
|
#define TB_DRAG_MODE 16 /* we're dragging the slider */
|
||||||
#define TB_DRAGPOSVALID 32 /* current Position is in dragPos */
|
#define TB_DRAGPOSVALID 32 /* current Position is in dragPos */
|
||||||
#define TB_SHOW_TOOLTIP 64 /* tooltip-style enabled and tooltip on */
|
#define TB_SHOW_TOOLTIP 64 /* tooltip-style enabled and tooltip on */
|
||||||
#define TB_REFRESH_TIMER_SET 128 /* is a TRACBKAR_Refresh queued?*/
|
|
||||||
|
|
||||||
|
|
||||||
/* helper defines for TRACKBAR_DrawTic */
|
/* helper defines for TRACKBAR_DrawTic */
|
||||||
#define TIC_LEFTEDGE 0x20
|
#define TIC_LEFTEDGE 0x20
|
||||||
|
@ -60,7 +57,6 @@ DEFAULT_DEBUG_CHANNEL(trackbar)
|
||||||
static BOOL TRACKBAR_SendNotify (HWND hwnd, UINT code);
|
static BOOL TRACKBAR_SendNotify (HWND hwnd, UINT code);
|
||||||
|
|
||||||
void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
|
void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
|
||||||
|
|
||||||
{
|
{
|
||||||
int i,tic,nrTics;
|
int i,tic,nrTics;
|
||||||
|
|
||||||
|
@ -75,7 +71,8 @@ void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nrTics!=infoPtr->uNumTics) {
|
if (nrTics!=infoPtr->uNumTics) {
|
||||||
infoPtr->tics=COMCTL32_ReAlloc (infoPtr->tics, (nrTics+1)*sizeof (DWORD));
|
infoPtr->tics=COMCTL32_ReAlloc (infoPtr->tics,
|
||||||
|
(nrTics+1)*sizeof (DWORD));
|
||||||
infoPtr->uNumTics=nrTics;
|
infoPtr->uNumTics=nrTics;
|
||||||
}
|
}
|
||||||
infoPtr->uNumTics=nrTics;
|
infoPtr->uNumTics=nrTics;
|
||||||
|
@ -88,7 +85,7 @@ void TRACKBAR_RecalculateTics (TRACKBAR_INFO *infoPtr)
|
||||||
/* converts from physical (mouse) position to logical position
|
/* converts from physical (mouse) position to logical position
|
||||||
(in range of trackbar) */
|
(in range of trackbar) */
|
||||||
|
|
||||||
static __inline__ INT
|
static __inline__ DOUBLE
|
||||||
TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place,
|
TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place,
|
||||||
int vertical)
|
int vertical)
|
||||||
{
|
{
|
||||||
|
@ -103,12 +100,16 @@ TRACKBAR_ConvertPlaceToPosition (TRACKBAR_INFO *infoPtr, int place,
|
||||||
pos=(range*(place - infoPtr->rcChannel.left)) / width;
|
pos=(range*(place - infoPtr->rcChannel.left)) / width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pos > infoPtr->nRangeMax)
|
||||||
|
pos = infoPtr->nRangeMax;
|
||||||
|
else if (pos < infoPtr->nRangeMin)
|
||||||
|
pos = infoPtr->nRangeMin;
|
||||||
|
|
||||||
TRACE (trackbar,"%.2f\n",pos);
|
TRACE (trackbar,"%.2f\n",pos);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
TRACKBAR_CalcChannel (HWND hwnd, TRACKBAR_INFO *infoPtr)
|
TRACKBAR_CalcChannel (HWND hwnd, TRACKBAR_INFO *infoPtr)
|
||||||
{
|
{
|
||||||
|
@ -160,7 +161,6 @@ TRACKBAR_CalcChannel (HWND hwnd, TRACKBAR_INFO *infoPtr)
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
TRACKBAR_CalcThumb (HWND hwnd, TRACKBAR_INFO *infoPtr)
|
TRACKBAR_CalcThumb (HWND hwnd, TRACKBAR_INFO *infoPtr)
|
||||||
|
|
||||||
{
|
{
|
||||||
RECT *thumb;
|
RECT *thumb;
|
||||||
int range, width;
|
int range, width;
|
||||||
|
@ -215,25 +215,6 @@ TRACKBAR_CalcSelection (HWND hwnd, TRACKBAR_INFO *infoPtr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
TRACKBAR_QueueRefresh (HWND hwnd)
|
|
||||||
{
|
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
|
||||||
|
|
||||||
TRACE (trackbar,"queued\n");
|
|
||||||
if (infoPtr->flags & TB_REFRESH_TIMER_SET) {
|
|
||||||
KillTimer (hwnd, TB_REFRESH_TIMER);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetTimer (hwnd, TB_REFRESH_TIMER, TB_REFRESH_DELAY, 0);
|
|
||||||
infoPtr->flags|=TB_REFRESH_TIMER_SET;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Trackbar drawing code. I like my spaghetti done milanese. */
|
/* Trackbar drawing code. I like my spaghetti done milanese. */
|
||||||
|
|
||||||
/* ticPos is in tic-units, not in pixels */
|
/* ticPos is in tic-units, not in pixels */
|
||||||
|
@ -241,7 +222,6 @@ TRACKBAR_QueueRefresh (HWND hwnd)
|
||||||
static VOID
|
static VOID
|
||||||
TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
|
TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
|
||||||
int flags, COLORREF clrTic)
|
int flags, COLORREF clrTic)
|
||||||
|
|
||||||
{
|
{
|
||||||
RECT rcChannel=infoPtr->rcChannel;
|
RECT rcChannel=infoPtr->rcChannel;
|
||||||
int x,y,width,range,side;
|
int x,y,width,range,side;
|
||||||
|
@ -292,7 +272,6 @@ TRACKBAR_DrawHorizTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
|
||||||
static VOID
|
static VOID
|
||||||
TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
|
TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
|
||||||
int flags, COLORREF clrTic)
|
int flags, COLORREF clrTic)
|
||||||
|
|
||||||
{
|
{
|
||||||
RECT rcChannel=infoPtr->rcChannel;
|
RECT rcChannel=infoPtr->rcChannel;
|
||||||
int x,y,width,range,side;
|
int x,y,width,range,side;
|
||||||
|
@ -345,7 +324,6 @@ TRACKBAR_DrawVertTic (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
|
||||||
static VOID
|
static VOID
|
||||||
TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
|
TRACKBAR_DrawTics (TRACKBAR_INFO *infoPtr, HDC hdc, LONG ticPos,
|
||||||
int flags, COLORREF clrTic)
|
int flags, COLORREF clrTic)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (flags & TBS_VERT) {
|
if (flags & TBS_VERT) {
|
||||||
|
@ -380,11 +358,6 @@ TRACKBAR_Refresh (HWND hwnd, HDC hdc)
|
||||||
FillRect (hdc, &rcClient, hBrush);
|
FillRect (hdc, &rcClient, hBrush);
|
||||||
DeleteObject (hBrush);
|
DeleteObject (hBrush);
|
||||||
|
|
||||||
if (infoPtr->flags & TB_REFRESH_TIMER_SET) {
|
|
||||||
KillTimer (hwnd, TB_REFRESH_TIMER);
|
|
||||||
infoPtr->flags &= ~TB_REFRESH_TIMER_SET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (infoPtr->flags & TB_DRAGPOSVALID) {
|
if (infoPtr->flags & TB_DRAGPOSVALID) {
|
||||||
infoPtr->nPos=infoPtr->dragPos;
|
infoPtr->nPos=infoPtr->dragPos;
|
||||||
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
||||||
|
@ -397,7 +370,8 @@ TRACKBAR_Refresh (HWND hwnd, HDC hdc)
|
||||||
}
|
}
|
||||||
if (infoPtr->flags & TB_SELECTIONCHANGED)
|
if (infoPtr->flags & TB_SELECTIONCHANGED)
|
||||||
TRACKBAR_CalcSelection (hwnd, infoPtr);
|
TRACKBAR_CalcSelection (hwnd, infoPtr);
|
||||||
infoPtr->flags &= ~ (TB_THUMBCHANGED | TB_SELECTIONCHANGED | TB_DRAGPOSVALID);
|
infoPtr->flags &= ~ (TB_THUMBCHANGED | TB_SELECTIONCHANGED |
|
||||||
|
TB_DRAGPOSVALID);
|
||||||
|
|
||||||
/* draw channel */
|
/* draw channel */
|
||||||
|
|
||||||
|
@ -503,8 +477,6 @@ TRACKBAR_Refresh (HWND hwnd, HDC hdc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
TRACKBAR_AlignBuddies (HWND hwnd, TRACKBAR_INFO *infoPtr)
|
TRACKBAR_AlignBuddies (HWND hwnd, TRACKBAR_INFO *infoPtr)
|
||||||
{
|
{
|
||||||
|
@ -567,11 +539,8 @@ TRACKBAR_ClearSel (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
infoPtr->nSelMax = 0;
|
infoPtr->nSelMax = 0;
|
||||||
infoPtr->flags |= TB_SELECTIONCHANGED;
|
infoPtr->flags |= TB_SELECTIONCHANGED;
|
||||||
|
|
||||||
if ((BOOL)wParam) {
|
if ((BOOL)wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -588,11 +557,8 @@ TRACKBAR_ClearTics (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
infoPtr->uNumTics = 0;
|
infoPtr->uNumTics = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wParam) {
|
if (wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -668,8 +634,6 @@ TRACKBAR_GetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_GetRangeMax (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_GetRangeMax (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -740,12 +704,8 @@ TRACKBAR_GetThumbRect (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_GetTic (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_GetTic (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
INT iTic;
|
INT iTic;
|
||||||
|
@ -778,6 +738,7 @@ TRACKBAR_GetTicPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
return (LRESULT) pos;
|
return (LRESULT) pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_GetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_GetToolTips (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -848,7 +809,7 @@ TRACKBAR_SetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
|
|
||||||
infoPtr->nPos = (INT)HIWORD(lParam);
|
infoPtr->nPos = (INT)LOWORD(lParam);
|
||||||
|
|
||||||
if (infoPtr->nPos < infoPtr->nRangeMin)
|
if (infoPtr->nPos < infoPtr->nRangeMin)
|
||||||
infoPtr->nPos = infoPtr->nRangeMin;
|
infoPtr->nPos = infoPtr->nRangeMin;
|
||||||
|
@ -857,11 +818,8 @@ TRACKBAR_SetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
infoPtr->nPos = infoPtr->nRangeMax;
|
infoPtr->nPos = infoPtr->nRangeMax;
|
||||||
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
||||||
|
|
||||||
if (wParam) {
|
if (wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -885,13 +843,12 @@ TRACKBAR_SetRange (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
|
infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
|
||||||
|
if (infoPtr->nPageSize == 0)
|
||||||
|
infoPtr->nPageSize = 1;
|
||||||
TRACKBAR_RecalculateTics (infoPtr);
|
TRACKBAR_RecalculateTics (infoPtr);
|
||||||
|
|
||||||
if (wParam) {
|
if (wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -909,13 +866,12 @@ TRACKBAR_SetRangeMax (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
|
infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
|
||||||
|
if (infoPtr->nPageSize == 0)
|
||||||
|
infoPtr->nPageSize = 1;
|
||||||
TRACKBAR_RecalculateTics (infoPtr);
|
TRACKBAR_RecalculateTics (infoPtr);
|
||||||
|
|
||||||
if (wParam) {
|
if (wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -933,31 +889,28 @@ TRACKBAR_SetRangeMin (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
|
infoPtr->nPageSize=(infoPtr->nRangeMax - infoPtr->nRangeMin)/5;
|
||||||
|
if (infoPtr->nPageSize == 0)
|
||||||
|
infoPtr->nPageSize = 1;
|
||||||
TRACKBAR_RecalculateTics (infoPtr);
|
TRACKBAR_RecalculateTics (infoPtr);
|
||||||
|
|
||||||
if (wParam) {
|
if (wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_SetTicFreq (HWND hwnd, WPARAM wParam)
|
TRACKBAR_SetTicFreq (HWND hwnd, WPARAM wParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_AUTOTICKS)
|
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_AUTOTICKS)
|
||||||
infoPtr->uTicFreq=(UINT) wParam;
|
infoPtr->uTicFreq=(UINT) wParam;
|
||||||
|
|
||||||
TRACKBAR_RecalculateTics (infoPtr);
|
TRACKBAR_RecalculateTics (infoPtr);
|
||||||
|
|
||||||
hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -980,11 +933,9 @@ TRACKBAR_SetSel (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if (infoPtr->nSelMax > infoPtr->nRangeMax)
|
if (infoPtr->nSelMax > infoPtr->nRangeMax)
|
||||||
infoPtr->nSelMax = infoPtr->nRangeMax;
|
infoPtr->nSelMax = infoPtr->nRangeMax;
|
||||||
|
|
||||||
if (wParam) {
|
if (wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1004,11 +955,8 @@ TRACKBAR_SetSelEnd (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if (infoPtr->nSelMax > infoPtr->nRangeMax)
|
if (infoPtr->nSelMax > infoPtr->nRangeMax)
|
||||||
infoPtr->nSelMax = infoPtr->nRangeMax;
|
infoPtr->nSelMax = infoPtr->nRangeMax;
|
||||||
|
|
||||||
if (wParam) {
|
if (wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1028,11 +976,8 @@ TRACKBAR_SetSelStart (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if (infoPtr->nSelMin < infoPtr->nRangeMin)
|
if (infoPtr->nSelMin < infoPtr->nRangeMin)
|
||||||
infoPtr->nSelMin = infoPtr->nRangeMin;
|
infoPtr->nSelMin = infoPtr->nRangeMin;
|
||||||
|
|
||||||
if (wParam) {
|
if (wParam)
|
||||||
HDC hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1042,16 +987,13 @@ static LRESULT
|
||||||
TRACKBAR_SetThumbLength (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_SetThumbLength (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_FIXEDLENGTH)
|
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_FIXEDLENGTH)
|
||||||
infoPtr->uThumbLen = (UINT)wParam;
|
infoPtr->uThumbLen = (UINT)wParam;
|
||||||
|
|
||||||
infoPtr->flags |= TB_THUMBSIZECHANGED;
|
infoPtr->flags |= TB_THUMBSIZECHANGED;
|
||||||
|
|
||||||
hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1062,7 +1004,6 @@ TRACKBAR_SetTic (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
INT nPos = (INT)lParam;
|
INT nPos = (INT)lParam;
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
if ((nPos < infoPtr->nRangeMin) || (nPos> infoPtr->nRangeMax))
|
if ((nPos < infoPtr->nRangeMin) || (nPos> infoPtr->nRangeMax))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1072,16 +1013,12 @@ TRACKBAR_SetTic (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
(infoPtr->uNumTics)*sizeof (DWORD));
|
(infoPtr->uNumTics)*sizeof (DWORD));
|
||||||
infoPtr->tics[infoPtr->uNumTics-1]=nPos;
|
infoPtr->tics[infoPtr->uNumTics-1]=nPos;
|
||||||
|
|
||||||
hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_SetTipSide (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_SetTipSide (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -1191,9 +1128,6 @@ TRACKBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
|
|
||||||
if (infoPtr->flags & TB_REFRESH_TIMER_SET)
|
|
||||||
KillTimer (hwnd, TB_REFRESH_TIMER);
|
|
||||||
|
|
||||||
/* delete tooltip control */
|
/* delete tooltip control */
|
||||||
if (infoPtr->hwndToolTip)
|
if (infoPtr->hwndToolTip)
|
||||||
DestroyWindow (infoPtr->hwndToolTip);
|
DestroyWindow (infoPtr->hwndToolTip);
|
||||||
|
@ -1213,8 +1147,7 @@ TRACKBAR_KillFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
infoPtr->bFocus = FALSE;
|
infoPtr->bFocus = FALSE;
|
||||||
infoPtr->flags &= ~TB_DRAG_MODE;
|
infoPtr->flags &= ~TB_DRAG_MODE;
|
||||||
|
|
||||||
TRACKBAR_QueueRefresh (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1225,7 +1158,8 @@ TRACKBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
|
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
|
||||||
int clickPlace,prevPos,clickPos,vertical;
|
int clickPlace,prevPos,vertical;
|
||||||
|
DOUBLE clickPos;
|
||||||
|
|
||||||
SetFocus (hwnd);
|
SetFocus (hwnd);
|
||||||
|
|
||||||
|
@ -1279,21 +1213,25 @@ TRACKBAR_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (prevPos!=infoPtr->nPos) {
|
if (prevPos!=infoPtr->nPos) {
|
||||||
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
||||||
TRACKBAR_QueueRefresh (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
|
|
||||||
TRACKBAR_QueueRefresh (hwnd);
|
|
||||||
TRACKBAR_SendNotify (hwnd, TB_ENDTRACK);
|
TRACKBAR_SendNotify (hwnd, TB_ENDTRACK);
|
||||||
|
|
||||||
|
if (infoPtr->flags & TB_DRAG_MODE)
|
||||||
|
{
|
||||||
infoPtr->flags &= ~TB_DRAG_MODE;
|
infoPtr->flags &= ~TB_DRAG_MODE;
|
||||||
|
ReleaseCapture ();
|
||||||
|
}
|
||||||
|
|
||||||
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_TOOLTIPS) { /* disable tooltip */
|
if (GetWindowLongA (hwnd, GWL_STYLE) & TBS_TOOLTIPS) { /* disable tooltip */
|
||||||
TTTOOLINFOA ti;
|
TTTOOLINFOA ti;
|
||||||
|
@ -1303,14 +1241,16 @@ TRACKBAR_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
ti.hwnd = (UINT)hwnd;
|
ti.hwnd = (UINT)hwnd;
|
||||||
|
|
||||||
infoPtr->flags &= ~TB_SHOW_TOOLTIP;
|
infoPtr->flags &= ~TB_SHOW_TOOLTIP;
|
||||||
ReleaseCapture ();
|
|
||||||
SendMessageA (infoPtr->hwndToolTip, TTM_TRACKACTIVATE,
|
SendMessageA (infoPtr->hwndToolTip, TTM_TRACKACTIVATE,
|
||||||
(WPARAM)FALSE, (LPARAM)&ti);
|
(WPARAM)FALSE, (LPARAM)&ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_CaptureChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_CaptureChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -1318,7 +1258,7 @@ TRACKBAR_CaptureChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (infoPtr->flags & TB_DRAGPOSVALID) {
|
if (infoPtr->flags & TB_DRAGPOSVALID) {
|
||||||
infoPtr->nPos=infoPtr->dragPos;
|
infoPtr->nPos=infoPtr->dragPos;
|
||||||
TRACKBAR_QueueRefresh (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->flags &= ~ TB_DRAGPOSVALID;
|
infoPtr->flags &= ~ TB_DRAGPOSVALID;
|
||||||
|
@ -1327,6 +1267,7 @@ TRACKBAR_CaptureChanged (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_Paint (HWND hwnd, WPARAM wParam)
|
TRACKBAR_Paint (HWND hwnd, WPARAM wParam)
|
||||||
{
|
{
|
||||||
|
@ -1345,14 +1286,11 @@ static LRESULT
|
||||||
TRACKBAR_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_SetFocus (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
TRACE (trackbar,"\n");
|
TRACE (trackbar,"\n");
|
||||||
infoPtr->bFocus = TRUE;
|
infoPtr->bFocus = TRUE;
|
||||||
|
|
||||||
hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1370,10 +1308,8 @@ TRACKBAR_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
TRACKBAR_SendNotify (HWND hwnd, UINT code)
|
TRACKBAR_SendNotify (HWND hwnd, UINT code)
|
||||||
|
|
||||||
{
|
{
|
||||||
TRACE (trackbar, "%x\n",code);
|
TRACE (trackbar, "%x\n",code);
|
||||||
|
|
||||||
|
@ -1385,26 +1321,34 @@ TRACKBAR_SendNotify (HWND hwnd, UINT code)
|
||||||
WM_HSCROLL, (WPARAM)code, (LPARAM)hwnd);
|
WM_HSCROLL, (WPARAM)code, (LPARAM)hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
||||||
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
|
DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
|
||||||
INT clickPlace;
|
SHORT clickPlace;
|
||||||
HDC hdc;
|
DOUBLE dragPos;
|
||||||
char buf[80];
|
char buf[80];
|
||||||
|
|
||||||
TRACE (trackbar, "%x\n",wParam);
|
TRACE (trackbar, "%x\n",wParam);
|
||||||
|
|
||||||
if (dwStyle & TBS_VERT)
|
if (dwStyle & TBS_VERT)
|
||||||
clickPlace=(INT)HIWORD(lParam);
|
clickPlace=(SHORT)HIWORD(lParam);
|
||||||
else
|
else
|
||||||
clickPlace=(INT)LOWORD(lParam);
|
clickPlace=(SHORT)LOWORD(lParam);
|
||||||
|
|
||||||
if (!(infoPtr->flags & TB_DRAG_MODE))
|
if (!(infoPtr->flags & TB_DRAG_MODE))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
infoPtr->dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace, dwStyle & TBS_VERT);
|
SetCapture (hwnd);
|
||||||
|
dragPos = TRACKBAR_ConvertPlaceToPosition (infoPtr, clickPlace,
|
||||||
|
dwStyle & TBS_VERT);
|
||||||
|
if (dragPos > ((INT)dragPos) + 0.5)
|
||||||
|
infoPtr->dragPos = dragPos + 1;
|
||||||
|
else
|
||||||
|
infoPtr->dragPos = dragPos;
|
||||||
|
|
||||||
infoPtr->flags |= TB_DRAGPOSVALID;
|
infoPtr->flags |= TB_DRAGPOSVALID;
|
||||||
TRACKBAR_SendNotify (hwnd, TB_THUMBTRACK | (infoPtr->nPos>>16));
|
TRACKBAR_SendNotify (hwnd, TB_THUMBTRACK | (infoPtr->nPos>>16));
|
||||||
|
|
||||||
|
@ -1431,9 +1375,8 @@ TRACKBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
0, (LPARAM)&ti);
|
0, (LPARAM)&ti);
|
||||||
}
|
}
|
||||||
|
|
||||||
hdc = GetDC (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
UpdateWindow (hwnd);
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1493,12 +1436,13 @@ TRACKBAR_KeyDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (pos!=infoPtr->nPos) {
|
if (pos!=infoPtr->nPos) {
|
||||||
infoPtr->flags |=TB_THUMBPOSCHANGED;
|
infoPtr->flags |=TB_THUMBPOSCHANGED;
|
||||||
TRACKBAR_QueueRefresh (hwnd);
|
InvalidateRect (hwnd, NULL, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TRACKBAR_KeyUp (HWND hwnd, WPARAM wParam)
|
TRACKBAR_KeyUp (HWND hwnd, WPARAM wParam)
|
||||||
{
|
{
|
||||||
|
@ -1517,31 +1461,6 @@ TRACKBAR_KeyUp (HWND hwnd, WPARAM wParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
|
||||||
TRACKBAR_HandleTimer (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr (hwnd);
|
|
||||||
HDC hdc;
|
|
||||||
|
|
||||||
TRACE (trackbar,"timer\n");
|
|
||||||
|
|
||||||
switch (wParam) {
|
|
||||||
case TB_REFRESH_TIMER:
|
|
||||||
KillTimer (hwnd, TB_REFRESH_TIMER );
|
|
||||||
if (infoPtr->flags & TB_DRAGPOSVALID) {
|
|
||||||
infoPtr->nPos=infoPtr->dragPos;
|
|
||||||
infoPtr->flags |= TB_THUMBPOSCHANGED;
|
|
||||||
}
|
|
||||||
infoPtr->flags &= ~ (TB_REFRESH_TIMER_SET | TB_DRAGPOSVALID);
|
|
||||||
hdc=GetDC (hwnd);
|
|
||||||
TRACKBAR_Refresh (hwnd, hdc);
|
|
||||||
ReleaseDC (hwnd, hdc);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LRESULT WINAPI
|
LRESULT WINAPI
|
||||||
TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -1695,9 +1614,6 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
return TRACKBAR_Size (hwnd, wParam, lParam);
|
return TRACKBAR_Size (hwnd, wParam, lParam);
|
||||||
|
|
||||||
case WM_TIMER:
|
|
||||||
return TRACKBAR_HandleTimer (hwnd, wParam, lParam);
|
|
||||||
|
|
||||||
case WM_WININICHANGE:
|
case WM_WININICHANGE:
|
||||||
return TRACKBAR_InitializeThumb (hwnd);
|
return TRACKBAR_InitializeThumb (hwnd);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ typedef struct tagTRACKBAR_INFO
|
||||||
HWND hwndBuddyRB;
|
HWND hwndBuddyRB;
|
||||||
INT fLocation;
|
INT fLocation;
|
||||||
COLORREF clrBk;
|
COLORREF clrBk;
|
||||||
|
|
||||||
INT flags;
|
INT flags;
|
||||||
BOOL bFocus;
|
BOOL bFocus;
|
||||||
RECT rcChannel;
|
RECT rcChannel;
|
||||||
|
@ -36,8 +35,8 @@ typedef struct tagTRACKBAR_INFO
|
||||||
} TRACKBAR_INFO;
|
} TRACKBAR_INFO;
|
||||||
|
|
||||||
|
|
||||||
#define TB_REFRESH_TIMER 1
|
/* #define TB_REFRESH_TIMER 1 */
|
||||||
#define TB_REFRESH_DELAY 1
|
/* #define TB_REFRESH_DELAY 1 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue