- Timestamp:
- Nov 17, 2008, 12:17:05 AM (17 years ago)
- Location:
- branches/branch-1-0/src/helpers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1-0/src/helpers/textview.c
r229 r374 183 183 184 184 /* 185 * Copyright (C) 2000 Ulrich Mller.185 * Copyright (C) 2000-2008 Ulrich Mller. 186 186 * This program is part of the XWorkplace package. 187 187 * This program is free software; you can redistribute it and/or modify … … 1100 1100 * 1101 1101 *@@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 1102 1103 *@@todo TXVWORDF_GLUEWITHNEXT 1103 1104 */ … … 1310 1311 { 1311 1312 // 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 1313 1315 > prclView->xRight) 1314 1316 // > ulWinCX) … … 1955 1957 * -- rclViewText: the text subrectangle (which 1956 1958 * is rclViewPaint minus borders). 1959 * 1960 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: fix cut/paste/typo. errors @@fixes 1086 1957 1961 */ 1958 1962 … … 1985 1989 ptxvd->rclViewText.yBottom = ptxvd->rclViewPaint.yBottom + ptxvd->cdata.ulYBorder; 1986 1990 ptxvd->rclViewText.xRight = ptxvd->rclViewPaint.xRight - ptxvd->cdata.ulXBorder; 1987 ptxvd->rclViewText.yTop = ptxvd->rclViewPaint.yTop - ptxvd->cdata.ul XBorder;1991 ptxvd->rclViewText.yTop = ptxvd->rclViewPaint.yTop - ptxvd->cdata.ulYBorder; // WarpIN V1.0.18 1988 1992 1989 1993 // now reposition scroll bars; their sizes may change … … 1995 1999 ulOfs = 0; 1996 2000 if (ptxvd->fHScrollVisible) 1997 ulOfs = ulScrollC X;2001 ulOfs = ulScrollCY; // WarpIN V1.0.18 1998 2002 WinSetWindowPos(ptxvd->hwndVScroll, 1999 2003 HWND_TOP, … … 2027 2031 * 2028 2032 *@@changed V0.9.3 (2000-05-05) [umoeller]: fixed buggy vertical scroll bars 2033 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: fix buggy horiz. scroll bars @@fixes 1086 2029 2034 */ 2030 2035 … … 2103 2108 AdjustViewRects(hwndTextView, 2104 2109 ptxvd); 2110 FormatText2Screen(hwndTextView, // WarpIN V1.0.18 2111 ptxvd, 2112 TRUE, // fAlreadyRecursing 2113 FALSE); // quick format 2105 2114 } 2106 2115 } … … 2767 2776 * 2768 2777 *@@added V1.0.0 (2002-08-12) [umoeller] 2778 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: added correct ID for horiz. scroll @@fixes 1086 2769 2779 */ 2770 2780 … … 2804 2814 ulMsg = WM_HSCROLL; 2805 2815 usCmd = SB_LINERIGHT; 2816 usID = ID_HSCROLL; // WarpIN V1.0.18 2806 2817 break; 2807 2818 … … 2809 2820 ulMsg = WM_HSCROLL; 2810 2821 usCmd = SB_LINELEFT; 2822 usID = ID_HSCROLL; // WarpIN V1.0.18 2811 2823 break; 2812 2824 … … 2838 2850 ulMsg = WM_VSCROLL; 2839 2851 else 2852 { 2840 2853 ulMsg = WM_HSCROLL; 2854 usID = ID_HSCROLL; // WarpIN V1.0.18 2855 } 2841 2856 2842 2857 sPos = 0; … … 2855 2870 ulMsg = WM_HSCROLL; 2856 2871 sPos = ptxvd->xfd.szlWorkspace.cx; 2872 usID = ID_HSCROLL; // WarpIN V1.0.18 2857 2873 } 2858 2874 -
branches/branch-1-0/src/helpers/winh.c
r346 r374 19 19 20 20 /* 21 * Copyright (C) 1997-200 6Ulrich Mller.21 * Copyright (C) 1997-2008 Ulrich Mller. 22 22 * This file is part of the "XWorkplace helpers" source package. 23 23 * This is free software; you can redistribute it and/or modify … … 1857 1857 * Terminology: 1858 1858 * 1859 * -- "window": the actual window with scroll bars which displays 1860 * a subrectangle of the available data. With a typical PM 1861 * application, this will be your client window. 1862 * 1863 * The width or height of this must be passed in ulWinPels. 1864 * 1865 * -- "viewport": the entire data to be displayed, of which the 1866 * "window" can only display a subrectangle, if the viewport 1867 * is larger than the window. 1868 * 1869 * The width or height of this must be passed in ulViewportPels. 1870 * This can be smaller than ulWinPels (if the window is larger 1871 * than the data) or the same or larger than ulWinPels 1872 * (if the window is too small to show all the data). 1873 * 1874 * -- "window offset": the offset of the current window within 1875 * the viewport. 1876 * 1877 * For horizontal scroll bars, this is the X coordinate, 1878 * counting from the left of the window (0 means leftmost). 1879 * 1880 * For vertical scroll bars, this is counted from the _top_ 1881 * of the viewport (0 means topmost, as opposed to OS/2 1882 * window coordinates!). This is because for vertical scroll 1883 * bars controls, higher values move the thumb _down_. Yes 1884 * indeed, this conflicts with PM's coordinate system. 1885 * 1886 * The window offset is therefore always positive. 1887 * 1888 * The scroll bar gets disabled if the entire viewport is visible, 1889 * that is, if ulViewportPels <= ulWinPels. In that case 1859 * -- "window": the actual window with scroll bars which displays 1860 * a subrectangle of the available data. With a typical PM 1861 * application, this will be your client window. 1862 * 1863 * The width or height of this must be passed in ulWinPels. 1864 * 1865 * -- "workarea": the entire data to be displayed, of which the 1866 * "window" can only display a subrectangle, if the workarea 1867 * is larger than the window. 1868 * 1869 * The width or height of this must be passed in ulWorkareaPels. 1870 * This can be smaller than ulWinPels (if the window is larger 1871 * than the data) or the same or larger than ulWinPels 1872 * (if the window is too small to show all the data). 1873 * 1874 * This value is exclusive in the sense that the maximum 1875 * window offset (below) can be the workarea minus one. 1876 * 1877 * -- "window offset": the zero-based offset of the current 1878 * window within the workarea, whose maximum value is 1879 * the workarea minus one. 1880 * 1881 * [pr]: I disagree with the above "workarea minus one" stuff. 1882 * It is perfectly possible to have the workarea and the 1883 * window area the same size and to display all the content. 1884 * This also means you do NOT get a disabled scroll bar 1885 * any more when they are the same size. 1886 * 1887 * For horizontal scroll bars, this is the X coordinate, 1888 * counting from the left of the window (0 means leftmost). 1889 * 1890 * For vertical scroll bars, this is counted from the _top_ 1891 * of the workarea (0 means topmost, as opposed to OS/2 1892 * window coordinates!). This is because for vertical scroll 1893 * bars controls, higher values move the thumb _down_. Yes 1894 * indeed, this conflicts with PM's coordinate system. 1895 * 1896 * The window offset is therefore always positive. 1897 * 1898 * The scroll bar gets disabled if the entire workarea is visible, 1899 * that is, if ulWorkareaPels <= ulWinPels. In that case 1890 1900 * FALSE is returned. If (fAutoHide == TRUE), the scroll 1891 1901 * bar is not only disabled, but also hidden from the display. 1892 1902 * In that case, you will need to reformat your output because 1893 * your viewportbecomes larger without the scroll bar.1903 * your workarea becomes larger without the scroll bar. 1894 1904 * 1895 1905 * This function will set the range of the scroll bar to 0 up 1896 * to a value depending on the viewportsize. For vertical scroll1906 * to a value depending on the workarea size. For vertical scroll 1897 1907 * bars, 0 means topmost (which is kinda sick with the OS/2 1898 1908 * coordinate system), for horizontal scroll bars, 0 means leftmost. … … 1900 1910 * The maximum value of the scroll bar will be 1901 1911 * 1902 + (ul ViewportPels - ulWinPels) / usScrollUnitPels1912 + (ulWorkareaPels - ulWinPels) / usScrollUnitPels 1903 1913 * 1904 1914 * The thumb size of the scroll bar will also be adjusted 1905 * based on the viewportand window size, as it should be.1915 * based on the workarea and window size, as it should be. 1906 1916 * 1907 1917 *@@added V0.9.1 (2000-02-14) [umoeller] 1908 1918 *@@changed V0.9.3 (2000-04-30) [umoeller]: fixed pels/unit confusion 1909 1919 *@@changed V0.9.3 (2000-05-08) [umoeller]: now handling scroll units automatically 1920 *@@changed V1.0.1 (2003-01-25) [umoeller]: fixed max value which caused right/bottommost scroll button to never be disabled 1921 *@@changed V1.0.1 (2003-01-25) [umoeller]: fixed bad thumb position for large offsets 1922 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: fix rounding errors @@fixes 1086 1923 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: disable scroll bars when workarea = win area @@fixes 1086 1910 1924 */ 1911 1925 … … 1914 1928 // visible window part (in pixels), 1915 1929 // excluding the scroll bar! 1916 ULONG ul ViewportPels, // in: dimension of total data part, of1930 ULONG ulWorkareaPels, // in: dimension of total data part, of 1917 1931 // which ulWinPels is a sub-dimension 1918 1932 // (in pixels); … … 1925 1939 BOOL brc = FALSE; 1926 1940 1927 // _Pmpf(("Entering winhUpdateScrollBar")); 1928 1929 // for large viewports, adjust scroll bar units 1930 USHORT usScrollUnitPels = 1; 1931 if (ulViewportPels > 10000) 1932 usScrollUnitPels = 100; 1933 1934 if (ulViewportPels > ulWinPels) 1935 { 1941 if (ulWorkareaPels > ulWinPels) // WarpIN V1.0.18 1942 { 1943 // for large workareas, adjust scroll bar units 1944 USHORT usDivisor = 1, usRounder; 1945 USHORT lMaxAllowedUnitOfs; 1946 1947 if (ulWorkareaPels > 10000) 1948 usDivisor = 100; 1949 1950 usRounder = usDivisor - 1; // WarpIN V1.0.18 1936 1951 // scrollbar needed: 1937 USHORT usThumbDivisorUnits = usScrollUnitPels; 1938 USHORT lMaxAllowedUnitOfs; 1939 // _Pmpf(("winhUpdateScrollBar: ulViewportPels > ulWinPels, enabling scroller")); 1940 // divisor for thumb size (below) 1941 if (ulViewportPels > 10000) 1942 // for very large viewports, we need to 1943 // raise the divisor, because we only 1944 // have a USHORT 1945 usThumbDivisorUnits = usScrollUnitPels * 100; 1946 1947 // viewport is larger than window: 1952 1953 // workarea is larger than window: 1948 1954 WinEnableWindow(hwndScrollBar, TRUE); 1949 1955 if (fAutoHide) … … 1951 1957 1952 1958 // calculate limit 1953 lMaxAllowedUnitOfs = ((ulViewportPels - ulWinPels + usScrollUnitPels) 1954 // scroll unit is 10 1955 / usScrollUnitPels); 1956 1957 // _Pmpf((" usCurUnitOfs: %d", ulCurUnitOfs)); 1958 // _Pmpf((" usMaxUnits: %d", lMaxAllowedUnitOfs)); 1959 lMaxAllowedUnitOfs = (ulWorkareaPels - ulWinPels + usRounder) 1960 / usDivisor; 1959 1961 1960 1962 // set thumb position and limit 1961 1963 WinSendMsg(hwndScrollBar, 1962 1964 SBM_SETSCROLLBAR, 1963 (MPARAM)( ulCurPelsOfs), // / usThumbDivisorUnits), // position: 0 means top1965 (MPARAM)((ulCurPelsOfs + usRounder) / usDivisor), // position: 0 means top 1964 1966 MPFROM2SHORT(0, // minimum 1965 1967 lMaxAllowedUnitOfs)); // maximum 1966 1968 1967 1969 // set thumb size based on ulWinPels and 1968 // ul ViewportPels1970 // ulWorkareaPels 1969 1971 WinSendMsg(hwndScrollBar, 1970 1972 SBM_SETTHUMBSIZE, 1971 MPFROM2SHORT( ulWinPels / usThumbDivisorUnits, // visible1972 ulViewportPels / usThumbDivisorUnits), // total1973 MPFROM2SHORT( (ulWinPels + usRounder) / usDivisor, // visible 1974 (ulWorkareaPels + usRounder) / usDivisor), // total 1973 1975 0); 1974 1976 brc = TRUE; … … 1976 1978 else 1977 1979 { 1978 // _Pmpf(("winhUpdateScrollBar: ulViewportPels <= ulWinPels")); 1979 // entire viewport is visible: 1980 // entire workarea is visible: 1980 1981 WinEnableWindow(hwndScrollBar, FALSE); 1981 1982 if (fAutoHide) … … 2026 2027 *@@changed V0.9.3 (2000-05-08) [umoeller]: now handling scroll units automatically 2027 2028 *@@changed V0.9.7 (2001-01-17) [umoeller]: changed PLONG to PULONG 2029 *@@changed WarpIN V1.0.18 (2008-11-16) [pr]: fix rounding error @@fixes 1086 2028 2030 */ 2029 2031 … … 2127 2129 WinSendMsg(hwndScrollBar, 2128 2130 SBM_SETPOS, 2129 (MPARAM)(*pulCurPelsOfs / usScrollUnitPels), // / usScrollUnit), 2131 (MPARAM)((*pulCurPelsOfs + (usScrollUnitPels / 2)) / usScrollUnitPels), 2132 (MPARAM)((*pulCurPelsOfs + (usScrollUnitPels / 2)) / usScrollUnitPels), // WarpIN V1.0.18 2130 2133 0); 2131 2134 // scroll window rectangle:
Note:
See TracChangeset
for help on using the changeset viewer.