Changeset 34 for trunk/Lucide/SOURCE


Ignore:
Timestamp:
Jun 2, 2006, 4:20:22 PM (15 years ago)
Author:
Eugene Romanenko
Message:

implemented fullscreen mode

Location:
trunk/Lucide/SOURCE/gui
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/Lucide.rc

    r28 r34  
    6868    BEGIN
    6969        MENUITEM "MENU_SHOW_NAV_PANE", CM_NAVPANE
     70        MENUITEM "MENU_FULLSCREEN", CM_FULLSCREEN
    7071    END
    7172
     
    9192    "-", CM_PREVPAGE
    9293    "+", CM_NEXTPAGE
     94    VK_F11, CM_FULLSCREEN, VIRTUALKEY
    9395END
    9496
  • trunk/Lucide/SOURCE/gui/Lucide_res.H

    r30 r34  
    4545#define CM_ROTATE90CW   404
    4646#define CM_ROTATE90CCW  405
    47 #define CM_NAVPANE              406
    48 #define CM_SINGLEPAGE   407
    49 #define CM_CONTINUOUS   408
    50 #define CM_DOCINFO              409
    51 #define CM_FONTSINFO    410
     47#define CM_SINGLEPAGE   406
     48#define CM_CONTINUOUS   407
     49#define CM_DOCINFO              408
     50#define CM_FONTSINFO    409
     51
     52#define CM_NAVPANE              501
     53#define CM_FULLSCREEN   502
    5254
    5355#define CM_PRODINFO             601
  • trunk/Lucide/SOURCE/gui/indexWindow.cpp

    r2 r34  
    3131    pOldPanelProc = WinSubclassWindow( hWndPanel, panelProc );
    3232
    33     hWndBar = WinCreateWindow( hWndFrame, WC_STATIC, "index/thumbs switch will be here",
     33    // index/thumbs switch will be here
     34    hWndBar = WinCreateWindow( hWndFrame, WC_STATIC, NULL,
    3435                               WS_VISIBLE | SS_TEXT | DT_LEFT | DT_VCENTER,
    3536                               0, 0, 0, 0, hWndPanel, HWND_TOP, ID_BAR, NULL, NULL );
     
    4546    WinSendMsg( hWndPanel, SBM_SETWINDOWS,
    4647                MPFROMHWND( hWndIndex ), MPFROMHWND( hWndBar ) );
    47     WinSendMsg( hWndPanel, SBM_SETFIXEDSIZE, MPFROMSHORT( 30 ), MPVOID );
     48    WinSendMsg( hWndPanel, SBM_SETFIXEDSIZE, MPFROMSHORT( 0 ), MPVOID );
    4849}
    4950
  • trunk/Lucide/SOURCE/gui/lucide.cpp

    r30 r34  
    3737void AboutBox( HWND hWndFrame );
    3838
    39 HAB   hab;
    40 HWND  hWndFrame;
    41 HWND  hWndMenu;
    42 HWND  hToolBar;
    43 HWND  hVertSplitter;
     39HAB   hab            = NULLHANDLE;
     40HWND  hWndFrame      = NULLHANDLE;
     41HWND  hWndMenu       = NULLHANDLE;
     42HWND  hToolBar       = NULLHANDLE;
     43HWND  hVertSplitter  = NULLHANDLE;
     44HWND  hFrameSysmenu  = NULLHANDLE;
     45HWND  hFrameTitlebar = NULLHANDLE;
     46HWND  hFrameMinMax   = NULLHANDLE;
    4447
    4548Environment    *ev        = somGetGlobalEnvironment();
     
    5154char           *title     = NULL;
    5255
     56
    5357bool  Lucide::dontSwitchPage = false;
    5458SHORT Lucide::splitterPos    = 100;
    5559bool  Lucide::showIndex      = true;
     60bool  Lucide::isFullscreen   = false;
     61LuWindowPos Lucide::winPos   = {0};
     62
    5663
    5764PFNWP pOldSplProc;
     
    421428}
    422429
     430
     431void Lucide::toggleFullscreen()
     432{
     433    ULONG ulFrameStyle = WinQueryWindowULong( hWndFrame, QWL_STYLE );
     434
     435    if ( isFullscreen )
     436    {
     437        WinSetParent( hFrameSysmenu,  hWndFrame, FALSE );
     438        WinSetParent( hFrameTitlebar, hWndFrame, FALSE );
     439        WinSetParent( hFrameMinMax,   hWndFrame, FALSE );
     440        ulFrameStyle |= FS_SIZEBORDER;
     441    }
     442    else
     443    {
     444        WinQueryWindowPos( hWndFrame, &winPos.Swp );
     445        winPos.XRestore  = WinQueryWindowUShort( hWndFrame, QWS_XRESTORE );
     446        winPos.YRestore  = WinQueryWindowUShort( hWndFrame, QWS_YRESTORE );
     447        winPos.CXRestore = WinQueryWindowUShort( hWndFrame, QWS_CXRESTORE );
     448        winPos.CYRestore = WinQueryWindowUShort( hWndFrame, QWS_CYRESTORE );
     449        winPos.XMinimize = WinQueryWindowUShort( hWndFrame, QWS_XMINIMIZE );
     450        winPos.YMinimize = WinQueryWindowUShort( hWndFrame, QWS_YMINIMIZE );
     451
     452        WinSetParent( hFrameSysmenu,  HWND_OBJECT, FALSE );
     453        WinSetParent( hFrameTitlebar, HWND_OBJECT, FALSE );
     454        WinSetParent( hFrameMinMax,   HWND_OBJECT, FALSE );
     455        ulFrameStyle &= ~FS_SIZEBORDER;
     456    }
     457
     458    WinSetWindowULong( hWndFrame, QWL_STYLE, ulFrameStyle );
     459    WinSendMsg( hWndFrame, WM_UPDATEFRAME,
     460                MPFROMLONG( FCF_TITLEBAR | FCF_SIZEBORDER | FCF_SYSMENU | FCF_MINMAX ),
     461                MPVOID );
     462
     463    if ( isFullscreen )
     464    {
     465        WinSetWindowUShort( hWndFrame, QWS_XRESTORE,  winPos.XRestore );
     466        WinSetWindowUShort( hWndFrame, QWS_YRESTORE,  winPos.YRestore );
     467        WinSetWindowUShort( hWndFrame, QWS_CXRESTORE, winPos.CXRestore );
     468        WinSetWindowUShort( hWndFrame, QWS_CYRESTORE, winPos.CYRestore );
     469        WinSetWindowUShort( hWndFrame, QWS_XMINIMIZE, winPos.XMinimize );
     470        WinSetWindowUShort( hWndFrame, QWS_YMINIMIZE, winPos.YMinimize );
     471        ULONG swpopt = SWP_MOVE | SWP_SIZE | SWP_SHOW;
     472        WinSetWindowPos( hWndFrame, NULLHANDLE,
     473                         winPos.Swp.x, winPos.Swp.y, winPos.Swp.cx, winPos.Swp.cy,
     474                         swpopt );
     475    }
     476    else
     477    {
     478        WinSetWindowPos( hWndFrame, HWND_TOP, 0, 0,
     479                         WinQuerySysValue( HWND_DESKTOP, SV_CXFULLSCREEN ) - 1,
     480                         WinQuerySysValue( HWND_DESKTOP, SV_CYFULLSCREEN ) +
     481                            WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ),
     482                         SWP_SIZE | SWP_MOVE | SWP_ZORDER );
     483    }
     484
     485    isFullscreen = !isFullscreen;
     486}
     487
    423488static MRESULT EXPENTRY splProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
    424489{
    425 
    426490    switch ( msg )
    427491    {
     
    546610                    return (MRESULT)FALSE;
    547611
     612                case CM_FULLSCREEN:
     613                    Lucide::toggleFullscreen();
     614                    return (MRESULT)FALSE;
     615
    548616                case CM_PRODINFO:
    549617                    AboutBox( hWndFrame );
     
    587655    hWndFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulFrameFlags, NULL, title,
    588656                                    WS_SYNCPAINT|WS_VISIBLE, NULLHANDLE, 100, NULL );
     657    hFrameSysmenu  = WinWindowFromID( hWndFrame, FID_SYSMENU );
     658    hFrameTitlebar = WinWindowFromID( hWndFrame, FID_TITLEBAR );
     659    hFrameMinMax   = WinWindowFromID( hWndFrame, FID_MINMAX );
    589660    WinSetAccelTable( hab, WinLoadAccelTable( hab, NULLHANDLE, IDA_MAINACCEL ), hWndFrame );
    590661    hWndMenu = WinLoadMenu( hWndFrame, NULLHANDLE, IDM_MAINMENU );
  • trunk/Lucide/SOURCE/gui/lucide.h

    r30 r34  
    1313enum ViewMode { SinglePage, Continuous };
    1414
     15struct LuWindowPos
     16{
     17    SWP    Swp;
     18    USHORT XRestore;
     19    USHORT YRestore;
     20    USHORT CXRestore;
     21    USHORT CYRestore;
     22    USHORT XMinimize;
     23    USHORT YMinimize;
     24};
     25
    1526class Lucide
    1627{
     
    2132                static bool docLoaded;
    2233                static char *loadError;
     34                static bool isFullscreen;
     35                static LuWindowPos winPos;
    2336   
    2437        static void setOfPages( long pages );
     
    4356        static void enableCopy( bool enable );
    4457        static void setViewMode( ViewMode mode );
     58        static void toggleFullscreen();
    4559};
    4660
Note: See TracChangeset for help on using the changeset viewer.