Changeset 268
- Timestamp:
- Apr 12, 2009, 10:08:49 AM (12 years ago)
- Location:
- trunk/Lucide/SOURCE/gui
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Lucide/SOURCE/gui/Lucide.rc
r267 r268 22 22 POINTER IDP_ZOOM_IN "bitmaps\\zoom_in.ptr" 23 23 POINTER IDP_ZOOM_OUT "bitmaps\\zoom_out.ptr" 24 POINTER IDP_HAND_CLOSED "bitmaps\\hand_closed.ptr" 25 24 26 25 27 MENU IDM_MAINMENU -
trunk/Lucide/SOURCE/gui/Lucide_res.H
r267 r268 42 42 #define IDP_ZOOM_IN 11 43 43 #define IDP_ZOOM_OUT 12 44 #define IDP_HAND_CLOSED 13 44 45 45 46 #define IDB_OPEN 20 -
trunk/Lucide/SOURCE/gui/docViewer.cpp
r266 r268 64 64 #define VERT_SPACE 2 65 65 #define NO_MOUSE_TIMER 1 66 #define SB_PAGEDRAG 100 66 67 67 68 // DocumentViewer constructor … … 106 107 WinSetRectEmpty( hab, &savedRcl ); 107 108 drawPS = false; 109 // mouse drag using right button 110 docDraggingStarted = false; 111 docDraggingStart.x = 0; docDraggingStart.y = 0; 112 docDraggingEnd.x = 0; docDraggingEnd.y = 0; 108 113 // fullscreen 109 114 fullscreen = false; … … 128 133 links = NULL; 129 134 handPtr = WinLoadPointer( HWND_DESKTOP, _hmod, IDP_HAND ); 135 handClosedPtr = WinLoadPointer( HWND_DESKTOP, _hmod, IDP_HAND_CLOSED ); 130 136 zoomInPtr = WinLoadPointer( HWND_DESKTOP, _hmod, IDP_ZOOM_IN ); 131 137 zoomOutPtr = WinLoadPointer( HWND_DESKTOP, _hmod, IDP_ZOOM_OUT ); … … 170 176 171 177 WinDestroyPointer( handPtr ); 178 WinDestroyPointer( handClosedPtr ); 172 179 WinDestroyPointer( zoomInPtr ); 173 180 WinDestroyPointer( zoomOutPtr ); … … 350 357 bool needRedraw = ( page == currentpage ); 351 358 double pgpos = pagenumToPos( page ) / VScrollStep; 352 vertScroll( hWndDoc, MPFROM2SHORT( pgpos, SB_SLIDERPOSITION ) , NULLHANDLE);359 vertScroll( hWndDoc, MPFROM2SHORT( pgpos, SB_SLIDERPOSITION ) ); 353 360 if ( needRedraw ) { 354 361 drawPage(); … … 554 561 RECTL r; 555 562 _this->docPosToWinPos( i, &(_this->foundrects[i]->_buffer[0]), &r ); 556 _this->scrollToPos( _this->hWndDoc, NULLHANDLE,r.xLeft, r.yBottom, false );563 _this->scrollToPos( _this->hWndDoc, r.xLeft, r.yBottom, false ); 557 564 } 558 565 break; … … 633 640 634 641 // handles vertical scrolling 635 MRESULT DocumentViewer::vertScroll( HWND hwnd, MPARAM mp2 , HRGN hrgn)642 MRESULT DocumentViewer::vertScroll( HWND hwnd, MPARAM mp2 ) 636 643 { 637 644 if ( fullscreen ) { … … 659 666 sVscrollInc = ( SHORT1FROMMP( mp2 ) - sVscrollPos ) * VScrollStep; 660 667 break; 661 } 662 663 sVscrollInc = __max( -sVscrollPos * VScrollStep, __min( sVscrollInc, 668 case SB_PAGEDRAG: 669 sVscrollInc = (SHORT)SHORT1FROMMP( mp2 ); 670 break; 671 } 672 673 if ( SHORT2FROMMP( mp2 ) != SB_PAGEDRAG ) { 674 sVscrollInc = __max( -sVscrollPos * VScrollStep, __min( sVscrollInc, 664 675 ( sVscrollMax - sVscrollPos ) * VScrollStep ) ); 665 sVscrollInc = ( sVscrollInc / VScrollStep ) * VScrollStep; 676 sVscrollInc = ( sVscrollInc / VScrollStep ) * VScrollStep; 677 } 678 666 679 if ( sVscrollInc != 0 ) 667 680 { 668 681 sVscrollPos += (SHORT)( sVscrollInc / VScrollStep ); 669 WinScrollWindow( hwnd, 0, sVscrollInc, NULL, NULL, hrgn, NULL, SW_INVALIDATERGN );682 WinScrollWindow( hwnd, 0, sVscrollInc, NULL, NULL, NULLHANDLE, NULL, SW_INVALIDATERGN ); 670 683 WinSendMsg( hWndVscroll, SBM_SETPOS, MPFROMSHORT( sVscrollPos ), MPVOID ); 671 684 WinUpdateWindow( hwnd ); … … 676 689 677 690 // handles horizontal scrolling 678 MRESULT DocumentViewer::horizScroll( HWND hwnd, MPARAM mp2 , HRGN hrgn)691 MRESULT DocumentViewer::horizScroll( HWND hwnd, MPARAM mp2 ) 679 692 { 680 693 if ( fullscreen ) { … … 709 722 { 710 723 sHscrollPos += (SHORT)sHscrollInc; 711 WinScrollWindow( hwnd, -sHscrollInc, 0, NULL, NULL, hrgn, NULL, SW_INVALIDATERGN );724 WinScrollWindow( hwnd, -sHscrollInc, 0, NULL, NULL, NULLHANDLE, NULL, SW_INVALIDATERGN ); 712 725 WinSendMsg( hWndHscroll, SBM_SETPOS, MPFROMSHORT( sHscrollPos ), MPVOID ); 713 726 WinUpdateWindow( hwnd ); … … 796 809 797 810 SHORT realScrollPos = (SHORT)(sVscrollMax * relativeScrollPos); 798 vertScroll( hWndDoc, MPFROM2SHORT( realScrollPos, SB_SLIDERPOSITION ) , NULLHANDLE);811 vertScroll( hWndDoc, MPFROM2SHORT( realScrollPos, SB_SLIDERPOSITION ) ); 799 812 } 800 813 } … … 1552 1565 1553 1566 // scrolls window to specified pos (optionally with text selection) 1554 void DocumentViewer::scrollToPos( HWND hwnd, HRGN hrgn,LONG xpos, LONG ypos,1567 void DocumentViewer::scrollToPos( HWND hwnd, LONG xpos, LONG ypos, 1555 1568 bool withSelection ) 1556 1569 { … … 1571 1584 1572 1585 if ( xinc != 0 ) { 1573 horizScroll( hwnd, MPFROM2SHORT( sHscrollPos + xinc, SB_SLIDERPOSITION ) , hrgn);1586 horizScroll( hwnd, MPFROM2SHORT( sHscrollPos + xinc, SB_SLIDERPOSITION ) ); 1574 1587 if ( withSelection ) { 1575 1588 selectionStart.x -= xinc; … … 1586 1599 1587 1600 vertScroll( hwnd, MPFROM2SHORT( ( ( sVscrollPos * VScrollStep ) + yinc ) / VScrollStep, 1588 SB_SLIDERPOSITION ) , hrgn);1601 SB_SLIDERPOSITION ) ); 1589 1602 if ( withSelection ) { 1590 1603 selectionStart.y += yinc; … … 1628 1641 if ( isContinuous() ) 1629 1642 { 1630 scrollToPos( hwnd, NULLHANDLE,xpos, ypos, true );1643 scrollToPos( hwnd, xpos, ypos, true ); 1631 1644 1632 1645 RECTL selRect = { … … 1667 1680 1668 1681 HPS hps = WinGetPS( hwnd ); 1669 HRGN scrolledRegion = NULLHANDLE; //GpiCreateRegion( hps, 0, NULL ); 1670 1671 scrollToPos( hwnd, scrolledRegion, xpos, ypos, true ); 1682 1683 scrollToPos( hwnd, xpos, ypos, true ); 1672 1684 1673 1685 // 127/191/255 … … 1693 1705 HRGN selectRegion = rectsToRegion( currentpage, hps, selrects[ currentpage ] ); 1694 1706 GpiCombineRegion( hps, selectRegion, selectRegion, clearRegion, CRGN_XOR ); 1695 //GpiCombineRegion( hps, selectRegion, selectRegion, scrolledRegion, CRGN_DIFF );1696 1707 GpiPaintRegion( hps, selectRegion ); 1697 1708 GpiDestroyRegion( hps, clearRegion ); 1698 1709 GpiDestroyRegion( hps, selectRegion ); 1699 //GpiDestroyRegion( hps, scrolledRegion );1700 1710 1701 1711 WinReleasePS( hps ); 1702 1712 } 1713 } 1714 else if ( docDraggingStarted && ( doc != NULL ) ) 1715 { 1716 WinSetPointer( HWND_DESKTOP, handClosedPtr ); 1717 docDraggingEnd.x = xpos; 1718 docDraggingEnd.y = ypos; 1719 1720 SHORT vMove = docDraggingEnd.y - docDraggingStart.y; 1721 if ( abs( vMove ) > 5 ) 1722 { 1723 vertScroll( hwnd, MPFROM2SHORT( vMove, SB_PAGEDRAG ) ); 1724 docDraggingStart.x = xpos; 1725 docDraggingStart.y = ypos; 1726 } 1727 return TRUE; 1703 1728 } 1704 1729 else if ( links != NULL ) … … 1819 1844 } 1820 1845 1821 1822 1846 BOOL DocumentViewer::wmChar( HWND hwnd, MPARAM mp1, MPARAM mp2 ) 1823 1847 { … … 1844 1868 goToPage( 0 ); 1845 1869 } else { 1846 vertScroll( hwnd, MPFROM2SHORT( 0, SB_SLIDERPOSITION ) , NULLHANDLE);1870 vertScroll( hwnd, MPFROM2SHORT( 0, SB_SLIDERPOSITION ) ); 1847 1871 } 1848 1872 } … … 1855 1879 goToPage( currentpage - 1 ); 1856 1880 if ( dojump ) { 1857 vertScroll( hwnd, MPFROM2SHORT( sVscrollMax, SB_SLIDERPOSITION ) , NULLHANDLE);1881 vertScroll( hwnd, MPFROM2SHORT( sVscrollMax, SB_SLIDERPOSITION ) ); 1858 1882 } 1859 1883 } else { … … 1869 1893 goToPage( totalpages - 1 ); 1870 1894 } else { 1871 vertScroll( hwnd, MPFROM2SHORT( sVscrollMax, SB_SLIDERPOSITION ) , NULLHANDLE);1895 vertScroll( hwnd, MPFROM2SHORT( sVscrollMax, SB_SLIDERPOSITION ) ); 1872 1896 } 1873 1897 } … … 1893 1917 1894 1918 case VK_HOME: 1895 horizScroll( hwnd, MPFROM2SHORT( 0, SB_SLIDERPOSITION ) , NULLHANDLE);1919 horizScroll( hwnd, MPFROM2SHORT( 0, SB_SLIDERPOSITION ) ); 1896 1920 return TRUE; 1897 1921 1898 1922 case VK_END: 1899 horizScroll( hwnd, MPFROM2SHORT( sHscrollMax, SB_SLIDERPOSITION ) , NULLHANDLE);1923 horizScroll( hwnd, MPFROM2SHORT( sHscrollMax, SB_SLIDERPOSITION ) ); 1900 1924 return TRUE; 1901 1925 } … … 1974 1998 } 1975 1999 2000 1976 2001 // handles WM_BUTTON1UP 1977 2002 void DocumentViewer::wmButton1Up() … … 1989 2014 1990 2015 Lucide::enableCopy( haveSelection ); 2016 } 2017 2018 2019 // handles WM_BUTTON2DOWN 2020 void DocumentViewer::wmButton2Down( HWND hwnd, SHORT xpos, SHORT ypos ) 2021 { 2022 if ( doc != NULL ) 2023 { 2024 WinSetCapture( HWND_DESKTOP, hwnd ); 2025 docDraggingStarted = true; 2026 docDraggingStart.x = xpos; 2027 docDraggingStart.y = ypos; 2028 } 2029 } 2030 2031 2032 // handles WM_BUTTON2UP 2033 void DocumentViewer::wmButton2Up() 2034 { 2035 if ( docDraggingStarted ) 2036 { 2037 WinSetCapture( HWND_DESKTOP, NULLHANDLE ); 2038 docDraggingStarted = false; 2039 } 1991 2040 } 1992 2041 … … 2095 2144 2096 2145 case WM_HSCROLL: 2097 _this->horizScroll( hwnd, mp2 , NULLHANDLE);2146 _this->horizScroll( hwnd, mp2 ); 2098 2147 break; 2099 2148 2100 2149 case WM_VSCROLL: 2101 _this->vertScroll( hwnd, mp2 , NULLHANDLE);2150 _this->vertScroll( hwnd, mp2 ); 2102 2151 break; 2103 2152 … … 2126 2175 break; 2127 2176 2177 case WM_BUTTON2DOWN: 2178 _this->wmButton2Down( hwnd, SHORT1FROMMP( mp1 ), SHORT2FROMMP( mp1 ) ); 2179 break; 2180 2181 case WM_BUTTON2UP: 2182 _this->wmButton2Up(); 2183 break; 2184 2128 2185 case WM_MOUSEMOVE: 2129 2186 if ( _this->wmMouseMove( hwnd, SHORT1FROMMP( mp1 ), SHORT2FROMMP( mp1 ) ) ) { -
trunk/Lucide/SOURCE/gui/docViewer.h
r266 r268 93 93 void countPagesizes(); 94 94 95 MRESULT vertScroll( HWND hwnd, MPARAM mp2 , HRGN hrgn);96 MRESULT horizScroll( HWND hwnd, MPARAM mp2 , HRGN hrgn);95 MRESULT vertScroll( HWND hwnd, MPARAM mp2 ); 96 MRESULT horizScroll( HWND hwnd, MPARAM mp2 ); 97 97 MRESULT wmDragOver( PDRAGINFO dragInfo ); 98 98 void wmDrop( PDRAGINFO dragInfo ); … … 104 104 void wmButton1Down( HWND hwnd, SHORT xpos, SHORT ypos ); 105 105 void wmButton1Up(); 106 void wmButton2Down( HWND hwnd, SHORT xpos, SHORT ypos ); 107 void wmButton2Up(); 106 108 BOOL wmMouseMove( HWND hwnd, SHORT xpos, SHORT ypos ); 107 109 BOOL wmClick( HWND hwnd, SHORT xpos, SHORT ypos ); … … 114 116 HRGN rectsToRegion( long pagenum, HPS hps, LuDocument_LuRectSequence *rects ); 115 117 void drawSelection( long pagenum, HPS hps, PRECTL r ); 116 void scrollToPos( HWND hwnd, HRGN hrgn,LONG xpos, LONG ypos, bool withSelection );118 void scrollToPos( HWND hwnd, LONG xpos, LONG ypos, bool withSelection ); 117 119 void freeRects( LuDocument_LuRectSequence **rects ); 118 120 void freeLinks(); … … 165 167 bool drawPS; 166 168 PgLayout layout; 169 170 // mouse drag using right button 171 bool docDraggingStarted; 172 POINTL docDraggingStart; 173 POINTL docDraggingEnd; 167 174 168 175 // fullscreen … … 208 215 // pointers 209 216 HPOINTER handPtr; 217 HPOINTER handClosedPtr; 210 218 HPOINTER zoomInPtr; 211 219 HPOINTER zoomOutPtr; -
trunk/Lucide/SOURCE/gui/makefile
r265 r268 1 1 .autodepend 2 2 3 TEST= 04 VERSION=1.2 13 TEST=1 4 VERSION=1.22 5 5 6 6 !if $(TEST)==1
Note: See TracChangeset
for help on using the changeset viewer.