mirror of
https://github.com/reactos/reactos.git
synced 2024-06-19 11:19:47 +00:00
[0.4.13][BROWSEUI] Port back several fixes and tweaks
0.4.15-dev-5688-g460a01b167
[BROWSEUI] CORE-18646 Fix crash while editing a label in the folder tree, add missing break 0.4.15-dev-5686-ga777cc2cc4
[BROWSEUI] CORE-18646 Fix crash on backspace while editing a label in the folder panel (#5059) 0.4.15-dev-4497-gbeefb07d18
[BROWSEUI] CORE-12804 Remove useless variable and unreachable code (#4483) and strip EOL whitespace
This commit is contained in:
parent
404e14de74
commit
6f01532b81
|
@ -81,7 +81,7 @@ HRESULT GetDisplayName(LPCITEMIDLIST pidlDirectory,TCHAR *szDisplayName,UINT cch
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is a Windows hack, because shell event messages in Windows gives an
|
This is a Windows hack, because shell event messages in Windows gives an
|
||||||
ill-formed PIDL stripped from useful data that parses incorrectly with SHGetFileInfo.
|
ill-formed PIDL stripped from useful data that parses incorrectly with SHGetFileInfo.
|
||||||
So we need to re-enumerate subfolders until we find one with the same name.
|
So we need to re-enumerate subfolders until we find one with the same name.
|
||||||
*/
|
*/
|
||||||
|
@ -144,7 +144,7 @@ Cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
CExplorerBand::CExplorerBand() :
|
CExplorerBand::CExplorerBand() :
|
||||||
pSite(NULL), fVisible(FALSE), bNavigating(FALSE), dwBandID(0), pidlCurrent(NULL)
|
pSite(NULL), fVisible(FALSE), bNavigating(FALSE), dwBandID(0), m_isEditing(FALSE), pidlCurrent(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ BOOL CExplorerBand::OnTreeItemDeleted(LPNMTREEVIEW pnmtv)
|
||||||
/* Destroy memory associated to our node */
|
/* Destroy memory associated to our node */
|
||||||
NodeInfo* ptr = GetNodeInfo(pnmtv->itemNew.hItem);
|
NodeInfo* ptr = GetNodeInfo(pnmtv->itemNew.hItem);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
ILFree(ptr->relativePidl);
|
ILFree(ptr->relativePidl);
|
||||||
ILFree(ptr->absolutePidl);
|
ILFree(ptr->absolutePidl);
|
||||||
delete ptr;
|
delete ptr;
|
||||||
|
@ -721,7 +721,6 @@ BOOL CExplorerBand::NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExp
|
||||||
HTREEITEM current;
|
HTREEITEM current;
|
||||||
HTREEITEM tmp;
|
HTREEITEM tmp;
|
||||||
HTREEITEM parent;
|
HTREEITEM parent;
|
||||||
BOOL found;
|
|
||||||
NodeInfo *nodeData;
|
NodeInfo *nodeData;
|
||||||
LPITEMIDLIST relativeChild;
|
LPITEMIDLIST relativeChild;
|
||||||
TVITEM tvItem;
|
TVITEM tvItem;
|
||||||
|
@ -729,10 +728,9 @@ BOOL CExplorerBand::NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExp
|
||||||
if (!item)
|
if (!item)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
found = FALSE;
|
|
||||||
current = hRoot;
|
current = hRoot;
|
||||||
parent = NULL;
|
parent = NULL;
|
||||||
while(!found)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
nodeData = GetNodeInfo(current);
|
nodeData = GetNodeInfo(current);
|
||||||
if (!nodeData)
|
if (!nodeData)
|
||||||
|
@ -771,7 +769,7 @@ BOOL CExplorerBand::NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExp
|
||||||
// Try to get a child
|
// Try to get a child
|
||||||
tmp = TreeView_GetChild(m_hWnd, current);
|
tmp = TreeView_GetChild(m_hWnd, current);
|
||||||
if (tmp)
|
if (tmp)
|
||||||
{
|
{
|
||||||
// We have a child, let's continue with it
|
// We have a child, let's continue with it
|
||||||
parent = current;
|
parent = current;
|
||||||
current = tmp;
|
current = tmp;
|
||||||
|
@ -806,7 +804,6 @@ BOOL CExplorerBand::NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExp
|
||||||
*item = NULL;
|
*item = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL CExplorerBand::NavigateToCurrentFolder()
|
BOOL CExplorerBand::NavigateToCurrentFolder()
|
||||||
|
@ -815,7 +812,7 @@ BOOL CExplorerBand::NavigateToCurrentFolder()
|
||||||
CComPtr<IBrowserService> pBrowserService;
|
CComPtr<IBrowserService> pBrowserService;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
HTREEITEM dummy;
|
HTREEITEM dummy;
|
||||||
BOOL result;
|
BOOL result;
|
||||||
explorerPidl = NULL;
|
explorerPidl = NULL;
|
||||||
|
|
||||||
hr = IUnknown_QueryService(pSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &pBrowserService));
|
hr = IUnknown_QueryService(pSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &pBrowserService));
|
||||||
|
@ -1136,7 +1133,7 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::SetSite(IUnknown *pUnkSite)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
pSite = pUnkSite;
|
pSite = pUnkSite;
|
||||||
|
|
||||||
if (m_hWnd)
|
if (m_hWnd)
|
||||||
{
|
{
|
||||||
|
@ -1214,7 +1211,8 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::HasFocusIO()
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CExplorerBand::TranslateAcceleratorIO(LPMSG lpMsg)
|
HRESULT STDMETHODCALLTYPE CExplorerBand::TranslateAcceleratorIO(LPMSG lpMsg)
|
||||||
{
|
{
|
||||||
if (lpMsg->hwnd == m_hWnd)
|
if (lpMsg->hwnd == m_hWnd ||
|
||||||
|
(m_isEditing && IsChild(lpMsg->hwnd)))
|
||||||
{
|
{
|
||||||
TranslateMessage(lpMsg);
|
TranslateMessage(lpMsg);
|
||||||
DispatchMessage(lpMsg);
|
DispatchMessage(lpMsg);
|
||||||
|
@ -1291,6 +1289,7 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
|
||||||
case TVN_BEGINDRAG:
|
case TVN_BEGINDRAG:
|
||||||
case TVN_BEGINRDRAG:
|
case TVN_BEGINRDRAG:
|
||||||
OnTreeItemDragging((LPNMTREEVIEW)lParam, pNotifyHeader->code == TVN_BEGINRDRAG);
|
OnTreeItemDragging((LPNMTREEVIEW)lParam, pNotifyHeader->code == TVN_BEGINRDRAG);
|
||||||
|
break;
|
||||||
case TVN_BEGINLABELEDITW:
|
case TVN_BEGINLABELEDITW:
|
||||||
{
|
{
|
||||||
// TODO: put this in a function ? (mostly copypasta from CDefView)
|
// TODO: put this in a function ? (mostly copypasta from CDefView)
|
||||||
|
@ -1310,8 +1309,12 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
|
hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
|
||||||
if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME) && theResult)
|
if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME))
|
||||||
*theResult = 0;
|
{
|
||||||
|
if (theResult)
|
||||||
|
*theResult = 0;
|
||||||
|
m_isEditing = TRUE;
|
||||||
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
case TVN_ENDLABELEDITW:
|
case TVN_ENDLABELEDITW:
|
||||||
|
@ -1320,6 +1323,7 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
|
||||||
NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
|
NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
m_isEditing = FALSE;
|
||||||
if (theResult)
|
if (theResult)
|
||||||
*theResult = 0;
|
*theResult = 0;
|
||||||
if (dispInfo->item.pszText)
|
if (dispInfo->item.pszText)
|
||||||
|
|
|
@ -59,6 +59,7 @@ private:
|
||||||
BOOL bNavigating;
|
BOOL bNavigating;
|
||||||
BOOL bFocused;
|
BOOL bFocused;
|
||||||
DWORD dwBandID;
|
DWORD dwBandID;
|
||||||
|
BOOL m_isEditing;
|
||||||
HIMAGELIST hImageList;
|
HIMAGELIST hImageList;
|
||||||
HTREEITEM hRoot;
|
HTREEITEM hRoot;
|
||||||
HTREEITEM oldSelected;
|
HTREEITEM oldSelected;
|
||||||
|
@ -95,7 +96,7 @@ private:
|
||||||
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto);
|
HRESULT UpdateBrowser(LPITEMIDLIST pidlGoto);
|
||||||
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort);
|
HTREEITEM InsertItem(HTREEITEM hParent, IShellFolder *psfParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort);
|
||||||
HTREEITEM InsertItem(HTREEITEM hParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort);
|
HTREEITEM InsertItem(HTREEITEM hParent, LPITEMIDLIST pElt, LPITEMIDLIST pEltRelative, BOOL bSort);
|
||||||
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo);
|
BOOL InsertSubitems(HTREEITEM hItem, NodeInfo *pNodeInfo);
|
||||||
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect);
|
BOOL NavigateToPIDL(LPITEMIDLIST dest, HTREEITEM *item, BOOL bExpand, BOOL bInsert, BOOL bSelect);
|
||||||
BOOL DeleteItem(LPITEMIDLIST toDelete);
|
BOOL DeleteItem(LPITEMIDLIST toDelete);
|
||||||
BOOL RenameItem(HTREEITEM toRename, LPITEMIDLIST newPidl);
|
BOOL RenameItem(HTREEITEM toRename, LPITEMIDLIST newPidl);
|
||||||
|
|
Loading…
Reference in a new issue