Index: trunk/settings.cpp
===================================================================
--- trunk/settings.cpp	(revision 2)
+++ trunk/settings.cpp	(revision 11)
@@ -17,5 +17,5 @@
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  ***/
-
+#include <direct.h>
 #include "settings.h"
 #include "ctype.h"
@@ -32,4 +32,5 @@
 USHORT ausDefSSW[7] = { 0 };
 
+#if 0
 ImageFormatInfo Settings::ifi[BMF_INVALID] =
 {
@@ -48,10 +49,29 @@
 };
 
+#else
+// pbm and gif don't save anything
+ImageFormatInfo Settings::ifi[BMF_INVALID] =
+{
+    { TRUE, BMF_JPG,  0L, "JPEG Interchange File Format (jpg)", "jpg", "JPG" },
+    { TRUE, BMF_PNG,  0L, "Portable Network Graphics (png)", "png", "PNG" },
+    { TRUE, BMF_OS20, 0L, "OS/2 Bitmap 2.0 (bmp)", "bmp", "Bitmap" },
+    { TRUE, BMF_TIF,  0L, "Microsoft/Aldus Tagged Image File Format (tif)", "tif", "TIFF" },
+    { TRUE, BMF_TGA,  0L, "Truevision Targa/Vista (tga)", "tga", "Targa" },
+    { TRUE, BMF_PCX,  0L, "ZSoft PC Paintbrush Image Format (pcx)", "pcx", "PCX" },
+    { TRUE, BMF_GIF,  0L, "Portable Anymap (pnm)", "pnm", "PNM" },
+    { TRUE, BMF_PBM,  0L, "Portable Pixel-map (ppm)", "ppm", "PPM" },
+    { TRUE, BMF_JP2,  0L, "Jpeg 2000 (provided by the Open Source OpenJPEG library) (jp2)", "jp2", "JP2" },
+    { TRUE, BMF_JBG,  0L, "JBIG Joint Bi-level Image experts Group (jbg)", "jbg", "JBG" },
+    { TRUE, BMF_RAW,  0L, "Camera RAW Image Format (raw)", "raw", "RAW" },
+    { TRUE, BMF_DIB,  0L, "Device Independent Bitmap (dib)", "dib", "DIB" }
+};
+#endif
+
 PTHTH_SE apse[] =
 {
-    new THTH_SES (SEI_SAVEFILE, "Save", "Filename", "gotcha.bmp"),
-    new THTH_SES (SEI_FORCESAVEFILE, "Save", "ForceSaveFilename", "force.bmp"),
-    new THTH_SEL (SEI_SAVESTYLE, "Save", "Style", SAVESTYLE_CLIPBOARD),
-    new THTH_SEL (SEI_FILEFORMAT, "Save", "FileFormat", BMF_16),
+    new THTH_SES (SEI_SAVEFILE, "Save", "Filename", "gotcha.png"),
+    new THTH_SES (SEI_FORCESAVEFILE, "Save", "ForceSaveFilename", "force.png"),
+    new THTH_SEL (SEI_SAVESTYLE, "Save", "Style", SAVESTYLE_FILE),
+    new THTH_SEL (SEI_FILEFORMAT, "Save", "FileFormat", BMF_PNG),
     new THTH_SEL (SEI_FILESAVESTYLE, "Save", "FileSaveStyle", FSS_PROMPT),
 
@@ -133,5 +153,5 @@
 
         if( pv ) {
-            if( mmio->pfmmioGetFormats( &mmfi, lNumFormats, pv, &lReturned, 0, 0 )
+            if( mmioGetFormats( &mmfi, lNumFormats, pv, &lReturned, 0, 0 )
                 != MMIO_SUCCESS ) {
                 DisplayError( "MMIO-Error",
@@ -440,5 +460,5 @@
 }
 
-// ** Page1Procedure ****************************************************** /*fold00*/
+// ** Page1Procedure ****************************************************** /*FOLD00*/
 
 MRESULT EXPENTRY
@@ -494,20 +514,4 @@
                            MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);
 
-/*        switch (pset->QueryFileFormat ())
-        {
-        case BMF_20:
-            WinSendDlgItemMsg (hwnd, WID_RB_BMF20, BM_CLICK,
-                               MPFROMSHORT(TRUE), 0);
-            break;
-        case BMF_12:
-            WinSendDlgItemMsg (hwnd, WID_RB_BMF12, BM_CLICK,
-                               MPFROMSHORT(TRUE), 0);
-            break;
-        default:
-            WinSendDlgItemMsg (hwnd, WID_RB_BMF16, BM_CLICK,
-                               MPFROMSHORT(TRUE), 0);
-            break;
-        } */
-
         // Select the appropriate entry in the fileformat-listbox.
         HWND     hwndLB = WinWindowFromID( hwnd, WID_LB_FILEFORMAT );
@@ -584,12 +588,7 @@
                                            MPFROMLONG( ul ), NULL ) );
             pset->SetFileFormat( SHORT( ul ) );
-/*            if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_BMF12),
-                            BM_QUERYCHECK, 0,0))
-                pset->SetFileFormat (BMF_12);
-            else if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_BMF20),
-                                 BM_QUERYCHECK, 0,0))
-                pset->SetFileFormat (BMF_20);
-            else
-                pset->SetFileFormat (BMF_16); */
+
+            pset->SetSaveFile(AddExtensionToFilename(pset->QuerySaveFile()));
+
 #ifdef _DOLOGDEBUG_
             LogDebug( "Page1Procedure: checkpoint 2" );
@@ -912,5 +911,5 @@
                 LogDebug( "Page4Procedure: WM_INITDLG: Doing '%s' ...", findbuf.achName );
 #endif
-                if ((psz = _getext (findbuf.achName)))
+                if ((psz = strchr (findbuf.achName, '.')))
                     *psz = '\0';
                 findbuf.achName[0] = toupper (findbuf.achName[0]);
@@ -1071,5 +1070,5 @@
 }
 
