mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
work around GCC's wide string constant bug to fix tree list image loading
svn path=/trunk/; revision=18227
This commit is contained in:
parent
0732c808f0
commit
723b42a105
4 changed files with 38 additions and 20 deletions
|
@ -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,
|
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);
|
-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*/);
|
CheckMenuItem(_menu_info._hMenuView, ID_VIEW_SIDE_BAR, MF_BYCOMMAND|MF_UNCHECKED/*MF_CHECKED*/);
|
||||||
|
|
||||||
|
@ -266,6 +266,7 @@ MainFrameBase::MainFrameBase(HWND hwnd)
|
||||||
|
|
||||||
MainFrameBase::~MainFrameBase()
|
MainFrameBase::~MainFrameBase()
|
||||||
{
|
{
|
||||||
|
(void)TreeView_SetImageList(_hsidebar, _himl_old, TVSIL_NORMAL);
|
||||||
ImageList_Destroy(_himl);
|
ImageList_Destroy(_himl);
|
||||||
|
|
||||||
// don't exit desktop when closing file manager window
|
// 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];
|
TCHAR buffer[MAX_PATH];
|
||||||
LPCTSTR path;
|
LPCTSTR path;
|
||||||
ShellPath shell_path = DesktopFolderPath();
|
ShellPath root_path = DesktopFolderPath();
|
||||||
|
|
||||||
if (lparam) {
|
if (lparam) {
|
||||||
if (wparam & OWM_PIDL) {
|
if (wparam & OWM_PIDL) {
|
||||||
// take over PIDL from lparam
|
// take over PIDL from lparam
|
||||||
shell_path.assign((LPCITEMIDLIST)lparam); // create as "rooted" window
|
root_path.assign((LPCITEMIDLIST)lparam); // create as "rooted" window
|
||||||
FileSysShellPath fsp(shell_path);
|
FileSysShellPath fsp(root_path);
|
||||||
path = fsp;
|
path = fsp;
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
|
@ -931,7 +932,7 @@ LRESULT MDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
} else {
|
} else {
|
||||||
// take over path from lparam
|
// take over path from lparam
|
||||||
path = (LPCTSTR)lparam;
|
path = (LPCTSTR)lparam;
|
||||||
shell_path = path; // create as "rooted" window
|
root_path = path; // create as "rooted" window
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
///@todo read paths and window placements from registry
|
///@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);
|
OBJ_CONTEXT("create ShellChildWndInfo", path);
|
||||||
|
|
||||||
// Shell Namespace as default view
|
// 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.showCmd = wparam&OWM_SEPARATE? SW_SHOWNORMAL: SW_SHOWMAXIMIZED;
|
||||||
create_info._pos.rcNormalPosition.left = CW_USEDEFAULT;
|
create_info._pos.rcNormalPosition.left = CW_USEDEFAULT;
|
||||||
|
@ -1442,13 +1443,13 @@ LRESULT SDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
|
|
||||||
TCHAR buffer[MAX_PATH];
|
TCHAR buffer[MAX_PATH];
|
||||||
LPCTSTR path;
|
LPCTSTR path;
|
||||||
ShellPath shell_path = DesktopFolderPath();
|
ShellPath root_path = DesktopFolderPath();
|
||||||
|
|
||||||
if (lparam) {
|
if (lparam) {
|
||||||
if (wparam & OWM_PIDL) {
|
if (wparam & OWM_PIDL) {
|
||||||
// take over PIDL from lparam
|
// take over PIDL from lparam
|
||||||
shell_path.assign((LPCITEMIDLIST)lparam); // create as "rooted" window
|
root_path.assign((LPCITEMIDLIST)lparam); // create as "rooted" window
|
||||||
FileSysShellPath fsp(shell_path);
|
FileSysShellPath fsp(root_path);
|
||||||
path = fsp;
|
path = fsp;
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
|
@ -1459,7 +1460,7 @@ LRESULT SDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
} else {
|
} else {
|
||||||
// take over path from lparam
|
// take over path from lparam
|
||||||
path = (LPCTSTR)lparam;
|
path = (LPCTSTR)lparam;
|
||||||
shell_path = path; // create as "rooted" window
|
root_path = path; // create as "rooted" window
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
///@todo read paths and window placements from registry
|
///@todo read paths and window placements from registry
|
||||||
|
@ -1467,10 +1468,10 @@ LRESULT SDIMainFrame::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||||
*buffer = '\0';
|
*buffer = '\0';
|
||||||
|
|
||||||
path = buffer;
|
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
|
return TRUE;} // success
|
||||||
|
|
||||||
default: def:
|
default: def:
|
||||||
|
|
|
@ -61,6 +61,7 @@ protected:
|
||||||
FullScreenParameters _fullscreen;
|
FullScreenParameters _fullscreen;
|
||||||
|
|
||||||
HACCEL _hAccel;
|
HACCEL _hAccel;
|
||||||
|
HIMAGELIST _himl_old;
|
||||||
|
|
||||||
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
|
||||||
bool ProcessMessage(UINT nmsg, WPARAM wparam, LPARAM lparam, LRESULT* pres);
|
bool ProcessMessage(UINT nmsg, WPARAM wparam, LPARAM lparam, LRESULT* pres);
|
||||||
|
|
|
@ -31,6 +31,12 @@
|
||||||
#include "../resource.h"
|
#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,
|
ShellBrowser::ShellBrowser(HWND hwnd, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
|
||||||
HIMAGELIST himl, BrowserCallback* cb, CtxMenuInterfaces& cm_ifs)
|
HIMAGELIST himl, BrowserCallback* cb, CtxMenuInterfaces& cm_ifs)
|
||||||
#ifndef __MINGW32__ // IShellFolderViewCB missing in MinGW (as of 25.09.2005)
|
#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()
|
ShellBrowser::~ShellBrowser()
|
||||||
{
|
{
|
||||||
(void)TreeView_SetImageList(_left_hwnd, 0, TVSIL_NORMAL);
|
(void)TreeView_SetImageList(_left_hwnd, _himl_old, TVSIL_NORMAL);
|
||||||
|
|
||||||
if (_pShellView)
|
if (_pShellView)
|
||||||
_pShellView->Release();
|
_pShellView->Release();
|
||||||
|
@ -146,7 +152,7 @@ void ShellBrowser::InitializeTree(HIMAGELIST himl)
|
||||||
{
|
{
|
||||||
CONTEXT("ShellBrowserChild::InitializeTree()");
|
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);
|
TreeView_SetScrollTime(_left_hwnd, 100);
|
||||||
|
|
||||||
TV_INSERTSTRUCT tvInsert;
|
TV_INSERTSTRUCT tvInsert;
|
||||||
|
|
|
@ -148,6 +148,7 @@ protected:
|
||||||
WindowHandle& _right_hwnd;
|
WindowHandle& _right_hwnd;
|
||||||
ShellPathInfo& _create_info;
|
ShellPathInfo& _create_info;
|
||||||
HIMAGELIST _himl;
|
HIMAGELIST _himl;
|
||||||
|
HIMAGELIST _himl_old;
|
||||||
BrowserCallback* _callback;
|
BrowserCallback* _callback;
|
||||||
|
|
||||||
WindowHandle _hWndFrame;
|
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
|
template<typename BASE> struct ShellBrowserChildT
|
||||||
: public BASE, public BrowserCallback
|
: public BASE, public BrowserCallback
|
||||||
{
|
{
|
||||||
|
@ -198,8 +208,8 @@ template<typename BASE> struct ShellBrowserChildT
|
||||||
{
|
{
|
||||||
SHFILEINFO sfi;
|
SHFILEINFO sfi;
|
||||||
|
|
||||||
_himlSmall = (HIMAGELIST)SHGetFileInfo(TEXT("C:\\"), 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
|
_himlSmall = (HIMAGELIST)SHGetFileInfo(C_DRIVE, 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_SMALLICON);
|
||||||
// _himlLarge = (HIMAGELIST)SHGetFileInfo(TEXT("C:\\"), 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_LARGEICON);
|
// _himlLarge = (HIMAGELIST)SHGetFileInfo(C_DRIVE, 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_LARGEICON);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue