From: H.G. Muller Date: Sun, 2 Dec 2012 10:09:14 +0000 (+0100) Subject: Start browsing in currently-selected folder (WB) X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=75a6740777dacce0256aa85aecfad5c9861ac5b5;p=xboard.git Start browsing in currently-selected folder (WB) The folder-browse dialog always started at My Computer, while file browsing started in the globally last-used folder (which might not be related at all to the file entry we are now browsing for). --- diff --git a/winboard/woptions.c b/winboard/woptions.c index 3457b91..90db822 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -2958,6 +2958,20 @@ VOID EnginePlayOptionsPopup(HWND hwnd) * UCI Options Dialog functions * \*---------------------------------------------------------------------------*/ +INT CALLBACK BrowseCallbackProc(HWND hwnd, + UINT uMsg, + LPARAM lp, + LPARAM pData) +{ + switch(uMsg) + { + case BFFM_INITIALIZED: + SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)pData); + break; + } + return 0; +} + BOOL BrowseForFolder( const char * title, char * path ) { BOOL result = FALSE; @@ -2968,6 +2982,8 @@ BOOL BrowseForFolder( const char * title, char * path ) bi.lpszTitle = title == 0 ? _("Choose Folder") : title; bi.ulFlags = BIF_RETURNONLYFSDIRS; + bi.lpfn = BrowseCallbackProc; + bi.lParam = (LPARAM) path; pidl = SHBrowseForFolder( &bi ); diff --git a/winboard/wsettings.c b/winboard/wsettings.c index dbfecfe..b3e41cd 100644 --- a/winboard/wsettings.c +++ b/winboard/wsettings.c @@ -477,7 +477,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa "Image files\0*.bmp\0\0"; OPENFILENAME ofn; - safeStrCpy( buf, "" , sizeof( buf)/sizeof( buf[0]) ); + GetDlgItemText( hDlg, i+3, buf, MSG_SIZ ); ZeroMemory( &ofn, sizeof(ofn) ); @@ -499,6 +499,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa } } else if(j == -3) { + GetDlgItemText( hDlg, i+3, buf, MSG_SIZ ); if( BrowseForFolder( _("Choose Folder:"), buf ) ) { SetDlgItemText( hDlg, i+3, buf ); }