From 45b041a50af4d3475b01bf5f8a196627cd2775cf Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Fri, 6 May 2011 18:59:26 +0200 Subject: [PATCH] Add default extension in file browser --- winboard/wsettings.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/winboard/wsettings.c b/winboard/wsettings.c index e3ddead..d628913 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -396,10 +396,12 @@ GetOptionValues(HWND hDlg, ChessProgramState *cps, Option *optionList) if(!cps && okFunc) ((ButtonCallback*) okFunc)(0); } +char *defaultExt[] = { NULL, "pgn", "fen", "exe", "trn", "bin", "log", "ini" }; + LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { char buf[MSG_SIZ]; - int i, j; + int i, j, ext; switch( message ) { @@ -445,7 +447,8 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa ofn.hwndOwner = hDlg; ofn.hInstance = hInst; ofn.lpstrFilter = filter; - ofn.nFilterIndex = 1L + (activeCps ? 0 : activeList[layoutList[(i-2000)/2+1]].max); + ofn.nFilterIndex = 1L + (ext = activeCps ? 0 : activeList[layoutList[(i-2000)/2+1]].max); + ofn.lpstrDefExt = defaultExt[ext]; ofn.lpstrFile = buf; ofn.nMaxFile = sizeof(buf); ofn.lpstrTitle = _("Choose File"); -- 1.7.0.4