Changeset 388 for trunk/Lucide


Ignore:
Timestamp:
Apr 14, 2010, 5:14:38 PM (11 years ago)
Author:
dmik
Message:

Reworked the switch to fullscreen code so that all accelerators that work in normal mode (like Ctrl-Ins, Ctrl-C, Ctrl-O etc) now work in fullscreen too. This also fixes various weird behavior such as the phantom Lucide main frame when pressing the Alt in fullscreen.

Location:
trunk/Lucide/gui
Files:
4 edited

Legend:

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

    r367 r388  
    190190                                       WS_VISIBLE, _hmod, 0, NULL );
    191191    WinSetWindowULong( hWndDocFrame, QWL_USER, (ULONG)this );
    192     oldFrameProc = WinSubclassWindow( hWndDocFrame, docFrameProc );
    193192
    194193    hWndDoc = WinCreateWindow( hWndDocFrame, "er.docview", NULL,
     
    26502649
    26512650
    2652 // static, window procedure
    2653 MRESULT EXPENTRY DocumentViewer::docFrameProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
    2654 {
    2655     DocumentViewer *_this = (DocumentViewer *)WinQueryWindowULong( hwnd, QWL_USER );
    2656 
    2657     switch ( msg )
    2658     {
    2659         case WM_SYSCOMMAND:
    2660             // Send WM_SYSCOMMAND messages to main frame
    2661             WinSendMsg( _this->hMainFrame, WM_SYSCOMMAND, mp1, mp2 );
    2662             return (MRESULT)FALSE;
    2663     }
    2664 
    2665     return _this->oldFrameProc( hwnd, msg, mp1, mp2 );
    2666 }
    2667 
  • trunk/Lucide/gui/docViewer.h

    r367 r388  
    169169        long textFieldPage;
    170170        long textFieldIndex;
    171         PFNWP oldFrameProc;
    172171        HWND hWndHscroll;
    173172        HWND hWndVscroll;
  • trunk/Lucide/gui/lucide.cpp

    r385 r388  
    9999HWND  hToolBar       = NULLHANDLE;
    100100HWND  hVertSplitter  = NULLHANDLE;
     101HWND  hHorizSplitter = NULLHANDLE;
    101102HWND  hFrameSysmenu  = NULLHANDLE;
    102103HWND  hFrameTitlebar = NULLHANDLE;
     
    717718
    718719
    719 void Lucide::toggleMaxview()
    720 {
     720void Lucide::toggleMaxviewFullscreen( bool maxview )
     721{
     722    enum TriState { NoChange, On, Off };
     723    TriState maxviewState = NoChange;
     724    TriState fullscreenState = NoChange;
     725
     726    if ( maxview )
     727    {
     728        // maxview command issued
     729        if ( !isMaxview )
     730        {
     731            if ( isFullscreen ) {
     732                fullscreenState = Off;
     733                isFullscreen = false;
     734            } else {
     735                maxviewState = On;
     736            }
     737            isMaxview = true;
     738        }
     739        else
     740        {
     741            if ( isFullscreen ) {
     742                fullscreenState = Off;
     743                isFullscreen = false;
     744            } else {
     745                maxviewState = Off;
     746                isMaxview = false;
     747            }
     748        }
     749    }
     750    else
     751    {
     752        // fullscreen command issued
     753        if ( !isFullscreen )
     754        {
     755            fullscreenState = On;
     756            if ( !isMaxview )
     757                maxviewState = On;
     758        }
     759        else
     760        {
     761            fullscreenState = Off;
     762            if ( !isMaxview )
     763                maxviewState = Off;
     764        }
     765
     766        isFullscreen = !isFullscreen;
     767    }
     768
    721769    ULONG ulFrameStyle = WinQueryWindowULong( hWndFrame, QWL_STYLE );
    722770
    723     if ( isMaxview )
     771    if ( fullscreenState == Off )
     772    {
     773        docViewer->setFullscreen( false );
     774        WinSetParent( hWndMenu, hWndFrame, TRUE );
     775    }
     776    else if ( fullscreenState == On )
     777    {
     778        docViewer->setFullscreen( true );
     779        WinSetParent( hWndMenu, HWND_OBJECT, FALSE );
     780    }
     781
     782    if ( maxviewState == Off )
    724783    {
    725784        WinSetParent( hFrameSysmenu,  hWndFrame, FALSE );
     
    728787        ulFrameStyle |= FS_SIZEBORDER;
    729788    }
    730     else
     789    else if ( maxviewState == On )
    731790    {
    732791        WinQueryWindowPos( hWndFrame, &winPos.Swp );
     
    744803    }
    745804
    746     WinSetWindowULong( hWndFrame, QWL_STYLE, ulFrameStyle );
    747     WinSendMsg( hWndFrame, WM_UPDATEFRAME,
    748                 MPFROMLONG( FCF_TITLEBAR | FCF_SIZEBORDER | FCF_SYSMENU | FCF_MINMAX ),
    749                 MPVOID );
    750 
    751     if ( isMaxview )
     805    if ( maxviewState != NoChange || fullscreenState != NoChange )
     806    {
     807        WinSetWindowULong( hWndFrame, QWL_STYLE, ulFrameStyle );
     808        WinSendMsg( hWndFrame, WM_UPDATEFRAME, MPVOID, MPVOID );
     809    }
     810
     811    if ( fullscreenState == Off )
     812    {
     813        WinSendMsg( hVertSplitter, SBM_SETSPLITTERSIZE, MPFROMSHORT( -1 ), MPVOID );
     814        WinSendMsg( hVertSplitter, SBM_SETSPLITTERPOS,
     815                    MPFROMSHORT( Lucide::showIndex ? Lucide::splitterPos : 0 ), MPVOID );
     816        WinSendMsg( hHorizSplitter, SBM_SETFIXEDSIZE,
     817            MPFROMSHORT( DEFAULT_PICTSIZE + TOOLBAR_HEIGHT_ADD ), MPVOID );
     818    }
     819    else if ( fullscreenState == On )
     820    {
     821        WinSendMsg( hHorizSplitter, SBM_SETSPLITTERPOS, 0, MPVOID );
     822        WinSendMsg( hVertSplitter, SBM_SETSPLITTERPOS, 0, MPVOID );
     823        WinSendMsg( hVertSplitter, SBM_SETSPLITTERSIZE, 0, MPVOID );
     824    }
     825
     826    if ( maxviewState == Off )
    752827    {
    753828        WinSetWindowUShort( hWndFrame, QWS_XRESTORE,  winPos.XRestore );
     
    757832        WinSetWindowUShort( hWndFrame, QWS_XMINIMIZE, winPos.XMinimize );
    758833        WinSetWindowUShort( hWndFrame, QWS_YMINIMIZE, winPos.YMinimize );
    759         ULONG swpopt = SWP_MOVE | SWP_SIZE | SWP_SHOW;
    760834        WinSetWindowPos( hWndFrame, NULLHANDLE,
    761835                         winPos.Swp.x, winPos.Swp.y, winPos.Swp.cx, winPos.Swp.cy,
    762                          swpopt );
    763     }
    764     else
     836                         SWP_MOVE | SWP_SIZE | SWP_SHOW );
     837    }
     838    else if ( maxviewState == On )
    765839    {
    766840        WinSetWindowPos( hWndFrame, HWND_TOP, 0, 0,
     
    769843                         SWP_SIZE | SWP_MOVE | SWP_ZORDER );
    770844    }
    771 
    772     isMaxview = !isMaxview;
    773 }
    774 
    775 
    776 void Lucide::toggleFullscreen()
    777 {
    778     if ( isFullscreen )
    779     {
    780         docViewer->setFullscreen( false );
    781         WinSetParent( docViewer->getFrameHWND(), hWndFrame, TRUE );
    782         WinSendMsg( hVertSplitter, SBM_SETWINDOWS,
    783                     MPFROMHWND( indexWin->getHWND() ),
    784                     MPFROMHWND( docViewer->getFrameHWND() ) );
    785     }
    786     else
    787     {
    788         docViewer->setFullscreen( true );
    789         WinSendMsg( hVertSplitter, SBM_SETWINDOWS,
    790                     MPFROMHWND( indexWin->getHWND() ),
    791                     MPFROMHWND( NULLHANDLE ) );
    792         WinSetParent( docViewer->getFrameHWND(), HWND_DESKTOP, FALSE );
    793         WinSetWindowPos( docViewer->getFrameHWND(), HWND_TOP, 0, 0,
    794                          WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ),
    795                          WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ),
    796                          SWP_SIZE | SWP_MOVE | SWP_ZORDER );
    797     }
    798 
    799     isFullscreen = !isFullscreen;
    800 }
     845}
     846
    801847
    802848void Lucide::focusDocview()
     
    12751321    // Horizontal splitter and its windows - Toolbar and Vertical splitter
    12761322    // Horizontal splitter is client window
    1277     HWND hHorizSplitter = WinCreateWindow( hWndFrame, WC_ER_SPLITTER, "",
    1278                                            WS_VISIBLE | SBS_HSPLIT | SBS_SECONDFIXED,
    1279                                            0, 0, 0, 0, hWndFrame, HWND_TOP,
    1280                                            FID_CLIENT, NULL, NULL );
     1323    hHorizSplitter = WinCreateWindow( hWndFrame, WC_ER_SPLITTER, "",
     1324                                      WS_VISIBLE | SBS_HSPLIT | SBS_SECONDFIXED,
     1325                                      0, 0, 0, 0, hWndFrame, HWND_TOP,
     1326                                      FID_CLIENT, NULL, NULL );
    12811327    pOldSplProc = WinSubclassWindow( hHorizSplitter, splProc );
    12821328
  • trunk/Lucide/gui/lucide.h

    r367 r388  
    111111        static void enableCopy( bool enable );
    112112        static void setPageLayout( PgLayout layout );
    113         static void toggleMaxview();
    114         static void toggleFullscreen();
     113        static void toggleMaxview() { toggleMaxviewFullscreen( true ); }
     114        static void toggleFullscreen() { toggleMaxviewFullscreen( false ); }
     115        static void toggleMaxviewFullscreen( bool maxview );
    115116        static void focusDocview();
    116117        static void focusIndex();
Note: See TracChangeset for help on using the changeset viewer.