Made the buttons in the filedlg change when selecting a different
view type by the context menu, cleanup.

diff --git a/dlls/commdlg/cdlg.h b/dlls/commdlg/cdlg.h
index 4fd5b0f..d4eccd3 100644
--- a/dlls/commdlg/cdlg.h
+++ b/dlls/commdlg/cdlg.h
@@ -7,6 +7,8 @@
 #ifndef _WINE_DLL_CDLG_H
 #define _WINE_DLL_CDLG_H
 
+#include "dlgs.h"
+
 /*---------------- 16-bit ----------------*/
 extern HINSTANCE16	COMMDLG_hInstance;
 extern HINSTANCE	COMMDLG_hInstance32;
diff --git a/dlls/commdlg/filedlg95.c b/dlls/commdlg/filedlg95.c
index f100790..c7ed801 100644
--- a/dlls/commdlg/filedlg95.c
+++ b/dlls/commdlg/filedlg95.c
@@ -921,22 +921,24 @@
   case IDC_LOOKIN:
     FILEDLG95_LOOKIN_OnCommand(hwnd,wNotifyCode);
     break;
+
+  /* --- toolbar --- */
     /* Up folder button */
-  case IDC_UPFOLDER:
+  case FCIDM_TB_UPFOLDER:
     FILEDLG95_SHELL_UpFolder(hwnd);
     break;
+    /* New folder button */
+  case FCIDM_TB_NEWFOLDER:
+    FILEDLG95_SHELL_NewFolder(hwnd);
+    break;
     /* List option button */
-  case IDC_LIST:
+  case FCIDM_TB_SMALLICON:
     FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_VIEWLIST);
     break;
     /* Details option button */
-  case IDC_DETAILS:
+  case FCIDM_TB_REPORTVIEW:
     FILEDLG95_SHELL_ExecuteCommand(hwnd,CMDSTR_VIEWDETAILS);
     break;
-    /* New folder button */
-  case IDC_NEWFOLDER:
-    FILEDLG95_SHELL_NewFolder(hwnd);
-    break;
 
   case IDC_FILENAME:
     break;
