Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Explorer++/Explorer++/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ struct Config
ValueWrapper<COLORREF> displayWindowTextColor = DisplayWindowDefaults::TEXT_COLOR;
ValueWrapper<LOGFONT> displayWindowFont = DisplayWindowDefaults::FONT;

// Preview pane - shows document previews on the right side
ValueWrapper<bool> showPreviewPane = true;

// These are settings that are shared between all tabs. It's not
// possible to adjust them on a per-tab basis.
GlobalFolderSettings globalFolderSettings;
Expand Down
41 changes: 41 additions & 0 deletions Explorer++/Explorer++/DisplayWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#include "Config.h"
#include "DisplayWindow/DisplayWindow.h"
#include "MainResource.h"
#include "PreviewPane.h"
#include "ShellBrowser/ShellBrowserImpl.h"
#include "TabContainer.h"
#include <glog/logging.h>
#include "../Helper/FolderSize.h"
#include "../Helper/Helper.h"
#include "../Helper/ShellHelper.h"
Expand Down Expand Up @@ -390,3 +392,42 @@ void Explorerplusplus::UpdateDisplayWindowForMultipleFiles(const Tab &tab)

DisplayWindow_BufferText(m_displayWindow->GetHWND(), szTotalSize);
}

void Explorerplusplus::UpdatePreviewPane(const Tab &tab)
{
OutputDebugString(L"[PreviewPane] UpdatePreviewPane called\n");

if (!m_config->showPreviewPane.get() || !m_previewPane)
{
OutputDebugString(L"[PreviewPane] Preview pane disabled or null\n");
return;
}

int nSelected = tab.GetShellBrowserImpl()->GetNumSelected();
wchar_t msg[256];
swprintf_s(msg, L"[PreviewPane] nSelected=%d\n", nSelected);
OutputDebugString(msg);

if (nSelected == 1)
{
int iSelected = ListView_GetNextItem(tab.GetShellBrowserImpl()->GetListView(), -1, LVNI_SELECTED);
swprintf_s(msg, L"[PreviewPane] iSelected=%d\n", iSelected);
OutputDebugString(msg);

if (iSelected != -1)
{
auto pidl = tab.GetShellBrowserImpl()->GetItemCompleteIdl(iSelected);
OutputDebugString(pidl.get() ? L"[PreviewPane] Got pidl, calling SetPreviewFile\n"
: L"[PreviewPane] pidl is null\n");
m_previewPane->SetPreviewFile(pidl.get());
}
else
{
m_previewPane->ClearPreview();
}
}
else
{
m_previewPane->ClearPreview();
}
}
9 changes: 9 additions & 0 deletions Explorer++/Explorer++/Explorer++.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Bookmarks/UI/BookmarksMainMenu.h"
#include "Config.h"
#include "DisplayWindow/DisplayWindow.h"
#include "PreviewPane.h"
#include "FrequentLocationsMenu.h"
#include "HistoryMenu.h"
#include "HolderWindow.h"
Expand Down Expand Up @@ -153,6 +154,8 @@ void Explorerplusplus::SetUpControlVisibilityConfigListeners()
m_config->showFolders.addObserver(std::bind(&Explorerplusplus::UpdateLayout, this)));
m_connections.push_back(
m_config->showDisplayWindow.addObserver(std::bind(&Explorerplusplus::UpdateLayout, this)));
m_connections.push_back(
m_config->showPreviewPane.addObserver(std::bind(&Explorerplusplus::UpdateLayout, this)));
}

void Explorerplusplus::Initialize(const WindowStorageData *storageData)
Expand All @@ -171,6 +174,7 @@ void Explorerplusplus::Initialize(const WindowStorageData *storageData)

CreateMainRebarAndChildren(storageData);
InitializeDisplayWindow();
InitializePreviewPane();
InitializeTabs();
CreateFolderControls();

Expand Down Expand Up @@ -206,6 +210,11 @@ void Explorerplusplus::InitializeDisplayWindow()
ApplyDisplayWindowPosition();
}

void Explorerplusplus::InitializePreviewPane()
{
m_previewPane = PreviewPane::Create(m_hContainer, m_config);
}