-// ** ReloadResources ***************************************************** /*fold00*/
+// ** ReloadResources ***************************************************** /*FOLD00*/
 
 BOOL Settings :: ReloadResources (PSZ psz)
@@ -1080,5 +1079,5 @@
     APIRET  rc;
 
-    if ((rc = DosLoadModule(PSZ(NULL), 0, psz, &g_hmod)))
+    if ((rc = DosLoadModule(PSZ(NULL), 0, "gotresen.dll", &g_hmod)))
     {
         DisplayError("ERROR", "Could not (re)load Gotcha! resource module "
@@ -1097,5 +1096,5 @@
 
     for( int i = 0; i < BMF_INVALID; i++ ) {
-        ifi[ i ].label = RSTR ( IDS_BITMAP12INTERNAL+i ); }
+        ifi[ i ].label = RSTR ( IDS_BMF_JPG+i ); }
 
     return TRUE;
@@ -1117,5 +1116,5 @@
 }
 
-// ** GetLanguages ******************************************************** /*fold00*/
+// ** GetLanguages ******************************************************** /*FOLD00*/
 
 USHORT Settings :: GetLanguages (HWND hwnd)
@@ -1137,5 +1136,5 @@
     {
         // we don't want the extension
-        if ((psz = _getext (findbuf.achName)))
+        if ((psz = strchr (findbuf.achName, '.')))
             *psz = '\0';
         // try opening the dll and read the version etc. data
@@ -1161,33 +1160,33 @@
 }
 
-// ** GetFileExtension **************************************************** /*fold00*/
-
-PSZ Settings :: GetFileExtension( SHORT type = BMF_INVALID )
+// ** GetFileExtension **************************************************** /*FOLD00*/
+
+PSZ Settings :: GetFileExtension( SHORT type )
 {
     if( type == BMF_INVALID )
         type = SHORT( QueryFileFormat() );
-    if( ( type >= BMF_12 ) && ( type < BMF_INVALID ) )
+    if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
         return ifi[ type ].extension;
     return "";
 }
 
-// ** GetFOURCC *********************************************************** /*fold00*/
-
-FOURCC Settings :: GetFOURCC( SHORT type = BMF_INVALID )
+// ** GetFOURCC *********************************************************** /*FOLD00*/
+
+FOURCC Settings :: GetFOURCC( SHORT type )
 {
     if( type == BMF_INVALID )
         type = SHORT( QueryFileFormat() );
-    if( ( type >= BMF_12 ) && ( type < BMF_INVALID ) )
+    if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
         return ifi[ type ].fourcc;
     return 0L;
 }
 
-// ** GetFileEAType ******************************************************* /*fold00*/
-
-PSZ Settings :: GetFileEAType( SHORT type = BMF_INVALID )
+// ** GetFileEAType ******************************************************* /*FOLD00*/
+
+PSZ Settings :: GetFileEAType( SHORT type )
 {
     if( type == BMF_INVALID )
         type = SHORT( QueryFileFormat() );
-    if( ( type >= BMF_12 ) && ( type < BMF_INVALID ) )
+    if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
         return ifi[ type ].eaType;
     return "";
