Add default extension in file browser
[xboard.git] / winboard / wsettings.c
index e3ddead..d628913 100644 (file)
@@ -396,10 +396,12 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList)
     if(!cps && okFunc) ((ButtonCallback*) okFunc)(0);\r
 }\r
 \r
+char *defaultExt[] = { NULL, "pgn", "fen", "exe", "trn", "bin", "log", "ini" };\r
+\r
 LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
 {\r
     char buf[MSG_SIZ];\r
-    int i, j;\r
+    int i, j, ext;\r
 \r
     switch( message )\r
     {\r
@@ -445,7 +447,8 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
                          ofn.hwndOwner = hDlg;\r
                          ofn.hInstance = hInst;\r
                          ofn.lpstrFilter = filter;\r
-                         ofn.nFilterIndex      = 1L + (activeCps ? 0 : activeList[layoutList[(i-2000)/2+1]].max);\r
+                         ofn.nFilterIndex      = 1L + (ext = activeCps ? 0 : activeList[layoutList[(i-2000)/2+1]].max);\r
+                         ofn.lpstrDefExt       = defaultExt[ext];\r
                          ofn.lpstrFile = buf;\r
                          ofn.nMaxFile = sizeof(buf);\r
                          ofn.lpstrTitle = _("Choose File");\r