Changeset 50


Ignore:
Timestamp:
Jun 11, 2006, 4:12:09 PM (16 years ago)
Author:
Eugene Romanenko
Message:

added settings dialog, asynch opening, fixed many crashes and bugs

Location:
trunk
Files:
4 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/BIN/Lucide.lng

    r48 r50  
    2121MENU_FIND=Find...\tCtrl+F
    2222MENU_FINDAGAIN=Find again\tCtrl+G
     23MENU_SETTINGS=Settings
    2324MENU_DOCUMENT=~Document
    2425MENU_FIRST_PAGE=First page
     
    6465MSGS_NO_SUIT_PLUG=Can't find suitable plugin for specified document!
    6566MSGS_FILE_LOAD_ERROR=File load error!
     67MSGS_LOADING_DOCUMENT=Loading document, please wait...
    6668
    6769#
     
    126128AD_COPYRIGHTS=(c) by Eugene Romanenko, netlabs.org in co-operation with Serenity Systems International
    127129AD_OK=OK
     130
     131#
     132# Settings dialog
     133#
     134SD_SETTINGS=Settings
     135SD_DEFAULT_PAGE_LAYOUT=Default Page Layout:
     136SD_DEFAULT_ZOOM=Default Zoom:
     137SD_OK=~OK
     138SD_CANCEL=~Cancel
  • trunk/Lucide/SOURCE/gui/Lucide.rc

    r44 r50  
    4040        MENUITEM "MENU_FIND", CM_FIND
    4141        MENUITEM "MENU_FINDAGAIN", CM_FINDAGAIN
     42        MENUITEM SEPARATOR
     43        MENUITEM "MENU_SETTINGS", CM_SETTINGS
    4244    END
    4345
  • trunk/Lucide/SOURCE/gui/Lucide_res.H

    r35 r50  
    6767#define CM_FIND                 203
    6868#define CM_FINDAGAIN    204
     69#define CM_SETTINGS             205
    6970
    7071#define CM_FIRSTPAGE    301
     
    116117#define IDC_NETLABSURL          12
    117118
     119#define IDD_SETTINGS            1006
     120#define IDC_DEFPGLAYOUT         10
     121#define IDC_DEFZOOM                     11
     122
    118123#endif // __LUCIDE_RES_H
  • trunk/Lucide/SOURCE/gui/dialogs.rc

    r31 r50  
    9191
    9292END
     93
     94DLGTEMPLATE IDD_SETTINGS
     95BEGIN
     96        DIALOG "SD_SETTINGS", -1, 60, 94, 207, 71, WS_VISIBLE, FCF_SYSMENU | FCF_TITLEBAR
     97        BEGIN
     98                CONTROL "", -1, 2, 24, 203, 45, WC_STATIC, SS_GROUPBOX | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     99                CONTROL "SD_DEFAULT_PAGE_LAYOUT", -1, 9, 48, 76, 14, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     100                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     101                CONTROL "", IDC_DEFPGLAYOUT, 88, 20, 111, 40, WC_COMBOBOX, CBS_DROPDOWNLIST | ES_ANY | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     102                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     103                CONTROL "SD_DEFAULT_ZOOM", -1, 9, 28, 77, 14, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     104                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     105                CONTROL "", IDC_DEFZOOM, 88, -3, 111, 43, WC_COMBOBOX, CBS_DROPDOWNLIST | ES_ANY | WS_VISIBLE | WS_GROUP | WS_TABSTOP
     106                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     107                DEFPUSHBUTTON "SD_OK", DID_OK, 91, 4, 51, 14
     108                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     109                PUSHBUTTON "SD_CANCEL", DID_CANCEL, 152, 4, 51, 14
     110                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
     111        END
     112END
     113
  • trunk/Lucide/SOURCE/gui/docViewer.cpp

    r40 r50  
    5858}
    5959
     60ULONG APIENTRY GPFHandler( PEXCEPTIONREPORTRECORD pxcptrec,
     61                           PEXCEPTIONREGISTRATIONRECORD prr,
     62                           PCONTEXTRECORD pcr, PVOID pv );
     63
     64
    6065typedef LuDocument_LuRectSequence    *PLuRectSequence;
    6166typedef LuDocument_LuLinkMapSequence *PLuLinkMapSequence;
     
    96101    drawareas   = NULL;
    97102    drawareaIndex = 0;
     103    closed        = true;
    98104    // continuous view
    99105    continuous  = false;
     
    181187    if ( doc != NULL )
    182188    {
     189        closed = false;
     190
    183191        totalpages = doc->getPageCount( ev );
    184192        bpp = doc->getBpp( ev );
     193        if ( !doc->isScalable( ev ) ) {
     194            zoom = 1;
     195        }
    185196
    186197        pagesizes = new LuSize[ totalpages ];
     
    205216        enableAsynchDraw = doc->isAsynchRenderingSupported( ev );
    206217        goToPage( 0 );
     218
     219        if ( continuous ) {
     220            drawPage();
     221        }
    207222    }
    208223}
     
    212227void DocumentViewer::close()
    213228{
     229    if ( closed ) {
     230        return;
     231    }
     232
     233    closed = true;
    214234    abortAsynch = true;
    215235    DosRequestMutexSem( todrawAccess, SEM_INDEFINITE_WAIT );
     
    236256    doc         = NULL;
    237257    totalpages  = 0;
    238     zoom        = 1;
    239258    currentpage = 0;
    240259    fullwidth   = 0;
     
    244263}
    245264
    246 // sets the view mode
    247 void DocumentViewer::setViewMode( ViewMode mode )
    248 {
    249     continuous = ( mode == Continuous );
     265// sets the page layout
     266void DocumentViewer::setPageLayout( PgLayout layout )
     267{
     268    continuous = ( layout == Continuous );
    250269    if ( doc != NULL ) {
    251270        long pg = currentpage;
     
    294313        double pgpos = pagenumToPos( page ) / VScrollStep;
    295314        vertScroll( hWndDoc, MPFROM2SHORT( pgpos, SB_SLIDERPOSITION ), NULLHANDLE );
    296         //drawPage();
    297315    }
    298316    else
     
    755773        }
    756774    }
    757 
    758775    WinDestroyMsgQueue( thmq );
    759776    WinTerminate( thab );
     
    767784    RECTL rcl;
    768785    HPS hps = WinBeginPaint( hwnd, 0L, &rcl );
    769     if ( hps != NULLHANDLE )
    770     {
    771         RECTL rclWin = { 0 };
    772         WinQueryWindowRect( hwnd, &rclWin );
    773         if ( WinEqualRect( hab, &rcl, &rclWin ) ) {
    774             GpiErase( hps );
    775         }
    776         WinEndPaint( hps );
    777     }
    778 
    779     RECTL rclPage = { 0, 0, width, height };
    780     if ( height < cyClient )
    781     {
    782         rclPage.yBottom = cyClient - height;
    783         rclPage.yTop = cyClient;
    784     }
    785     RECTL rclDraw = { 0 };
    786     if ( WinIntersectRect( hab, &rclDraw, &rcl, &rclPage ) )
    787     {
    788         if ( ( drawareas != NULL ) && ( drawareas->size() > 0 ) ) {
    789             if ( isSubrect( &((*drawareas)[0].drawrect), &rclDraw ) &&
    790                  ( sVscrollInc == 0 ) && ( sHscrollInc == 0 ) ) {
    791                 return;
    792             }
     786    RECTL rclWin = { 0 };
     787    WinQueryWindowRect( hwnd, &rclWin );
     788    if ( WinEqualRect( hab, &rcl, &rclWin ) ) {
     789        GpiErase( hps );
     790    }
     791    WinEndPaint( hps );
     792
     793    if ( doc != NULL )
     794    {
     795        RECTL rclPage = { 0, 0, width, height };
     796        if ( height < cyClient )
     797        {
     798            rclPage.yBottom = cyClient - height;
     799            rclPage.yTop = cyClient;
     800        }
     801        RECTL rclDraw = { 0 };
     802        if ( WinIntersectRect( hab, &rclDraw, &rcl, &rclPage ) )
     803        {
     804            if ( ( drawareas != NULL ) && ( drawareas->size() > 0 ) ) {
     805                if ( isSubrect( &((*drawareas)[0].drawrect), &rclDraw ) &&
     806                     ( sVscrollInc == 0 ) && ( sHscrollInc == 0 ) ) {
     807                    return;
     808                }
     809            }
     810
     811            abortAsynch = true;
     812            DosRequestMutexSem( todrawAccess, SEM_INDEFINITE_WAIT );
     813
     814            if ( drawareas == NULL ) {
     815                drawareas = new DrawAreas;
     816            }
     817            if ( drawareas->size() == 0 ) {
     818                PageDrawArea pda;
     819                memset( &pda, 0, sizeof( pda ) );
     820                pda.pagenum = currentpage;
     821                drawareas->push_back( pda );
     822            }
     823
     824            PageDrawArea *ppda = &((*drawareas)[0]);
     825
     826            if ( !WinIsRectEmpty( hab, &ppda->drawrect ) )
     827            {
     828                if ( sVscrollInc > 0 ) {
     829                    ppda->drawrect.yTop    += sVscrollInc;
     830                } else if ( sVscrollInc < 0 ) {
     831                    ppda->drawrect.yBottom += sVscrollInc;
     832                }
     833                if ( sHscrollInc > 0 ) {
     834                    ppda->drawrect.xLeft  -= sHscrollInc;
     835                } else if ( sHscrollInc < 0 ) {
     836                    ppda->drawrect.xRight -= sHscrollInc;
     837                }
     838            }
     839            WinUnionRect( hab, &ppda->drawrect, &ppda->drawrect, &rclDraw );
     840            ppda->startpos.x = sHscrollPos + ppda->drawrect.xLeft;
     841            ppda->startpos.y = ( cyClient - ppda->drawrect.yTop ) + sVscrollPos;
     842
     843            // workaround ?
     844            ppda->drawrect.xRight++;
     845            ppda->drawrect.yTop++;
     846
     847            DosReleaseMutexSem( todrawAccess );
     848            DosPostEventSem( haveDraw );
     849        }
     850    }
     851}
     852
     853
     854// handles WM_PAINT if continuous asynchronous rendering used
     855void DocumentViewer::wmPaintContAsynch( HWND hwnd )
     856{
     857    RECTL rcl, rclWin, rclDraw = { 0 };
     858    HPS hps = WinBeginPaint( hwnd, 0L, &rcl );
     859    GpiErase( hpsBuffer );
     860    BlitGraphicsBuffer( hps, hpsBuffer, &rcl );
     861    WinEndPaint( hps );
     862
     863    if ( doc != NULL )
     864    {
     865        if ( isSubrect( &savedRcl, &rcl ) && ( sVscrollInc == 0 ) && ( sHscrollInc == 0 ) ) {
     866            return;
    793867        }
    794868
     
    796870        DosRequestMutexSem( todrawAccess, SEM_INDEFINITE_WAIT );
    797871
    798         if ( drawareas == NULL ) {
    799             drawareas = new DrawAreas;
    800         }
    801         if ( drawareas->size() == 0 ) {
    802             PageDrawArea pda;
    803             memset( &pda, 0, sizeof( pda ) );
    804             pda.pagenum = currentpage;
    805             drawareas->push_back( pda );
    806         }
    807 
    808         PageDrawArea *ppda = &((*drawareas)[0]);
    809 
    810         if ( !WinIsRectEmpty( hab, &ppda->drawrect ) )
    811         {
    812             if ( sVscrollInc > 0 ) {
    813                 ppda->drawrect.yTop    += sVscrollInc;
    814             } else if ( sVscrollInc < 0 ) {
    815                 ppda->drawrect.yBottom += sVscrollInc;
    816             }
    817             if ( sHscrollInc > 0 ) {
    818                 ppda->drawrect.xLeft  -= sHscrollInc;
    819             } else if ( sHscrollInc < 0 ) {
    820                 ppda->drawrect.xRight -= sHscrollInc;
    821             }
    822         }
    823         WinUnionRect( hab, &ppda->drawrect, &ppda->drawrect, &rclDraw );
    824         ppda->startpos.x = sHscrollPos + ppda->drawrect.xLeft;
    825         ppda->startpos.y = ( cyClient - ppda->drawrect.yTop ) + sVscrollPos;
    826 
    827         // workaround ?
    828         ppda->drawrect.xRight++;
    829         ppda->drawrect.yTop++;
    830 
     872        WinQueryWindowRect( hwnd, &rclWin );
     873        WinUnionRect( hab, &rcl, &rcl, &savedRcl );
     874
     875        if ( sVscrollInc > 0 ) {
     876            rcl.yTop    += sVscrollInc;
     877        } else if ( sVscrollInc < 0 ) {
     878            rcl.yBottom += sVscrollInc;
     879        }
     880        if ( sHscrollInc > 0 ) {
     881            rcl.xLeft  -= sHscrollInc;
     882        } else if ( sHscrollInc < 0 ) {
     883            rcl.xRight -= sHscrollInc;
     884        }
     885
     886        WinIntersectRect( hab, &rclDraw, &rcl, &rclWin );
     887        WinCopyRect( hab, &rcl, &rclDraw );
     888        WinCopyRect( hab, &savedRcl, &rcl );
     889
     890        delete drawareas;
     891        drawareas = findDrawAreas( &rcl );
     892
     893        for ( int i = 0; i < drawareas->size(); i++ )
     894        {
     895            PageDrawArea *pda = &(*drawareas)[ i ];
     896
     897            // load links for page if not loaded before
     898            if ( links[ pda->pagenum ] == NULL ) {
     899                links[ pda->pagenum ] = doc->getLinkMapping( ev, pda->pagenum );
     900            }
     901        }
    831902        DosReleaseMutexSem( todrawAccess );
    832903        DosPostEventSem( haveDraw );
    833     }
    834 }
    835 
    836 
    837 // handles WM_PAINT if continuous asynchronous rendering used
    838 void DocumentViewer::wmPaintContAsynch( HWND hwnd )
    839 {
    840     RECTL rcl, rclWin, rclDraw = { 0 };
    841     HPS hps = WinBeginPaint( hwnd, 0L, &rcl );
    842     if ( hps != NULLHANDLE ) {
    843         GpiErase( hpsBuffer );
    844         BlitGraphicsBuffer( hps, hpsBuffer, &rcl );
    845         WinEndPaint( hps );
    846     }
    847 
    848     if ( isSubrect( &savedRcl, &rcl ) && ( sVscrollInc == 0 ) && ( sHscrollInc == 0 ) ) {
    849         return;
    850     }
    851 
    852     abortAsynch = true;
    853     DosRequestMutexSem( todrawAccess, SEM_INDEFINITE_WAIT );
    854 
    855     WinQueryWindowRect( hwnd, &rclWin );
    856     WinUnionRect( hab, &rcl, &rcl, &savedRcl );
    857 
    858     if ( sVscrollInc > 0 ) {
    859         rcl.yTop    += sVscrollInc;
    860     } else if ( sVscrollInc < 0 ) {
    861         rcl.yBottom += sVscrollInc;
    862     }
    863     if ( sHscrollInc > 0 ) {
    864         rcl.xLeft  -= sHscrollInc;
    865     } else if ( sHscrollInc < 0 ) {
    866         rcl.xRight -= sHscrollInc;
    867     }
    868 
    869     WinIntersectRect( hab, &rclDraw, &rcl, &rclWin );
    870     WinCopyRect( hab, &rcl, &rclDraw );
    871     WinCopyRect( hab, &savedRcl, &rcl );
    872 
    873     delete drawareas;
    874     drawareas = findDrawAreas( &rcl );
    875 
    876     for ( int i = 0; i < drawareas->size(); i++ )
    877     {
    878         PageDrawArea *pda = &(*drawareas)[ i ];
    879 
    880         // load links for page if not loaded before
    881         if ( links[ pda->pagenum ] == NULL ) {
    882             links[ pda->pagenum ] = doc->getLinkMapping( ev, pda->pagenum );
    883         }
    884     }
    885     DosReleaseMutexSem( todrawAccess );
    886     DosPostEventSem( haveDraw );
    887 
    888     determineCurrentPage();
     904
     905        determineCurrentPage();
     906    }
    889907}
    890908
     
    897915    GpiErase( hpsBuffer );
    898916
    899     RECTL rclPage = { 0, 0, width, height };
    900     if ( height < cyClient )
    901     {
    902         rclPage.yBottom = cyClient - height;
    903         rclPage.yTop = cyClient;
    904     }
    905     RECTL rclDraw = { 0 };
    906     if ( WinIntersectRect( hab, &rclDraw, &rcl, &rclPage ) )
    907     {
    908         spos_x = sHscrollPos + rclDraw.xLeft;
    909         spos_y = (cyClient - rclDraw.yTop) + sVscrollPos;
    910         LONG rclx = rclDraw.xRight - rclDraw.xLeft;
    911         LONG rcly = rclDraw.yTop - rclDraw.yBottom;
    912 
    913         pixbuf = new LuPixbuf( ev, rclx, rcly, bpp );
    914         POINTL aptlPoints[4]={ rclDraw.xLeft, rclDraw.yBottom,
    915                                rclDraw.xRight-1, rclDraw.yTop-1,
    916                                0, 0, rclx, rcly };
    917 
    918         doc->renderPageToPixbuf( ev, currentpage, spos_x, spos_y,
    919                                  rclx, rcly, realzoom, 0, pixbuf );
    920         LONG lRop = ROP_SRCCOPY;
    921         BITMAPINFO2 pbmi;
    922         pbmi.cbFix = 16L;
    923         pbmi.cx = rclx;
    924         pbmi.cy = rcly;
    925         pbmi.cPlanes = 1;
    926         pbmi.cBitCount = bpp * 8;
    927         GpiDrawBits( hpsBuffer, pixbuf->getDataPtr( ev ), &pbmi, 4L,
    928                      aptlPoints, lRop, BBO_IGNORE );
    929 
    930         drawSelection( currentpage, hpsBuffer, &rclDraw );
    931         drawFound( currentpage, hpsBuffer, &rclDraw );
    932 
     917    if ( doc != NULL )
     918    {
     919        RECTL rclPage = { 0, 0, width, height };
     920        if ( height < cyClient )
     921        {
     922            rclPage.yBottom = cyClient - height;
     923            rclPage.yTop = cyClient;
     924        }
     925        RECTL rclDraw = { 0 };
     926        if ( WinIntersectRect( hab, &rclDraw, &rcl, &rclPage ) )
     927        {
     928            spos_x = sHscrollPos + rclDraw.xLeft;
     929            spos_y = (cyClient - rclDraw.yTop) + sVscrollPos;
     930            LONG rclx = rclDraw.xRight - rclDraw.xLeft;
     931            LONG rcly = rclDraw.yTop - rclDraw.yBottom;
     932
     933            pixbuf = new LuPixbuf( ev, rclx, rcly, bpp );
     934            POINTL aptlPoints[4]={ rclDraw.xLeft, rclDraw.yBottom,
     935                                   rclDraw.xRight-1, rclDraw.yTop-1,
     936                                   0, 0, rclx, rcly };
     937
     938            doc->renderPageToPixbuf( ev, currentpage, spos_x, spos_y,
     939                                     rclx, rcly, realzoom, 0, pixbuf );
     940            LONG lRop = ROP_SRCCOPY;
     941            BITMAPINFO2 pbmi;
     942            pbmi.cbFix = 16L;
     943            pbmi.cx = rclx;
     944            pbmi.cy = rcly;
     945            pbmi.cPlanes = 1;
     946            pbmi.cBitCount = bpp * 8;
     947            GpiDrawBits( hpsBuffer, pixbuf->getDataPtr( ev ), &pbmi, 4L,
     948                         aptlPoints, lRop, BBO_IGNORE );
     949
     950            drawSelection( currentpage, hpsBuffer, &rclDraw );
     951            drawFound( currentpage, hpsBuffer, &rclDraw );
     952
     953            BlitGraphicsBuffer( hps, hpsBuffer, &rcl );
     954            delete pixbuf;
     955            pixbuf = NULL;
     956        }
     957    }
     958    else {
    933959        BlitGraphicsBuffer( hps, hpsBuffer, &rcl );
    934         delete pixbuf;
    935         pixbuf = NULL;
    936     }
    937 
     960    }
    938961    WinEndPaint( hps );
    939962}
     
    10381061    GpiErase( hpsBuffer );
    10391062
    1040     delete drawareas;
    1041     drawareas = findDrawAreas( &rcl );
    1042 
    1043     for ( int i = 0; i < drawareas->size(); i++ )
    1044     {
    1045         PageDrawArea *pda = &(*drawareas)[ i ];
    1046 
    1047         // load links for page if not loaded before
    1048         if ( links[ pda->pagenum ] == NULL ) {
    1049             links[ pda->pagenum ] = doc->getLinkMapping( ev, pda->pagenum );
    1050         }
    1051 
    1052         spos_x = pda->startpos.x;
    1053         //spos_y = ( cyClient - pda->drawrect.yTop ) + ( sVscrollPos * VScrollStep );
    1054         spos_y = pda->startpos.y;
    1055         LONG rclx = pda->drawrect.xRight - pda->drawrect.xLeft;
    1056         LONG rcly = pda->drawrect.yTop - pda->drawrect.yBottom;
    1057 
    1058         pixbuf = new LuPixbuf( ev, rclx, rcly, bpp );
    1059         POINTL aptlPoints[4]={ pda->drawrect.xLeft, pda->drawrect.yBottom,
    1060                                pda->drawrect.xRight-1, pda->drawrect.yTop-1,
    1061                                0, 0, rclx, rcly };
    1062 
    1063         doc->renderPageToPixbuf( ev, pda->pagenum, spos_x, spos_y,
    1064                                  rclx, rcly, realzoom, 0, pixbuf );
    1065         LONG lRop = ROP_SRCCOPY;
    1066         BITMAPINFO2 pbmi;
    1067         pbmi.cbFix = 16L;
    1068         pbmi.cx = rclx;
    1069         pbmi.cy = rcly;
    1070         pbmi.cPlanes = 1;
    1071         pbmi.cBitCount = bpp * 8;
    1072         GpiDrawBits( hpsBuffer, pixbuf->getDataPtr( ev ), &pbmi, 4L,
    1073                      aptlPoints, lRop, BBO_IGNORE );
    1074 
    1075         drawSelection( pda->pagenum, hpsBuffer, &pda->drawrect );
    1076         drawFound( pda->pagenum, hpsBuffer, &pda->drawrect );
    1077 
    1078         delete pixbuf;
    1079         pixbuf = NULL;
    1080     }
    1081     delete drawareas;
    1082     drawareas = NULL;
     1063    if ( doc != NULL )
     1064    {
     1065        delete drawareas;
     1066        drawareas = findDrawAreas( &rcl );
     1067
     1068        for ( int i = 0; i < drawareas->size(); i++ )
     1069        {
     1070            PageDrawArea *pda = &(*drawareas)[ i ];
     1071
     1072            // load links for page if not loaded before
     1073            if ( links[ pda->pagenum ] == NULL ) {
     1074                links[ pda->pagenum ] = doc->getLinkMapping( ev, pda->pagenum );
     1075            }
     1076
     1077            spos_x = pda->startpos.x;
     1078            //spos_y = ( cyClient - pda->drawrect.yTop ) + ( sVscrollPos * VScrollStep );
     1079            spos_y = pda->startpos.y;
     1080            LONG rclx = pda->drawrect.xRight - pda->drawrect.xLeft;
     1081            LONG rcly = pda->drawrect.yTop - pda->drawrect.yBottom;
     1082
     1083            pixbuf = new LuPixbuf( ev, rclx, rcly, bpp );
     1084            POINTL aptlPoints[4]={ pda->drawrect.xLeft, pda->drawrect.yBottom,
     1085                                   pda->drawrect.xRight-1, pda->drawrect.yTop-1,
     1086                                   0, 0, rclx, rcly };
     1087
     1088            doc->renderPageToPixbuf( ev, pda->pagenum, spos_x, spos_y,
     1089                                     rclx, rcly, realzoom, 0, pixbuf );
     1090            LONG lRop = ROP_SRCCOPY;
     1091            BITMAPINFO2 pbmi;
     1092            pbmi.cbFix = 16L;
     1093            pbmi.cx = rclx;
     1094            pbmi.cy = rcly;
     1095            pbmi.cPlanes = 1;
     1096            pbmi.cBitCount = bpp * 8;
     1097            GpiDrawBits( hpsBuffer, pixbuf->getDataPtr( ev ), &pbmi, 4L,
     1098                         aptlPoints, lRop, BBO_IGNORE );
     1099
     1100            drawSelection( pda->pagenum, hpsBuffer, &pda->drawrect );
     1101            drawFound( pda->pagenum, hpsBuffer, &pda->drawrect );
     1102
     1103            delete pixbuf;
     1104            pixbuf = NULL;
     1105        }
     1106        delete drawareas;
     1107        drawareas = NULL;
     1108    }
    10831109    BlitGraphicsBuffer( hps, hpsBuffer, &rcl );
    10841110    WinEndPaint( hps );
    10851111
    1086     determineCurrentPage();
     1112    if ( doc != NULL ) {
     1113        determineCurrentPage();
     1114    }
    10871115}
    10881116
  • trunk/Lucide/SOURCE/gui/docViewer.h

    r40 r50  
    6060        virtual ~DocumentViewer();
    6161
    62         void setViewMode( ViewMode mode );
     62        void setPageLayout( PgLayout layout );
    6363
    6464        HWND getHWND() { return hWndDocFrame; }
     
    147147        DrawAreas *drawareas;
    148148        int drawareaIndex;
     149        bool closed;
    149150
    150151        // continuous view
  • trunk/Lucide/SOURCE/gui/lucide.cpp

    r40 r50  
    5050#include "findDlg.h"
    5151#include "progressDlg.h"
     52#include "settingsDlg.h"
    5253#include "docViewer.h"
    5354#include "indexWindow.h"
     55#include "lusettings.h"
    5456#include "luutils.h"
    5557#include "tb_spl.h"
     
    6769const char *showind    = "ShowIndex";
    6870
     71ULONG APIENTRY GPFHandler( PEXCEPTIONREPORTRECORD pxcptrec,
     72                           PEXCEPTIONREGISTRATIONRECORD prr,
     73                           PCONTEXTRECORD pcr, PVOID pv );
    6974
    7075HWND createToolbar( HWND hwnd );
     
    8691IndexWindow    *indexWin  = NULL;
    8792FindDlg        *findDlg   = NULL;
     93LuSettings     *settings  = NULL;
    8894char           *title     = NULL;
    8995
     
    291297}
    292298
    293 void Lucide::setViewMode( ViewMode mode )
    294 {
    295     if ( mode == SinglePage )
     299void Lucide::setPageLayout( PgLayout layout )
     300{
     301    if ( layout == SinglePage )
    296302    {
    297303        WinSendMsg( hWndMenu, MM_SETITEMATTR,
     
    312318    }
    313319
    314     docViewer->setViewMode( mode );
     320    docViewer->setPageLayout( layout );
    315321}
    316322
     
    371377                loadError = NULL;
    372378
    373 #if 0
     379                // Load document asynchronously
    374380                loadProgressDlg = new ProgressDlg( hWndFrame );
    375                 loadProgressDlg->setText( "Loading document, please wait..." );
     381                char *ldmsg = newstrdupL( MSGS_LOADING_DOCUMENT );
     382                loadProgressDlg->setText( ldmsg );
     383                delete ldmsg;
    376384                loadProgressDlg->show( loadthread, NULL ); // doc will be loaded
    377385                delete loadProgressDlg;
    378 #else
    379                 docLoaded = doc->loadFile( ev, docName, NULL, &loadError );
    380 #endif
    381386
    382387                if ( docLoaded )
    383388                {
    384389                    char *t = new char[ 2048 ];
    385                     char _fn[ _MAX_NAME ];
     390                    char _fn[ _MAX_FNAME ];
    386391                    char _ex[ _MAX_EXT ];
    387392                    _splitpath( fn, NULL, NULL, _fn, _ex );
    388                     strcpy( t, _fn );
    389                     strcat( t, _ex );
    390                     strcat( t, " - " );
    391                     strcat( t, title );
     393                    snprintf( t, 2048, "%s%s - %s", _fn, _ex, title );
    392394                    WinSetWindowText( hWndFrame, t );
    393395                    delete t;
     
    602604                    return (MRESULT)FALSE;
    603605
     606                case CM_SETTINGS:
     607                {
     608                    SettingsDlg *d = new SettingsDlg( hWndFrame, settings );
     609                    d->doDialog();
     610                    return (MRESULT)FALSE;
     611                }
     612
    604613                case CM_FIRSTPAGE:
    605614                    Lucide::goToPage( 0 );
     
    631640
    632641                case CM_SINGLEPAGE:
    633                     Lucide::setViewMode( SinglePage );
     642                    Lucide::setPageLayout( SinglePage );
    634643                    return (MRESULT)FALSE;
    635644
    636645                case CM_CONTINUOUS:
    637                     Lucide::setViewMode( Continuous );
     646                    Lucide::setPageLayout( Continuous );
    638647                    return (MRESULT)FALSE;
    639648
     
    681690
    682691    loadLang();
     692
     693    settings = new LuSettings;
     694    settings->load();
    683695
    684696    pluginMan = new PluginManager;
     
    737749    findDlg = new FindDlg( hWndFrame );
    738750    Lucide::checkMenus();
     751    Lucide::setPageLayout( settings->layout );
     752    Lucide::setZoom( settings->zoom );
    739753
    740754    // ®ª § âì ®ª­® ¯à®£à ¬¬ë
     
    767781
    768782    WinDestroyWindow( hWndFrame );
    769     WinDestroyMsgQueue( hmq );
    770     WinTerminate( hab );
    771783
    772784    delete docViewer;
     
    779791    delete findDlg;
    780792    delete title;
    781 
     793    delete settings;
     794
     795    WinDestroyMsgQueue( hmq );
     796    WinTerminate( hab );
    782797    return 0;
    783798}
  • trunk/Lucide/SOURCE/gui/lucide.h

    r35 r50  
    4545class ProgressDlg;
    4646
    47 enum ViewMode { SinglePage, Continuous };
     47enum PgLayout { SinglePage = 0, Continuous = 1 };
    4848
    4949struct LuWindowPos
     
    8989        static void setZoom( double zoom );
    9090        static void enableCopy( bool enable );
    91         static void setViewMode( ViewMode mode );
     91        static void setPageLayout( PgLayout layout );
    9292        static void toggleFullscreen();
    9393};
  • trunk/Lucide/SOURCE/gui/luutils.cpp

    r35 r50  
    4545
    4646#include "luutils.h"
     47#include "messages.h"
    4748
    4849bool initCountryInfo();
     
    441442}
    442443
     444void setZoomValues( HWND lbox )
     445{
     446    std::string actsizetext = getLocalizedString( TBHINT_ACTUAL_SIZE );
     447    WinSetWindowText( lbox, actsizetext.c_str() );
     448    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END),
     449                MPFROMP( actsizetext.c_str() ) );
     450    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END),
     451                MPFROMP( getLocalizedString( TBHINT_FIT_WINDOW ).c_str() ) );
     452    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END),
     453                MPFROMP( getLocalizedString( TBHINT_FIT_WIDTH ).c_str() ) );
     454    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "12.5%" ) );
     455    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "25%" ) );
     456    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "50%" ) );
     457    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "100%" ) );
     458    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "125%" ) );
     459    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "150%" ) );
     460    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "200%" ) );
     461    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "300%" ) );
     462    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "400%" ) );
     463    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "800%" ) );
     464    WinSendMsg( lbox, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "1600%" ) );
     465}
     466
     467double convZoom( SHORT v )
     468{
     469        double z = -3;
     470    switch ( v )
     471    {
     472        case 0:   z = 1;      break;
     473        case 1:   z = -2;     break;
     474        case 2:   z = -1;     break;
     475        case 3:   z = 0.125;  break;
     476        case 4:   z = 0.25;   break;
     477        case 5:   z = 0.5;    break;
     478        case 6:   z = 1;      break;
     479        case 7:   z = 1.25;   break;
     480        case 8:   z = 1.5;    break;
     481        case 9:   z = 2;      break;
     482        case 10:  z = 3;      break;
     483        case 11:  z = 4;      break;
     484        case 12:  z = 8;      break;
     485        case 13:  z = 16;     break;
     486    }
     487    return z;
     488}
  • trunk/Lucide/SOURCE/gui/luutils.h

    r35 r50  
    6666void textToClipbrd( HAB hab, const char *text );
    6767void centerWindow( HWND parent, HWND hwnd );
     68void setZoomValues( HWND lbox );
     69double convZoom( SHORT v );
    6870#endif
    6971
  • trunk/Lucide/SOURCE/gui/makefile

    r30 r50  
    22
    33TEST=0
    4 VERSION=Beta 1
     4VERSION=Beta 1.1
    55
    66!if $(TEST)==1
     
    3636       linklab.obj wwbtn.obj intern.obj messages.obj indexWindow.obj \
    3737       fontsInfoDlg.obj docInfoDlg.obj findDlg.obj progressDlg.obj \
    38        aboutDlg.obj
     38       aboutDlg.obj settingsDlg.obj lusettings.obj
    3939
    4040Lucide.exe: $(OBJS) Lucide.res
     
    5757file $(OBJDIR)\progressDlg.obj
    5858file $(OBJDIR)\aboutDlg.obj
     59file $(OBJDIR)\settingsDlg.obj
     60file $(OBJDIR)\lusettings.obj
    5961file $(OBJDIR)\docViewer.obj
    6062file $(OBJDIR)\indexWindow.obj
     
    9193progressDlg.obj:    progressDlg.cpp
    9294aboutDlg.obj:       aboutDlg.cpp
     95settingsDlg.obj:    settingsDlg.cpp
     96lusettings.obj:     lusettings.cpp
    9397docViewer.obj:      docViewer.cpp
    9498indexWindow.obj:    indexWindow.cpp
  • trunk/Lucide/SOURCE/gui/messages.cpp

    r35 r50  
    3636
    3737
     38// Some menu item, which used not only in menu
     39const char *MENU_SINGLE_PAGE = "MENU_SINGLE_PAGE";
     40const char *MENU_CONTINUOUS  = "MENU_CONTINUOUS";
     41
     42
    3843// Toolbar hints
    3944const char *TBHINT_OPEN          = "TBHINT_OPEN";
     
    5358
    5459// Lucide messages
    55 const char *MSGS_MAIN_WIN_TITLE  = "MSGS_MAIN_WIN_TITLE";
    56 const char *MSGS_NO_SUIT_PLUG    = "MSGS_NO_SUIT_PLUG";
    57 const char *MSGS_FILE_LOAD_ERROR = "MSGS_FILE_LOAD_ERROR";
     60const char *MSGS_MAIN_WIN_TITLE   = "MSGS_MAIN_WIN_TITLE";
     61const char *MSGS_NO_SUIT_PLUG     = "MSGS_NO_SUIT_PLUG";
     62const char *MSGS_FILE_LOAD_ERROR  = "MSGS_FILE_LOAD_ERROR";
     63const char *MSGS_LOADING_DOCUMENT = "MSGS_LOADING_DOCUMENT";
    5864
    5965// Plugins List columns titles
  • trunk/Lucide/SOURCE/gui/messages.h

    r35 r50  
    3737
    3838
     39// Some menu item, which used not only in menu
     40extern const char *MENU_SINGLE_PAGE;
     41extern const char *MENU_CONTINUOUS;
     42
    3943// Toolbar hints
    4044extern const char *TBHINT_OPEN;
     
    5660extern const char *MSGS_NO_SUIT_PLUG;
    5761extern const char *MSGS_FILE_LOAD_ERROR;
     62extern const char *MSGS_LOADING_DOCUMENT;
    5863
    5964// Plugins List columns titles
  • trunk/Lucide/SOURCE/gui/progressDlg.cpp

    r35 r50  
    2222 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    2323 * in which case the provisions of the LGPL are applicable instead of those
    24  * above. If you wish to allow use of your version of this file only under the 
     24 * above. If you wish to allow use of your version of this file only under the
    2525 * terms of the LGPL, and not to allow others to use your version of this file
    2626 * under the terms of the CDDL, indicate your decision by deleting the
    2727 * provisions above and replace them with the notice and other provisions
    2828 * required by the LGPL. If you do not delete the provisions above, a recipient
    29  * may use your version of this file under the terms of any one of the CDDL 
     29 * may use your version of this file under the terms of any one of the CDDL
    3030 * or the LGPL.
    3131 *
     
    3838
    3939#include <process.h>
     40#include <stdio.h>
    4041
    4142#include "luutils.h"
     
    119120            _this->hDialog = hwnd;
    120121            WinSetDlgItemText( hwnd, IDC_PTEXT, _this->text );
     122            WinEnableControl( hwnd, DID_CANCEL, _this->fn != NULL );
    121123
    122124            _this->startPos = 0;
     
    139141            _this->pOldBarProc = WinSubclassWindow( hBar, progressBarProc );
    140142            WinStartTimer( hBarHab, hBar, TID_PAINT, 1 );
    141 
     143           
    142144            _beginthread( _this->threadFn, NULL, 65536, _this->threadData );
    143145
     
    165167                case DID_CANCEL:
    166168                    WinEnableControl( hwnd, DID_CANCEL, FALSE );
    167                     _this->fn( _this->data );
     169                    if ( _this->fn != NULL ) {
     170                        _this->fn( _this->data );
     171                    }
    168172                    return (MRESULT)FALSE;
    169173            };
  • trunk/Lucide/SOURCE/gui/toolbar.cpp

    r35 r50  
    2222 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    2323 * in which case the provisions of the LGPL are applicable instead of those
    24  * above. If you wish to allow use of your version of this file only under the 
     24 * above. If you wish to allow use of your version of this file only under the
    2525 * terms of the LGPL, and not to allow others to use your version of this file
    2626 * under the terms of the CDDL, indicate your decision by deleting the
    2727 * provisions above and replace them with the notice and other provisions
    2828 * required by the LGPL. If you do not delete the provisions above, a recipient
    29  * may use your version of this file under the terms of any one of the CDDL 
     29 * may use your version of this file under the terms of any one of the CDDL
    3030 * or the LGPL.
    3131 *
     
    7474                if ( ( controlId == TBID_ZOOM ) && ( notifyCode == CBN_ENTER ) )
    7575                {
    76                     SHORT rc = (SHORT)WinSendDlgItemMsg( hwnd, TBID_ZOOM, LM_QUERYSELECTION,
    77                                             MPFROMSHORT( LIT_CURSOR ), MPVOID );
    78                     if ( rc != LIT_NONE )
     76                    bool shortValueOk = false;
     77                    SHORT sResult = 0;
     78                    if ( WinQueryDlgItemShort( hwnd, TBID_ZOOM, &sResult, FALSE ) )
    7979                    {
    80                         switch ( rc )
     80                        if ( ( sResult > 0 ) && ( sResult < 1600 ) ) {
     81                            shortValueOk = true;
     82                            Lucide::setZoom( (double)sResult / 100.0 );
     83                        }
     84                    }
     85
     86                    if ( !shortValueOk )
     87                    {
     88                        SHORT rc = (SHORT)WinSendDlgItemMsg( hwnd, TBID_ZOOM, LM_QUERYSELECTION,
     89                                                MPFROMSHORT( LIT_CURSOR ), MPVOID );
     90                        if ( rc != LIT_NONE )
    8191                        {
    82                             case 0:   Lucide::setZoom( 1 );      break;
    83                             case 1:   Lucide::setZoom( -2 );     break;
    84                             case 2:   Lucide::setZoom( -1 );     break;
    85                             case 3:   Lucide::setZoom( 0.125 );  break;
    86                             case 4:   Lucide::setZoom( 0.25 );   break;
    87                             case 5:   Lucide::setZoom( 0.5 );    break;
    88                             case 6:   Lucide::setZoom( 1 );      break;
    89                             case 7:   Lucide::setZoom( 1.25 );   break;
    90                             case 8:   Lucide::setZoom( 1.5 );    break;
    91                             case 9:   Lucide::setZoom( 2 );      break;
    92                             case 10:  Lucide::setZoom( 3 );      break;
    93                             case 11:  Lucide::setZoom( 4 );      break;
    94                             case 12:  Lucide::setZoom( 8 );      break;
    95                             case 13:  Lucide::setZoom( 16 );     break;
     92                            double z = convZoom( rc );
     93                            if ( z >= -2 ) {
     94                                Lucide::setZoom( z );
     95                            }
    9696                        }
    9797                    }
     
    269269
    270270    cs.ctrlHandle = WinCreateWindow( hToolBar, WC_COMBOBOX, NULL,
    271                                      WS_VISIBLE | CBS_DROPDOWNLIST,
     271                                     WS_VISIBLE | CBS_DROPDOWN,
    272272                                     0,0,0,0, hToolBar, HWND_TOP, TBID_ZOOM, NULL, NULL );
    273273    WinSetPresParam( cs.ctrlHandle, PP_FONTNAMESIZE, deffontlen, deffont );
    274274    std::string actsizetext = getLocalizedString( TBHINT_ACTUAL_SIZE );
    275     WinSetWindowText( cs.ctrlHandle, actsizetext.c_str() );
    276     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END),
    277                 MPFROMP( actsizetext.c_str() ) );
    278     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END),
    279                 MPFROMP( getLocalizedString( TBHINT_FIT_WINDOW ).c_str() ) );
    280     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END),
    281                 MPFROMP( getLocalizedString( TBHINT_FIT_WIDTH ).c_str() ) );
    282     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "12.5%" ) );
    283     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "25%" ) );
    284     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "50%" ) );
    285     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "100%" ) );
    286     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "125%" ) );
    287     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "150%" ) );
    288     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "200%" ) );
    289     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "300%" ) );
    290     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "400%" ) );
    291     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "800%" ) );
    292     WinSendMsg( cs.ctrlHandle, LM_INSERTITEM, MPFROMSHORT(LIT_END), MPFROMP( "1600%" ) );
     275    setZoomValues( cs.ctrlHandle );
    293276    cs.cx = 80;
    294277    cs.cy = -100;
  • trunk/Lucide/SOURCE/plugins/ludjvu/ludjvu.cpp

    r36 r50  
    218218{
    219219    LuDjvuDocumentData *somThis = LuDjvuDocumentGetData(somSelf);
    220    
     220
    221221    double page_ratio;
    222222    double p_width = 0, p_height = 0;
     
    242242    while ( ddjvu_thumbnail_status( d->d_document, pagenum, 1 ) < DDJVU_JOB_OK ) {
    243243            ddjvu_message_wait( d->d_context );
    244             ddjvu_message_pop( d->d_context ); 
    245     }
    246        
     244            ddjvu_message_pop( d->d_context );
     245    }
     246
    247247    int t_width = thumb_width;
    248248    int t_height = thumb_height;
  • trunk/Lucide/SOURCE/plugins/ludoc/lutypes.h

    r35 r50  
    129129{
    130130        char *title;
    131         char *format; /* eg, "pdf-1.5" */
     131        char *format;
    132132        char *author;
    133133        char *subject;
  • trunk/Lucide/SOURCE/plugins/lupoppler/lupoppler.cpp

    r44 r50  
    313313    Environment      *ev;
    314314    LuPixbuf         *pixbuf;
    315     SplashBitmap     *bitmap;
     315    SplashOutputDev  *out;
    316316    void             *fndata;
    317317    _asynchCallbackFn fnd;
     
    328328    DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, &now, sizeof( long ) );
    329329    long dist = ( now - cd->tmr );
    330     if ( ( dist > cd->delay ) || cd->forceDraw ) {
    331         copy_page_to_pixbuf( cd->ev, cd->bitmap, cd->pixbuf );
     330    if ( ( dist > cd->delay ) || cd->forceDraw )
     331    {
     332        // Note: we use out->getBitmap() on each iteration instead
     333        //       of remembering pointer to bitmap before call
     334        //       page->displaySlice() because OutputDev may change
     335        //       bitmap during page->displaySlice() processing.
     336        copy_page_to_pixbuf( cd->ev, cd->out->getBitmap(), cd->pixbuf );
    332337        cd->fnd( cd->fndata );
    333338        cd->tmr = now;
     
    362367    acd.ev        = ev;
    363368    acd.pixbuf    = pixbuf;
    364     acd.bitmap    = document->output_dev->getBitmap();
     369    acd.out       = document->output_dev;
    365370    acd.fndata    = fndata;
    366371    acd.fnd       = (_asynchCallbackFn)fnd;
  • trunk/Lucide/SOURCE/plugins/lupoppler/makefile

    r31 r50  
    2020   DEL MAKE.CFG
    2121   
    22 lupplr.dll: lupoppler.obj ..\ludoc\ludoc.lib
     22lupplr.dll: lupoppler.obj ..\ludoc\ludoc.lib ..\..\..\..\poppler\poppler.lib
    2323  copy &&|
    2424option quiet
  • trunk/poppler/mypoppler/poppler/Page.cc

    r27 r50  
    350350}
    351351
     352
    352353void Page::displaySlice(OutputDev *out, double hDPI, double vDPI,
    353354                        int rotate, GBool useMediaBox, GBool crop,
Note: See TracChangeset for help on using the changeset viewer.