Ignore:
Timestamp:
Apr 16, 2010, 8:57:27 PM (12 years ago)
Author:
dmik
Message:

Renamed "Full screen" mode to "Presentation" mode (activated by F5 now) and renamed "Maximized view" mode to "Full screen" mode (same F11 shortcut), for clarity and similarity with other applications (fixes ticket:176).

File:
1 edited

Legend:

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

    r397 r399  
    8686const char *prfSplpos  = "SplitterPos";
    8787const char *prfShowind = "ShowIndex";
    88 const char *prfMaxView = "MaxView";
    89 const char *prfFs      = "FullScreen";
     88const char *prfFullscreen   = "FullScreen";
     89const char *prfPresentation = "Presentation";
    9090
    9191HWND createToolbar( HWND hwnd );
     
    120120SHORT        Lucide::splitterPos                   = 100;
    121121bool         Lucide::showIndex                     = true;
    122 bool         Lucide::isMaxview                     = false;
    123122bool         Lucide::isFullscreen                  = false;
     123bool         Lucide::isPresentation                = false;
    124124LuWindowPos  Lucide::winPos                        = {0};
    125125char         Lucide::docFullName[ CCHMAXPATH ]     = "";
     
    743743
    744744
    745 void Lucide::toggleMaxviewFullscreen( bool maxview, bool atStartup )
     745void Lucide::toggleFullscreenEx( bool presentation, bool atStartup )
    746746{
    747747    enum TriState { NoChange, On, Off };
    748     TriState maxviewState = NoChange;
    749748    TriState fullscreenState = NoChange;
    750 
    751     if ( maxview )
    752     {
    753         // maxview command issued
    754         if ( !isMaxview )
    755         {
    756             if ( isFullscreen ) {
    757                 fullscreenState = Off;
    758                 isFullscreen = false;
    759             } else {
    760                 maxviewState = On;
    761             }
    762             isMaxview = true;
    763         }
    764         else
    765         {
    766             if ( isFullscreen ) {
    767                 fullscreenState = Off;
    768                 isFullscreen = false;
    769             } else {
    770                 maxviewState = Off;
    771                 isMaxview = false;
    772             }
    773         }
    774     }
    775     else
     749    TriState presentationState = NoChange;
     750
     751    if ( !presentation )
    776752    {
    777753        // fullscreen command issued
    778754        if ( !isFullscreen )
    779755        {
    780             fullscreenState = On;
    781             if ( !isMaxview )
    782                 maxviewState = On;
     756            if ( isPresentation ) {
     757                presentationState = Off;
     758                isPresentation = false;
     759            } else {
     760                fullscreenState = On;
     761            }
     762            isFullscreen = true;
    783763        }
    784764        else
    785765        {
    786             fullscreenState = Off;
    787             if ( !isMaxview )
    788                 maxviewState = Off;
    789         }
    790 
    791         isFullscreen = !isFullscreen;
     766            if ( isPresentation ) {
     767                presentationState = Off;
     768                isPresentation = false;
     769            } else {
     770                fullscreenState = Off;
     771                isFullscreen = false;
     772            }
     773        }
     774    }
     775    else
     776    {
     777        // presentation command issued
     778        if ( !isPresentation )
     779        {
     780            presentationState = On;
     781            if ( !isFullscreen )
     782                fullscreenState = On;
     783        }
     784        else
     785        {
     786            presentationState = Off;
     787            if ( !isFullscreen )
     788                fullscreenState = Off;
     789        }
     790
     791        isPresentation = !isPresentation;
    792792    }
    793793
    794794    ULONG ulFrameStyle = WinQueryWindowULong( hWndFrame, QWL_STYLE );
    795795
     796    if ( presentationState == Off )
     797    {
     798        docViewer->setPresentation( false );
     799        WinSetParent( hWndMenu, hWndFrame, FALSE );
     800    }
     801    else if ( presentationState == On )
     802    {
     803        docViewer->setPresentation( true );
     804        WinSetParent( hWndMenu, HWND_OBJECT, FALSE );
     805    }
     806
    796807    if ( fullscreenState == Off )
    797     {
    798         docViewer->setFullscreen( false );
    799         WinSetParent( hWndMenu, hWndFrame, FALSE );
    800     }
    801     else if ( fullscreenState == On )
    802     {
    803         docViewer->setFullscreen( true );
    804         WinSetParent( hWndMenu, HWND_OBJECT, FALSE );
    805     }
    806 
    807     if ( maxviewState == Off )
    808808    {
    809809        WinSetParent( hFrameSysmenu,  hWndFrame, FALSE );
     
    812812        ulFrameStyle |= FS_SIZEBORDER;
    813813    }
    814     else if ( maxviewState == On )
     814    else if ( fullscreenState == On )
    815815    {
    816816        if ( !atStartup )
     
    831831    }
    832832
    833     if ( maxviewState != NoChange || fullscreenState != NoChange )
     833    if ( fullscreenState != NoChange || presentationState != NoChange )
    834834    {
    835835        WinSetWindowULong( hWndFrame, QWL_STYLE, ulFrameStyle );
     
    837837    }
    838838
    839     if ( fullscreenState == Off )
     839    if ( presentationState == Off )
    840840    {
    841841        WinSendMsg( hVertSplitter, SBM_SETSPLITTERSIZE, MPFROMSHORT( -1 ), MPVOID );
     
    845845            MPFROMSHORT( DEFAULT_PICTSIZE + TOOLBAR_HEIGHT_ADD ), MPVOID );
    846846    }
    847     else if ( fullscreenState == On )
     847    else if ( presentationState == On )
    848848    {
    849849        WinSendMsg( hHorizSplitter, SBM_SETSPLITTERPOS, 0, MPVOID );
     
    852852    }
    853853
    854     if ( maxviewState == Off )
     854    if ( fullscreenState == Off )
    855855    {
    856856        WinSetWindowUShort( hWndFrame, QWS_XRESTORE,  winPos.XRestore );
     
    864864                         SWP_SIZE | SWP_MOVE | SWP_SHOW );
    865865    }
    866     else if ( maxviewState == On )
     866    else if ( fullscreenState == On )
    867867    {
    868868        WinSetWindowPos( hWndFrame, NULLHANDLE, 0, 0,
     
    911911}
    912912
    913 void Lucide::cmdSwitchToFullscreen()
    914 {
    915     if ( !isFullscreen )
     913void Lucide::cmdSwitchToPresentation()
     914{
     915    if ( !isPresentation )
    916916    {
    917917        SWP pos = {0};
     
    922922                    SWP_SHOW | SWP_ACTIVATE | SWP_RESTORE | SWP_ZORDER );
    923923        }
    924         toggleFullscreen();
     924        togglePresentation();
    925925    }
    926926}
     
    10331033                           itoa( Lucide::showIndex, valbuf, 10 ) );
    10341034
    1035     if ( isMaxview )
    1036         PrfWriteProfileString( HINI_USERPROFILE, appName, prfMaxView, "1" );
     1035    if ( isFullscreen )
     1036        PrfWriteProfileString( HINI_USERPROFILE, appName, prfFullscreen, "1" );
    10371037    else
    1038         PrfWriteProfileString( HINI_USERPROFILE, appName, prfMaxView, NULL );
    1039 
    1040     if ( isFullscreen )
    1041         PrfWriteProfileString( HINI_USERPROFILE, appName, prfFs, "1" );
     1038        PrfWriteProfileString( HINI_USERPROFILE, appName, prfFullscreen, NULL );
     1039
     1040    if ( isPresentation )
     1041        PrfWriteProfileString( HINI_USERPROFILE, appName, prfPresentation, "1" );
    10421042    else
    1043         PrfWriteProfileString( HINI_USERPROFILE, appName, prfFs, NULL );
    1044 
    1045     if ( !isMaxview && !isFullscreen ) {
     1043        PrfWriteProfileString( HINI_USERPROFILE, appName, prfPresentation, NULL );
     1044
     1045    if ( !isFullscreen && !isPresentation ) {
    10461046        WinQueryWindowPos( hWndFrame, &winPos.Swp );
    10471047        winPos.XRestore  = WinQueryWindowUShort( hWndFrame, QWS_XRESTORE );
     
    10661066                MPFROMSHORT( showIndex ? splitterPos : 0 ), MPVOID );
    10671067
    1068     bool maxview = PrfQueryProfileInt( HINI_USERPROFILE, appName, prfMaxView, 0 ) == 1;
    1069     bool fullscreen = PrfQueryProfileInt( HINI_USERPROFILE, appName, prfFs, 0 ) == 1;
     1068    bool fullscreen = PrfQueryProfileInt( HINI_USERPROFILE, appName,
     1069                                          prfFullscreen, 0 ) == 1;
     1070    bool presentation = PrfQueryProfileInt( HINI_USERPROFILE, appName,
     1071                                            prfPresentation, 0 ) == 1;
    10701072
    10711073    LONG sx, sy;
     
    11011103        // is present (PM bug?). Therefore, when the saved normal size the same
    11021104        // as fullscreen and we should go fullscreen at startup, WinSetWindowPos()
    1103         // issued from toggleMaxviewFullscreen() will not resize FID_CLIENT even
     1105        // issued from toggleFullscreenEx() will not resize FID_CLIENT even
    11041106        // though it will contain SWP_SHOW
    11051107
    1106         if ( !maxview && !fullscreen ) {
     1108        if ( !fullscreen && !presentation ) {
    11071109            // only set the normal size if no if fullscreen or presentation is
    11081110            // requested, to avoid flicker. We could also avoid flicker by
     
    11681170
    11691171        // we don't initialize winPos here so reset atStartup to let
    1170         // toggleMaxviewFullscreen() do this
     1172        // toggleFullscreenEx() do this
    11711173        atStartup = false;
    11721174    }
     
    11741176    if ( fullscreen )
    11751177    {
    1176         toggleMaxviewFullscreen( false, atStartup );
    1177         isMaxview = maxview;
    1178     }
    1179     else if ( maxview )
    1180     {
    1181         toggleMaxviewFullscreen( true, atStartup );
     1178        toggleFullscreenEx( false, atStartup );
     1179        isFullscreen = fullscreen;
     1180    }
     1181    else if ( presentation )
     1182    {
     1183        toggleFullscreenEx( true, atStartup );
    11821184    }
    11831185}
     
    12011203                }
    12021204            }
    1203             // in fullscreen, we hide the menu which effectively makes all
    1204             // disabled items work through accelerators which is completely
     1205            // in presentation mode, we hide the menu which effectively makes
     1206            // all disabled items work through accelerators which is completely
    12051207            // unexpected. Fix it by translating accels manually and checking
    12061208            // if they are disabled in the hidden menu
     
    14691471                    return (MRESULT)FALSE;
    14701472
    1471                 case CM_MAXVIEW:
    1472                     Lucide::toggleMaxview();
    1473                     return (MRESULT)FALSE;
    1474 
    14751473                case CM_FULLSCREEN:
    14761474                    Lucide::toggleFullscreen();
    14771475                    return (MRESULT)FALSE;
    14781476
     1477                case CM_PRESENTATION:
     1478                    Lucide::togglePresentation();
     1479                    return (MRESULT)FALSE;
     1480
    14791481                case CM_PRODINFO:
    14801482                    AboutBox( hWndFrame );
     
    14851487                    return (MRESULT)FALSE;
    14861488
    1487                 case CM_TOFULLSCREEN:
    1488                     Lucide::cmdSwitchToFullscreen();
     1489                case CM_TOPRESENTATION:
     1490                    Lucide::cmdSwitchToPresentation();
    14891491                    return (MRESULT)FALSE;
    14901492
Note: See TracChangeset for help on using the changeset viewer.