mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 14:54:39 +02:00
Fix customizing toolbar icon messed with dark mode
Ref:
d85b9a7464 (commitcomment-74498214)
This commit is contained in:
parent
b25f37646d
commit
fa3ba7e389
@ -613,8 +613,6 @@ LRESULT Notepad_plus::init(HWND hwnd)
|
||||
|
||||
_toolBar.init(_pPublicInterface->getHinst(), hwnd, tbStatus, toolBarIcons, sizeof(toolBarIcons) / sizeof(ToolBarButtonUnit));
|
||||
|
||||
changeToolBarIcons();
|
||||
|
||||
_rebarTop.init(_pPublicInterface->getHinst(), hwnd);
|
||||
_rebarBottom.init(_pPublicInterface->getHinst(), hwnd);
|
||||
_toolBar.addToRebar(&_rebarTop);
|
||||
@ -5113,11 +5111,6 @@ bool Notepad_plus::addCurrentMacro()
|
||||
return false;
|
||||
}
|
||||
|
||||
void Notepad_plus::changeToolBarIcons()
|
||||
{
|
||||
_toolBar.changeIcons();
|
||||
}
|
||||
|
||||
bool Notepad_plus::switchToFile(BufferID id)
|
||||
{
|
||||
int i = 0;
|
||||
|
@ -207,7 +207,6 @@ public:
|
||||
bool fileLoadSession(const TCHAR* fn = nullptr);
|
||||
const TCHAR * fileSaveSession(size_t nbFile, TCHAR ** fileNames, const TCHAR *sessionFile2save, bool includeFileBrowser = false);
|
||||
const TCHAR * fileSaveSession(size_t nbFile = 0, TCHAR** fileNames = nullptr);
|
||||
void changeToolBarIcons();
|
||||
|
||||
bool doBlockComment(comment_mode currCommentMode);
|
||||
bool doStreamComment();
|
||||
|
@ -2041,7 +2041,6 @@ void Notepad_plus::command(int id)
|
||||
if (state != TB_SMALL)
|
||||
{
|
||||
_toolBar.reduce();
|
||||
changeToolBarIcons();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2053,7 +2052,6 @@ void Notepad_plus::command(int id)
|
||||
if (state != TB_LARGE)
|
||||
{
|
||||
_toolBar.enlarge();
|
||||
changeToolBarIcons();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2065,7 +2063,6 @@ void Notepad_plus::command(int id)
|
||||
if (state != TB_SMALL2)
|
||||
{
|
||||
_toolBar.reduceToSet2();
|
||||
changeToolBarIcons();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2077,7 +2074,6 @@ void Notepad_plus::command(int id)
|
||||
if (state != TB_LARGE2)
|
||||
{
|
||||
_toolBar.enlargeToSet2();
|
||||
changeToolBarIcons();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -146,7 +146,9 @@ public :
|
||||
|
||||
bool replaceIcon(size_t witchList, size_t iconIndex, const TCHAR *iconLocation) const {
|
||||
if ((witchList != HLIST_DEFAULT) && (witchList != HLIST_DISABLE) &&
|
||||
(witchList != HLIST_DEFAULT2) && (witchList != HLIST_DISABLE2))
|
||||
(witchList != HLIST_DEFAULT2) && (witchList != HLIST_DISABLE2) &&
|
||||
(witchList != HLIST_DEFAULT_DM) && (witchList != HLIST_DISABLE_DM) &&
|
||||
(witchList != HLIST_DEFAULT_DM2) && (witchList != HLIST_DISABLE_DM2))
|
||||
return false;
|
||||
|
||||
return _iconListVector[witchList].changeIcon(iconIndex, iconLocation);
|
||||
|
@ -92,7 +92,12 @@ void ToolBar::initTheme(TiXmlDocument *toolIconsDocRoot)
|
||||
locator += icoUnit._id;
|
||||
locator += ext;
|
||||
if (::PathFileExists(locator.c_str()))
|
||||
_customIconVect.push_back(iconLocator(0, i, locator));
|
||||
{
|
||||
_customIconVect.push_back(iconLocator(HLIST_DEFAULT, i, locator));
|
||||
_customIconVect.push_back(iconLocator(HLIST_DEFAULT2, i, locator));
|
||||
_customIconVect.push_back(iconLocator(HLIST_DEFAULT_DM, i, locator));
|
||||
_customIconVect.push_back(iconLocator(HLIST_DEFAULT_DM2, i, locator));
|
||||
}
|
||||
|
||||
if (icoUnit.hasDisabledIcon)
|
||||
{
|
||||
@ -102,7 +107,12 @@ void ToolBar::initTheme(TiXmlDocument *toolIconsDocRoot)
|
||||
locator_dis += disabled_suffix;
|
||||
locator_dis += ext;
|
||||
if (::PathFileExists(locator_dis.c_str()))
|
||||
_customIconVect.push_back(iconLocator(1, i, locator_dis));
|
||||
{
|
||||
_customIconVect.push_back(iconLocator(HLIST_DISABLE, i, locator_dis));
|
||||
_customIconVect.push_back(iconLocator(HLIST_DISABLE2, i, locator_dis));
|
||||
_customIconVect.push_back(iconLocator(HLIST_DISABLE_DM, i, locator_dis));
|
||||
_customIconVect.push_back(iconLocator(HLIST_DISABLE_DM2, i, locator_dis));
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@ -264,10 +274,8 @@ void ToolBar::setToBmpIcons()
|
||||
Window::redraw();
|
||||
}
|
||||
|
||||
|
||||
void ToolBar::reset(bool create)
|
||||
{
|
||||
|
||||
if (create && _hSelf)
|
||||
{
|
||||
//Store current button state information
|
||||
@ -307,6 +315,8 @@ void ToolBar::reset(bool create)
|
||||
// backward compatibility.
|
||||
::SendMessage(_hSelf, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
|
||||
::SendMessage(_hSelf, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_HIDECLIPPEDBUTTONS);
|
||||
|
||||
change2CustomIconsIfAny();
|
||||
}
|
||||
|
||||
if (!_hSelf)
|
||||
@ -317,11 +327,10 @@ void ToolBar::reset(bool create)
|
||||
bool doOverrideToolbarIcons = _customIconVect.size() > 0;
|
||||
if (doOverrideToolbarIcons)
|
||||
{
|
||||
setDefaultImageList();
|
||||
setDisableImageList();
|
||||
if (_state == TB_STANDARD)
|
||||
_state = TB_SMALL;
|
||||
}
|
||||
else // use internal icons according the settings
|
||||
{
|
||||
|
||||
if (_state != TB_STANDARD) //If non standard icons, use custom imagelists
|
||||
{
|
||||
if (_state == TB_SMALL || _state == TB_LARGE)
|
||||
@ -385,7 +394,6 @@ void ToolBar::reset(bool create)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (create)
|
||||
{ //if the toolbar has been recreated, readd the buttons
|
||||
|
@ -82,7 +82,7 @@ public :
|
||||
return _state;
|
||||
};
|
||||
|
||||
bool changeIcons() {
|
||||
bool change2CustomIconsIfAny() {
|
||||
if (!_toolIcons) return false;
|
||||
|
||||
for (size_t i = 0, len = _customIconVect.size(); i < len; ++i)
|
||||
@ -113,6 +113,7 @@ private :
|
||||
ReBar * _pRebar = nullptr;
|
||||
REBARBANDINFO _rbBand = {};
|
||||
std::vector<iconLocator> _customIconVect;
|
||||
|
||||
TiXmlNode *_toolIcons = nullptr;
|
||||
|
||||
void setDefaultImageList() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user