[NEW_FEATURE] (Author: Christian Cuvier) Add a new capacity in context menu: the menu item can be renamed (only for occidental languages).

[UPDATE] Update contextMenu.xml.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@695 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-11-06 23:56:57 +00:00
parent 549e5f5f29
commit a85c08b0a9
2 changed files with 26 additions and 10 deletions

View File

@ -1375,11 +1375,13 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
childNode = childNode->NextSibling(TEXT("Item")) ) childNode = childNode->NextSibling(TEXT("Item")) )
{ {
const TCHAR *folderName = (childNode->ToElement())->Attribute(TEXT("FolderName")); const TCHAR *folderName = (childNode->ToElement())->Attribute(TEXT("FolderName"));
const TCHAR *displayAs = (childNode->ToElement())->Attribute(TEXT("ItemNameAs"));
int id; int id;
const TCHAR *idStr = (childNode->ToElement())->Attribute(TEXT("id"), &id); const TCHAR *idStr = (childNode->ToElement())->Attribute(TEXT("id"), &id);
if (idStr) if (idStr)
{ {
_contextMenuItems.push_back(MenuItemUnit(id, TEXT(""), folderName)); _contextMenuItems.push_back(MenuItemUnit(id, displayAs?displayAs:TEXT(""), folderName));
} }
else else
{ {
@ -1418,7 +1420,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
if (generic_stricmp(menuItemName, purgeMenuItemString(cmdStr).c_str()) == 0) if (generic_stricmp(menuItemName, purgeMenuItemString(cmdStr).c_str()) == 0)
{ {
int cmdId = ::GetMenuItemID(currMenu, currMenuPos); int cmdId = ::GetMenuItemID(currMenu, currMenuPos);
_contextMenuItems.push_back(MenuItemUnit(cmdId, TEXT(""), folderName)); _contextMenuItems.push_back(MenuItemUnit(cmdId, displayAs?displayAs:TEXT(""), folderName));
break; break;
} }
@ -1465,7 +1467,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
if (generic_stricmp(pluginCmdName, purgeMenuItemString(pluginCmdStr).c_str()) == 0) if (generic_stricmp(pluginCmdName, purgeMenuItemString(pluginCmdStr).c_str()) == 0)
{ {
int pluginCmdId = ::GetMenuItemID(pluginMenu, j); int pluginCmdId = ::GetMenuItemID(pluginMenu, j);
_contextMenuItems.push_back(MenuItemUnit(pluginCmdId, TEXT(""), folderName)); _contextMenuItems.push_back(MenuItemUnit(pluginCmdId, displayAs?displayAs:TEXT(""), folderName));
break; break;
} }
} }

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="Windows-1252" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!-- <!--
By modifying this file, you can customize your context menu popuped as right clicking on the edit zone. By modifying this file, you can customize your context menu popuped as right clicking on the edit zone.
It may be more convinient to access to your frequent used commands via context menu than via the top menu. It may be more convinient to access to your frequent used commands via context menu than via the top menu.
@ -8,19 +8,25 @@ http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Context_Menu
--> -->
<NotepadPlus> <NotepadPlus>
<ScintillaContextMenu> <ScintillaContextMenu>
<!-- Use MenuEntryName and MenuItemName to localize your commands to add --> <!--
Use MenuEntryName and MenuItemName to localize your commands to add.
The values should be in English but not in translated language.
(You can set Notepad++ language back to English from Preferences dialog via menu "Settings->Preferences...")
-->
<Item MenuEntryName="Edit" MenuItemName="Cut"/> <Item MenuEntryName="Edit" MenuItemName="Cut"/>
<Item MenuEntryName="Edit" MenuItemName="Copy"/> <Item MenuEntryName="Edit" MenuItemName="Copy"/>
<Item MenuEntryName="Edit" MenuItemName="Paste"/> <Item MenuEntryName="Edit" MenuItemName="Paste"/>
<Item MenuEntryName="Edit" MenuItemName="Delete"/> <Item MenuEntryName="Edit" MenuItemName="Delete"/>
<Item MenuEntryName="Edit" MenuItemName="Select all"/> <Item MenuEntryName="Edit" MenuItemName="Select all"/>
<!-- id="0" is the separator --> <!-- id="0" is the separator -->
<Item id="0"/> <Item id="0"/>
<!-- You can use command id to add the commands you want. <!-- You can use command id to add the commands you want.
Check english.xml to get commands id: Check english.xml to get commands id:
http://notepad-plus.svn.sourceforge.net/viewvc/notepad-plus/trunk/PowerEditor/installer/nativeLang/english.xml http://notepad-plus.svn.sourceforge.net/viewvc/notepad-plus/trunk/PowerEditor/installer/nativeLang/english.xml
Use FolderName (optional) to create sub-menu. FolderName can be used in any item. Use FolderName (optional) to create sub-menu. FolderName can be used in any type of item.
--> -->
<Item FolderName="Style token" id="43022"/> <Item FolderName="Style token" id="43022"/>
<Item FolderName="Style token" id="43024"/> <Item FolderName="Style token" id="43024"/>
@ -35,10 +41,18 @@ http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Context_Menu
<Item FolderName="Remove style" id="43031"/> <Item FolderName="Remove style" id="43031"/>
<Item FolderName="Remove style" id="43032"/> <Item FolderName="Remove style" id="43032"/>
<Item id="0"/> <Item id="0"/>
<!-- To add plugin commands, you have to use PluginEntryName and PluginCommandItemName to localize the plugin commands -->
<Item FolderName="Plugin commands" PluginEntryName="MIME Tools" PluginCommandItemName="Base64 Encode"/> <!--
<Item FolderName="Plugin commands" PluginEntryName="MIME Tools" PluginCommandItemName="Base64 Decode"/> To add plugin commands, you have to use PluginEntryName and PluginCommandItemName to localize the plugin commands
<Item FolderName="Plugin commands" PluginEntryName="NppExport" PluginCommandItemName="Copy all formats to clipboard"/> -->
<Item FolderName="Plugin commands" PluginEntryName="MIME Tools" PluginCommandItemName="Base64 Encode" />
<Item FolderName="Plugin commands" PluginEntryName="MIME Tools" PluginCommandItemName="Base64 Decode" />
<!--
Use ItemNameAs (optional) to rename the menu item name in the context menu
ItemNameAs can be used in any type of item.
-->
<Item PluginEntryName="NppExport" PluginCommandItemName="Copy all formats to clipboard" ItemNameAs="Copy Text with Syntax Highlighting" />
<Item id="0"/> <Item id="0"/>
<Item MenuEntryName="Edit" MenuItemName="UPPERCASE"/> <Item MenuEntryName="Edit" MenuItemName="UPPERCASE"/>