>From dffef85bb438da644bfca1defa8ecd3da26f6bb9 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Sun, 12 Feb 2012 16:22:37 +0300 Subject: [PATCH 5/6] Update ticks on TBM_SETRANGEMIN --- dlls/comctl32/tests/trackbar.c | 16 +++++++++++++++- dlls/comctl32/trackbar.c | 9 +++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/tests/trackbar.c b/dlls/comctl32/tests/trackbar.c index 7c16ae8..a444503 100644 --- a/dlls/comctl32/tests/trackbar.c +++ b/dlls/comctl32/tests/trackbar.c @@ -993,6 +993,12 @@ static void test_initial_state(void) ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0); expect(2, ret); + ret = SendMessage(hWnd, TBM_SETRANGEMIN, TRUE, 10); + expect(0, ret); + + ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0); + expect(2, ret); + DestroyWindow(hWnd); } @@ -1014,12 +1020,20 @@ static void test_TBS_AUTOTICKS(void) ret = SendMessage(hWnd, TBM_GETRANGEMAX, 0, 0); expect(100, ret); + /* TBM_SETRANGEMAX rebuilds tics */ ret = SendMessage(hWnd, TBM_SETRANGEMAX, TRUE, 200); expect(0, ret); - ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0); expect(201, ret); + /* TBM_SETRANGEMIN rebuilds tics */ + ret = SendMessage(hWnd, TBM_SETRANGEMAX, TRUE, 100); + expect(0, ret); + ret = SendMessage(hWnd, TBM_SETRANGEMIN, TRUE, 10); + expect(0, ret); + ret = SendMessage(hWnd, TBM_GETNUMTICS, 0, 0); + expect(91, ret); + DestroyWindow(hWnd); } diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c index 667bff1..679d979 100644 --- a/dlls/comctl32/trackbar.c +++ b/dlls/comctl32/trackbar.c @@ -1199,8 +1199,10 @@ TRACKBAR_SetRangeMax (TRACKBAR_INFO *infoPtr, BOOL redraw, LONG lMax) static inline LRESULT -TRACKBAR_SetRangeMin (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMin) +TRACKBAR_SetRangeMin (TRACKBAR_INFO *infoPtr, BOOL redraw, LONG lMin) { + BOOL changed = infoPtr->lRangeMin != lMin; + infoPtr->lRangeMin = lMin; if (infoPtr->lPos < infoPtr->lRangeMin) { infoPtr->lPos = infoPtr->lRangeMin; @@ -1210,7 +1212,10 @@ TRACKBAR_SetRangeMin (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMin) infoPtr->lPageSize = (infoPtr->lRangeMax - infoPtr->lRangeMin) / 5; if (infoPtr->lPageSize == 0) infoPtr->lPageSize = 1; - if (fRedraw) TRACKBAR_InvalidateAll(infoPtr); + if (changed && (infoPtr->dwStyle & TBS_AUTOTICKS)) + TRACKBAR_RecalculateTics (infoPtr); + + if (redraw) TRACKBAR_InvalidateAll(infoPtr); return 0; } -- 1.5.6.5