Ignore:
Timestamp:
Jul 26, 2006, 3:02:50 PM (15 years ago)
Author:
Eugene Romanenko
Message:

UI improvements, save files, ability to compile plugins with gcc, saveAs for djvu plugin, djvu plugin compiled with gcc, get rid of ddjvuapi.dll

File:
1 edited

Legend:

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

    r87 r88  
    263263    checkZoomMenus();
    264264
     265    WinEnableMenuItem( hWndMenu, CM_SAVEAS, doc->isSaveable( ev ) );
    265266    setOfPages( doc->getPageCount( ev ) );
    266267    WinEnableMenuItem( hWndMenu, CM_FONTSINFO, doc->isHaveFontInfo( ev ) );
     
    450451}
    451452
     453void Lucide::saveDocumentAs()
     454{
     455    char dirbuf[ CCHMAXPATH ];
     456    PFILEDLG fd = new FILEDLG;
     457    memset( fd, 0, sizeof( FILEDLG ) );
     458    fd->cbSize = sizeof( FILEDLG );
     459    fd->fl = FDS_CENTER | FDS_SAVEAS_DIALOG;
     460    PrfQueryProfileString( HINI_USERPROFILE, appName, lvd, "",
     461                           dirbuf, sizeof( dirbuf ) );
     462    char fil[ _MAX_FNAME ] = "";
     463    char ext[ _MAX_EXT ] = "";
     464    _splitpath( docName, NULL, NULL, fil, ext );
     465    snprintf( fd->szFullFile, sizeof( fd->szFullFile ),
     466                "%s%s%s", dirbuf, fil, ext );
     467    WinFileDlg( HWND_DESKTOP, hWndFrame, fd );
     468    if ( fd->lReturn == DID_OK )
     469    {
     470        bool doSave = true;
     471        if ( access( fd->szFullFile, F_OK ) == 0 )
     472        {
     473            char *t = newstrdupL( MSGS_WARNING );
     474            char *m = newstrdupL( MSGS_OVERWRITE_FILE );
     475            ULONG response = WinMessageBox( HWND_DESKTOP, hWndFrame, m, t,
     476                                            0, MB_YESNO | MB_WARNING | MB_MOVEABLE );
     477            delete m;
     478            delete t;
     479
     480            doSave = ( response == MBID_YES );
     481        }
     482        if ( doSave )
     483        {
     484            if ( !doc->saveAs( ev, fd->szFullFile ) )
     485            {
     486                char *m = newstrdupL( MSGS_FILE_SAVE_ERROR );
     487                WinMessageBox( HWND_DESKTOP, hWndFrame, m, NULL,
     488                               0, MB_OK | MB_ERROR | MB_MOVEABLE );
     489                delete m;
     490            }
     491        }
     492    }
     493    delete fd;
     494}
     495
    452496void Lucide::checkNavpane()
    453497{
     
    580624                    return (MRESULT)FALSE;
    581625
     626                case CM_SAVEAS:
     627                    Lucide::saveDocumentAs();
     628                    return (MRESULT)FALSE;
     629
    582630                case CM_EXIT:
    583631                    WinPostMsg( hWndFrame, WM_CLOSE, NULL, NULL );
Note: See TracChangeset for help on using the changeset viewer.