Changeset 11


Ignore:
Timestamp:
Feb 21, 2018, 1:01:16 AM (7 years ago)
Author:
Gregg Young
Message:

This changes the bitmap save from an internal bitmap or the use of MMOS2 to using GBM. The save code was adapted from GBMv2 by Heiko Nitzsche and Andy Keys. Also fixed the failure of the file dialog to update the file extension name on the first save after a format changes. Non English resources haven't been updated yet. Several more build error warning fixes.

Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/bitmap.cpp

    r2 r11  
    1818 ***/
    1919
    20 // ** CaptureWindow ******************************************************* /*fold00*/
     20// ** CaptureWindow ******************************************************* /*FOLD00*/
    2121
    2222#define MAX_WAIT   15
     
    4242        for (USHORT i = 0; i < MAX_WAIT; i++)
    4343        {
    44             _sleep2 (100);
     44            DosSleep (100);
    4545            WinQueryWindowPos (hwndParent, &swp);
    4646            if ((swp.hwndInsertBehind == HWND_TOP) ||
     
    149149               sizeof (aptl) / sizeof (POINTL), /* Number of points in aptl */
    150150               aptl, ROP_SRCCOPY, BBO_IGNORE);
    151     SaveBitmap (hbm, hpsMem);
     151    SaveBitmap (hbm, hpsMem, sWidth, sHeight, bmp.cBitCount);
    152152
    153153    // re-associate the previous bit map and the memory presentation space
  • trunk/english/gotresen.rc

    r5 r11  
    2020
    2121/* Please do NOT try to translate the following statement :-) */
    22 RCINCLUDE "src\common.rc"
     22RCINCLUDE "..\common.rc"
    2323
    2424/* Please adjust the name of the language (but leave the number alone :-)
     
    8080            FS_NOBYTEALIGN | FS_DLGBORDER | NOT WS_VISIBLE,
    8181            FCF_TITLEBAR | FCF_SYSMENU | FCF_AUTOICON | FCF_TASKLIST | FCF_MINBUTTON
    82     BEGIN          // Please do NOT try to translate the "thth.wc..." ;-)
     82    BEGIN          /* Please do NOT try to translate the "thth.wc..." ;-)*/
    8383        WINDOW          "", FID_CLIENT, 0, 0, 200, 70, "thth.wc.gotcha.main",
    8484                        FS_NOBYTEALIGN | NOT WS_VISIBLE
     
    272272    IDS_PAGELANGUAGE                   "Language"
    273273
    274     IDS_BITMAP12INTERNAL               "Bitmap 1.2 (Saved using Gotcha! internal routine)"
    275     IDS_BITMAP16INTERNAL               "Bitmap 1.6 (Saved using Gotcha! internal routine)"
    276     IDS_BITMAP20INTERNAL               "Bitmap 2.0 (Saved using Gotcha! internal routine)"
    277     IDS_BITMAP13MMOS2                  "Bitmap 1.3 (Saved using OS/2 Multimedia)"
    278     IDS_BITMAP20MMOS2                  "Bitmap 2.0 (Saved using OS/2 Multimedia)"
    279     IDS_TIFFCOMPRESSED                 "TIFF compressed"
    280     IDS_TIFFUNCOMPRESSED               "TIFF uncompressed"
    281     IDS_TGA                            "TGA"
    282     IDS_PCX                            "PCX"
    283     IDS_GIF                            "GIF"
    284     IDS_JPEG                           "Jpeg (Probably won't work, reason unknown)"
    285     IDS_DIB                            "DIB (Device Independent Bitmap)"
     274    IDS_BMF_JPG        "JPEG Interchange File Format (jpg)"
     275    IDS_BMF_PNG        "Portable Network Graphics (png)"
     276    IDS_BMF_OS20       "OS/2 Bitmap 2.0 (bmp)"
     277    IDS_BMF_TIF        "Microsoft/Aldus Tagged Image File Format (tif)"
     278    IDS_BMF_TGA        "Truevision Targa/Vista (tga)"
     279    IDS_BMF_PCX        "ZSoft PC Paintbrush Image Format (pcx)"
     280    IDS_BMF_GIF        "Portable Anymap (pnm)"
     281    IDS_BMF_PBM        "Portable Pixel-map (ppm)"
     282    IDS_BMF_JP2        "Jpeg 2000 (provided by the Open Source OpenJPEG library) (jp2)"
     283    IDS_BMF_JBG        "JBIG Joint Bi-level Image experts Group (jbg)"
     284    IDS_BMF_RAW        "Camera RAW Image Format (raw)"
     285    IDS_BMF_DIB        "Device Independent Bitmap (dib)"
    286286
    287287    IDS_SNAPLABEL                      "Snap!"
  • trunk/id.h

    r2 r11  
    148148#define IDS_PAGEMISC                        20
    149149#define IDS_PAGELANGUAGE                    21
    150 #define IDS_BITMAP12INTERNAL                22
    151 #define IDS_BITMAP16INTERNAL                23
    152 #define IDS_BITMAP20INTERNAL                24
    153 #define IDS_BITMAP13MMOS2                   25
    154 #define IDS_BITMAP20MMOS2                   26
    155 #define IDS_TIFFCOMPRESSED                  27
    156 #define IDS_TIFFUNCOMPRESSED                28
    157 #define IDS_TGA                             29
    158 #define IDS_PCX                             30
    159 #define IDS_GIF                             31
    160 #define IDS_JPEG                            32
    161 #define IDS_DIB                             33
     150#define IDS_BMF_JPG                         22
     151#define IDS_BMF_PNG                         23
     152#define IDS_BMF_OS20                        24
     153#define IDS_BMF_TIF                         25
     154#define IDS_BMF_TGA                         26
     155#define IDS_BMF_PCX                         27
     156#define IDS_BMF_GIF                         28
     157#define IDS_BMF_PBM                         29
     158#define IDS_BMF_JP2                         30
     159#define IDS_BMF_JBG                         31
     160#define IDS_BMF_RAW                         32
     161#define IDS_BMF_DIB                         33
    162162#define IDS_SNAPLABEL                       34
    163163#define IDS_GENERALHELP                     35
  • trunk/savebmp.cpp

    r2 r11  
    2020#include <time.h>
    2121
    22 // ** SaveBitmap ********************************************************** /*fold00*/
    23 
    24 VOID SaveBitmap (HBITMAP hbm, HPS hps)
     22#include "gbm\gbm.h"
     23#include "gbm\gbmmem.h"
     24#include "model.h"
     25
     26#define  __PMPRINTF__
     27#include "PMPRINTF.H"
     28
     29/* ------------------------------ */
     30static int StrideOf(const MOD *mod)
    2531{
     32    DebugHereIAm();
     33        return ( ( mod->gbm.w * mod->gbm.bpp + 31 ) / 32 ) * 4;
     34        }
     35/*...e*/
     36
     37/*...sAllocateData:0:*/
     38static BOOL AllocateData(MOD *mod)
     39        {
     40        const unsigned long stride = StrideOf(mod);
     41        if ( (mod->pbData = (UCHAR*) gbmmem_malloc(stride * mod->gbm.h)) == NULL )
     42            return FALSE;
     43        DebugHereIAm();
     44        return TRUE;
     45        }
     46/*...e*/
     47
     48/*...sModCreate:0:*/
     49MOD_ERR ModCreate(
     50        int w, int h, int bpp, const GBMRGB gbmrgb[],
     51        MOD *modNew
     52        )
     53        {
     54        modNew->gbm.w   = w;
     55        modNew->gbm.h   = h;
     56        modNew->gbm.bpp = bpp;
     57        if ( gbmrgb != NULL && bpp != 24 )
     58                memcpy(&(modNew->gbmrgb), gbmrgb, sizeof(GBMRGB) << bpp);
     59        if ( !AllocateData(modNew) )
     60            return MOD_ERR_MEM;
     61        DebugHereIAm();
     62        return MOD_ERR_OK;
     63        }
     64/*...e*/
     65
     66/*MOD_ERR ModCreateFromHPS(
     67        HPS hps, int w, int h, int bpp, //lBitCountScreen > 8 ) ? 24 : lBitCountScreen
     68        MOD *modNew
     69        )*/
     70/*...sModCreateFromHPS:0:*/
     71MOD_ERR ModCreateFromHPS(
     72        HPS hps, int w, int h, int bpp,
     73        MOD *modNew
     74        )
     75        {
     76        MOD_ERR mrc;
     77
     78    #pragma pack(2)
     79        struct
     80                {
     81                BITMAPINFOHEADER2 bmp2;
     82                RGB2 argb2Color[0x100];
     83                } bm;
     84    #pragma pack()
     85
     86        if ( (mrc = ModCreate(w, h, bpp, NULL, modNew)) != MOD_ERR_OK )
     87                return mrc;
     88        DebugHereIAm();
     89        memset(&(bm.bmp2), 0, sizeof(bm.bmp2));
     90        bm.bmp2.cbFix     = sizeof(BITMAPINFOHEADER2);
     91        bm.bmp2.cx        = w;
     92        bm.bmp2.cy        = h;
     93        bm.bmp2.cBitCount = bpp;
     94        bm.bmp2.cPlanes   = 1;
     95        GpiQueryBitmapBits(hps, 0L, h, modNew->pbData, (BITMAPINFO2 *) &bm);
     96
     97        if ( bpp != 24 )
     98                {
     99                int i;
     100                for ( i = 0; i < (1<<bpp); i++ )
     101                        {
     102                        modNew->gbmrgb[i].r = bm.argb2Color[i].bRed  ;
     103                        modNew->gbmrgb[i].g = bm.argb2Color[i].bGreen;
     104                        modNew->gbmrgb[i].b = bm.argb2Color[i].bBlue ;
     105                        }
     106                }
     107        DebugHereIAm();
     108        return MOD_ERR_OK;
     109        }
     110/*...e*/
     111
     112/*MOD_ERR ModWriteToFile(
     113        const MOD *mod,
     114        const CHAR *szFn, const CHAR *szOpt // ""
     115        )*/
     116/*...sModWriteToFile:0:*/
     117MOD_ERR ModWriteToFile(
     118        const MOD *mod,
     119        const CHAR *szFn, const CHAR *szOpt
     120        )
     121        {
     122        GBM_ERR grc;
     123        int fd, ft, flag = 0;
     124        GBMFT gbmft;
     125
     126        if ( (grc = gbm_guess_filetype(szFn, &ft)) != GBM_ERR_OK ) {
     127            return grc;
     128        }
     129        PmpfF(( "file type %i", ft ));
     130        DebugHereIAm();
     131        gbm_query_filetype(ft, &gbmft);
     132        PmpfF(( "file type %i name %s flags %i bpp %i", ft, gbmft.short_name,
     133               gbmft.flags, mod->gbm.bpp));
     134        switch ( mod->gbm.bpp )
     135                {
     136                case 1:         flag = GBM_FT_W1;       break;
     137                case 4:         flag = GBM_FT_W4;       break;
     138                case 8:         flag = GBM_FT_W8;       break;
     139                case 24:        flag = GBM_FT_W24;      break;
     140                default:        flag = 0;       break;
     141                }
     142
     143        if ( (gbmft.flags & flag) == 0 )
     144            return MOD_ERR_SUPPORT;
     145        DebugHereIAm();
     146        if ( (fd = gbm_io_create(szFn, GBM_O_WRONLY)) == -1 )
     147                return MOD_ERR_CREATE;
     148        DebugHereIAm();
     149        if ( (grc = gbm_write(szFn, fd, ft, &(mod->gbm), mod->gbmrgb, mod->pbData, szOpt)) != GBM_ERR_OK )
     150                {
     151                gbm_io_close(fd);
     152                unlink(szFn);
     153                return MOD_ERR_GBM(grc);
     154                }
     155        DebugHereIAm();
     156        gbm_io_close(fd);
     157        DebugHereIAm();
     158        return MOD_ERR_OK;
     159        }
     160/*...e*/
     161// ** SaveBitmap ********************************************************** /*FOLD00*/
     162
     163VOID SaveBitmap (HBITMAP hbm, HPS hps, int width, int height, int bitCount)
     164{
    26165#ifdef _DOLOGMEM_
    27166    LogMem("SaveBitmap", TRUE);
    28167#endif
     168    MOD newmod;
    29169
    30170    if( pset->QueryFileSaveStyle () == FSS_FORCEFILE )
     
    32172        PSZ psz = pset->QueryForceSaveFile();
    33173        psz = AddExtensionToFilename( psz );
    34         SaveBitmapToFile( hbm, psz, hps );
     174        //
     175        /*if( ( pset->QueryFileFormat() == BMF_12 ) ||
     176           ( pset->QueryFileFormat() == BMF_16 ) ||
     177           ( pset->QueryFileFormat() == BMF_20 ) ) {
     178            SaveBitmapToFile( hbm, psz, hps );
     179            DebugHereIAm();
     180        }
     181        else { */
     182            ModCreateFromHPS( hps, width, height,
     183                             (bitCount > 8 ) ? 24 : bitCount,
     184                             &newmod );
     185            ModWriteToFile(&newmod, psz, "" );
     186        //}
    35187#ifdef _DOLOGMEM_
    36188        LogMem( "SaveBitmap-1", FALSE );
     
    60212            LogDebug( "Before call to SaveBitmapToFile()" );
    61213#endif
    62             SaveBitmapToFile (hbm, pset->QuerySaveFile (), hps);
     214            //DebugHereIAm();
     215            /*if( ( pset->QueryFileFormat() == BMF_12 ) ||
     216               ( pset->QueryFileFormat() == BMF_16 ) ||
     217               ( pset->QueryFileFormat() == BMF_20 ) ) {
     218                DebugHereIAm();
     219                SaveBitmapToFile( hbm, pset->QuerySaveFile (), hps );
     220                DebugHereIAm();
     221            }
     222            else {*/
     223                ModCreateFromHPS( hps, width, height,
     224                                 (bitCount > 8 ) ? 24 : bitCount,
     225                                 &newmod );
     226                ModWriteToFile(&newmod, pset->QuerySaveFile (), "" );
     227            //}
    63228#ifdef _DOLOGDEBUG_
    64229            LogDebug( "After call to SaveBitmapToFile()" );
     
    96261#define CB_20HEADER       sizeof (BITMAPINFOHEADER2) // == 64
    97262
     263#if 0
    98264VOID SaveBitmapToFile (HBITMAP hbm, PSZ psz, HPS hps)
    99265{
     
    274440        fwrite (pb, cbBits, 1, pf);
    275441        fclose (pf);
    276     } else {
     442    }
     443
     444    /*else {
    277445#ifdef _DOLOGDEBUG_
    278446        LogDebug( "SaveBitmapToFile(): Starting 'else' path." );
     
    304472        // Open target file.
    305473        HMMIO hmmioTarget;
    306         if( ! ( hmmioTarget = pset->GetMMIO()->pfmmioOpen( psz,
     474        if( ! ( hmmioTarget = mmioOpen( psz,
    307475                                        &mmioinfoTarget,
    308476                                        MMIO_CREATE | MMIO_WRITE |
    309                                         MMIO_DENYWRITE | MMIO_NOIDENTIFY ) ) ) {
     477                                        MMIO_DENYWRITE | MMIO_NOIDENTIFY ))) {
    310478            DisplayError ("mmioOpen()-Error",
    311479                          "mmioOpen()-Error %ld", mmioinfoTarget.ulErrorRet );
     
    319487        ULONG ulImageHeaderLength;
    320488
    321         xmmioQueryHeaderLength( hmmioTarget, (PLONG)&ulImageHeaderLength, 0L, 0L );
     489        mmioQueryHeaderLength( hmmioTarget, (PLONG)&ulImageHeaderLength, 0L, 0L );
    322490        if( ulImageHeaderLength != sizeof( MMIMAGEHEADER ) )
    323491        {
    324492            // We have a problem.....possibly incompatible versions.
    325             xmmioClose( hmmioTarget, 0L );
     493            mmioClose( hmmioTarget, 0L );
    326494            DisplayError ("mmioQueryHeaderLength()-Error",
    327495                          "mmioQueryHeaderLength()-Error",
     
    355523#endif
    356524        ULONG ulBytesRead;
    357         if( ( rc = (LONG)xmmioSetHeader( hmmioTarget, (MMIMAGEHEADER*)&mmImgHdr,
     525        if( ( rc = (LONG)mmioSetHeader( hmmioTarget, (MMIMAGEHEADER*)&mmImgHdr,
    358526                                         (LONG)sizeof( MMIMAGEHEADER ), (PLONG)&ulBytesRead,
    359527                                         0L, 0L ) ) != MMIO_SUCCESS )
    360528        {
    361529            // Header unavailable.
    362             xmmioClose( hmmioTarget, 0L );
     530            mmioClose( hmmioTarget, 0L );
    363531            DisplayError ("mmioSetHeader()-Error",
    364532                          "mmioSetHeader()-Error %ld", rc );
     
    370538
    371539        // write the actual bitmap data bits
    372         if( ( rc = xmmioWrite( hmmioTarget, pb, cbBits ) ) == MMIO_ERROR )
     540        if( ( rc = mmioWrite( hmmioTarget, (CHAR *) pb, cbBits ) ) == MMIO_ERROR )
    373541            DisplayError ("mmioWrite()-Error",
    374542                          "mmioWrite()-Error %ld", rc );
     
    377545#endif
    378546
    379         if( ( rc = xmmioClose( hmmioTarget, 0 ) ) != MMIO_SUCCESS )
     547        if( ( rc = mmioClose( hmmioTarget, 0 ) ) != MMIO_SUCCESS )
    380548            DisplayError ("mmioClose()-Error",
    381549                          "mmioClose()-Error %ld", rc );
     
    383551        LogDebug( "SaveBitmapToFile(): xmmioClose ok." );
    384552#endif
    385     }
     553    } */
    386554
    387555#ifdef _DOLOGDEBUG_
     
    399567#endif
    400568}
    401 
     569#endif
    402570// ** SetEAs ************************************************************** /*FOLD00*/
    403571
     
    620788}
    621789
    622 // ** AddExtensionToFilename ********************************************** /*fold00*/
     790// ** AddExtensionToFilename ********************************************** /*FOLD00*/
    623791
    624792PSZ AddExtensionToFilename( PSZ psz )
     
    629797    PSZ pszExtension;
    630798
    631     PSZ apszValidExtensions[10] =
    632     { "bmp", "tif", "tiff", "tga", "targa", "pcx", "gif", "jpg", "jpeg", "dib" };
     799    PSZ apszValidExtensions[16] =
     800    { "bmp", "tif", "tiff", "tga", "targa", "pcx", "pnm", "jpg", "jpeg",
     801    "jpg2", "jbg", "jbig", "png", "ppm", "raw", "dib" };
    633802
    634803    if( ! ( pszExtension = strrchr( psz, '.' ) ) ) {
     
    641810        // Some extension, but not the correct one - change or append.
    642811        BOOL fValidExtension = FALSE;
    643         for( int i = 0; i < 10; i++ ) {
     812        for( int i = 0; i < 16; i++ ) {
    644813            if( stricmp( pszExtension+1, apszValidExtensions[i] ) == 0 ) {
    645814                fValidExtension = TRUE;
  • trunk/settings.cpp

    r2 r11  
    1717 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1818 ***/
    19 
     19#include <direct.h>
    2020#include "settings.h"
    2121#include "ctype.h"
     
    3232USHORT ausDefSSW[7] = { 0 };
    3333
     34#if 0
    3435ImageFormatInfo Settings::ifi[BMF_INVALID] =
    3536{
     
    4849};
    4950
     51#else
     52// pbm and gif don't save anything
     53ImageFormatInfo Settings::ifi[BMF_INVALID] =
     54{
     55    { TRUE, BMF_JPG,  0L, "JPEG Interchange File Format (jpg)", "jpg", "JPG" },
     56    { TRUE, BMF_PNG,  0L, "Portable Network Graphics (png)", "png", "PNG" },
     57    { TRUE, BMF_OS20, 0L, "OS/2 Bitmap 2.0 (bmp)", "bmp", "Bitmap" },
     58    { TRUE, BMF_TIF,  0L, "Microsoft/Aldus Tagged Image File Format (tif)", "tif", "TIFF" },
     59    { TRUE, BMF_TGA,  0L, "Truevision Targa/Vista (tga)", "tga", "Targa" },
     60    { TRUE, BMF_PCX,  0L, "ZSoft PC Paintbrush Image Format (pcx)", "pcx", "PCX" },
     61    { TRUE, BMF_GIF,  0L, "Portable Anymap (pnm)", "pnm", "PNM" },
     62    { TRUE, BMF_PBM,  0L, "Portable Pixel-map (ppm)", "ppm", "PPM" },
     63    { TRUE, BMF_JP2,  0L, "Jpeg 2000 (provided by the Open Source OpenJPEG library) (jp2)", "jp2", "JP2" },
     64    { TRUE, BMF_JBG,  0L, "JBIG Joint Bi-level Image experts Group (jbg)", "jbg", "JBG" },
     65    { TRUE, BMF_RAW,  0L, "Camera RAW Image Format (raw)", "raw", "RAW" },
     66    { TRUE, BMF_DIB,  0L, "Device Independent Bitmap (dib)", "dib", "DIB" }
     67};
     68#endif
     69
    5070PTHTH_SE apse[] =
    5171{
    52     new THTH_SES (SEI_SAVEFILE, "Save", "Filename", "gotcha.bmp"),
    53     new THTH_SES (SEI_FORCESAVEFILE, "Save", "ForceSaveFilename", "force.bmp"),
    54     new THTH_SEL (SEI_SAVESTYLE, "Save", "Style", SAVESTYLE_CLIPBOARD),
    55     new THTH_SEL (SEI_FILEFORMAT, "Save", "FileFormat", BMF_16),
     72    new THTH_SES (SEI_SAVEFILE, "Save", "Filename", "gotcha.png"),
     73    new THTH_SES (SEI_FORCESAVEFILE, "Save", "ForceSaveFilename", "force.png"),
     74    new THTH_SEL (SEI_SAVESTYLE, "Save", "Style", SAVESTYLE_FILE),
     75    new THTH_SEL (SEI_FILEFORMAT, "Save", "FileFormat", BMF_PNG),
    5676    new THTH_SEL (SEI_FILESAVESTYLE, "Save", "FileSaveStyle", FSS_PROMPT),
    5777
     
    133153
    134154        if( pv ) {
    135             if( mmio->pfmmioGetFormats( &mmfi, lNumFormats, pv, &lReturned, 0, 0 )
     155            if( mmioGetFormats( &mmfi, lNumFormats, pv, &lReturned, 0, 0 )
    136156                != MMIO_SUCCESS ) {
    137157                DisplayError( "MMIO-Error",
     
    440460}
    441461
    442 // ** Page1Procedure ****************************************************** /*fold00*/
     462// ** Page1Procedure ****************************************************** /*FOLD00*/
    443463
    444464MRESULT EXPENTRY
     
    494514                           MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);
    495515
    496 /*        switch (pset->QueryFileFormat ())
    497         {
    498         case BMF_20:
    499             WinSendDlgItemMsg (hwnd, WID_RB_BMF20, BM_CLICK,
    500                                MPFROMSHORT(TRUE), 0);
    501             break;
    502         case BMF_12:
    503             WinSendDlgItemMsg (hwnd, WID_RB_BMF12, BM_CLICK,
    504                                MPFROMSHORT(TRUE), 0);
    505             break;
    506         default:
    507             WinSendDlgItemMsg (hwnd, WID_RB_BMF16, BM_CLICK,
    508                                MPFROMSHORT(TRUE), 0);
    509             break;
    510         } */
    511 
    512516        // Select the appropriate entry in the fileformat-listbox.
    513517        HWND     hwndLB = WinWindowFromID( hwnd, WID_LB_FILEFORMAT );
     
    584588                                           MPFROMLONG( ul ), NULL ) );
    585589            pset->SetFileFormat( SHORT( ul ) );
    586 /*            if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_BMF12),
    587                             BM_QUERYCHECK, 0,0))
    588                 pset->SetFileFormat (BMF_12);
    589             else if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_BMF20),
    590                                  BM_QUERYCHECK, 0,0))
    591                 pset->SetFileFormat (BMF_20);
    592             else
    593                 pset->SetFileFormat (BMF_16); */
     590
     591            pset->SetSaveFile(AddExtensionToFilename(pset->QuerySaveFile()));
     592
    594593#ifdef _DOLOGDEBUG_
    595594            LogDebug( "Page1Procedure: checkpoint 2" );
     
    912911                LogDebug( "Page4Procedure: WM_INITDLG: Doing '%s' ...", findbuf.achName );
    913912#endif
    914                 if ((psz = _getext (findbuf.achName)))
     913                if ((psz = strchr (findbuf.achName, '.')))
    915914                    *psz = '\0';
    916915                findbuf.achName[0] = toupper (findbuf.achName[0]);
     
    10711070}
    10721071
    1073 // ** ReloadResources ***************************************************** /*fold00*/
     1072// ** ReloadResources ***************************************************** /*FOLD00*/
    10741073
    10751074BOOL Settings :: ReloadResources (PSZ psz)
     
    10801079    APIRET  rc;
    10811080
    1082     if ((rc = DosLoadModule(PSZ(NULL), 0, psz, &g_hmod)))
     1081    if ((rc = DosLoadModule(PSZ(NULL), 0, "gotresen.dll", &g_hmod)))
    10831082    {
    10841083        DisplayError("ERROR", "Could not (re)load Gotcha! resource module "
     
    10971096
    10981097    for( int i = 0; i < BMF_INVALID; i++ ) {
    1099         ifi[ i ].label = RSTR ( IDS_BITMAP12INTERNAL+i ); }
     1098        ifi[ i ].label = RSTR ( IDS_BMF_JPG+i ); }
    11001099
    11011100    return TRUE;
     
    11171116}
    11181117
    1119 // ** GetLanguages ******************************************************** /*fold00*/
     1118// ** GetLanguages ******************************************************** /*FOLD00*/
    11201119
    11211120USHORT Settings :: GetLanguages (HWND hwnd)
     
    11371136    {
    11381137        // we don't want the extension
    1139         if ((psz = _getext (findbuf.achName)))
     1138        if ((psz = strchr (findbuf.achName, '.')))
    11401139            *psz = '\0';
    11411140        // try opening the dll and read the version etc. data
     
    11611160}
    11621161
    1163 // ** GetFileExtension **************************************************** /*fold00*/
    1164 
    1165 PSZ Settings :: GetFileExtension( SHORT type = BMF_INVALID )
     1162// ** GetFileExtension **************************************************** /*FOLD00*/
     1163
     1164PSZ Settings :: GetFileExtension( SHORT type )
    11661165{
    11671166    if( type == BMF_INVALID )
    11681167        type = SHORT( QueryFileFormat() );
    1169     if( ( type >= BMF_12 ) && ( type < BMF_INVALID ) )
     1168    if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
    11701169        return ifi[ type ].extension;
    11711170    return "";
    11721171}
    11731172
    1174 // ** GetFOURCC *********************************************************** /*fold00*/
    1175 
    1176 FOURCC Settings :: GetFOURCC( SHORT type = BMF_INVALID )
     1173// ** GetFOURCC *********************************************************** /*FOLD00*/
     1174
     1175FOURCC Settings :: GetFOURCC( SHORT type )
    11771176{
    11781177    if( type == BMF_INVALID )
    11791178        type = SHORT( QueryFileFormat() );
    1180     if( ( type >= BMF_12 ) && ( type < BMF_INVALID ) )
     1179    if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
    11811180        return ifi[ type ].fourcc;
    11821181    return 0L;
    11831182}
    11841183
    1185 // ** GetFileEAType ******************************************************* /*fold00*/
    1186 
    1187 PSZ Settings :: GetFileEAType( SHORT type = BMF_INVALID )
     1184// ** GetFileEAType ******************************************************* /*FOLD00*/
     1185
     1186PSZ Settings :: GetFileEAType( SHORT type )
    11881187{
    11891188    if( type == BMF_INVALID )
    11901189        type = SHORT( QueryFileFormat() );
    1191     if( ( type >= BMF_12 ) && ( type < BMF_INVALID ) )
     1190    if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
    11921191        return ifi[ type ].eaType;
    11931192    return "";
  • trunk/settings.h

    r2 r11  
    3535
    3636enum { SAVESTYLE_CLIPBOARD, SAVESTYLE_FILE, };
     37#if 0
    3738enum {
    3839    BMF_12, BMF_16, BMF_20, BMF_OS13, BMF_OS20, BMF_TIF, BMF_TIFU,
     
    4041    BMF_INVALID
    4142};
     43#else
     44enum {
     45    BMF_JPG, BMF_PNG, BMF_OS20, BMF_TIF, BMF_TGA, BMF_PCX, BMF_GIF,
     46    BMF_PBM, BMF_JP2, BMF_JBG, BMF_RAW, BMF_DIB,
     47    BMF_INVALID
     48};
     49#endif
    4250enum { FSS_PROMPT, FSS_NUMFILES, FSS_FORCEFILE, };
    4351
     
    180188// ** inline funcs ******************************************************** /*FOLD00*/
    181189
    182 inline VOID Settings :: SetWindowData (SWP *pswp, BOOL f = TRUE)
     190inline VOID Settings :: SetWindowData (SWP *pswp, BOOL f)
    183191{
    184192    // FIXME puke, yukk, choke! get this flag thing away! do it better!
     
    196204}
    197205
    198 inline thth_MMIO *Settings :: GetMMIO( VOID ) { return mmio; }
     206thth_MMIO *Settings :: GetMMIO( VOID ) { return mmio; }
    199207
    200208// ************************************************************************
Note: See TracChangeset for help on using the changeset viewer.