From 612d72cb58cff42c758cd5a33295770e73c4f041 Mon Sep 17 00:00:00 2001 From: David Quintana Date: Mon, 3 Mar 2014 11:14:04 +0000 Subject: [PATCH] [RSHELL] * Move the copying back where it belongs. CMake may generate the dependencies the wrong way around (explorer-new should depend on rshell), but at least the copying works as expected, even if I always have to "build solution". * Allow toggling between TBSTYLE_EX_VERTICAL and the manual TBSTATE_WRAP setting by (un)definiting TBSTYLE_EX_VERTICAL. CORE-7881 svn path=/branches/shell-experiments/; revision=62412 --- base/shell/explorer-new/CMakeLists.txt | 6 ---- base/shell/filebrowser/CMakeLists.txt | 13 +------- base/shell/rshell/CMakeLists.txt | 6 ++++ base/shell/rshell/CMenuToolbars.cpp | 43 ++++++++++++++++++-------- base/shell/rshell/CMenuToolbars.h | 4 +-- 5 files changed, 39 insertions(+), 33 deletions(-) diff --git a/base/shell/explorer-new/CMakeLists.txt b/base/shell/explorer-new/CMakeLists.txt index 20518f20e2e..0653b33c13b 100644 --- a/base/shell/explorer-new/CMakeLists.txt +++ b/base/shell/explorer-new/CMakeLists.txt @@ -39,9 +39,3 @@ add_importlibs(explorer_new ntdll) add_pch(explorer_new precomp.h SOURCE) add_cd_file(TARGET explorer_new DESTINATION reactos FOR all) - -add_custom_command(TARGET explorer_new POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy - "$" - "$/$" - COMMENT "Copying $ to output") diff --git a/base/shell/filebrowser/CMakeLists.txt b/base/shell/filebrowser/CMakeLists.txt index fda8e7710a1..81209bcf006 100644 --- a/base/shell/filebrowser/CMakeLists.txt +++ b/base/shell/filebrowser/CMakeLists.txt @@ -11,15 +11,4 @@ add_importlibs(filebrowser shell32 msvcrt kernel32) - -add_custom_command(TARGET filebrowser POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy - "$" - "$/$" - COMMENT "Copying $ to output") - -add_custom_command(TARGET filebrowser POST_BUILD - COMMAND "${CMAKE_COMMAND}" -E copy - "$" - "$/$" - COMMENT "Copying $ to output") + \ No newline at end of file diff --git a/base/shell/rshell/CMakeLists.txt b/base/shell/rshell/CMakeLists.txt index 08917e91fd6..ae88c160fd8 100644 --- a/base/shell/rshell/CMakeLists.txt +++ b/base/shell/rshell/CMakeLists.txt @@ -43,3 +43,9 @@ add_importlibs(rshell ntdll) add_cd_file(TARGET rshell DESTINATION reactos FOR all) + +add_custom_command(TARGET rshell POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$" + "$/$" + COMMENT "Copying to output directory") diff --git a/base/shell/rshell/CMenuToolbars.cpp b/base/shell/rshell/CMenuToolbars.cpp index a796d3da799..d2ba80d8482 100644 --- a/base/shell/rshell/CMenuToolbars.cpp +++ b/base/shell/rshell/CMenuToolbars.cpp @@ -34,7 +34,8 @@ HRESULT WINAPI SHGetImageList( _Out_ void **ppv ); -#define TBSTYLE_EX_VERTICAL 4 +// FIXME: Enable if/when wine comctl supports this flag properly +//#define TBSTYLE_EX_VERTICAL 4 #define TIMERID_HOTTRACK 1 #define SUBCLASS_ID_MENUBAND 1 @@ -259,8 +260,10 @@ HRESULT CMenuToolbarBase::CreateToolbar(HWND hwndParent, DWORD dwFlags) { tbStyles |= CCS_VERT; +#ifdef TBSTYLE_EX_VERTICAL // FIXME: Use when it works in ros (?) - //tbExStyles |= TBSTYLE_EX_VERTICAL | WS_EX_TOOLWINDOW; + tbExStyles |= TBSTYLE_EX_VERTICAL | WS_EX_TOOLWINDOW; +#endif } RECT rc; @@ -644,11 +647,15 @@ HRESULT CMenuToolbarBase::ChangeHotItem(DWORD dwSelectType) return S_FALSE; } -HRESULT CMenuToolbarBase::AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData) +HRESULT CMenuToolbarBase::AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last) { TBBUTTON tbb = { 0 }; - tbb.fsState = TBSTATE_ENABLED | TBSTATE_WRAP; + tbb.fsState = TBSTATE_ENABLED; +#ifndef TBSTYLE_EX_VERTICAL + if (!last) + tbb.fsState |= TBSTATE_WRAP; +#endif tbb.fsStyle = 0; if (hasSubMenu) @@ -665,11 +672,15 @@ HRESULT CMenuToolbarBase::AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSu return S_OK; } -HRESULT CMenuToolbarBase::AddSeparator() +HRESULT CMenuToolbarBase::AddSeparator(BOOL last) { TBBUTTON tbb = { 0 }; - tbb.fsState = TBSTATE_ENABLED | TBSTATE_WRAP; + tbb.fsState = TBSTATE_ENABLED; +#ifndef TBSTYLE_EX_VERTICAL + if (!last) + tbb.fsState |= TBSTATE_WRAP; +#endif tbb.fsStyle = BTNS_SEP; tbb.iBitmap = 0; @@ -683,7 +694,7 @@ HRESULT CMenuToolbarBase::AddPlaceholder() TBBUTTON tbb = { 0 }; PCWSTR MenuString = L"(Empty)"; - tbb.fsState = TBSTATE_WRAP; // disabled + tbb.fsState = 0; tbb.fsStyle = 0; tbb.iString = (INT_PTR) MenuString; tbb.iBitmap = -1; @@ -773,11 +784,13 @@ HRESULT CMenuStaticToolbar::FillToolbar() for (i = 0; i < ic; i++) { + BOOL last = i + 1 == ic; + MENUITEMINFOW info; info.cbSize = sizeof(info); info.dwTypeData = NULL; - info.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STRING | MIIM_SUBMENU; + info.fMask = MIIM_FTYPE | MIIM_STRING; GetMenuItemInfoW(m_hmenu, i, TRUE, &info); @@ -786,7 +799,7 @@ HRESULT CMenuStaticToolbar::FillToolbar() info.cch++; info.dwTypeData = (PWSTR) HeapAlloc(GetProcessHeap(), 0, (info.cch + 1) * sizeof(WCHAR)); - info.fMask = MIIM_STRING; + info.fMask = MIIM_STRING | MIIM_SUBMENU | MIIM_ID; GetMenuItemInfoW(m_hmenu, i, TRUE, &info); SMINFO * sminfo = new SMINFO(); @@ -797,13 +810,13 @@ HRESULT CMenuStaticToolbar::FillToolbar() if (FAILED(hr)) return hr; - AddButton(info.wID, info.dwTypeData, info.hSubMenu != NULL, sminfo->iIcon, reinterpret_cast(sminfo)); + AddButton(info.wID, info.dwTypeData, info.hSubMenu != NULL, sminfo->iIcon, reinterpret_cast(sminfo), last); HeapFree(GetProcessHeap(), 0, info.dwTypeData); } else { - AddSeparator(); + AddSeparator(last); } } @@ -881,7 +894,8 @@ HRESULT CMenuSFToolbar::FillToolbar() LPITEMIDLIST item = static_cast(CoTaskMemAlloc(sizeof(ITEMIDLIST))); ULONG fetched; - while ((hr = eidl->Next(1, &item, &fetched)) == S_OK) + hr = eidl->Next(1, &item, &fetched); + while (SUCCEEDED(hr) && fetched > 0) { INT index = 0; INT indexOpen = 0; @@ -904,7 +918,10 @@ HRESULT CMenuSFToolbar::FillToolbar() DWORD_PTR dwData = reinterpret_cast(ILClone(item)); // FIXME: remove before deleting the toolbar or it will leak - AddButton(++i, MenuString, attrs & SFGAO_FOLDER, index, dwData); + // Fetch next item already, so we know if the current one is the last + hr = eidl->Next(1, &item, &fetched); + + AddButton(++i, MenuString, attrs & SFGAO_FOLDER, index, dwData, SUCCEEDED(hr) && fetched > 0); CoTaskMemFree(MenuString); } diff --git a/base/shell/rshell/CMenuToolbars.h b/base/shell/rshell/CMenuToolbars.h index d18804d50d2..c8f15cb961b 100644 --- a/base/shell/rshell/CMenuToolbars.h +++ b/base/shell/rshell/CMenuToolbars.h @@ -87,8 +87,8 @@ protected: LRESULT CALLBACK SubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - HRESULT AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData); - HRESULT AddSeparator(); + HRESULT AddButton(DWORD commandId, LPCWSTR caption, BOOL hasSubMenu, INT iconId, DWORD_PTR buttonData, BOOL last); + HRESULT AddSeparator(BOOL last); HRESULT AddPlaceholder(); HRESULT UpdateImageLists();