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);
}
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(_subDocTab.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);

View File

@ -1052,6 +1052,16 @@ namespace NppDarkMode
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)
{
UINT msg = 0;
@ -1076,14 +1086,14 @@ namespace NppDarkMode
if (msg == 0)
{
SetWindowTheme(hwnd, NppDarkMode::isEnabled() ? L"DarkMode_Explorer" : nullptr, nullptr);
NppDarkMode::setDarkExplorerTheme(hwnd);
}
else
{
auto hTips = reinterpret_cast<HWND>(::SendMessage(hwnd, msg, 0, 0));
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 setDarkTitleBar(HWND hwnd);
void setDarkExplorerTheme(HWND hwnd);
void setDarkScrollBar(HWND hwnd);
void setDarkTooltips(HWND hwnd, ToolTipsType type);
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(_2ButtonsTip, NppDarkMode::ToolTipsType::tooltip);
NppDarkMode::setDarkTooltips(_filterTip, NppDarkMode::ToolTipsType::tooltip);
HWND finder = getHFindResults();
if (finder)
{
NppDarkMode::setDarkScrollBar(finder);
}
NppDarkMode::autoThemeChildControls(_hSelf);
return TRUE;
}

View File

@ -187,7 +187,7 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
}
Window::init(hInst, hPere);
_hSelf = ::CreateWindowEx(
_hSelf = ::CreateWindowEx(
0,\
TEXT("Scintilla"),\
TEXT("Notepad++"),\
@ -203,10 +203,12 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
throw std::runtime_error("ScintillaEditView::init : CreateWindowEx() function return null");
}
NppDarkMode::setDarkScrollBar(_hSelf);
_pScintillaFunc = (SCINTILLA_FUNC)::SendMessage(_hSelf, SCI_GETDIRECTFUNCTION, 0, 0);
_pScintillaPtr = (SCINTILLA_PTR)::SendMessage(_hSelf, SCI_GETDIRECTPOINTER, 0, 0);
_userDefineDlg.init(_hInst, _hParent, this);
_userDefineDlg.init(_hInst, _hParent, this);
if (!_pScintillaFunc)
{
@ -218,10 +220,10 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
throw std::runtime_error("ScintillaEditView::init : SCI_GETDIRECTPOINTER message failed");
}
execute(SCI_SETMARGINMASKN, _SC_MARGE_FOLDER, SC_MASK_FOLDERS);
showMargin(_SC_MARGE_FOLDER, true);
execute(SCI_SETMARGINMASKN, _SC_MARGE_FOLDER, SC_MASK_FOLDERS);
showMargin(_SC_MARGE_FOLDER, true);
execute(SCI_SETMARGINMASKN, _SC_MARGE_SYBOLE, (1<<MARK_BOOKMARK) | (1<<MARK_HIDELINESBEGIN) | (1<<MARK_HIDELINESEND) | (1<<MARK_HIDELINESUNDERLINE));
execute(SCI_SETMARGINMASKN, _SC_MARGE_SYBOLE, (1<<MARK_BOOKMARK) | (1<<MARK_HIDELINESBEGIN) | (1<<MARK_HIDELINESEND) | (1<<MARK_HIDELINESUNDERLINE));
execute(SCI_MARKERSETALPHA, MARK_BOOKMARK, 70);
@ -344,6 +346,12 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
{
switch (Message)
{
case NPPM_INTERNAL_REFRESHDARKMODE:
{
NppDarkMode::setDarkScrollBar(_hSelf);
return TRUE;
}
case WM_MOUSEHWHEEL :
{
::CallWindowProc(_scintillaDefaultProc, hwnd, WM_HSCROLL, ((short)HIWORD(wParam) > 0)?SB_LINERIGHT:SB_LINELEFT, 0);

View File

@ -188,13 +188,20 @@ void ClipboardHistoryPanel::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
INT_PTR CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG :
{
switch (message)
{
case WM_INITDIALOG:
{
_hwndNextCbViewer = ::SetClipboardViewer(_hSelf);
return TRUE;
}
NppDarkMode::setDarkScrollBar(::GetDlgItem(_hSelf, IDC_LIST_CLIPBOARD));
return TRUE;
}
case NPPM_INTERNAL_REFRESHDARKMODE:
{
NppDarkMode::setDarkScrollBar(GetDlgItem(_hSelf, IDC_LIST_CLIPBOARD));
return TRUE;
}
case WM_CHANGECBCHAIN:
if (_hwndNextCbViewer == reinterpret_cast<HWND>(wParam))