mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-22 21:34:58 +02:00
Fix Document List icons unchanged issue after switching to dark mode
1. Document List icons now support darkmode icons and alternate icons. 2. Fixed memory leak in code and additional code refactoring. Fix #10740, close #10956
This commit is contained in:
parent
ae09024e66
commit
4a7a33f010
@ -6606,9 +6606,10 @@ void Notepad_plus::launchDocumentListPanel()
|
||||
if (!_pDocumentListPanel)
|
||||
{
|
||||
NppParameters& nppParams = NppParameters::getInstance();
|
||||
int tabBarStatus = nppParams.getNppGUI()._tabStatus;
|
||||
|
||||
_pDocumentListPanel = new VerticalFileSwitcher;
|
||||
HIMAGELIST hImgLst = _docTabIconList.getHandle();
|
||||
HIMAGELIST hImgLst = ((tabBarStatus & TAB_ALTICONS) ? _docTabIconListAlt.getHandle() : NppDarkMode::isEnabled() ? _docTabIconListDarkMode.getHandle() : _docTabIconList.getHandle());
|
||||
_pDocumentListPanel->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), hImgLst);
|
||||
NativeLangSpeaker *pNativeSpeaker = nppParams.getNativeLangSpeaker();
|
||||
bool isRTL = pNativeSpeaker->isRTL();
|
||||
|
@ -740,6 +740,40 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||
{
|
||||
_mainDocTab.changeIcons(static_cast<unsigned char>(lParam));
|
||||
_subDocTab.changeIcons(static_cast<unsigned char>(lParam));
|
||||
|
||||
//restart document list with the same icons as the DocTabs
|
||||
if (_pDocumentListPanel)
|
||||
{
|
||||
if (!_pDocumentListPanel->isClosed()) // if doclist is open
|
||||
{
|
||||
//close the doclist
|
||||
_pDocumentListPanel->display(false);
|
||||
|
||||
//clean doclist
|
||||
_pDocumentListPanel->destroy();
|
||||
_pDocumentListPanel = nullptr;
|
||||
|
||||
//relaunch with new icons
|
||||
launchDocumentListPanel();
|
||||
}
|
||||
else //if doclist is closed
|
||||
{
|
||||
//clean doclist
|
||||
_pDocumentListPanel->destroy();
|
||||
_pDocumentListPanel = nullptr;
|
||||
|
||||
//relaunch doclist with new icons and close it
|
||||
launchDocumentListPanel();
|
||||
if (_pDocumentListPanel)
|
||||
{
|
||||
_pDocumentListPanel->display(false);
|
||||
_pDocumentListPanel->setClosed(true);
|
||||
checkMenuItem(IDM_VIEW_DOCLIST, false);
|
||||
_toolBar.setCheck(IDM_VIEW_DOCLIST, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,9 @@ public:
|
||||
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast<LPARAM>(_hSelf));
|
||||
}
|
||||
|
||||
virtual void destroy() {}
|
||||
virtual void destroy() {
|
||||
StaticDialog::destroy();
|
||||
}
|
||||
|
||||
virtual void setBackgroundColor(COLORREF) {}
|
||||
virtual void setForegroundColor(COLORREF) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user