@@ -972,12 +974,12 @@
 static LRESULT FILEDLG95_InitUI(HWND hwnd)
 {
   TBBUTTON tbb[] =
-  {{VIEW_PARENTFOLDER, IDC_UPFOLDER, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
-   {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
-   {VIEW_NEWFOLDER, IDC_NEWFOLDER, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
-   {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
-   {VIEW_LIST, IDC_LIST, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
-   {VIEW_DETAILS, IDC_DETAILS, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
+  {{VIEW_PARENTFOLDER, FCIDM_TB_UPFOLDER,   TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
+   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
+   {VIEW_NEWFOLDER,    FCIDM_TB_NEWFOLDER,  TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
+   {0,                 0,                   TBSTATE_ENABLED, TBSTYLE_SEP, {0, 0}, 0, 0 },
+   {VIEW_LIST,         FCIDM_TB_SMALLICON,  TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
+   {VIEW_DETAILS,      FCIDM_TB_REPORTVIEW, TBSTATE_ENABLED, TBSTYLE_BUTTON, {0, 0}, 0, 0 },
   };
   RECT rectTB;
   
diff --git a/dlls/commdlg/filedlgbrowser.c b/dlls/commdlg/filedlgbrowser.c
index 6c4eeeb..1c487f1 100644
--- a/dlls/commdlg/filedlgbrowser.c
+++ b/dlls/commdlg/filedlgbrowser.c
@@ -503,11 +503,21 @@
                                               
 {
     ICOM_THIS(IShellBrowserImpl, iface);
+    LRESULT lres;
+    
+    TRACE("(%p)->(0x%08x 0x%08x 0x%08x 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);
 
-    TRACE("(%p)\n", This);
-
-    /* Feature not implemented */
-    return E_NOTIMPL;
+    switch (id)
+    {
+      case FCW_TOOLBAR:
+        lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
+	break;
+      default:
+        FIXME("ctrl id: %x\n", id);
+        return E_NOTIMPL;
+    }
+    if (pret) *pret = lres;
+    return S_OK;
 }
 /**************************************************************************
 *  IShellBrowserImpl_SetMenuSB
diff --git a/dlls/commdlg/filedlgbrowser.h b/dlls/commdlg/filedlgbrowser.h
index ca0572f..809f06b 100644
--- a/dlls/commdlg/filedlgbrowser.h
+++ b/dlls/commdlg/filedlgbrowser.h
@@ -69,6 +69,40 @@
 } FileOpenDlgInfos;
 
 /***********************************************************************
+ * Control ID's
+ */
+#define IDS_ABOUTBOX                    101
+#define IDS_DOCUMENTFOLDERS             102
+#define IDS_PERSONAL                    103
+#define IDS_FAVORITES                   104
+#define IDS_PATH                        105
+#define IDS_DESKTOP                     106
+
+#define IDS_FONTS                       108
+#define IDS_MYCOMPUTER                  110
+#define IDS_SYSTEMFOLDERS               112
+#define IDS_LOCALHARDRIVES              113
+#define IDS_FILENOTFOUND                114
+#define IDS_VERIFYFILE                  115
+#define IDS_CREATEFILE                  116
+
+#define IDC_OPENREADONLY                chx1
+
+#define IDC_TOOLBARSTATIC		stc1
+#define IDC_FILETYPESTATIC              stc2
+#define IDC_FILENAMESTATIC              stc3
+#define IDC_LOOKINSTATIC                stc4
+
+#define IDC_SHELLSTATIC                 lst1
+
+#define IDC_FILETYPE                    cmb1
+#define IDC_LOOKIN                      cmb2
+
+#define IDC_FILENAME                    edt1
+
+#define IDC_TOOLBAR			ctl1
+
+/***********************************************************************
  * Prototypes for the methods of the IShellBrowserImpl class
  */
 /* Constructor */
diff --git a/dlls/commdlg/rsrc.rc b/dlls/commdlg/rsrc.rc
index 5f8b365..c63171e 100644
--- a/dlls/commdlg/rsrc.rc
+++ b/dlls/commdlg/rsrc.rc
@@ -5,9 +5,9 @@
 
 #include "winuser.h"
 #include "winnls.h"
-#include "dlgs.h"
 #include "cdlg.h"
 #include "winspool.h"
+#include "filedlgbrowser.h"
 
 /*
  * Everything that does not depend on language,
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index 0913e5b..b73a004 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -207,11 +207,7 @@
 	return ret;
 }
 /**********************************************************
- *
- * ##### helperfunctions for initializing the view #####
- */
-/**********************************************************
- *	set the toolbar buttons
+ *	set the toolbar of the filedialog buttons
  */
 static void CheckToolbar(IShellViewImpl * This)
 {
@@ -219,17 +215,24 @@
 
 	TRACE("\n");
 	
-	IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
+	if (IsInCommDlg(This))
+	{
+	  IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
 		FCIDM_TB_SMALLICON, (This->FolderSettings.ViewMode==FVM_LIST)? TRUE : FALSE, &result);
-	IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
+	  IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_CHECKBUTTON,
 		FCIDM_TB_REPORTVIEW, (This->FolderSettings.ViewMode==FVM_DETAILS)? TRUE : FALSE, &result);
-	IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
+	  IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
 		FCIDM_TB_SMALLICON, TRUE, &result);
-	IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
+	  IShellBrowser_SendControlMsg(This->pShellBrowser, FCW_TOOLBAR, TB_ENABLEBUTTON,
 		FCIDM_TB_REPORTVIEW, TRUE, &result);
+	}
 }
 
 /**********************************************************
+ *
+ * ##### helperfunctions for initializing the view #####
+ */
+/**********************************************************
  *	change the style of the listview control
  */
 static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
@@ -960,21 +963,25 @@
 	  case FCIDM_SHVIEW_SMALLICON:
 	    This->FolderSettings.ViewMode = FVM_SMALLICON;
 	    SetStyle (This, LVS_SMALLICON, LVS_TYPEMASK);
+	    CheckToolbar(This);
 	    break;
 
 	  case FCIDM_SHVIEW_BIGICON:
 	    This->FolderSettings.ViewMode = FVM_ICON;
 	    SetStyle (This, LVS_ICON, LVS_TYPEMASK);
+	    CheckToolbar(This);
 	    break;
 
 	  case FCIDM_SHVIEW_LISTVIEW:
 	    This->FolderSettings.ViewMode = FVM_LIST;
 	    SetStyle (This, LVS_LIST, LVS_TYPEMASK);
+	    CheckToolbar(This);
 	    break;
 
 	  case FCIDM_SHVIEW_REPORTVIEW:
 	    This->FolderSettings.ViewMode = FVM_DETAILS;
 	    SetStyle (This, LVS_REPORT, LVS_TYPEMASK);
+	    CheckToolbar(This);
 	    break;
 
 	  /* the menu-ID's for sorting are 0x30... see shrec.rc */
@@ -986,7 +993,6 @@
 	    This->ListViewSortInfo.bIsAscending = TRUE;
 	    This->ListViewSortInfo.nLastHeaderID = This->ListViewSortInfo.nHeaderID;
 	    ListView_SortItems(This->hWndList, ShellView_ListViewCompareItems, (LPARAM) (&(This->ListViewSortInfo)));
-	    CheckToolbar(This);
 	    break;
 	    
 	  default:
diff --git a/include/dlgs.h b/include/dlgs.h
index 261978c..5e16c81 100644
--- a/include/dlgs.h
+++ b/include/dlgs.h
@@ -196,42 +196,4 @@
 #define COLORMGMTDLGORD		1551
 #define NEWFILEOPENV2ORD	1552
 
-/* fixme: move away */
-#define IDS_ABOUTBOX                    101
-#define IDS_DOCUMENTFOLDERS             102
-#define IDS_PERSONAL                    103
-#define IDS_FAVORITES                   104
-#define IDS_PATH                        105
-#define IDS_DESKTOP                     106
-
-#define IDS_FONTS                       108
-#define IDS_MYCOMPUTER                  110
-#define IDS_SYSTEMFOLDERS               112
-#define IDS_LOCALHARDRIVES              113
-#define IDS_FILENOTFOUND                114
-#define IDS_VERIFYFILE                  115
-#define IDS_CREATEFILE                  116
-
-#define IDC_OPENREADONLY                chx1
-
-#define IDC_TOOLBARSTATIC		stc1
-#define IDC_FILETYPESTATIC              stc2
-#define IDC_FILENAMESTATIC              stc3
-#define IDC_LOOKINSTATIC                stc4
-
-#define IDC_SHELLSTATIC                 lst1
-
-#define IDC_FILETYPE                    cmb1
-#define IDC_LOOKIN                      cmb2
-
-#define IDC_FILENAME                    edt1
-
-/* fixme: replace with FCIDM_* constants */
-#define IDC_UPFOLDER                    1009
-#define IDC_NEWFOLDER                   1010
-#define IDC_LIST                        1011
-#define IDC_DETAILS                     1012
-
-#define IDC_TOOLBAR			ctl1
-
 #endif  /* #ifdef __WINE_DLGS_H */
diff --git a/include/wine/obj_shellview.h b/include/wine/obj_shellview.h
index 29cbfd2..63a3f0d 100644
--- a/include/wine/obj_shellview.h
+++ b/include/wine/obj_shellview.h
@@ -72,6 +72,8 @@
 #define FCIDM_SHVIEWLAST	0x7fff
 #define FCIDM_BROWSERFIRST	0xA000
 /* undocumented toolbar items from stddlg's*/
+#define FCIDM_TB_UPFOLDER	0xA001
+#define FCIDM_TB_NEWFOLDER	0xA002
 #define FCIDM_TB_SMALLICON	0xA003
 #define FCIDM_TB_REPORTVIEW	0xA004