Changeset 230 for trunk


Ignore:
Timestamp:
Aug 18, 2007, 11:35:31 AM (14 years ago)
Author:
Eugene Romanenko
Message:

custom file dialog with preview

Location:
trunk/Lucide
Files:
1 added
11 edited

Legend:

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

    r229 r230  
    234234PSW_OK=~OK
    235235PSW_CANCEL=~Cancel
     236
     237#
     238# Open file dialog
     239#
     240FDLG_OPEN=Open
     241FDLG_FILENAME=File~name
     242FDLG_DRIVE=D~rive
     243FDLG_FILETYPE=File ~Type
     244FDLG_FILE=~File
     245FDLG_DIRECTORY=~Directory
     246FDLG_OK=~OK
     247FDLG_CANCEL=~Cancel
     248FDLG_NO_PREVIEW_AVAILABLE=No preview available
  • trunk/Lucide/BIN/Lucide_ru.lng

    r229 r230  
    233233PSW_OK=ŽŠ
    234234PSW_CANCEL=Žâª §
     235
     236#
     237# Open file dialog
     238#
     239FDLG_OPEN=Žâªàëâì
     240#FDLG_FILENAME=File~name
     241#FDLG_DRIVE=D~rive
     242#FDLG_FILETYPE=File ~Type
     243#FDLG_FILE=~File
     244#FDLG_DIRECTORY=~Directory
     245#FDLG_OK=~OK
     246FDLG_CANCEL=Žâª §
     247FDLG_NO_PREVIEW_AVAILABLE=à¥€¯à®á¬®âà ­¥€®áâ㯥­
  • trunk/Lucide/SOURCE/gui/Lucide_res.H

    r229 r230  
    176176#define IDC_PASSWORD        10
    177177
     178#define IDD_LCD_FILEDLG     1010
     179#define IDC_PREVIEW                     5000
     180
    178181
    179182#endif // __LUCIDE_RES_H
  • trunk/Lucide/SOURCE/gui/dialogs.rc

    r185 r230  
    5656                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    5757        END
    58 
    5958END
    6059
     
    216215                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    217216        END
    218 
    219217END
    220218
     
    233231                PRESPARAMS PP_FONTNAMESIZE "9.WarpSans"
    234232        END
    235 
    236 END
    237 
     233END
     234
     235DLGTEMPLATE IDD_LCD_FILEDLG
     236BEGIN
     237        DIALOG "FDLG_OPEN", -1, 4, 3, 291, 188, FS_NOBYTEALIGN | FS_DLGBORDER | WS_CLIPSIBLINGS | WS_SAVEBITS, FCF_SYSMENU | FCF_TITLEBAR | FCF_DLGBORDER
     238        BEGIN
     239                CONTROL "FDLG_FILENAME", DID_FILENAME_TXT, 5, 174, 36, 7, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     240                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     241                CONTROL "", DID_FILENAME_ED, 45, 175, 238, 6, WC_ENTRYFIELD, ES_AUTOSCROLL | ES_LEFT | ES_MARGIN | WS_TABSTOP | WS_VISIBLE
     242                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     243                CONTROL "FDLG_DRIVE", DID_DRIVE_TXT, 5, 160, 36, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     244                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     245                CONTROL "", DID_DRIVE_CB, 43, 118, 83, 51, WC_COMBOBOX, CBS_DROPDOWNLIST | WS_TABSTOP | WS_VISIBLE
     246                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     247                CONTROL "FDLG_FILETYPE", DID_FILTER_TXT, 135, 160, 42, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     248                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     249                CONTROL "", DID_FILTER_CB, 178, 43, 107, 126, WC_COMBOBOX, CBS_DROPDOWNLIST | WS_TABSTOP | WS_VISIBLE
     250                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     251                CONTROL "FDLG_FILE", DID_FILES_TXT, 130, 146, 118, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     252                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     253                CONTROL "", DID_FILES_LB, 129, 23, 120, 120, WC_LISTBOX, LS_HORZSCROLL | LS_NOADJUSTPOS | WS_VISIBLE | WS_TABSTOP
     254                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     255                CONTROL "FDLG_DIRECTORY", DID_DIRECTORY_TXT, 5, 146, 119, 8, WC_STATIC, SS_TEXT | DT_LEFT | DT_TOP | WS_VISIBLE | WS_GROUP
     256                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     257                CONTROL "", DID_DIRECTORY_LB, 4, 23, 120, 120, WC_LISTBOX, LS_HORZSCROLL | LS_OWNERDRAW | LS_NOADJUSTPOS | WS_VISIBLE | WS_TABSTOP
     258                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     259                CONTROL "FDLG_OK", DID_OK_PB, 4, 3, 50, 14, WC_BUTTON, BS_DEFAULT | BS_PUSHBUTTON | WS_TABSTOP | WS_VISIBLE | WS_GROUP
     260                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     261                CONTROL "FDLG_CANCEL", DID_CANCEL_PB, 57, 3, 50, 14, WC_BUTTON, BS_PUSHBUTTON | WS_VISIBLE
     262                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     263                CONTROL "Preview", IDC_PREVIEW, 256, 5, 28, 138, WC_STATIC, SS_TEXT | DT_CENTER | DT_VCENTER | DT_MNEMONIC | WS_VISIBLE | WS_GROUP
     264                PRESPARAMS PP_FONTNAMESIZE , "9.WarpSans"
     265        END
     266END
     267
  • trunk/Lucide/SOURCE/gui/lucide.cpp

    r229 r230  
    8181void initPipeMon( HWND hWndFrame );
    8282void unInitPipeMon();
     83HWND LcdFileDlg( HWND hwndP, HWND hwndO, FILEDLG *pfild );
     84
    8385
    8486HAB   hab            = NULLHANDLE;
     
    584586    snprintf( fd->szFullFile, sizeof( fd->szFullFile ),
    585587              "%s%s", dirbuf, pluginMan->getExtsMask().c_str() );
    586     WinFileDlg( HWND_DESKTOP, hWndFrame, fd );
     588    LcdFileDlg( HWND_DESKTOP, hWndFrame, fd );
    587589    if ( fd->lReturn == DID_OK )
    588590    {
  • trunk/Lucide/SOURCE/gui/lucidethumbs.cpp

    r198 r230  
    7373ULONG  APIENTRY (*pMmioSetHeader)(HMMIO,PVOID,LONG,PLONG,ULONG,ULONG);
    7474USHORT APIENTRY (*pMmioClose)(HMMIO,USHORT);
     75ULONG  APIENTRY (*pMmioIdentifyFile)(PSZ,PMMIOINFO,PMMFORMATINFO,PFOURCC,ULONG,ULONG);
     76ULONG  APIENTRY (*pMmioQueryHeaderLength)(HMMIO,PLONG,ULONG,ULONG);
     77ULONG  APIENTRY (*pMmioGetHeader)(HMMIO,PVOID,LONG,PLONG,ULONG,ULONG);
     78LONG   APIENTRY (*pMmioRead)(HMMIO,PCHAR,LONG);
    7579
    7680static bool loadMMIOFuncs()
     
    8892            break;
    8993        if ( DosQueryProcAddr( mmioHndl, 0, "mmioClose", (PFN *)&pMmioClose ) != 0 )
     94            break;
     95        if ( DosQueryProcAddr( mmioHndl, 0, "mmioIdentifyFile", (PFN *)&pMmioIdentifyFile ) != 0 )
     96            break;
     97        if ( DosQueryProcAddr( mmioHndl, 0, "mmioQueryHeaderLength", (PFN *)&pMmioQueryHeaderLength ) != 0 )
     98            break;
     99        if ( DosQueryProcAddr( mmioHndl, 0, "mmioGetHeader", (PFN *)&pMmioGetHeader ) != 0 )
     100            break;
     101        if ( DosQueryProcAddr( mmioHndl, 0, "mmioRead", (PFN *)&pMmioRead ) != 0 )
    90102            break;
    91103
     
    347359}
    348360
     361
     362HBITMAP LoadBitmap( HAB hab, HDC hdc, HPS *hps, PSZ pszFileName )
     363{
     364    HBITMAP       hbm;
     365    MMIOINFO      mmioinfo;
     366    MMFORMATINFO  mmFormatInfo;
     367    HMMIO         hmmio;
     368    ULONG         ulImageHeaderLength;
     369    MMIMAGEHEADER mmImgHdr;
     370    ULONG         ulBytesRead;
     371    ULONG         dwNumRowBytes;
     372    PBYTE         pRowBuffer;
     373    ULONG         dwRowCount;
     374    SIZEL         ImageSize;
     375    ULONG         dwHeight, dwWidth;
     376    SHORT         wBitCount;
     377    FOURCC        fccStorageSystem;
     378    ULONG         dwPadBytes;
     379    ULONG         dwRowBits;
     380    ULONG         ulReturnCode;
     381    ULONG         dwReturnCode;
     382    HBITMAP       hbReturnCode;
     383    LONG          lReturnCode;
     384    FOURCC        fccIOProc;
     385
     386
     387    ulReturnCode = pMmioIdentifyFile( pszFileName, 0L, &mmFormatInfo,
     388                                      &fccStorageSystem, 0L, 0L );
     389    if ( ulReturnCode == MMIO_ERROR ) {
     390         return NULLHANDLE;
     391    }
     392
     393    if( mmFormatInfo.fccIOProc == FOURCC_DOS ) {
     394         return NULLHANDLE;
     395    }
     396
     397    if ( (mmFormatInfo.ulMediaType != MMIO_MEDIATYPE_IMAGE) ||
     398         ((mmFormatInfo.ulFlags & MMIO_CANREADTRANSLATED) == 0) ) {
     399         return NULLHANDLE;
     400    }
     401    else {
     402         fccIOProc = mmFormatInfo.fccIOProc;
     403    }
     404
     405    memset( &mmioinfo, 0L, sizeof( MMIOINFO ) );
     406    mmioinfo.fccIOProc = fccIOProc;
     407    mmioinfo.ulTranslate = MMIO_TRANSLATEHEADER | MMIO_TRANSLATEDATA;
     408
     409    hmmio = pMmioOpen( (PSZ)pszFileName, &mmioinfo,
     410                      MMIO_READ | MMIO_DENYWRITE | MMIO_NOIDENTIFY );
     411
     412    if ( !hmmio ) {
     413         return NULLHANDLE;
     414    }
     415
     416    dwReturnCode = pMmioQueryHeaderLength( hmmio, (PLONG)&ulImageHeaderLength, 0L, 0L );
     417
     418    if ( ulImageHeaderLength != sizeof ( MMIMAGEHEADER ) ) {
     419         pMmioClose( hmmio, 0L );
     420         return NULLHANDLE;
     421    }
     422
     423    ulReturnCode = pMmioGetHeader( hmmio, &mmImgHdr, sizeof( MMIMAGEHEADER ),
     424                                   (PLONG)&ulBytesRead, 0L, 0L );
     425
     426    if ( ulReturnCode != MMIO_SUCCESS ) {
     427         pMmioClose( hmmio, 0L );
     428         return NULLHANDLE;
     429    }
     430
     431    dwHeight = mmImgHdr.mmXDIBHeader.BMPInfoHeader2.cy;
     432    dwWidth = mmImgHdr.mmXDIBHeader.BMPInfoHeader2.cx;
     433    wBitCount = mmImgHdr.mmXDIBHeader.BMPInfoHeader2.cBitCount;
     434    dwRowBits = dwWidth * mmImgHdr.mmXDIBHeader.BMPInfoHeader2.cBitCount;
     435    dwNumRowBytes = dwRowBits >> 3;
     436
     437    if ( dwRowBits % 8 ) {
     438         dwNumRowBytes++;
     439    }
     440
     441    dwPadBytes = ( dwNumRowBytes % 4 );
     442
     443    if ( dwPadBytes ) {
     444         dwNumRowBytes += 4 - dwPadBytes;
     445    }
     446
     447    pRowBuffer = (PBYTE)malloc( dwNumRowBytes );
     448
     449    ImageSize.cx = dwWidth;
     450    ImageSize.cy = dwHeight;
     451
     452    *hps = GpiCreatePS( hab, hdc, &ImageSize,
     453                        PU_PELS | GPIF_DEFAULT | GPIT_MICRO | GPIA_ASSOC );
     454
     455    if ( !*hps ) {
     456        free( pRowBuffer );
     457        pMmioClose( hmmio, 0L );
     458        return NULLHANDLE;
     459    }
     460
     461    hbm = GpiCreateBitmap( *hps, &mmImgHdr.mmXDIBHeader.BMPInfoHeader2, 0L, NULL, NULL );
     462
     463    if ( !hbm )
     464    {
     465        free( pRowBuffer );
     466        pMmioClose( hmmio, 0L );
     467        return NULLHANDLE;
     468    }
     469
     470    hbReturnCode = GpiSetBitmap( *hps, hbm );
     471
     472    for ( dwRowCount = 0; dwRowCount < dwHeight; dwRowCount++ )
     473    {
     474         ulBytesRead = pMmioRead( hmmio, pRowBuffer, dwNumRowBytes );
     475
     476         if ( !ulBytesRead ) {
     477              break;
     478         }
     479
     480         lReturnCode = GpiSetBitmapBits( *hps, dwRowCount, 1, pRowBuffer,
     481                                         (PBITMAPINFO2)&mmImgHdr.mmXDIBHeader.BMPInfoHeader2 );
     482    }
     483
     484    pMmioClose( hmmio, 0L );
     485    free( pRowBuffer );
     486
     487    return hbm;
     488}
     489
  • trunk/Lucide/SOURCE/gui/makefile

    r229 r230  
    22
    33TEST=0
    4 VERSION=1.02
     4VERSION=1.10-test
    55
    66!if $(TEST)==1
     
    3838       aboutDlg.obj settingsDlg.obj lusettings.obj printDlg.obj \
    3939       print.obj stbrowser.obj pipemon.obj lucidethumbs.obj \
    40        passwordDlg.obj recent.obj
     40       passwordDlg.obj recent.obj lcdfdlg.obj
    4141
    4242lucide.dll: $(OBJS) lucide.res
     
    7474file $(OBJDIR)\passwordDlg.obj
    7575file $(OBJDIR)\recent.obj
     76file $(OBJDIR)\lcdfdlg.obj
    7677name $(EXEDIR)\lucide
    7778lib ..\plugins\ludoc\ludoc
     
    137138passwordDlg.obj:    passwordDlg.cpp
    138139recent.obj:         recent.cpp
     140lcdfdlg.obj:        lcdfdlg.cpp
    139141lcd.obj:            lcd.c               makefile
    140142
  • trunk/Lucide/SOURCE/gui/messages.cpp

    r229 r230  
    129129const char *PRINT_FAILED                = "PRINT_FAILED";
    130130
     131// Open file dialog
     132const char *FDLG_NO_PREVIEW_AVAILABLE = "FDLG_NO_PREVIEW_AVAILABLE";
  • trunk/Lucide/SOURCE/gui/messages.h

    r229 r230  
    130130extern const char *PRINT_FAILED;
    131131
     132// Open file dialog
     133extern const char *FDLG_NO_PREVIEW_AVAILABLE;
     134
    132135
    133136#endif // __MESSAGES_H
  • trunk/Lucide/SOURCE/gui/pluginman.cpp

    r229 r230  
    310310        char *p = strtok( tmpexts, ";" );
    311311        while ( p != NULL ) {
    312             cRet += "*.";
     312            cRet += '*';
    313313            cRet += p;
    314             cRet += ";";
     314            cRet += ';';
    315315            p = strtok( NULL, ";" );
    316316        }
  • trunk/Lucide/changelog

    r229 r230  
    1 1.02:
     11.10-test:
    22  - JPG plugin: added support for quality image scaling. 
    33  - If the filename does not have an extension or the extension is unknown,
     
    77    directory.
    88  - List of recent files.
     9  - Custom file dialog with preview.
    910  - Hotkeys (Ctrl+0/1/2) for predefined zoom levels.
    1011  - UClip package is optional now.
Note: See TracChangeset for help on using the changeset viewer.