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
This commit is contained in:
Don Ho 2025-04-11 03:06:49 +02:00
parent a23955742c
commit 4f649d24dd
10 changed files with 86 additions and 123 deletions

View File

@ -1240,21 +1240,6 @@ bool NppParameters::load()
isAllLaoded = false; 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 // // shortcuts.xml : for per user //
//------------------------------// //------------------------------//

View File

@ -26,7 +26,7 @@ BIN_DIRECTORY := ../bin
INSTALLER_DIRECTORY := ../installer INSTALLER_DIRECTORY := ../installer
TARGET_BINARY := notepad++.exe 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/ BIN_DATA := change.log doLocalConf.xml nppLogNulContentCorruptionIssue.xml readme.txt userDefineLangs/
INSTALLER_DATA := autoCompletion/ functionList/ localization/ themes/ INSTALLER_DATA := autoCompletion/ functionList/ localization/ themes/

View File

@ -82,7 +82,6 @@ Function copyCommonFiles
File "..\bin\contextMenu.xml" File "..\bin\contextMenu.xml"
File "..\src\tabContextMenu_example.xml" File "..\src\tabContextMenu_example.xml"
File "..\src\toolbarButtonsConf_example.xml" File "..\src\toolbarButtonsConf_example.xml"
File "..\src\toolbarIcons.xml"
SetOverwrite on SetOverwrite on
SetOutPath "$INSTDIR\" SetOutPath "$INSTDIR\"

View File

@ -123,8 +123,6 @@ copy /Y ..\bin\"notepad++.exe" .\minimalist\
If ErrorLevel 1 goto End If ErrorLevel 1 goto End
copy /Y ".\themes\DarkModeDefault.xml" .\minimalist\themes\ copy /Y ".\themes\DarkModeDefault.xml" .\minimalist\themes\
If ErrorLevel 1 goto End If ErrorLevel 1 goto End
copy /Y ..\src\toolbarIcons.xml .\minimalist\
If ErrorLevel 1 goto End
rmdir /S /Q .\minimalist64 rmdir /S /Q .\minimalist64
@ -160,8 +158,6 @@ copy /Y ..\bin64\"notepad++.exe" .\minimalist64\
If ErrorLevel 1 goto End If ErrorLevel 1 goto End
copy /Y ".\themes\DarkModeDefault.xml" .\minimalist64\themes\ copy /Y ".\themes\DarkModeDefault.xml" .\minimalist64\themes\
If ErrorLevel 1 goto End If ErrorLevel 1 goto End
copy /Y ..\src\toolbarIcons.xml .\minimalist64\
If ErrorLevel 1 goto End
rmdir /S /Q .\minimalistArm64 rmdir /S /Q .\minimalistArm64
@ -197,8 +193,6 @@ copy /Y ..\binarm64\"notepad++.exe" .\minimalistArm64\
If ErrorLevel 1 goto End If ErrorLevel 1 goto End
copy /Y ".\themes\DarkModeDefault.xml" .\minimalistArm64\themes\ copy /Y ".\themes\DarkModeDefault.xml" .\minimalistArm64\themes\
If ErrorLevel 1 goto End If ErrorLevel 1 goto End
copy /Y ..\src\toolbarIcons.xml .\minimalistArm64\
If ErrorLevel 1 goto End
rem Remove old built Notepad++ 32-bit package 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 If ErrorLevel 1 goto End
copy /Y ..\bin\"notepad++.exe" .\zipped.package.release\ copy /Y ..\bin\"notepad++.exe" .\zipped.package.release\
If ErrorLevel 1 goto End 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 If ErrorLevel 1 goto End
copy /Y ..\bin64\"notepad++.exe" .\zipped.package.release64\ copy /Y ..\bin64\"notepad++.exe" .\zipped.package.release64\
If ErrorLevel 1 goto End 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 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 If ErrorLevel 1 goto End
copy /Y ..\binarm64\"notepad++.exe" .\zipped.package.releaseArm64\ copy /Y ..\binarm64\"notepad++.exe" .\zipped.package.releaseArm64\
If ErrorLevel 1 goto End 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 rem Plugins: Copy needed files into Notepad++ 32-bit package folders

View File

@ -149,16 +149,11 @@ Notepad_plus::Notepad_plus()
nppParam.setNativeLangSpeaker(&_nativeLangSpeaker); nppParam.setNativeLangSpeaker(&_nativeLangSpeaker);
TiXmlDocument *toolIconsDocRoot = nppParam.getCustomizedToolIcons();
TiXmlDocument *toolButtonsDocRoot = nppParam.getCustomizedToolButtons(); TiXmlDocument *toolButtonsDocRoot = nppParam.getCustomizedToolButtons();
if (toolIconsDocRoot)
{
_toolBar.initTheme(toolIconsDocRoot);
}
if (toolButtonsDocRoot) if (toolButtonsDocRoot)
{ {
_toolBar.initTheme(toolButtonsDocRoot);
_toolBar.initHideButtonsConf(toolButtonsDocRoot, toolBarIcons, sizeof(toolBarIcons) / sizeof(ToolBarButtonUnit)); _toolBar.initHideButtonsConf(toolButtonsDocRoot, toolBarIcons, sizeof(toolBarIcons) / sizeof(ToolBarButtonUnit));
} }

View File

@ -520,7 +520,7 @@ namespace NppDarkMode
return (lstrcmp(theme.c_str(), L"stylers.xml") == 0) ? L"" : theme; 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) void setToolBarIconSet(int state2Set, bool useDark)
{ {

View File

@ -1483,21 +1483,6 @@ bool NppParameters::load()
isAllLoaded = false; 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 // // toolbarButtonsConf.xml : for per user //
//---------------------------------------// //---------------------------------------//
@ -1724,7 +1709,6 @@ void NppParameters::destroyInstance()
} }
delete _pXmlNativeLangDocA; delete _pXmlNativeLangDocA;
delete _pXmlToolIconsDoc;
delete _pXmlToolButtonsConfDoc; delete _pXmlToolButtonsConfDoc;
delete _pXmlShortcutDocA; delete _pXmlShortcutDocA;
delete _pXmlContextMenuDocA; delete _pXmlContextMenuDocA;

View File

