Module: wine Branch: master Commit: 2a348791ee56c6556887a64d98eea68aaa01cc01 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2a348791ee56c6556887a64d98...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Jun 8 00:04:28 2014 +0400
comctl32/progress: Update position by one step on PBM_SETPOS in PBS_MARQUEE style.
---
dlls/comctl32/progress.c | 85 +++++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 38 deletions(-)
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c index 7c996cb..44fdd3f 100644 --- a/dlls/comctl32/progress.c +++ b/dlls/comctl32/progress.c @@ -448,38 +448,32 @@ static LRESULT PROGRESS_Paint (PROGRESS_INFO *infoPtr, HDC hdc)
/*********************************************************************** - * PROGRESS_Timer - * Handle the marquee timer messages + * Advance marquee progress by one step. */ -static LRESULT PROGRESS_Timer (PROGRESS_INFO *infoPtr, INT idTimer) +static void PROGRESS_UpdateMarquee (PROGRESS_INFO *infoPtr) { - if(idTimer == ID_MARQUEE_TIMER) - { - LONG style = GetWindowLongW (infoPtr->Self, GWL_STYLE); - RECT rect; - int ledWidth, leds; - HTHEME theme = GetWindowTheme (infoPtr->Self); - BOOL barSmooth = (style & PBS_SMOOTH) && !theme; + LONG style = GetWindowLongW (infoPtr->Self, GWL_STYLE); + RECT rect; + int ledWidth, leds; + HTHEME theme = GetWindowTheme (infoPtr->Self); + BOOL smooth = (style & PBS_SMOOTH) && !theme;
- get_client_rect (infoPtr->Self, &rect); + get_client_rect (infoPtr->Self, &rect);
- if(!barSmooth) - ledWidth = get_led_size( infoPtr, style, &rect ) + - get_led_gap( infoPtr ); - else - ledWidth = 1; + if (smooth) + ledWidth = 1; + else + ledWidth = get_led_size( infoPtr, style, &rect ) + get_led_gap( infoPtr );
- leds = (get_bar_size( style, &rect ) + ledWidth - 1) / - ledWidth; + leds = (get_bar_size( style, &rect ) + ledWidth - 1) / + ledWidth;
- /* increment the marquee progress */ - if(++infoPtr->MarqueePos >= leds) - infoPtr->MarqueePos = 0; + /* increment the marquee progress */ + if (++infoPtr->MarqueePos >= leds) + infoPtr->MarqueePos = 0;
- InvalidateRect(infoPtr->Self, &rect, TRUE); - UpdateWindow(infoPtr->Self); - } - return 0; + InvalidateRect(infoPtr->Self, &rect, TRUE); + UpdateWindow(infoPtr->Self); }
@@ -522,6 +516,30 @@ static DWORD PROGRESS_SetRange (PROGRESS_INFO *infoPtr, int low, int high) return res; }
+static UINT PROGRESS_SetPos (PROGRESS_INFO *infoPtr, INT pos) +{ + DWORD style = GetWindowLongW(infoPtr->Self, GWL_STYLE); + + if (style & PBS_MARQUEE) + { + PROGRESS_UpdateMarquee(infoPtr); + return 1; + } + else + { + UINT oldVal; + oldVal = infoPtr->CurVal; + if (oldVal != pos) { + infoPtr->CurVal = pos; + PROGRESS_CoercePos(infoPtr); + TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal); + PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ); + UpdateWindow( infoPtr->Self ); + } + return oldVal; + } +} + /*********************************************************************** * ProgressWindowProc */ @@ -596,7 +614,9 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, return PROGRESS_Paint (infoPtr, (HDC)wParam);
case WM_TIMER: - return PROGRESS_Timer (infoPtr, (INT)wParam); + if (wParam == ID_MARQUEE_TIMER) + PROGRESS_UpdateMarquee (infoPtr); + return 0;
case WM_THEMECHANGED: { @@ -632,18 +652,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, }
case PBM_SETPOS: - { - UINT oldVal; - oldVal = infoPtr->CurVal; - if(oldVal != wParam) { - infoPtr->CurVal = (INT)wParam; - PROGRESS_CoercePos(infoPtr); - TRACE("PBM_SETPOS: current pos changed from %d to %d\n", oldVal, infoPtr->CurVal); - PROGRESS_Invalidate( infoPtr, oldVal, infoPtr->CurVal ); - UpdateWindow( infoPtr->Self ); - } - return oldVal; - } + return PROGRESS_SetPos(infoPtr, wParam);
case PBM_SETRANGE: return PROGRESS_SetRange (infoPtr, (int)LOWORD(lParam), (int)HIWORD(lParam));