Add dark mode search results panel tab bar icon

ref #14959

Close #15286
This commit is contained in:
ozone10 2024-06-13 16:23:32 +02:00 committed by Don Ho
parent 7f7dd1df01
commit dbdeca5b28
7 changed files with 31 additions and 9 deletions

View File

@ -286,7 +286,7 @@ IDI_READONLY_ALT_ICON ICON "icons/standard/tabbar/readonly_alt.ic
IDI_MONITORING_ICON ICON "icons/standard/tabbar/monitoring.ico"
IDI_MONITORING_DM_ICON ICON "icons/dark/tabbar/monitoring.ico"
IDI_FIND_RESULT_ICON ICON "icons/findResult.ico"
IDI_FIND_RESULT_ICON ICON "icons/standard/panels/tabbar/findResult.ico"
IDC_DRAG_TAB CURSOR "cursors/drag.cur"
IDC_DRAG_INTERDIT_TAB CURSOR "cursors/drag_interdit.cur"
@ -356,6 +356,8 @@ IDR_CLIPBOARDPANEL_ICO_DM ICON "icons/dark/panels/tabbar/clipboardP
IDR_ASCIIPANEL_ICO ICON "icons/standard/panels/tabbar/asciiPanel.ico"
IDR_ASCIIPANEL_ICO2 ICON "icons/light/panels/tabbar/asciiPanel.ico"
IDR_ASCIIPANEL_ICO_DM ICON "icons/dark/panels/tabbar/asciiPanel.ico"
IDR_FIND_RESULT_ICO2 ICON "icons/light/panels/tabbar/findResult.ico"
IDR_FIND_RESULT_ICO_DM ICON "icons/dark/panels/tabbar/findResult.ico"
IDI_PROJECT_WORKSPACE BITMAP "icons/standard/panels/treeview/project_work_space.bmp"

View File

@ -3507,6 +3507,8 @@ void FindReplaceDlg::findAllIn(InWhat op)
bool justCreated = false;
if (!_pFinder)
{
NppParameters& nppParam = NppParameters::getInstance();
_pFinder = new Finder();
_pFinder->init(_hInst, (*_ppEditView)->getHParent(), _ppEditView);
_pFinder->setVolatiled(false);
@ -3517,8 +3519,14 @@ void FindReplaceDlg::findAllIn(InWhat op)
// define the default docking behaviour
data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO | DWS_USEOWNDARKMODE;
int icoID = IDI_FIND_RESULT_ICON;
if (NppDarkMode::isEnabled())
icoID = IDR_FIND_RESULT_ICO_DM;
else if (nppParam.getNppGUI()._toolBarStatus != TB_STANDARD)
icoID = IDR_FIND_RESULT_ICO2;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pFinder->getHSelf());
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(IDI_FIND_RESULT_ICON), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
data.pszAddInfo = _findAllResultStr;
@ -3528,7 +3536,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
// in this case is DOCKABLE_DEMO_INDEX
data.dlgID = 0;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string text = pNativeSpeaker->getLocalizedStrFromID("find-result-caption", TEXT(""));
if (!text.empty())
@ -3554,7 +3562,6 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder->_scintView.execute(SCI_SETUSETABS, true);
_pFinder->_scintView.execute(SCI_SETTABWIDTH, 4);
NppParameters& nppParam = NppParameters::getInstance();
NppGUI& nppGUI = nppParam.getNppGUI();
_pFinder->_longLinesAreWrapped = nppGUI._finderLinesAreCurrentlyWrapped;
_pFinder->_scintView.wrap(_pFinder->_longLinesAreWrapped);
@ -3647,6 +3654,8 @@ void FindReplaceDlg::findAllIn(InWhat op)
Finder * FindReplaceDlg::createFinder()
{
NppParameters& nppParam = NppParameters::getInstance();
Finder *pFinder = new Finder();
pFinder->init(_hInst, (*_ppEditView)->getHParent(), _ppEditView);
@ -3657,8 +3666,14 @@ Finder * FindReplaceDlg::createFinder()
// define the default docking behaviour
data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO | DWS_USEOWNDARKMODE;
int icoID = IDI_FIND_RESULT_ICON;
if (NppDarkMode::isEnabled())
icoID = IDR_FIND_RESULT_ICO_DM;
else if (nppParam.getNppGUI()._toolBarStatus != TB_STANDARD)
icoID = IDR_FIND_RESULT_ICO2;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pFinder->getHSelf());
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(IDI_FIND_RESULT_ICON), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
data.pszAddInfo = _findAllResultStr;
@ -3668,7 +3683,7 @@ Finder * FindReplaceDlg::createFinder()
// in this case is DOCKABLE_DEMO_INDEX
data.dlgID = 0;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
generic_string text = pNativeSpeaker->getLocalizedStrFromID("find-result-caption", TEXT(""));
if (!text.empty())
{

View File

@ -119,10 +119,14 @@ public:
updateCaption();
};
void destroy() override{
void destroy() override {
for (auto& tTbData : _vTbData)
{
::DestroyIcon(tTbData->hIconTab);
if (tTbData->hIconTab != nullptr)
{
::DestroyIcon(tTbData->hIconTab);
tTbData->hIconTab = nullptr;
}
delete tTbData;
}
::DestroyWindow(_hSelf);

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -265,7 +265,6 @@
#define IDI_UNSAVED_DM_ICON 510
#define IDI_MONITORING_DM_ICON 511
#define IDI_READONLY_DM_ICON 512
#define IDI_DELETE_ICON 525
#define IDI_PROJECT_WORKSPACE 601
@ -374,6 +373,8 @@
#define IDR_CLIPBOARDPANEL_ICO_DM 1561
#define IDR_ASCIIPANEL_ICO2 1562
#define IDR_ASCIIPANEL_ICO_DM 1563
#define IDR_FIND_RESULT_ICO2 1564
#define IDR_FIND_RESULT_ICO_DM 1565
#define ID_MACRO 20000
// O .