void Explorerplusplus::CreateFolderControls()
{
UINT holderStyle = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
Expand Down
7 changes: 7 additions & 0 deletions Explorer++/Explorer++/Explorer++.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class TabBacking;
class TabContainer;
class TaskbarThumbnails;
class ThemeWindowTracker;
class PreviewPane;
class WindowSubclass;

namespace Applications
Expand Down Expand Up @@ -350,6 +351,8 @@ class Explorerplusplus : public BrowserWindow, public CoreInterface, public Plug

/* Miscellaneous. */
void InitializeDisplayWindow();
void InitializePreviewPane();
void UpdatePreviewPane(const Tab &tab);

static void FolderSizeCallbackStub(int nFolders, int nFiles, PULARGE_INTEGER lTotalFolderSize,
LPVOID pData);
Expand Down Expand Up @@ -386,6 +389,10 @@ class Explorerplusplus : public BrowserWindow, public CoreInterface, public Plug
int m_displayWindowWidth = LayoutDefaults::DEFAULT_DISPLAY_WINDOW_WIDTH;
int m_displayWindowHeight = LayoutDefaults::DEFAULT_DISPLAY_WINDOW_HEIGHT;

// Preview pane
PreviewPane *m_previewPane = nullptr;
int m_previewPaneWidth = LayoutDefaults::DEFAULT_PREVIEW_PANE_WIDTH;

wil::com_ptr_nothrow<IImageList> m_mainMenuSystemImageList;
std::vector<wil::unique_hbitmap> m_mainMenuImages;
MainMenuPreShowSignal m_mainMenuPreShowSignal;
Expand Down
2 changes: 2 additions & 0 deletions Explorer++/Explorer++/Explorer++.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,7 @@
<ClCompile Include="DialogStorageHelper.cpp" />
<ClCompile Include="DisplayColoursDialog.cpp" />
<ClCompile Include="DisplayWindow.cpp" />
<ClCompile Include="PreviewPane.cpp" />
<ClCompile Include="DrivesToolbar.cpp" />
<ClCompile Include="Plugins\Event.cpp" />
<ClCompile Include="EventSwitcher.cpp" />
Expand Down Expand Up @@ -1773,6 +1774,7 @@
<ClInclude Include="DialogConstants.h" />
<ClInclude Include="DisplayColoursDialog.h" />
<ClInclude Include="DisplayWindow\DisplayWindow.h" />
<ClInclude Include="PreviewPane.h" />
<ClInclude Include="DrivesToolbar.h" />
<ClInclude Include="Plugins\Event.h" />
<ClInclude Include="Explorer++.h" />
Expand Down
2 changes: 2 additions & 0 deletions Explorer++/Explorer++/HandleWindowState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
void Explorerplusplus::UpdateWindowStates(const Tab &tab)
{
UpdateDisplayWindow(tab);
UpdatePreviewPane(tab);
}

/*
Expand Down Expand Up @@ -89,6 +90,7 @@ void Explorerplusplus::SetProgramMenuItemStates(HMENU hProgramMenu)
MenuHelper::CheckItem(hProgramMenu, IDM_VIEW_STATUSBAR, m_config->showStatusBar.get());
MenuHelper::CheckItem(hProgramMenu, IDM_VIEW_FOLDERS, m_config->showFolders.get());
MenuHelper::CheckItem(hProgramMenu, IDM_VIEW_DISPLAYWINDOW, m_config->showDisplayWindow.get());
MenuHelper::CheckItem(hProgramMenu, IDM_VIEW_PREVIEWPANE, m_config->showPreviewPane.get());
MenuHelper::CheckItem(hProgramMenu, IDM_VIEW_TOOLBARS_ADDRESS_BAR,
m_config->showAddressBar.get());
MenuHelper::CheckItem(hProgramMenu, IDM_VIEW_TOOLBARS_MAIN_TOOLBAR,
Expand Down
1 change: 1 addition & 0 deletions Explorer++/Explorer++/LayoutDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace LayoutDefaults
inline constexpr UINT DEFAULT_TREEVIEW_WIDTH = 208;
inline constexpr UINT DEFAULT_DISPLAY_WINDOW_WIDTH = 300;
inline constexpr UINT DEFAULT_DISPLAY_WINDOW_HEIGHT = 90;
inline constexpr UINT DEFAULT_PREVIEW_PANE_WIDTH = 350;

RECT GetDefaultMainWindowBounds();

Expand Down
6 changes: 5 additions & 1 deletion Explorer++/Explorer++/MainWndSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ LRESULT Explorerplusplus::WindowProcedure(HWND hwnd, UINT msg, WPARAM wParam, LP
{
Tab &selectedTab = GetActivePane()->GetTabContainer()->GetSelectedTab();

UpdateDisplayWindow(selectedTab);
UpdateWindowStates(selectedTab);
m_mainToolbar->UpdateToolbarButtonStates();

KillTimer(m_hContainer, LISTVIEW_ITEM_CHANGED_TIMER_ID);
Expand Down Expand Up @@ -431,6 +431,10 @@ LRESULT Explorerplusplus::HandleMenuOrToolbarButtonOrAccelerator(HWND hwnd, UINT
m_commandController.ExecuteCommand(id);
break;

case IDM_VIEW_PREVIEWPANE:
m_config->showPreviewPane = !m_config->showPreviewPane.get();
break;

case IDM_DISPLAYWINDOW_VERTICAL:
m_config->displayWindowVertical = !m_config->displayWindowVertical;
ApplyDisplayWindowPosition();
Expand Down
32 changes: 30 additions & 2 deletions Explorer++/Explorer++/MsgHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "DarkModeManager.h"
#include "DisplayWindow/DisplayWindow.h"
#include "HolderWindow.h"
#include "PreviewPane.h"
#include "MainRebarStorage.h"
#include "MainRebarView.h"
#include "MainResource.h"
Expand Down Expand Up @@ -337,6 +338,11 @@ void Explorerplusplus::UpdateLayout()
}
}

if (m_config->showPreviewPane.get() && m_previewPane)
{
indentRight += m_previewPaneWidth;
}

if (m_config->showFolders.get())
{
indentLeft = m_treeViewWidth;
Expand Down Expand Up @@ -429,7 +435,12 @@ void Explorerplusplus::UpdateLayout()

if (m_config->displayWindowVertical)
{
SetWindowPos(m_displayWindow->GetHWND(), nullptr, mainWindowWidth - indentRight,
int displayWindowLeft = mainWindowWidth - indentRight;
if (m_config->showPreviewPane.get())
{
displayWindowLeft += m_previewPaneWidth;
}
SetWindowPos(m_displayWindow->GetHWND(), nullptr, displayWindowLeft,
indentRebar, m_displayWindowWidth, mainWindowHeight - indentRebar - indentBottom,
displayWindowShowFlags);
}
Expand All @@ -439,6 +450,23 @@ void Explorerplusplus::UpdateLayout()
mainWindowWidth, m_displayWindowHeight, displayWindowShowFlags);
}

/* <---- Preview pane ----> */

if (m_previewPane)
{
UINT previewPaneShowFlags =
(m_config->showPreviewPane.get() ? SWP_SHOWWINDOW : SWP_HIDEWINDOW) | SWP_NOZORDER;

int previewPaneLeft = mainWindowWidth - m_previewPaneWidth;
if (m_config->showDisplayWindow.get() && m_config->displayWindowVertical)
{
previewPaneLeft -= m_displayWindowWidth;
}

SetWindowPos(m_previewPane->GetHWND(), nullptr, previewPaneLeft, indentRebar,
m_previewPaneWidth, mainWindowHeight - indentRebar - indentBottom, previewPaneShowFlags);
}

/* <---- ALL listview windows ----> */

for (auto &tab : GetActivePane()->GetTabContainer()->GetAllTabs() | boost::adaptors::map_values)
Expand Down Expand Up @@ -688,7 +716,7 @@ void Explorerplusplus::CopyColumnInfoToClipboard()
void Explorerplusplus::OnDirectoryContentsChanged(const ShellBrowser *shellBrowser)
{
const auto *tab = shellBrowser->GetTab();
UpdateDisplayWindow(*tab);
UpdateWindowStates(*tab);
}

void Explorerplusplus::CreateNewWindow(const std::vector<TabStorageData> &tabs)
Expand Down
Loading