From 4f649d24dd3ee6e899e5b781df579602cac07583 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Fri, 11 Apr 2025 03:06:49 +0200 Subject: [PATCH] Use only toolbarButtonsConf.xml for toolbar buttons/icons customization Merge toolbarIcons.xml into toolbarButtonsConf.xml for toolbar buttons/icons customization and remove toolbarIcons.xml. Fix #16402, close #16407 --- PowerEditor/Test/FunctionList/cpp/unitTest | 15 --- PowerEditor/gcc/makefile | 2 +- .../nsisInclude/mainSectionFuncs.nsh | 1 - PowerEditor/installer/packageAll.bat | 12 --- PowerEditor/src/Notepad_plus.cpp | 7 +- PowerEditor/src/NppDarkMode.cpp | 2 +- PowerEditor/src/Parameters.cpp | 16 ---- PowerEditor/src/Parameters.h | 2 - .../src/toolbarButtonsConf_example.xml | 93 +++++++++++++++++-- PowerEditor/src/toolbarIcons.xml | 59 ------------ 10 files changed, 86 insertions(+), 123 deletions(-) delete mode 100644 PowerEditor/src/toolbarIcons.xml diff --git a/PowerEditor/Test/FunctionList/cpp/unitTest b/PowerEditor/Test/FunctionList/cpp/unitTest index 9f901ae4a..5604ee54d 100644 --- a/PowerEditor/Test/FunctionList/cpp/unitTest +++ b/PowerEditor/Test/FunctionList/cpp/unitTest @@ -1240,21 +1240,6 @@ bool NppParameters::load() isAllLaoded = false; } - //---------------------------------// - // toolbarIcons.xml : for per user // - //---------------------------------// - generic_string toolbarIconsPath(_userPath); - PathAppend(toolbarIconsPath, TEXT("toolbarIcons.xml")); - - _pXmlToolIconsDoc = new TiXmlDocument(toolbarIconsPath); - loadOkay = _pXmlToolIconsDoc->LoadFile(); - if (!loadOkay) - { - delete _pXmlToolIconsDoc; - _pXmlToolIconsDoc = nullptr; - isAllLaoded = false; - } - //------------------------------// // shortcuts.xml : for per user // //------------------------------// diff --git a/PowerEditor/gcc/makefile b/PowerEditor/gcc/makefile index d680273fc..a372392b5 100644 --- a/PowerEditor/gcc/makefile +++ b/PowerEditor/gcc/makefile @@ -26,7 +26,7 @@ BIN_DIRECTORY := ../bin INSTALLER_DIRECTORY := ../installer TARGET_BINARY := notepad++.exe -SRC_DATA := contextMenu.xml langs.model.xml shortcuts.xml stylers.model.xml tabContextMenu_example.xml toolbarButtonsConf_example.xml toolbarIcons.xml +SRC_DATA := contextMenu.xml langs.model.xml shortcuts.xml stylers.model.xml tabContextMenu_example.xml toolbarButtonsConf_example.xml BIN_DATA := change.log doLocalConf.xml nppLogNulContentCorruptionIssue.xml readme.txt userDefineLangs/ INSTALLER_DATA := autoCompletion/ functionList/ localization/ themes/ diff --git a/PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh b/PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh index 754e95b6d..a4bd85275 100644 --- a/PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh +++ b/PowerEditor/installer/nsisInclude/mainSectionFuncs.nsh @@ -82,7 +82,6 @@ Function copyCommonFiles File "..\bin\contextMenu.xml" File "..\src\tabContextMenu_example.xml" File "..\src\toolbarButtonsConf_example.xml" - File "..\src\toolbarIcons.xml" SetOverwrite on SetOutPath "$INSTDIR\" diff --git a/PowerEditor/installer/packageAll.bat b/PowerEditor/installer/packageAll.bat index 8a18c4ef7..12f2d26ad 100644 --- a/PowerEditor/installer/packageAll.bat +++ b/PowerEditor/installer/packageAll.bat @@ -123,8 +123,6 @@ copy /Y ..\bin\"notepad++.exe" .\minimalist\ If ErrorLevel 1 goto End copy /Y ".\themes\DarkModeDefault.xml" .\minimalist\themes\ If ErrorLevel 1 goto End -copy /Y ..\src\toolbarIcons.xml .\minimalist\ -If ErrorLevel 1 goto End rmdir /S /Q .\minimalist64 @@ -160,8 +158,6 @@ copy /Y ..\bin64\"notepad++.exe" .\minimalist64\ If ErrorLevel 1 goto End copy /Y ".\themes\DarkModeDefault.xml" .\minimalist64\themes\ If ErrorLevel 1 goto End -copy /Y ..\src\toolbarIcons.xml .\minimalist64\ -If ErrorLevel 1 goto End rmdir /S /Q .\minimalistArm64 @@ -197,8 +193,6 @@ copy /Y ..\binarm64\"notepad++.exe" .\minimalistArm64\ If ErrorLevel 1 goto End copy /Y ".\themes\DarkModeDefault.xml" .\minimalistArm64\themes\ If ErrorLevel 1 goto End -copy /Y ..\src\toolbarIcons.xml .\minimalistArm64\ -If ErrorLevel 1 goto End rem Remove old built Notepad++ 32-bit package @@ -283,8 +277,6 @@ copy /Y ..\bin\nppLogNulContentCorruptionIssue.xml .\zipped.package.release\ If ErrorLevel 1 goto End copy /Y ..\bin\"notepad++.exe" .\zipped.package.release\ If ErrorLevel 1 goto End -copy /Y ..\src\toolbarIcons.xml .\zipped.package.release\ -If ErrorLevel 1 goto End @@ -313,8 +305,6 @@ copy /Y ..\bin\nppLogNulContentCorruptionIssue.xml .\zipped.package.release64\ If ErrorLevel 1 goto End copy /Y ..\bin64\"notepad++.exe" .\zipped.package.release64\ If ErrorLevel 1 goto End -copy /Y ..\src\toolbarIcons.xml .\zipped.package.release64\ -If ErrorLevel 1 goto End rem Basic Copy needed files into Notepad++ ARM64 package folders @@ -342,8 +332,6 @@ copy /Y ..\bin\nppLogNulContentCorruptionIssue.xml .\zipped.package.releaseArm64 If ErrorLevel 1 goto End copy /Y ..\binarm64\"notepad++.exe" .\zipped.package.releaseArm64\ If ErrorLevel 1 goto End -copy /Y ..\src\toolbarIcons.xml .\zipped.package.releaseArm64\ -If ErrorLevel 1 goto End rem Plugins: Copy needed files into Notepad++ 32-bit package folders diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 69b00fd1d..7a8981e57 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -149,16 +149,11 @@ Notepad_plus::Notepad_plus() nppParam.setNativeLangSpeaker(&_nativeLangSpeaker); - TiXmlDocument *toolIconsDocRoot = nppParam.getCustomizedToolIcons(); TiXmlDocument *toolButtonsDocRoot = nppParam.getCustomizedToolButtons(); - if (toolIconsDocRoot) - { - _toolBar.initTheme(toolIconsDocRoot); - } - if (toolButtonsDocRoot) { + _toolBar.initTheme(toolButtonsDocRoot); _toolBar.initHideButtonsConf(toolButtonsDocRoot, toolBarIcons, sizeof(toolBarIcons) / sizeof(ToolBarButtonUnit)); } diff --git a/PowerEditor/src/NppDarkMode.cpp b/PowerEditor/src/NppDarkMode.cpp index d597f1f78..c24ced466 100644 --- a/PowerEditor/src/NppDarkMode.cpp +++ b/PowerEditor/src/NppDarkMode.cpp @@ -520,7 +520,7 @@ namespace NppDarkMode return (lstrcmp(theme.c_str(), L"stylers.xml") == 0) ? L"" : theme; } - static bool g_isCustomToolIconUsed = NppParameters::getInstance().getCustomizedToolIcons() != nullptr; + static bool g_isCustomToolIconUsed = NppParameters::getInstance().getCustomizedToolButtons() != nullptr; void setToolBarIconSet(int state2Set, bool useDark) { diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 40a5bc7b9..39e64c599 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -1483,21 +1483,6 @@ bool NppParameters::load() isAllLoaded = false; } - //---------------------------------// - // toolbarIcons.xml : for per user // - //---------------------------------// - std::wstring toolbarIconsPath(_userPath); - pathAppend(toolbarIconsPath, L"toolbarIcons.xml"); - - _pXmlToolIconsDoc = new TiXmlDocument(toolbarIconsPath); - loadOkay = _pXmlToolIconsDoc->LoadFile(); - if (!loadOkay) - { - delete _pXmlToolIconsDoc; - _pXmlToolIconsDoc = nullptr; - isAllLoaded = false; - } - //---------------------------------------// // toolbarButtonsConf.xml : for per user // //---------------------------------------// @@ -1724,7 +1709,6 @@ void NppParameters::destroyInstance() } delete _pXmlNativeLangDocA; - delete _pXmlToolIconsDoc; delete _pXmlToolButtonsConfDoc; delete _pXmlShortcutDocA; delete _pXmlContextMenuDocA; diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 734b06b1c..d58024093 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1632,7 +1632,6 @@ public: TiXmlDocumentA * getNativeLangA() const {return _pXmlNativeLangDocA;}; - TiXmlDocument* getCustomizedToolIcons() const {return _pXmlToolIconsDoc;}; TiXmlDocument* getCustomizedToolButtons() const {return _pXmlToolButtonsConfDoc;}; bool isTransparentAvailable() const { @@ -1877,7 +1876,6 @@ private: TiXmlDocument *_pXmlUserStylerDoc = nullptr; // stylers.xml TiXmlDocument *_pXmlUserLangDoc = nullptr; // userDefineLang.xml std::vector _pXmlUserLangsDoc; // userDefineLang customized XMLs - TiXmlDocument *_pXmlToolIconsDoc = nullptr; // toolbarIcons.xml TiXmlDocument * _pXmlToolButtonsConfDoc = nullptr; // toolbarButtonsConf.xml TiXmlDocumentA *_pXmlShortcutDocA = nullptr; // shortcuts.xml diff --git a/PowerEditor/src/toolbarButtonsConf_example.xml b/PowerEditor/src/toolbarButtonsConf_example.xml index 48821a28c..69d88eb2e 100644 --- a/PowerEditor/src/toolbarButtonsConf_example.xml +++ b/PowerEditor/src/toolbarButtonsConf_example.xml @@ -1,19 +1,25 @@ + + +