Make Alternate Icons behaviour in dark mode consistent
The usage of alternate icons in dark mode can be remember now though the sessions. Fix #10159, close #11674pull/11678/head
parent
77a53ebd2f
commit
67297397d4
|
@ -235,7 +235,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
|||
pIconListVector.push_back(&_docTabIconListAlt); // 1
|
||||
pIconListVector.push_back(&_docTabIconListDarkMode);// 2
|
||||
|
||||
unsigned char indexDocTabIcon = NppDarkMode::isEnabled() ? 2 : ((tabBarStatus & TAB_ALTICONS) ? 1 : 0);
|
||||
unsigned char indexDocTabIcon = (((tabBarStatus & TAB_ALTICONS) == TAB_ALTICONS) ? 1 : NppDarkMode::isEnabled() ? 2 : 1);
|
||||
|
||||
_mainDocTab.init(_pPublicInterface->getHinst(), hwnd, &_mainEditView, pIconListVector, indexDocTabIcon);
|
||||
_subDocTab.init(_pPublicInterface->getHinst(), hwnd, &_subEditView, pIconListVector, indexDocTabIcon);
|
||||
|
@ -7713,95 +7713,65 @@ void Notepad_plus::restoreMinimizeDialogs()
|
|||
|
||||
void Notepad_plus::refreshDarkMode(bool resetStyle)
|
||||
{
|
||||
NppParameters& nppParams = NppParameters::getInstance();
|
||||
|
||||
SendMessage(_pPublicInterface->getHSelf(), NPPM_SETEDITORBORDEREDGE, 0, nppParams.getSVP()._showBorderEdge);
|
||||
|
||||
if (resetStyle && NppDarkMode::isExperimentalSupported())
|
||||
{
|
||||
NppDarkMode::allowDarkModeForApp(NppDarkMode::isEnabled());
|
||||
|
||||
NppDarkMode::setDarkTitleBar(_pPublicInterface->getHSelf());
|
||||
::SetWindowPos(_pPublicInterface->getHSelf(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
|
||||
for (auto& docCont : _dockingManager.getContainerInfo())
|
||||
{
|
||||
NppDarkMode::setDarkTitleBar(docCont->getCaptionWnd());
|
||||
::SetWindowPos(docCont->getCaptionWnd(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
for (auto& hwndDlg : _hModelessDlgs)
|
||||
{
|
||||
NppDarkMode::setDarkTitleBar(hwndDlg);
|
||||
::SendMessage(hwndDlg, NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
::RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
::SetWindowPos(hwndDlg, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto& hwndDlg : _hModelessDlgs)
|
||||
{
|
||||
::SendMessage(hwndDlg, NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
::RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
}
|
||||
}
|
||||
|
||||
if (_pProjectPanel_1)
|
||||
{
|
||||
::SendMessage(_pProjectPanel_1->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pProjectPanel_2)
|
||||
{
|
||||
::SendMessage(_pProjectPanel_2->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pProjectPanel_3)
|
||||
{
|
||||
::SendMessage(_pProjectPanel_3->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pFuncList)
|
||||
{
|
||||
::SendMessage(_pFuncList->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pFileBrowser)
|
||||
{
|
||||
::SendMessage(_pFileBrowser->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
|
||||
if (_pAnsiCharPanel)
|
||||
{
|
||||
::SendMessage(_pAnsiCharPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pDocumentListPanel)
|
||||
{
|
||||
::SendMessage(_pDocumentListPanel->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);
|
||||
|
||||
SendMessage(_incrementFindDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
RedrawWindow(_pPublicInterface->getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
SendMessage(_pPublicInterface->getHSelf(), NPPM_INTERNAL_CHANGETABBAEICONS, 0, NppDarkMode::isEnabled() ? 2 : 0);
|
||||
|
||||
::SendMessage(_findInFinderDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
::RedrawWindow(_findInFinderDlg.getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
if (resetStyle && NppDarkMode::isExperimentalSupported())
|
||||
{
|
||||
NppDarkMode::setDarkTitleBar(_findInFinderDlg.getHSelf());
|
||||
::SetWindowPos(_findInFinderDlg.getHSelf(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
if (resetStyle)
|
||||
{
|
||||
NppParameters& nppParams = NppParameters::getInstance();
|
||||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_SETEDITORBORDEREDGE, 0, nppParams.getSVP()._showBorderEdge);
|
||||
|
||||
::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);
|
||||
|
||||
::SendMessage(_findInFinderDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
::RedrawWindow(_findInFinderDlg.getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
|
||||
::SendMessage(_incrementFindDlg.getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
::RedrawWindow(_pPublicInterface->getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
|
||||
if (_pProjectPanel_1)
|
||||
{
|
||||
::SendMessage(_pProjectPanel_1->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pProjectPanel_2)
|
||||
{
|
||||
::SendMessage(_pProjectPanel_2->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pProjectPanel_3)
|
||||
{
|
||||
::SendMessage(_pProjectPanel_3->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pFuncList)
|
||||
{
|
||||
::SendMessage(_pFuncList->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pFileBrowser)
|
||||
{
|
||||
::SendMessage(_pFileBrowser->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
|
||||
if (_pAnsiCharPanel)
|
||||
{
|
||||
::SendMessage(_pAnsiCharPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
if (_pDocumentListPanel)
|
||||
{
|
||||
::SendMessage(_pDocumentListPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
|
||||
if (_pClipboardHistoryPanel)
|
||||
{
|
||||
::SendMessage(_pClipboardHistoryPanel->getHSelf(), NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
}
|
||||
|
||||
bool isChecked = _preference._generalSubDlg.isCheckedOrNot(IDC_CHECK_TAB_ALTICONS);
|
||||
if (!isChecked)
|
||||
{
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_INTERNAL_CHANGETABBAEICONS, 0, NppDarkMode::isEnabled() ? 2 : 0);
|
||||
}
|
||||
|
||||
toolBarStatusType state = _toolBar.getState();
|
||||
switch (state)
|
||||
{
|
||||
|
@ -7862,6 +7832,49 @@ void Notepad_plus::refreshDarkMode(bool resetStyle)
|
|||
::SendMessage(_pPublicInterface->getHSelf(), WM_UPDATESCINTILLAS, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (NppDarkMode::isExperimentalSupported())
|
||||
{
|
||||
NppDarkMode::allowDarkModeForApp(NppDarkMode::isEnabled());
|
||||
|
||||
NppDarkMode::setDarkTitleBar(_pPublicInterface->getHSelf());
|
||||
::SetWindowPos(_pPublicInterface->getHSelf(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
|
||||
for (auto& docCont : _dockingManager.getContainerInfo())
|
||||
{
|
||||
auto hwndDocCont = docCont->getCaptionWnd();
|
||||
NppDarkMode::setDarkTitleBar(hwndDocCont);
|
||||
::SetWindowPos(hwndDocCont, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
for (auto& hwndDlg : _hModelessDlgs)
|
||||
{
|
||||
NppDarkMode::setDarkTitleBar(hwndDlg);
|
||||
::SendMessage(hwndDlg, NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
::RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
::SetWindowPos(hwndDlg, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
NppDarkMode::setDarkTitleBar(_findInFinderDlg.getHSelf());
|
||||
::SetWindowPos(_findInFinderDlg.getHSelf(), nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto& docCont : _dockingManager.getContainerInfo())
|
||||
{
|
||||
auto hwndDocCont = docCont->getCaptionWnd();
|
||||
::RedrawWindow(hwndDocCont, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
}
|
||||
|
||||
for (auto& hwndDlg : _hModelessDlgs)
|
||||
{
|
||||
//::SendMessage(hwndDlg, NPPM_INTERNAL_REFRESHDARKMODE, 0, 0);
|
||||
::RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
}
|
||||
|
||||
::RedrawWindow(_findInFinderDlg.getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
::RedrawWindow(_pPublicInterface->getHSelf(), nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue