Start browsing in currently-selected folder (WB)
authorH.G. Muller <h.g.muller@hccnet.nl>
Sun, 2 Dec 2012 10:09:14 +0000 (11:09 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Fri, 7 Dec 2012 21:27:36 +0000 (22:27 +0100)
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).

winboard/woptions.c
winboard/wsettings.c

index 3457b91..90db822 100644 (file)
@@ -2958,6 +2958,20 @@ VOID EnginePlayOptionsPopup(HWND hwnd)
  * UCI Options Dialog functions\r
  *\r
 \*---------------------------------------------------------------------------*/\r
+INT CALLBACK BrowseCallbackProc(HWND hwnd, \r
+                                UINT uMsg,\r
+                                LPARAM lp, \r
+                                LPARAM pData) \r
+{\r
+    switch(uMsg) \r
+    {\r
+      case BFFM_INITIALIZED: \r
+        SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)pData);\r
+        break;\r
+    }\r
+    return 0;\r
+}\r
+\r
 BOOL BrowseForFolder( const char * title, char * path )\r
 {\r
     BOOL result = FALSE;\r
@@ -2968,6 +2982,8 @@ BOOL BrowseForFolder( const char * title, char * path )
 \r
     bi.lpszTitle = title == 0 ? _("Choose Folder") : title;\r
     bi.ulFlags = BIF_RETURNONLYFSDIRS;\r
+    bi.lpfn = BrowseCallbackProc;\r
+    bi.lParam = (LPARAM) path;\r
 \r
     pidl = SHBrowseForFolder( &bi );\r
 \r
index dbfecfe..b3e41cd 100644 (file)
@@ -477,7 +477,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
                                "Image files\0*.bmp\0\0";\r
                          OPENFILENAME ofn;\r
 \r
-                         safeStrCpy( buf, "" , sizeof( buf)/sizeof( buf[0]) );\r
+                         GetDlgItemText( hDlg, i+3, buf, MSG_SIZ );\r
 \r
                          ZeroMemory( &ofn, sizeof(ofn) );\r
 \r
@@ -499,6 +499,7 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
                          }\r
                } else\r
                if(j == -3) {\r
+                   GetDlgItemText( hDlg, i+3, buf, MSG_SIZ );\r
                    if( BrowseForFolder( _("Choose Folder:"), buf ) ) {\r
                        SetDlgItemText( hDlg, i+3, buf );\r
                    }\r