Improve dynamic switching for scrollbars.

For main and sub edits, finder (search result docking window) and clipboard history panel.

Fix #10083, close #10084
This commit is contained in:
ozone10 2021-06-29 16:24:52 +02:00 committed by Don Ho
parent 60105d68f7
commit 75643560a3
6 changed files with 55 additions and 13 deletions

View File

@ -7554,6 +7554,14 @@ void Notepad_plus::refreshDarkMode()
::SendMessage(_pFileSwitcherPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0); ::SendMessage(_pFileSwitcherPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
} }
if (_pClipboardHistoryPanel)
{
::SendMessage(_pClipboardHistoryPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
}
::SendMessage(_subEditView.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
::SendMessage(_mainEditView.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
::SendMessage(_mainDocTab.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0); ::SendMessage(_mainDocTab.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
::SendMessage(_subDocTab.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0); ::SendMessage(_subDocTab.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);

View File

@ -1052,6 +1052,16 @@ namespace NppDarkMode
NppDarkMode::setTitleBarThemeColor(hwnd, useDark); NppDarkMode::setTitleBarThemeColor(hwnd, useDark);
} }
void setDarkExplorerTheme(HWND hwnd)
{
SetWindowTheme(hwnd, NppDarkMode::isEnabled() ? L"DarkMode_Explorer" : nullptr, nullptr);
}
void setDarkScrollBar(HWND hwnd)
{
NppDarkMode::setDarkExplorerTheme(hwnd);
}
void setDarkTooltips(HWND hwnd, ToolTipsType type) void setDarkTooltips(HWND hwnd, ToolTipsType type)
{ {
UINT msg = 0; UINT msg = 0;
@ -1076,14 +1086,14 @@ namespace NppDarkMode
if (msg == 0) if (msg == 0)
{ {
SetWindowTheme(hwnd, NppDarkMode::isEnabled() ? L"DarkMode_Explorer" : nullptr, nullptr); NppDarkMode::setDarkExplorerTheme(hwnd);
} }
else else
{ {
auto hTips = reinterpret_cast<HWND>(::SendMessage(hwnd, msg, 0, 0)); auto hTips = reinterpret_cast<HWND>(::SendMessage(hwnd, msg, 0, 0));
if (hTips != nullptr) if (hTips != nullptr)
{ {
SetWindowTheme(hTips, NppDarkMode::isEnabled() ? L"DarkMode_Explorer" : nullptr, nullptr); NppDarkMode::setDarkExplorerTheme(hTips);
} }
} }
} }

View File

@ -85,6 +85,8 @@ namespace NppDarkMode
void autoThemeChildControls(HWND hwndParent); void autoThemeChildControls(HWND hwndParent);
void setDarkTitleBar(HWND hwnd); void setDarkTitleBar(HWND hwnd);
void setDarkExplorerTheme(HWND hwnd);
void setDarkScrollBar(HWND hwnd);
void setDarkTooltips(HWND hwnd, ToolTipsType type); void setDarkTooltips(HWND hwnd, ToolTipsType type);
void setDarkLineAbovePanelToolbar(HWND hwnd); void setDarkLineAbovePanelToolbar(HWND hwnd);

View File

@ -881,6 +881,13 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
NppDarkMode::setDarkTooltips(_shiftTrickUpTip, NppDarkMode::ToolTipsType::tooltip); NppDarkMode::setDarkTooltips(_shiftTrickUpTip, NppDarkMode::ToolTipsType::tooltip);
NppDarkMode::setDarkTooltips(_2ButtonsTip, NppDarkMode::ToolTipsType::tooltip); NppDarkMode::setDarkTooltips(_2ButtonsTip, NppDarkMode::ToolTipsType::tooltip);
NppDarkMode::setDarkTooltips(_filterTip, NppDarkMode::ToolTipsType::tooltip); NppDarkMode::setDarkTooltips(_filterTip, NppDarkMode::ToolTipsType::tooltip);
HWND finder = getHFindResults();
if (finder)
{
NppDarkMode::setDarkScrollBar(finder);
}
NppDarkMode::autoThemeChildControls(_hSelf); NppDarkMode::autoThemeChildControls(_hSelf);
return TRUE; return TRUE;
} }

View File

@ -203,6 +203,8 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
throw std::runtime_error("ScintillaEditView::init : CreateWindowEx() function return null"); throw std::runtime_error("ScintillaEditView::init : CreateWindowEx() function return null");
} }
NppDarkMode::setDarkScrollBar(_hSelf);
_pScintillaFunc = (SCINTILLA_FUNC)::SendMessage(_hSelf, SCI_GETDIRECTFUNCTION, 0, 0); _pScintillaFunc = (SCINTILLA_FUNC)::SendMessage(_hSelf, SCI_GETDIRECTFUNCTION, 0, 0);
_pScintillaPtr = (SCINTILLA_PTR)::SendMessage(_hSelf, SCI_GETDIRECTPOINTER, 0, 0); _pScintillaPtr = (SCINTILLA_PTR)::SendMessage(_hSelf, SCI_GETDIRECTPOINTER, 0, 0);
@ -344,6 +346,12 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
{ {
switch (Message) switch (Message)
{ {
case NPPM_INTERNAL_REFRESHDARKMODE:
{
NppDarkMode::setDarkScrollBar(_hSelf);
return TRUE;
}
case WM_MOUSEHWHEEL : case WM_MOUSEHWHEEL :
{ {
::CallWindowProc(_scintillaDefaultProc, hwnd, WM_HSCROLL, ((short)HIWORD(wParam) > 0)?SB_LINERIGHT:SB_LINELEFT, 0); ::CallWindowProc(_scintillaDefaultProc, hwnd, WM_HSCROLL, ((short)HIWORD(wParam) > 0)?SB_LINERIGHT:SB_LINELEFT, 0);

View File

@ -193,6 +193,13 @@ INT_PTR CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam,
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
_hwndNextCbViewer = ::SetClipboardViewer(_hSelf); _hwndNextCbViewer = ::SetClipboardViewer(_hSelf);
NppDarkMode::setDarkScrollBar(::GetDlgItem(_hSelf, IDC_LIST_CLIPBOARD));
return TRUE;
}
case NPPM_INTERNAL_REFRESHDARKMODE:
{
NppDarkMode::setDarkScrollBar(GetDlgItem(_hSelf, IDC_LIST_CLIPBOARD));
return TRUE; return TRUE;
} }