work around GCC's wide string constant bug to fix tree list image
loading
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.h
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.h
_____
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
--- trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
2005-10-02 18:00:04 UTC (rev 18226)
+++ trunk/reactos/subsys/system/explorer/shell/mainframe.cpp
2005-10-02 18:28:36 UTC (rev 18227)
@@ -224,7 +224,7 @@
WS_CHILD|WS_TABSTOP|WS_BORDER|/*WS_VISIBLE|*/WS_CHILD|TVS_HASLINES|TVS_H
ASBUTTONS|TVS_SHOWSELALWAYS|TVS_INFOTIP,
-1, -1, 200, 0, _hwnd,
(HMENU)IDW_SIDEBAR, g_Globals._hInstance, 0);
- (void)TreeView_SetImageList(_hsidebar, _himl, TVSIL_NORMAL);
+ _himl_old = TreeView_SetImageList(_hsidebar, _himl,
TVSIL_NORMAL);
CheckMenuItem(_menu_info._hMenuView, ID_VIEW_SIDE_BAR,
MF_BYCOMMAND|MF_UNCHECKED/*MF_CHECKED*/);
@@ -266,6 +266,7 @@
MainFrameBase::~MainFrameBase()
{
+ (void)TreeView_SetImageList(_hsidebar, _himl_old, TVSIL_NORMAL);
ImageList_Destroy(_himl);
// don't exit desktop when closing file manager window
@@ -914,13 +915,13 @@
TCHAR buffer[MAX_PATH];
LPCTSTR path;
- ShellPath shell_path = DesktopFolderPath();
+ ShellPath root_path = DesktopFolderPath();
if (lparam) {
if (wparam & OWM_PIDL) {
// take over PIDL from lparam
-
shell_path.assign((LPCITEMIDLIST)lparam); // create as "rooted"
window
- FileSysShellPath fsp(shell_path);
+ root_path.assign((LPCITEMIDLIST)lparam);
// create as "rooted" window
+ FileSysShellPath fsp(root_path);
path = fsp;
if (path) {
@@ -931,7 +932,7 @@
} else {
// take over path from lparam
path = (LPCTSTR)lparam;
- shell_path = path; // create as
"rooted" window
+ root_path = path; // create as
"rooted" window
}
} else {
///@todo read paths and window placements from
registry
@@ -949,7 +950,7 @@
OBJ_CONTEXT("create ShellChildWndInfo", path);
// Shell Namespace as default view
- ShellChildWndInfo create_info(_hmdiclient, path,
shell_path);
+ ShellChildWndInfo create_info(_hmdiclient, path,
root_path);
create_info._pos.showCmd = wparam&OWM_SEPARATE?
SW_SHOWNORMAL: SW_SHOWMAXIMIZED;
create_info._pos.rcNormalPosition.left =
CW_USEDEFAULT;
@@ -1442,13 +1443,13 @@
TCHAR buffer[MAX_PATH];
LPCTSTR path;
- ShellPath shell_path = DesktopFolderPath();
+ ShellPath root_path = DesktopFolderPath();
if (lparam) {
if (wparam & OWM_PIDL) {
// take over PIDL from lparam
-
shell_path.assign((LPCITEMIDLIST)lparam); // create as "rooted"
window
- FileSysShellPath fsp(shell_path);
+ root_path.assign((LPCITEMIDLIST)lparam);
// create as "rooted" window
+ FileSysShellPath fsp(root_path);
path = fsp;
if (path) {
@@ -1459,7 +1460,7 @@
} else {
// take over path from lparam
path = (LPCTSTR)lparam;
- shell_path = path; // create as
"rooted" window
+ root_path = path; // create as
"rooted" window
}
} else {
///@todo read paths and window placements from
registry
@@ -1467,10 +1468,10 @@
*buffer = '\0';
path = buffer;
- shell_path = path;
+ root_path = path;
}
- jump_to(shell_path, (OPEN_WINDOW_MODE)wparam); //@todo
content of 'path' not used any more
+ jump_to(root_path, (OPEN_WINDOW_MODE)wparam); //@todo
content of 'path' not used any more
return TRUE;} // success
default: def:
_____
Modified: trunk/reactos/subsys/system/explorer/shell/mainframe.h
--- trunk/reactos/subsys/system/explorer/shell/mainframe.h
2005-10-02 18:00:04 UTC (rev 18226)
+++ trunk/reactos/subsys/system/explorer/shell/mainframe.h
2005-10-02 18:28:36 UTC (rev 18227)
@@ -52,15 +52,16 @@
WindowHandle _hsidebar;
HIMAGELIST _himl;
- HMENU _hMenuFrame;
- HMENU _hMenuWindow;
+ HMENU _hMenuFrame;
+ HMENU _hMenuWindow;
- MenuInfo _menu_info;
+ MenuInfo _menu_info;
protected:
FullScreenParameters _fullscreen;
- HACCEL _hAccel;
+ HACCEL _hAccel;
+ HIMAGELIST _himl_old;
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
bool ProcessMessage(UINT nmsg, WPARAM wparam, LPARAM lparam,
LRESULT* pres);
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
--- trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
2005-10-02 18:00:04 UTC (rev 18226)
+++ trunk/reactos/subsys/system/explorer/shell/shellbrowser.cpp
2005-10-02 18:28:36 UTC (rev 18227)
@@ -31,6 +31,12 @@
#include "../resource.h"
+ // work around GCC's wide string constant bug
+#ifdef __GNUC__
+const LPCTSTR C_DRIVE = C_DRIVE_STR;
+#endif
+
+
ShellBrowser::ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle&
right_hwnd, ShellPathInfo& create_info,
HIMAGELIST himl,
BrowserCallback* cb, CtxMenuInterfaces& cm_ifs)
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of
25.09.2005)
@@ -55,7 +61,7 @@
ShellBrowser::~ShellBrowser()
{
- (void)TreeView_SetImageList(_left_hwnd, 0, TVSIL_NORMAL);
+ (void)TreeView_SetImageList(_left_hwnd, _himl_old,
TVSIL_NORMAL);
if (_pShellView)
_pShellView->Release();
@@ -146,7 +152,7 @@
{
CONTEXT("ShellBrowserChild::InitializeTree()");
- (void)TreeView_SetImageList(_left_hwnd, himl, TVSIL_NORMAL);
+ _himl_old = TreeView_SetImageList(_left_hwnd, himl,
TVSIL_NORMAL);
TreeView_SetScrollTime(_left_hwnd, 100);
TV_INSERTSTRUCT tvInsert;
_____
Modified: trunk/reactos/subsys/system/explorer/shell/shellbrowser.h
--- trunk/reactos/subsys/system/explorer/shell/shellbrowser.h
2005-10-02 18:00:04 UTC (rev 18226)
+++ trunk/reactos/subsys/system/explorer/shell/shellbrowser.h
2005-10-02 18:28:36 UTC (rev 18227)
@@ -148,6 +148,7 @@
WindowHandle& _right_hwnd;
ShellPathInfo& _create_info;
HIMAGELIST _himl;
+ HIMAGELIST _himl_old;
BrowserCallback* _callback;
WindowHandle _hWndFrame;
@@ -175,6 +176,15 @@
};
+#define C_DRIVE_STR TEXT("C:\\")
+
+ // work around GCC's wide string constant bug
+#ifdef __GNUC__
+extern const LPCTSTR C_DRIVE;
+#else
+#define C_DRIVE C_DRIVE_STR
+#endif
+
template<typename BASE> struct ShellBrowserChildT
: public BASE, public BrowserCallback
{
@@ -198,8 +208,8 @@
{
SHFILEINFO sfi;
- _himlSmall = (HIMAGELIST)SHGetFileInfo(TEXT("C:\\"), 0,
&sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
-// _himlLarge = (HIMAGELIST)SHGetFileInfo(TEXT("C:\\"), 0,
&sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_LARGEICON);
+ _himlSmall = (HIMAGELIST)SHGetFileInfo(C_DRIVE, 0, &sfi,
sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
+// _himlLarge = (HIMAGELIST)SHGetFileInfo(C_DRIVE, 0, &sfi,
sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_LARGEICON);
}
protected: