From 659330e81a057d7f44cd69396f8067316632e17f Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 15 Mar 2025 21:28:42 +0100 Subject: [PATCH] Fix plugin button hidings being ignored bug in toolbar button conf Fix plugin button hidings settings being ignored bug in toolbar button config, if the value of "hideAll" attribute of "Standard" node in "toolbarButtonsConf.xml" is set to "yes". Fix #16280, close #16285 --- .../src/WinControls/ToolBar/ToolBar.cpp | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp index 781f3d027..c27f320e6 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp @@ -87,29 +87,30 @@ void ToolBar::initHideButtonsConf(TiXmlDocument* toolButtonsDocRoot, ToolBarButt { for (int i = 0; i < arraySize; ++i) _toolbarStdButtonsConfArray[i] = false; - return; } - - for (int i = 0; i < arraySize; ++i) - _toolbarStdButtonsConfArray[i] = true; - - for (TiXmlNode* childNode = standardToolButtons->FirstChildElement(L"Button"); - childNode; - childNode = childNode->NextSibling(L"Button")) + else { - TiXmlElement* element = childNode->ToElement(); - int cmdID =0; - const wchar_t* cmdIDStr = element->Attribute(L"id", &cmdID); + for (int i = 0; i < arraySize; ++i) + _toolbarStdButtonsConfArray[i] = true; - int index = 0; - const wchar_t* orderStr = element->Attribute(L"index", &index); - - const wchar_t* isHide = element->Attribute(L"hide"); - - if (cmdIDStr && orderStr && isHide && (lstrcmp(isHide, L"yes") == 0)) + for (TiXmlNode* childNode = standardToolButtons->FirstChildElement(L"Button"); + childNode; + childNode = childNode->NextSibling(L"Button")) { - if (index < arraySize && buttonUnitArray[index]._cmdID == cmdID) - _toolbarStdButtonsConfArray[index] = false; + TiXmlElement* element = childNode->ToElement(); + int cmdID = 0; + const wchar_t* cmdIDStr = element->Attribute(L"id", &cmdID); + + int index = 0; + const wchar_t* orderStr = element->Attribute(L"index", &index); + + const wchar_t* isHide = element->Attribute(L"hide"); + + if (cmdIDStr && orderStr && isHide && (lstrcmp(isHide, L"yes") == 0)) + { + if (index < arraySize && buttonUnitArray[index]._cmdID == cmdID) + _toolbarStdButtonsConfArray[index] = false; + } } } }