work around GCC's wide string constant bug to fix tree list image loading

svn path=/trunk/; revision=18227
This commit is contained in:
Martin Fuchs 2005-10-02 18:28:36 +00:00
parent 0732c808f0
commit 723b42a105
4 changed files with 38 additions and 20 deletions

View file

@ -224,7 +224,7 @@ MainFrameBase::MainFrameBase(HWND hwnd)
WS_CHILD|WS_TABSTOP|WS_BORDER|/*WS_VISIBLE|*/WS_CHILD|TVS_HASLINES|TVS_HASBUTTONS|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(HWND hwnd)
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 @@ LRESULT MDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
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 @@ LRESULT MDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
} 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 @@ LRESULT MDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
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 @@ LRESULT SDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
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 @@ LRESULT SDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
} 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 @@ LRESULT SDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
*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:

View file

@ -52,15 +52,16 @@ struct MainFrameBase : public PreTranslateWindow
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);

View file

@ -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(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd,
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 @@ void ShellBrowser::InitializeTree(HIMAGELIST himl)
{
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;

View file

@ -148,6 +148,7 @@ protected:
WindowHandle& _right_hwnd;
ShellPathInfo& _create_info;
HIMAGELIST _himl;
HIMAGELIST _himl_old;
BrowserCallback* _callback;
WindowHandle _hWndFrame;
@ -175,6 +176,15 @@ protected:
};
#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 @@ template<typename BASE> struct ShellBrowserChildT
{
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: