Ignore:
Timestamp:
Nov 16, 2008, 11:36:11 PM (17 years ago)
Author:
pr
Message:

Fix scroll bar bugs in textview control. Bug 1086.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/winh.c

    r346 r373  
    1919
    2020/*
    21  *      Copyright (C) 1997-2006 Ulrich M”ller.
     21 *      Copyright (C) 1997-2008 Ulrich M”ller.
    2222 *      This file is part of the "XWorkplace helpers" source package.
    2323 *      This is free software; you can redistribute it and/or modify
     
    19351935 *          the workarea minus one.
    19361936 *
     1937 *          [pr]: I disagree with the above "workarea minus one" stuff.
     1938 *                It is perfectly possible to have the workarea and the
     1939 *                window area the same size and to display all the content.
     1940 *                This also means you do NOT get a disabled scroll bar
     1941 *                any more when they are the same size.
     1942 *
    19371943 *          For horizontal scroll bars, this is the X coordinate,
    19381944 *          counting from the left of the window (0 means leftmost).
     
    19701976 *@@changed V1.0.1 (2003-01-25) [umoeller]: fixed max value which caused right/bottommost scroll button to never be disabled
    19711977 *@@changed V1.0.1 (2003-01-25) [umoeller]: fixed bad thumb position for large offsets
     1978 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: fix rounding errors @@fixes 1086
     1979 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: disable scroll bars when workarea = win area @@fixes 1086
    19721980 */
    19731981
     
    19871995    BOOL brc = FALSE;
    19881996
    1989     if (ulWorkareaPels >= ulWinPels)
     1997    if (ulWorkareaPels > ulWinPels) // WarpIN V1.0.18
    19901998    {
    19911999        // for large workareas, adjust scroll bar units
    1992         USHORT  usDivisor = 1;
     2000        USHORT  usDivisor = 1, usRounder;
    19932001        USHORT  lMaxAllowedUnitOfs;
    19942002
     
    19962004            usDivisor = 100;
    19972005
     2006        usRounder = usDivisor - 1;  // WarpIN V1.0.18
    19982007        // scrollbar needed:
    19992008
     
    20042013
    20052014        // calculate limit
    2006         lMaxAllowedUnitOfs =   (ulWorkareaPels - ulWinPels)
     2015        lMaxAllowedUnitOfs =   (ulWorkareaPels - ulWinPels + usRounder)
    20072016                             / usDivisor;
    20082017
     
    20102019        WinSendMsg(hwndScrollBar,
    20112020                   SBM_SETSCROLLBAR,
    2012                    (MPARAM)(ulCurPelsOfs / usDivisor),   // position: 0 means top
     2021                   (MPARAM)((ulCurPelsOfs + usRounder) / usDivisor),   // position: 0 means top
    20132022                   MPFROM2SHORT(0,  // minimum
    20142023                                lMaxAllowedUnitOfs));    // maximum
     
    20182027        WinSendMsg(hwndScrollBar,
    20192028                   SBM_SETTHUMBSIZE,
    2020                    MPFROM2SHORT(    ulWinPels / usDivisor,       // visible
    2021                                     ulWorkareaPels / usDivisor), // total
     2029                   MPFROM2SHORT(    (ulWinPels + usRounder) / usDivisor,       // visible
     2030                                    (ulWorkareaPels + usRounder) / usDivisor), // total
    20222031                   0);
    20232032        brc = TRUE;
     
    20772086 *@@changed V0.9.7 (2001-01-17) [umoeller]: changed PLONG to PULONG
    20782087 *@@changed V1.0.1 (2003-01-25) [umoeller]: changed prototype, no longer calling WinScrollWindow, fixed offset bugs
     2088 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: fix rounding error @@fixes 1086
    20792089 */
    20802090
     
    21472157        WinSendMsg(hwndScrollBar,
    21482158                   SBM_SETPOS,
    2149                    (MPARAM)(*plCurPelsOfs / lScrollUnitPels),
     2159                   (MPARAM)((*plCurPelsOfs + (lScrollUnitPels / 2)) / lScrollUnitPels),  // WarpIN V1.0.18
    21502160                   0);
    21512161
Note: See TracChangeset for help on using the changeset viewer.