mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 15:54:17 +02:00
parent
ad79718fc8
commit
86adb21480
@ -2374,6 +2374,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
_pFileBrowser->setForegroundColor(pStyle->_fgColor);
|
_pFileBrowser->setForegroundColor(pStyle->_fgColor);
|
||||||
::SendMessage(_pFileBrowser->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, refreshOnlyTreeView);
|
::SendMessage(_pFileBrowser->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, refreshOnlyTreeView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NppDarkMode::updateTreeViewStylePrev();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pDocMap)
|
if (_pDocMap)
|
||||||
|
@ -591,6 +591,7 @@ namespace NppDarkMode
|
|||||||
return invert_c;
|
return invert_c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static TreeViewStyle g_treeViewStylePrev = TreeViewStyle::classic;
|
||||||
static TreeViewStyle g_treeViewStyle = TreeViewStyle::classic;
|
static TreeViewStyle g_treeViewStyle = TreeViewStyle::classic;
|
||||||
static COLORREF g_treeViewBg = NppParameters::getInstance().getCurrentDefaultBgColor();
|
static COLORREF g_treeViewBg = NppParameters::getInstance().getCurrentDefaultBgColor();
|
||||||
static double g_lightnessTreeView = 50.0;
|
static double g_lightnessTreeView = 50.0;
|
||||||
@ -1094,7 +1095,7 @@ namespace NppDarkMode
|
|||||||
static void renderButton(HWND hwnd, HDC hdc, HTHEME hTheme, int iPartID, int iStateID)
|
static void renderButton(HWND hwnd, HDC hdc, HTHEME hTheme, int iPartID, int iStateID)
|
||||||
{
|
{
|
||||||
RECT rcClient{};
|
RECT rcClient{};
|
||||||
WCHAR szText[256] = { '\0' };
|
wchar_t szText[256] = { '\0' };
|
||||||
DWORD nState = static_cast<DWORD>(SendMessage(hwnd, BM_GETSTATE, 0, 0));
|
DWORD nState = static_cast<DWORD>(SendMessage(hwnd, BM_GETSTATE, 0, 0));
|
||||||
DWORD uiState = static_cast<DWORD>(SendMessage(hwnd, WM_QUERYUISTATE, 0, 0));
|
DWORD uiState = static_cast<DWORD>(SendMessage(hwnd, WM_QUERYUISTATE, 0, 0));
|
||||||
auto nStyle = ::GetWindowLongPtr(hwnd, GWL_STYLE);
|
auto nStyle = ::GetWindowLongPtr(hwnd, GWL_STYLE);
|
||||||
@ -1414,7 +1415,7 @@ namespace NppDarkMode
|
|||||||
|
|
||||||
hOldFont = static_cast<HFONT>(::SelectObject(hdc, hFont));
|
hOldFont = static_cast<HFONT>(::SelectObject(hdc, hFont));
|
||||||
|
|
||||||
WCHAR szText[256] = { '\0' };
|
wchar_t szText[256] = { '\0' };
|
||||||
GetWindowText(hwnd, szText, _countof(szText));
|
GetWindowText(hwnd, szText, _countof(szText));
|
||||||
|
|
||||||
auto style = static_cast<long>(::GetWindowLongPtr(hwnd, GWL_STYLE));
|
auto style = static_cast<long>(::GetWindowLongPtr(hwnd, GWL_STYLE));
|
||||||
@ -1486,14 +1487,12 @@ namespace NppDarkMode
|
|||||||
DWORD_PTR dwRefData
|
DWORD_PTR dwRefData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(uIdSubclass);
|
|
||||||
|
|
||||||
auto pButtonData = reinterpret_cast<ButtonData*>(dwRefData);
|
auto pButtonData = reinterpret_cast<ButtonData*>(dwRefData);
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
RemoveWindowSubclass(hWnd, GroupboxSubclass, g_groupboxSubclassID);
|
RemoveWindowSubclass(hWnd, GroupboxSubclass, uIdSubclass);
|
||||||
delete pButtonData;
|
delete pButtonData;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2577,8 +2576,8 @@ namespace NppDarkMode
|
|||||||
TreeView_SetTextColor(hwnd, NppParameters::getInstance().getCurrentDefaultFgColor());
|
TreeView_SetTextColor(hwnd, NppParameters::getInstance().getCurrentDefaultFgColor());
|
||||||
TreeView_SetBkColor(hwnd, NppParameters::getInstance().getCurrentDefaultBgColor());
|
TreeView_SetBkColor(hwnd, NppParameters::getInstance().getCurrentDefaultBgColor());
|
||||||
|
|
||||||
NppDarkMode::calculateTreeViewStyle();
|
//NppDarkMode::calculateTreeViewStyle();
|
||||||
NppDarkMode::setTreeViewStyle(hwnd);
|
NppDarkMode::setTreeViewStyle(hwnd, p._theme);
|
||||||
|
|
||||||
if (p._theme)
|
if (p._theme)
|
||||||
{
|
{
|
||||||
@ -3253,17 +3252,26 @@ namespace NppDarkMode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateTreeViewStylePrev()
|
||||||
|
{
|
||||||
|
g_treeViewStylePrev = g_treeViewStyle;
|
||||||
|
}
|
||||||
|
|
||||||
TreeViewStyle getTreeViewStyle()
|
TreeViewStyle getTreeViewStyle()
|
||||||
{
|
{
|
||||||
const auto style = g_treeViewStyle;
|
const auto style = g_treeViewStyle;
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTreeViewStyle(HWND hwnd)
|
void setTreeViewStyle(HWND hWnd, bool force)
|
||||||
{
|
{
|
||||||
auto style = static_cast<long>(::GetWindowLongPtr(hwnd, GWL_STYLE));
|
if (force || g_treeViewStylePrev != g_treeViewStyle)
|
||||||
bool hasHotStyle = (style & TVS_TRACKSELECT) == TVS_TRACKSELECT;
|
{
|
||||||
|
auto style = ::GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||||
|
const bool hasHotStyle = (style & TVS_TRACKSELECT) == TVS_TRACKSELECT;
|
||||||
bool change = false;
|
bool change = false;
|
||||||
|
std::wstring strSubAppName;
|
||||||
|
|
||||||
switch (g_treeViewStyle)
|
switch (g_treeViewStyle)
|
||||||
{
|
{
|
||||||
case TreeViewStyle::light:
|
case TreeViewStyle::light:
|
||||||
@ -3273,19 +3281,25 @@ namespace NppDarkMode
|
|||||||
style |= TVS_TRACKSELECT;
|
style |= TVS_TRACKSELECT;
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
SetWindowTheme(hwnd, L"Explorer", nullptr);
|
strSubAppName = L"Explorer";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TreeViewStyle::dark:
|
case TreeViewStyle::dark:
|
||||||
|
{
|
||||||
|
if (NppDarkMode::isExperimentalSupported())
|
||||||
{
|
{
|
||||||
if (!hasHotStyle)
|
if (!hasHotStyle)
|
||||||
{
|
{
|
||||||
style |= TVS_TRACKSELECT;
|
style |= TVS_TRACKSELECT;
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
SetWindowTheme(hwnd, g_isAtLeastWindows10 ? L"DarkMode_Explorer" : nullptr, nullptr);
|
strSubAppName = L"DarkMode_Explorer";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
[[fallthrough]];
|
||||||
|
}
|
||||||
|
|
||||||
case TreeViewStyle::classic:
|
case TreeViewStyle::classic:
|
||||||
{
|
{
|
||||||
if (hasHotStyle)
|
if (hasHotStyle)
|
||||||
@ -3293,14 +3307,17 @@ namespace NppDarkMode
|
|||||||
style &= ~TVS_TRACKSELECT;
|
style &= ~TVS_TRACKSELECT;
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
SetWindowTheme(hwnd, nullptr, nullptr);
|
strSubAppName = L"";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change)
|
if (change)
|
||||||
{
|
{
|
||||||
::SetWindowLongPtr(hwnd, GWL_STYLE, style);
|
::SetWindowLongPtr(hWnd, GWL_STYLE, style);
|
||||||
|
}
|
||||||
|
|
||||||
|
::SetWindowTheme(hWnd, strSubAppName.empty() ? nullptr : strSubAppName.c_str(), nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,8 +226,9 @@ namespace NppDarkMode
|
|||||||
|
|
||||||
void disableVisualStyle(HWND hwnd, bool doDisable);
|
void disableVisualStyle(HWND hwnd, bool doDisable);
|
||||||
void calculateTreeViewStyle();
|
void calculateTreeViewStyle();
|
||||||
|
void updateTreeViewStylePrev();
|
||||||
TreeViewStyle getTreeViewStyle();
|
TreeViewStyle getTreeViewStyle();
|
||||||
void setTreeViewStyle(HWND hwnd);
|
void setTreeViewStyle(HWND hWnd, bool force = false);
|
||||||
bool isThemeDark();
|
bool isThemeDark();
|
||||||
void setBorder(HWND hwnd, bool border = true);
|
void setBorder(HWND hwnd, bool border = true);
|
||||||
|
|
||||||
|
@ -217,7 +217,10 @@ intptr_t CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
|||||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||||
::SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_iconListVector.at(NppDarkMode::isEnabled() ? 1 : 0)));
|
::SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_iconListVector.at(NppDarkMode::isEnabled() ? 1 : 0)));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> imgIds = _treeView.getImageIds(
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
{ IDI_FB_ROOTOPEN, IDI_FB_ROOTCLOSE, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE }
|
{ IDI_FB_ROOTOPEN, IDI_FB_ROOTCLOSE, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE }
|
||||||
|
@ -971,7 +971,10 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
|||||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||||
::SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_iconListVector.at(NppDarkMode::isEnabled() ? 1 : 0)));
|
::SendMessage(_hToolbarMenu, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_iconListVector.at(NppDarkMode::isEnabled() ? 1 : 0)));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> imgIds = _treeView.getImageIds(
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
{ IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF }
|
{ IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF }
|
||||||
|
@ -110,7 +110,10 @@ intptr_t CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
{
|
{
|
||||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> imgIds = _treeView.getImageIds(
|
std::vector<int> imgIds = _treeView.getImageIds(
|
||||||
{ IDI_PROJECT_WORKSPACE, IDI_PROJECT_WORKSPACEDIRTY, IDI_PROJECT_PROJECT, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE, IDI_PROJECT_FILEINVALID }
|
{ IDI_PROJECT_WORKSPACE, IDI_PROJECT_WORKSPACEDIRTY, IDI_PROJECT_PROJECT, IDI_PROJECT_FOLDEROPEN, IDI_PROJECT_FOLDERCLOSE, IDI_PROJECT_FILE, IDI_PROJECT_FILEINVALID }
|
||||||
|
@ -46,7 +46,7 @@ void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID)
|
|||||||
_hInst,
|
_hInst,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
NppDarkMode::setTreeViewStyle(_hSelf);
|
NppDarkMode::setTreeViewStyle(_hSelf, true);
|
||||||
|
|
||||||
const int itemHeight = DPIManagerV2::scale(g_treeviewIcoSize + g_treeviewItemPadding * 2, _hParent);
|
const int itemHeight = DPIManagerV2::scale(g_treeviewIcoSize + g_treeviewItemPadding * 2, _hParent);
|
||||||
TreeView_SetItemHeight(_hSelf, itemHeight);
|
TreeView_SetItemHeight(_hSelf, itemHeight);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user