Changeset 395 for trunk/Lucide


Ignore:
Timestamp:
Apr 15, 2010, 4:37:49 PM (12 years ago)
Author:
dmik
Message:

Fixed scrolling with RMB and enabled it in fullscreen.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/gui/docViewer.cpp

    r393 r395  
    544544{
    545545    fullscreen = _fullscreen;
    546     ULONG ulFrameStyle = WinQueryWindowULong( hWndDocFrame, QWL_STYLE );
    547546
    548547    if ( fullscreen )
     
    554553        WinSetParent( hWndHscroll, HWND_OBJECT, FALSE );
    555554        WinSetParent( hWndVscroll, HWND_OBJECT, FALSE );
    556         ulFrameStyle &= ~FS_SIZEBORDER;
    557555    }
    558556    else
     
    562560        WinSetParent( hWndHscroll, hWndDocFrame, FALSE );
    563561        WinSetParent( hWndVscroll, hWndDocFrame, FALSE );
    564         ulFrameStyle &= ~FS_SIZEBORDER;
    565     }
    566 
    567     WinSetWindowULong( hWndDocFrame, QWL_STYLE, ulFrameStyle );
    568     WinSendMsg( hWndDocFrame, WM_UPDATEFRAME,
    569                 MPFROMLONG( FCF_VERTSCROLL | FCF_HORZSCROLL | FCF_SIZEBORDER ), MPVOID );
     562    }
     563
     564    WinSendMsg( hWndDocFrame, WM_UPDATEFRAME, MPVOID, MPVOID );
    570565
    571566    if ( mouseHidden ) {
     
    772767MRESULT DocumentViewer::vertScroll( HWND hwnd, MPARAM mp2 )
    773768{
    774     if ( fullscreen ) {
    775         return ( MRFROMLONG( 0 ) );
    776     }
    777 
    778769    sVscrollInc = 0;
    779770
     
    801792    }
    802793
    803     if ( SHORT2FROMMP( mp2 ) != SB_PAGEDRAG ) {
    804         sVscrollInc = std::max( -sVscrollPos * (LONG)VScrollStep, std::min( sVscrollInc,
    805                               ( sVscrollMax - sVscrollPos ) * (LONG)VScrollStep ) );
    806         sVscrollInc = ( sVscrollInc / VScrollStep ) * VScrollStep;
    807     }
     794    sVscrollInc =
     795        std::max( -sVscrollPos * (LONG)VScrollStep,
     796                  std::min( sVscrollInc,
     797                            ( sVscrollMax - sVscrollPos ) * (LONG)VScrollStep ) );
     798    sVscrollInc = ( sVscrollInc / VScrollStep ) * VScrollStep;
    808799
    809800    if ( sVscrollInc != 0 )
     
    822813MRESULT DocumentViewer::horizScroll( HWND hwnd, MPARAM mp2 )
    823814{
    824     if ( fullscreen ) {
    825         return ( MRFROMLONG( 0 ) );
    826     }
    827 
    828815    sHscrollInc = 0;
    829816
     
    851838    }
    852839
    853     sHscrollInc = std::max( -(LONG)sHscrollPos, std::min( sHscrollInc, (LONG)(sHscrollMax - sHscrollPos) ) );
     840    sHscrollInc =
     841        std::max( -(LONG)sHscrollPos,
     842                  std::min( sHscrollInc, (LONG)(sHscrollMax - sHscrollPos) ) );
    854843
    855844    if ( sHscrollInc != 0 )
     
    892881    WinReleasePS( hps );
    893882
    894     if ( fullscreen )
    895     {
    896         sHscrollMax = 0;
    897         sHscrollPos = 0;
    898         realVscrollMax = 0;
    899         VScrollStep = 1;
    900         sVscrollPos = 0;
    901     }
    902     else
    903     {
    904         sHscrollMax = (SHORT)std::max( 0., ( isContinuous() ? fullwidth : width ) - cxClient );
    905         sHscrollPos = std::min( sHscrollPos, sHscrollMax );
    906 
    907         WinSendMsg( hWndHscroll, SBM_SETSCROLLBAR,
    908                     MPFROMSHORT(sHscrollPos), MPFROM2SHORT(0, sHscrollMax) );
    909         WinSendMsg( hWndHscroll, SBM_SETTHUMBSIZE,
    910                     MPFROM2SHORT( cxClient, width ), MPVOID );
    911         WinEnableWindow( hWndHscroll, (BOOL)( sHscrollMax != 0 ) );
    912 
    913         VScrollStep = 1;
    914         if ( isContinuous() )
    915         {
    916             realVscrollMax = std::max( 0., fullheight - cyClient );
    917             ULONG ssize = realVscrollMax / VScrollStep;
    918             while ( ssize > 32000 ) {
    919                 VScrollStep += LINE_HEIGHT;
    920                 ssize = realVscrollMax / VScrollStep;
    921             }
    922 
    923             sVscrollMax = (SHORT)ssize;
    924             if ( realVscrollMax > ( sVscrollMax * VScrollStep ) ) {
    925                 sVscrollMax += 1;
    926             }
    927         }
    928         else {
    929             realVscrollMax = sVscrollMax = (SHORT)std::max( 0., height - cyClient );
    930         }
    931         sVscrollPos = std::min( sVscrollPos, sVscrollMax );
    932 
    933         WinSendMsg( hWndVscroll, SBM_SETSCROLLBAR,
    934                     MPFROMSHORT(sVscrollPos), MPFROM2SHORT(0, sVscrollMax) );
    935         if ( isContinuous() ) {
    936             WinSendMsg( hWndVscroll, SBM_SETTHUMBSIZE,
    937                         MPFROM2SHORT( cyClient/VScrollStep, fullheight/VScrollStep ), MPVOID );
    938         }
    939         else {
    940             WinSendMsg( hWndVscroll, SBM_SETTHUMBSIZE,
    941                         MPFROM2SHORT( cyClient, height ), MPVOID );
    942         }
    943         WinEnableWindow( hWndVscroll, (BOOL)( sVscrollMax != 0 ) );
    944 
    945         SHORT realScrollPos = (SHORT)(sVscrollMax * relativeScrollPos);
    946         vertScroll( hWndDoc, MPFROM2SHORT( realScrollPos, SB_SLIDERPOSITION ) );
    947     }
     883    sHscrollMax = (SHORT)std::max( 0., ( isContinuous() ? fullwidth : width ) - cxClient );
     884    sHscrollPos = std::min( sHscrollPos, sHscrollMax );
     885
     886    WinSendMsg( hWndHscroll, SBM_SETSCROLLBAR,
     887                MPFROMSHORT(sHscrollPos), MPFROM2SHORT(0, sHscrollMax) );
     888    WinSendMsg( hWndHscroll, SBM_SETTHUMBSIZE,
     889                MPFROM2SHORT( cxClient, width ), MPVOID );
     890    WinEnableWindow( hWndHscroll, (BOOL)( sHscrollMax != 0 ) );
     891
     892    VScrollStep = 1;
     893    if ( isContinuous() )
     894    {
     895        realVscrollMax = std::max( 0., fullheight - cyClient );
     896        ULONG ssize = realVscrollMax / VScrollStep;
     897        while ( ssize > 32000 ) {
     898            VScrollStep += LINE_HEIGHT;
     899            ssize = realVscrollMax / VScrollStep;
     900        }
     901
     902        sVscrollMax = (SHORT)ssize;
     903        if ( realVscrollMax > ( sVscrollMax * VScrollStep ) ) {
     904            sVscrollMax += 1;
     905        }
     906    }
     907    else {
     908        realVscrollMax = sVscrollMax = (SHORT)std::max( 0., height - cyClient );
     909    }
     910    sVscrollPos = std::min( sVscrollPos, sVscrollMax );
     911
     912    WinSendMsg( hWndVscroll, SBM_SETSCROLLBAR,
     913                MPFROMSHORT(sVscrollPos), MPFROM2SHORT(0, sVscrollMax) );
     914    if ( isContinuous() ) {
     915        WinSendMsg( hWndVscroll, SBM_SETTHUMBSIZE,
     916                    MPFROM2SHORT( cyClient/VScrollStep, fullheight/VScrollStep ), MPVOID );
     917    }
     918    else {
     919        WinSendMsg( hWndVscroll, SBM_SETTHUMBSIZE,
     920                    MPFROM2SHORT( cyClient, height ), MPVOID );
     921    }
     922    WinEnableWindow( hWndVscroll, (BOOL)( sVscrollMax != 0 ) );
     923
     924    SHORT realScrollPos = (SHORT)(sVscrollMax * relativeScrollPos);
     925    vertScroll( hWndDoc, MPFROM2SHORT( realScrollPos, SB_SLIDERPOSITION ) );
    948926
    949927    positionTextField();
     
    20061984            docDraggingEnd.y = ypos;
    20071985
    2008             SHORT hMove = docDraggingEnd.x - docDraggingStart.x;
     1986            SHORT hMove = -( docDraggingEnd.x - docDraggingStart.x );
    20091987            if ( abs( hMove ) > 5 )
    20101988            {
Note: See TracChangeset for help on using the changeset viewer.