diff --git a/Explorer++/Explorer++/CoreInterface.h b/Explorer++/Explorer++/CoreInterface.h index 0bb375bfc..5e5df446a 100644 --- a/Explorer++/Explorer++/CoreInterface.h +++ b/Explorer++/Explorer++/CoreInterface.h @@ -98,8 +98,6 @@ class CoreInterface virtual void ShowTabBar() = 0; virtual void HideTabBar() = 0; - virtual void SetListViewInitialPosition(HWND hListView) = 0; - virtual void FocusChanged() = 0; virtual boost::signals2::connection AddTabsInitializedObserver( diff --git a/Explorer++/Explorer++/Explorer++.h b/Explorer++/Explorer++/Explorer++.h index 440a282bb..edae52e0c 100644 --- a/Explorer++/Explorer++/Explorer++.h +++ b/Explorer++/Explorer++/Explorer++.h @@ -386,7 +386,6 @@ class Explorerplusplus : /* Window state update. */ void UpdateWindowStates(const Tab &tab); - void SetListViewInitialPosition(HWND hListView) override; void ToggleFolders(); void OnTreeViewHolderResized(int newWidth); void ToggleDualPane(); diff --git a/Explorer++/Explorer++/ShellBrowser/ShellBrowserImpl.cpp b/Explorer++/Explorer++/ShellBrowser/ShellBrowserImpl.cpp index 754ee0a33..bbd16e912 100644 --- a/Explorer++/Explorer++/ShellBrowser/ShellBrowserImpl.cpp +++ b/Explorer++/Explorer++/ShellBrowser/ShellBrowserImpl.cpp @@ -165,7 +165,7 @@ HWND ShellBrowserImpl::CreateListView(HWND parent) // return NULL. The actual view mode set here doesn't matter, since it will be updated when // navigating to a folder. return ::CreateListView(parent, - WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_REPORT | LVS_EDITLABELS + WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | LVS_REPORT | LVS_EDITLABELS | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_AUTOARRANGE | WS_TABSTOP | LVS_ALIGNTOP); } diff --git a/Explorer++/Explorer++/TabContainer.cpp b/Explorer++/Explorer++/TabContainer.cpp index d1f49922c..e755bd813 100644 --- a/Explorer++/Explorer++/TabContainer.cpp +++ b/Explorer++/Explorer++/TabContainer.cpp @@ -945,13 +945,6 @@ Tab &TabContainer::SetUpNewTab(Tab &tab, NavigateParams &navigateParams, the folder). */ index = InsertNewTab(index, tab.GetId(), navigateParams.pidl, tabSettings.name); - // Note that for the listview window to be shown, it has to have a non-zero - // size. If the size is zero at the point it's shown, it will instead remain - // hidden, even if it's later resized. Currently, if the tab is selected, - // the listview is shown during the OnTabSelected() call below. Therefore, - // the listview needs to have a non-zero size before that point. - m_coreInterface->SetListViewInitialPosition(tab.GetShellBrowserImpl()->GetListView()); - bool selected = false; if (tabSettings.selected) diff --git a/Explorer++/Explorer++/TabHandler.cpp b/Explorer++/Explorer++/TabHandler.cpp index 44e73777b..a6d0bd89a 100644 --- a/Explorer++/Explorer++/TabHandler.cpp +++ b/Explorer++/Explorer++/TabHandler.cpp @@ -67,6 +67,10 @@ void Explorerplusplus::OnTabCreated(int tabId, BOOL switchToNewTab) /* TODO: This subclass needs to be removed. */ SetWindowSubclass(tab.GetShellBrowserImpl()->GetListView(), ListViewProcStub, 0, reinterpret_cast(this)); + + // A tab has been created, so this call is needed in order to set the size and position of the + // tab's listview control. + UpdateLayout(); } boost::signals2::connection Explorerplusplus::AddTabsInitializedObserver( diff --git a/Explorer++/Explorer++/WindowHandler.cpp b/Explorer++/Explorer++/WindowHandler.cpp index 5fbb1bb03..bd93aae09 100644 --- a/Explorer++/Explorer++/WindowHandler.cpp +++ b/Explorer++/Explorer++/WindowHandler.cpp @@ -4,94 +4,10 @@ #include "stdafx.h" #include "Explorer++.h" -#include "App.h" #include "Config.h" #include "HolderWindow.h" -#include "IconResourceLoader.h" -#include "MainRebarView.h" -#include "MainToolbar.h" -#include "MainToolbarButtons.h" -#include "Runtime.h" -#include "ShellTreeView/ShellTreeView.h" -#include "TabContainer.h" -#include "../Helper/Controls.h" -#include "../Helper/DpiCompatibility.h" #include "../Helper/WindowHelper.h" -/* TODO: This should be linked to OnSize(). */ -void Explorerplusplus::SetListViewInitialPosition(HWND hListView) -{ - RECT rc; - int mainWindowWidth; - int mainWindowHeight; - int indentBottom = 0; - int indentTop = 0; - int indentLeft = 0; - int indentRight = 0; - int indentRebar = 0; - - GetClientRect(m_hContainer, &rc); - - mainWindowWidth = GetRectWidth(&rc); - mainWindowHeight = GetRectHeight(&rc); - - if (m_mainRebarView) - { - GetWindowRect(m_mainRebarView->GetHWND(), &rc); - indentRebar += GetRectHeight(&rc); - } - - if (m_config->showStatusBar) - { - GetWindowRect(m_hStatusBar, &rc); - indentBottom += GetRectHeight(&rc); - } - - if (m_config->showDisplayWindow.get()) - { - if (m_config->displayWindowVertical) - { - indentRight += m_displayWindowWidth; - } - else - { - indentBottom += m_displayWindowHeight; - } - } - - if (m_config->showFolders.get()) - { - GetClientRect(m_treeViewHolder->GetHWND(), &rc); - indentLeft = GetRectWidth(&rc); - } - - indentTop = indentRebar; - - RECT tabWindowRect; - GetClientRect(GetActivePane()->GetTabContainer()->GetHWND(), &tabWindowRect); - - int tabWindowHeight = GetRectHeight(&tabWindowRect); - - if (m_bShowTabBar) - { - if (!m_config->showTabBarAtBottom.get()) - { - indentTop += tabWindowHeight; - } - } - - int width = mainWindowWidth - indentLeft - indentRight; - int height = mainWindowHeight - indentTop - indentBottom; - - if (m_config->showTabBarAtBottom.get()) - { - height -= tabWindowHeight; - } - - SetWindowPos(hListView, nullptr, indentLeft, indentTop, width, height, - SWP_HIDEWINDOW | SWP_NOZORDER); -} - void Explorerplusplus::ToggleFolders() { m_config->showFolders = !m_config->showFolders.get();