Changeset 373 for trunk/src


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

Fix scroll bar bugs in textview control. Bug 1086.

Location:
trunk/src/helpers
Files:
2 edited

Legend:

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

    r243 r373  
    183183
    184184/*
    185  *      Copyright (C) 2000 Ulrich M”ller.
     185 *      Copyright (C) 2000-2008 Ulrich M”ller.
    186186 *      This program is part of the XWorkplace package.
    187187 *      This program is free software; you can redistribute it and/or modify
     
    11001100 *
    11011101 *@@changed V0.9.3 (2000-05-06) [umoeller]: largely rewritten; now handling paragraph and character formats
     1102 *@@changed V1.0.18 (2008-11-16) [pr]: bodge formatting to remove unwanted scroll bars @@fixes 1086
    11021103 *@@todo TXVWORDF_GLUEWITHNEXT
    11031104 */
     
    13101311                            {
    13111312                                // yes: check if the word still fits
    1312                                 if (    (flbuf.lXCurrent + pWordThis->ulCXWithSpaces // ###
     1313                                // WarpIN V1.0.18 @@todo add fudge factor of 2 - makes things work
     1314                                if (    (flbuf.lXCurrent + pWordThis->ulCXWithSpaces + 2
    13131315                                             > prclView->xRight)
    13141316                                             // > ulWinCX)
     
    19541956 *      -- rclViewText: the text subrectangle (which
    19551957 *         is rclViewPaint minus borders).
     1958 *
     1959 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: fix cut/paste/typo. errors @@fixes 1086
    19561960 */
    19571961
     
    19841988    ptxvd->rclViewText.yBottom = ptxvd->rclViewPaint.yBottom + ptxvd->cdata.ulYBorder;
    19851989    ptxvd->rclViewText.xRight = ptxvd->rclViewPaint.xRight - ptxvd->cdata.ulXBorder;
    1986     ptxvd->rclViewText.yTop = ptxvd->rclViewPaint.yTop - ptxvd->cdata.ulXBorder;
     1990    ptxvd->rclViewText.yTop = ptxvd->rclViewPaint.yTop - ptxvd->cdata.ulYBorder;  // WarpIN V1.0.18
    19871991
    19881992    // now reposition scroll bars; their sizes may change
     
    19941998        ulOfs = 0;
    19951999        if (ptxvd->fHScrollVisible)
    1996             ulOfs = ulScrollCX;
     2000            ulOfs = ulScrollCY;  // WarpIN V1.0.18
    19972001        WinSetWindowPos(ptxvd->scrw.hwndVScroll,
    19982002                        HWND_TOP,
     
    20262030 *
    20272031 *@@changed V0.9.3 (2000-05-05) [umoeller]: fixed buggy vertical scroll bars
     2032 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: fix buggy horiz. scroll bars @@fixes 1086
    20282033 */
    20292034
     
    21022107                    AdjustViewRects(hwndTextView,
    21032108                                    ptxvd);
     2109                    FormatText2Screen(hwndTextView,  // WarpIN V1.0.18
     2110                                      ptxvd,
     2111                                      TRUE,   // fAlreadyRecursing
     2112                                      FALSE);   // quick format
    21042113                }
    21052114        }
     
    25622571 *
    25632572 *@@added V1.0.1 (2003-01-25) [umoeller]
     2573 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: check for horiz. scroll message @@fixes 1086
    25642574 */
    25652575
     
    25852595                                              mp2);
    25862596        }
    2587         else if (ptxvd->fHScrollVisible)
     2597        else if (    (msg == WM_HSCROLL)  // WarpIN V1.0.18
     2598                  && (ptxvd->fHScrollVisible)
     2599                )
    25882600        {
    25892601            LONG cx = ptxvd->rclViewText.xRight - ptxvd->rclViewText.xLeft;
     
    27862798 *
    27872799 *@@added V1.0.0 (2002-08-12) [umoeller]
     2800 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: added correct ID for horiz. scroll @@fixes 1086
    27882801 */
    27892802
     
    28232836                    ulMsg = WM_HSCROLL;
    28242837                    usCmd = SB_LINERIGHT;
     2838                    usID = ID_HSCROLL;  // WarpIN V1.0.18
    28252839                break;
    28262840
     
    28282842                    ulMsg = WM_HSCROLL;
    28292843                    usCmd = SB_LINELEFT;
     2844                    usID = ID_HSCROLL;  // WarpIN V1.0.18
    28302845                break;
    28312846
     
    28572872                        ulMsg = WM_VSCROLL;
    28582873                    else
     2874                    {
    28592875                        ulMsg = WM_HSCROLL;
     2876                        usID = ID_HSCROLL;  // WarpIN V1.0.18
     2877                    }
    28602878
    28612879                    sPos = 0;
     
    28742892                        ulMsg = WM_HSCROLL;
    28752893                        sPos = ptxvd->xfd.szlWorkspace.cx;
     2894                        usID = ID_HSCROLL;  // WarpIN V1.0.18
    28762895                    }
    28772896
  • 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.