@ -1632,7 +1632,6 @@ public:
TiXmlDocumentA * getNativeLangA() const {return _pXmlNativeLangDocA;}; TiXmlDocumentA * getNativeLangA() const {return _pXmlNativeLangDocA;};
TiXmlDocument* getCustomizedToolIcons() const {return _pXmlToolIconsDoc;};
TiXmlDocument* getCustomizedToolButtons() const {return _pXmlToolButtonsConfDoc;}; TiXmlDocument* getCustomizedToolButtons() const {return _pXmlToolButtonsConfDoc;};
bool isTransparentAvailable() const { bool isTransparentAvailable() const {
@ -1877,7 +1876,6 @@ private:
TiXmlDocument *_pXmlUserStylerDoc = nullptr; // stylers.xml TiXmlDocument *_pXmlUserStylerDoc = nullptr; // stylers.xml
TiXmlDocument *_pXmlUserLangDoc = nullptr; // userDefineLang.xml TiXmlDocument *_pXmlUserLangDoc = nullptr; // userDefineLang.xml
std::vector<UdlXmlFileState> _pXmlUserLangsDoc; // userDefineLang customized XMLs std::vector<UdlXmlFileState> _pXmlUserLangsDoc; // userDefineLang customized XMLs
TiXmlDocument *_pXmlToolIconsDoc = nullptr; // toolbarIcons.xml
TiXmlDocument * _pXmlToolButtonsConfDoc = nullptr; // toolbarButtonsConf.xml TiXmlDocument * _pXmlToolButtonsConfDoc = nullptr; // toolbarButtonsConf.xml
TiXmlDocumentA *_pXmlShortcutDocA = nullptr; // shortcuts.xml TiXmlDocumentA *_pXmlShortcutDocA = nullptr; // shortcuts.xml

View File

@ -1,19 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<NotepadPlus> <NotepadPlus>
<!--
This file allows you to:
1. Hide any toolbar buttons you don't need.
2. Change the appearance of (replace) any or all toolbar icons.
To archieve one or both of above gaols, you need to move and rename the "toolbarButtonsConf_example.xml" to "%APPDATA%\Notepad++\toolbarButtonsConf.xml" (or place it beside "notepad++.exe" if you're using the portable package).
Edit the relevant sections, save your change, and relaunch Notepad++ for the modifications to take effect.
-->
<ToolbarButtons> <ToolbarButtons>
<!-- <!--
This file makes your toolbar buttons hideable. The "Standard" section allows your toolbar's standard buttons (come with Notepad++) to be hidden.
Usage: Usage: Modify the "hideAll" or "hide" attributes of the items by settings their values to "yes" or "no".
Move and rename the "toolbarButtonsConf_example.xml" to "%APPDATA%\Notepad++\toolbarButtonsConf.xml"
(or beside "notepad++.exe" if you're using the portable package).
Modify the attributes "hideAll" or "hide" of the items with "yes" or "no" values.
Save the file and relaunch Notepad++ to hide/show the buttons you selected.
Notice: Notice:
1. The values of the attributes "index" and "id" shouldn't be modified because they are used for synchronizing with internal data to maintain the coherence of this file. 1. The "index" and "id" attributes values must not be modified, as they are used to synchronize with internal data for maintaining the file's coherence.
2. The attribute "name" is informative only, so the values of "name" can be modified for the user's convenience. 2. The "name" attribute is for informational purposes only, so its values can be modified for the user's convenience.
3. The "yes" value of the "hideAll" attribute will override all values of the "hide" attribute. 3. Setting the "hideAll" attribute's value to "yes" will override all "hide" attribute values.
--> -->
<Standard hideAll="no"> <Standard hideAll="no">
<Button hide="no" index="0" id="41001" name="New" /> <Button hide="no" index="0" id="41001" name="New" />
@ -73,4 +79,71 @@ When installing / uninstalling plugins, add/remove button entries as necessary s
<!-- Add more "Button" tags here... --> <!-- Add more "Button" tags here... -->
</Plugin> </Plugin>
</ToolbarButtons> </ToolbarButtons>
<!--
The "ToolBarIcons" section (tag) is for customizing your toolbar icons, by using an alternative set of icons.
To override the current toolbar icons, you need 2 things: this file and your icons set.
You can get a sample icons set here:
https://notepad-plus-plus.org/assets/data/nppLegacyIconSet.zip
Instructions to customize your toolbar icons:
1. Create a new folder named "toolbarIcons" in the directory where "toolbarButtonsConf.xml" file is located.
2. Edit the "icoFolderName" attribute value of "ToolBarIcons" tag in "toolbarButtonsConf.xml" file. Specify the name of the icon set you want in the "icoFolderName" attribute. For example: <ToolBarIcons icoFolderName="myAwesomeIcons" />.
3. Navigate to the "toolbarIcons" folder and create a new folder named exactly as the icon set name you specified in the "icoFolderName" attribute.
4. Place all your customized icons in the foder "[toolbarButtonsConf.xml's folder]\toolbarIcons\myAwesomeIcons\".
5. Finally, relaunch Notepad++ to see your icon set replace the default icons.
Note: if the "icoFolderName" value is an empty string, the icons will be located in "[toolbarButtonsConf.xml's folder]\toolbarIcons\default\".
Replacing icons: Each icon (45 in total) has a fixed and specific name. Please ignore the empty room - they are the separators.
Naming convention:
0 new.ico
1 open.ico
2 save.ico save_disabled.ico
3 save-all.ico save-all_disabled.ico
4 close.ico
5 close-all.ico
6 print.ico
7
8 cut.ico cut_disabled.ico
9 copy.ico copy_disabled.ico
10 paste.ico paste_disabled.ico
11
12 undo.ico undo_disabled.ico
13 redo.ico redo_disabled.ico
14
15 find.ico
16 replace.ico
17
18 zoom-in.ico
19 zoom-out.ico
20
21 sync-vertical.ico
22 sync-horizontal.ico
23
24 word-wrap.ico
25 all-chars.ico
26 indent-guide.ico
27
28 udl-dlg.ico
29 doc-map.ico
30 doc-list.ico
31 function-list.ico
32 folder-as-workspace.ico
33
34 monitoring.ico monitoring_disabled.ico
35
36 record.ico record_disabled.ico
37 stop-record.ico stop-record_disabled.ico
38 playback.ico playback_disabled.ico
39 playback-multiple.ico playback-multiple_disabled.ico
40 save-macro.ico save-macro_disabled.ico
It's not necessary to have a complete set of icons (45 icons). Any missing icons will simply remain unsubstituted.
-->
<ToolBarIcons icoFolderName="" />
</NotepadPlus> </NotepadPlus>

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
This file is for customizing your toolbar icons.
To override the current toolbar icons, you need 2 things: this file and your icons set.
Here are the instructions to customize your toolbar icons:
1. Put this file ("toolbarIcons.xml") in the same folder as "config.xml" file (Note 1).
2. Create a new folder "toolbarIcons" in the folder where you put "toolbarIcons.xml" file.
3. Edit this file ("toolbarIcons.xml"): put the icon set name you want in "icoFolderName" attribute (Note 2).
For example: <ToolBarIcons icoFolderName="myAwesomeIcons" />
4. Go into "toolbarIcons" folder and create a new folder with the exact name of the icon set name you provided in "icoFolderName".
5. Put all your customized icons into "[toolbarIcons.xml's folder]\toolbarIcons\myAwesomeIcons\".
6. Now it's the magic moment: Relaunch Notepad++ and you'll see your icon set instead of the default icons.
Note:
1. If you find the file "doLocalConf.xml" in the Notepad++ installed directory, you will find the "config.xml" in Notepad++ installed directory. Otherwise it should be in "%APPDATA%\Notepad++\" directory.
2. if "icoFolderName" value is an empty string, the path of icons will be in "[toolbarIcons.xml's folder]\toolbarIcons\default\" folder.
Each replacing icon (45 icons) has the fixed and specific name:
1 new.ico
2 open.ico
3 save.ico save_disabled.ico
4 save-all.ico save-all_disabled.ico
5 close.ico
6 close-all.ico
7 print.ico
8 cut.ico cut_disabled.ico
9 copy.ico copy_disabled.ico
10 paste.ico paste_disabled.ico
11 undo.ico undo_disabled.ico
12 redo.ico redo_disabled.ico
13 find.ico
14 replace.ico
15 zoom-in.ico
16 zoom-out.ico
17 sync-vertical.ico
18 sync-horizontal.ico
19 word-wrap.ico
20 all-chars.ico
21 indent-guide.ico
22 udl-dlg.ico
23 doc-map.ico
24 doc-list.ico
25 function-list.ico
26 folder-as-workspace.ico
27 monitoring.ico monitoring_disabled.ico
28 record.ico record_disabled.ico
29 stop-record.ico stop-record_disabled.ico
30 playback.ico playback_disabled.ico
31 playback-multiple.ico playback-multiple_disabled.ico
32 save-macro.ico save-macro_disabled.ico
It's not necessary to have all complete set (45 icons). The absent icons just won't be substituted.
-->
<NotepadPlus>
<ToolBarIcons icoFolderName="" />
</NotepadPlus>