mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
Use Explorer theme for list- and tree-views
Apply Explorer theme on list- and tree-views. Allow dynamic change between dark and light mode in these views. Add border to document switcher for consistency. Refactor code in TreeView.cpp to make it consistent. Fix #10055, close #10056
This commit is contained in:
parent
5df7c97f98
commit
c8be679cde
@ -7545,6 +7545,15 @@ void Notepad_plus::refreshDarkMode()
|
|||||||
::SendMessage(_pFileBrowser->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
::SendMessage(_pFileBrowser->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_pAnsiCharPanel)
|
||||||
|
{
|
||||||
|
::SendMessage(_pAnsiCharPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||||
|
}
|
||||||
|
if (_pFileSwitcherPanel)
|
||||||
|
{
|
||||||
|
::SendMessage(_pFileSwitcherPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
SendMessage(_findReplaceDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
SendMessage(_findReplaceDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||||
SendMessage(_incrementFindDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
SendMessage(_incrementFindDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||||
RedrawWindow(_pPublicInterface->getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
RedrawWindow(_pPublicInterface->getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||||
|
@ -1115,4 +1115,10 @@ namespace NppDarkMode
|
|||||||
|
|
||||||
::SendMessage(hwnd, TB_SETCOLORSCHEME, 0, reinterpret_cast<LPARAM>(&scheme));
|
::SendMessage(hwnd, TB_SETCOLORSCHEME, 0, reinterpret_cast<LPARAM>(&scheme));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setExplorerTheme(HWND hwnd)
|
||||||
|
{
|
||||||
|
NppDarkMode::allowDarkModeForWindow(hwnd, NppDarkMode::isEnabled() && NppDarkMode::isExperimentalEnabled());
|
||||||
|
SetWindowTheme(hwnd, L"Explorer", nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,4 +86,6 @@ namespace NppDarkMode
|
|||||||
void setDarkTitleBar(HWND hwnd);
|
void setDarkTitleBar(HWND hwnd);
|
||||||
void setDarkTooltips(HWND hwnd, ToolTipsType type);
|
void setDarkTooltips(HWND hwnd, ToolTipsType type);
|
||||||
void setDarkLineAbovePanelToolbar(HWND hwnd);
|
void setDarkLineAbovePanelToolbar(HWND hwnd);
|
||||||
|
|
||||||
|
void setExplorerTheme(HWND hwnd);
|
||||||
}
|
}
|
||||||
|
@ -54,11 +54,13 @@ void ListView::init(HINSTANCE hInst, HWND parent)
|
|||||||
throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
|
throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NppDarkMode::setExplorerTheme(_hSelf);
|
||||||
|
|
||||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||||
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
|
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
|
||||||
|
|
||||||
DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf);
|
DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf);
|
||||||
exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT | _extraStyle;
|
exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT | LVS_EX_DOUBLEBUFFER | _extraStyle;
|
||||||
ListView_SetExtendedListViewStyle(_hSelf, exStyle);
|
ListView_SetExtendedListViewStyle(_hSelf, exStyle);
|
||||||
|
|
||||||
if (_columnInfos.size())
|
if (_columnInfos.size())
|
||||||
|
@ -27,10 +27,10 @@ void AnsiCharPanel::switchEncoding()
|
|||||||
|
|
||||||
INT_PTR CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
|
||||||
generic_string valStr = pNativeSpeaker->getAttrNameStr(TEXT("Value"), "AsciiInsertion", "ColumnVal");
|
generic_string valStr = pNativeSpeaker->getAttrNameStr(TEXT("Value"), "AsciiInsertion", "ColumnVal");
|
||||||
@ -50,8 +50,14 @@ INT_PTR CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
_listView.setValues(codepage==-1?0:codepage);
|
_listView.setValues(codepage==-1?0:codepage);
|
||||||
_listView.display();
|
_listView.display();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
|
{
|
||||||
|
NppDarkMode::setExplorerTheme(_listView.getHSelf());
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
|
@ -98,10 +98,10 @@ bool isRelatedRootFolder(const generic_string & relatedRoot, const generic_strin
|
|||||||
|
|
||||||
INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
NppParameters& nppParam = NppParameters::getInstance();
|
NppParameters& nppParam = NppParameters::getInstance();
|
||||||
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS | TBSTYLE_CUSTOMERASE;
|
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS | TBSTYLE_CUSTOMERASE;
|
||||||
_hToolbarMenu = CreateWindowEx(WS_EX_LAYOUTRTL, TOOLBARCLASSNAME, NULL, style, 0, 0, 0, 0, _hSelf, nullptr, _hInst, NULL);
|
_hToolbarMenu = CreateWindowEx(WS_EX_LAYOUTRTL, TOOLBARCLASSNAME, NULL, style, 0, 0, 0, 0, _hSelf, nullptr, _hInst, NULL);
|
||||||
@ -173,7 +173,8 @@ INT_PTR CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
{
|
{
|
||||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||||
break;
|
NppDarkMode::setExplorerTheme(_treeView.getHSelf());
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
|
@ -838,7 +838,8 @@ INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
{
|
{
|
||||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||||
break;
|
NppDarkMode::setExplorerTheme(_treeView.getHSelf());
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
|
@ -44,10 +44,10 @@ ProjectPanel::~ProjectPanel()
|
|||||||
|
|
||||||
INT_PTR CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
ProjectPanel::initMenus();
|
ProjectPanel::initMenus();
|
||||||
|
|
||||||
// Create toolbar menu
|
// Create toolbar menu
|
||||||
@ -100,7 +100,8 @@ INT_PTR CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
|||||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
{
|
{
|
||||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||||
break;
|
NppDarkMode::setExplorerTheme(_treeView.getHSelf());
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
|
@ -26,17 +26,24 @@ void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID)
|
|||||||
Window::init(hInst, parent);
|
Window::init(hInst, parent);
|
||||||
_hSelf = ::GetDlgItem(parent, treeViewID);
|
_hSelf = ::GetDlgItem(parent, treeViewID);
|
||||||
|
|
||||||
_hSelf = CreateWindowEx(0,
|
auto treeViewStyles = WS_HSCROLL | WS_TABSTOP | TVS_LINESATROOT\
|
||||||
WC_TREEVIEW,
|
| TVS_HASLINES | TVS_HASBUTTONS | TVS_SHOWSELALWAYS\
|
||||||
TEXT("Tree View"),
|
| TVS_EDITLABELS | TVS_INFOTIP | TVS_TRACKSELECT;
|
||||||
WS_CHILD | WS_BORDER | WS_HSCROLL | WS_TABSTOP | TVS_LINESATROOT | TVS_HASLINES |
|
|
||||||
TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_EDITLABELS | TVS_INFOTIP,
|
|
||||||
0, 0, 0, 0,
|
|
||||||
_hParent,
|
|
||||||
NULL,
|
|
||||||
_hInst,
|
|
||||||
(LPVOID)0);
|
|
||||||
|
|
||||||
|
_hSelf = CreateWindowEx(0,
|
||||||
|
WC_TREEVIEW,
|
||||||
|
TEXT("Tree View"),
|
||||||
|
WS_CHILD | WS_BORDER | treeViewStyles,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
_hParent,
|
||||||
|
nullptr,
|
||||||
|
_hInst,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
NppDarkMode::setExplorerTheme(_hSelf);
|
||||||
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::treeview);
|
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::treeview);
|
||||||
|
|
||||||
int itemHeight = NppParameters::getInstance()._dpiManager.scaleY(CY_ITEMHEIGHT);
|
int itemHeight = NppParameters::getInstance()._dpiManager.scaleY(CY_ITEMHEIGHT);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "VerticalFileSwitcher.h"
|
#include "VerticalFileSwitcher.h"
|
||||||
#include "menuCmdID.h"
|
#include "menuCmdID.h"
|
||||||
#include "Parameters.h"
|
#include "Parameters.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
int CALLBACK ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||||
{
|
{
|
||||||
@ -59,16 +60,22 @@ void VerticalFileSwitcher::startColumnSort()
|
|||||||
|
|
||||||
INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG :
|
case WM_INITDIALOG :
|
||||||
{
|
{
|
||||||
_fileListView.init(_hInst, _hSelf, _hImaLst);
|
_fileListView.init(_hInst, _hSelf, _hImaLst);
|
||||||
_fileListView.initList();
|
_fileListView.initList();
|
||||||
_fileListView.display();
|
_fileListView.display();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||||
|
{
|
||||||
|
NppDarkMode::setExplorerTheme(_fileListView.getHSelf());
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST
|
|||||||
|
|
||||||
_hSelf = ::CreateWindow(WC_LISTVIEW,
|
_hSelf = ::CreateWindow(WC_LISTVIEW,
|
||||||
TEXT(""),
|
TEXT(""),
|
||||||
WS_CHILD | listViewStyles,
|
WS_CHILD | WS_BORDER | listViewStyles,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -55,12 +55,13 @@ void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST
|
|||||||
throw std::runtime_error("VerticalFileSwitcherListView::init : CreateWindowEx() function return null");
|
throw std::runtime_error("VerticalFileSwitcherListView::init : CreateWindowEx() function return null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NppDarkMode::setExplorerTheme(_hSelf);
|
||||||
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::listview);
|
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::listview);
|
||||||
|
|
||||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||||
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
|
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
|
||||||
|
|
||||||
ListView_SetExtendedListViewStyle(_hSelf, LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT | LVS_EX_INFOTIP);
|
ListView_SetExtendedListViewStyle(_hSelf, LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT | LVS_EX_INFOTIP | LVS_EX_DOUBLEBUFFER);
|
||||||
ListView_SetItemCountEx(_hSelf, 50, LVSICF_NOSCROLL);
|
ListView_SetItemCountEx(_hSelf, 50, LVSICF_NOSCROLL);
|
||||||
ListView_SetImageList(_hSelf, _hImaLst, LVSIL_SMALL);
|
ListView_SetImageList(_hSelf, _hImaLst, LVSIL_SMALL);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user