Add default extension in file browser
authorH.G. Muller <h.g.muller@hccnet.nl>
Fri, 6 May 2011 16:59:26 +0000 (18:59 +0200)
committerH.G. Muller <h.g.muller@hccnet.nl>
Sat, 7 May 2011 12:50:27 +0000 (14:50 +0200)
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