[BUG_FIXED] Fixed context menu population to check sub menus of main menu entries.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@472 f5eea248-9336-0410-98b8-ebc06183d4e3remotes/x64
parent
fd94587a2e
commit
10aa27cfe5
|
@ -207,6 +207,7 @@ BEGIN
|
||||||
MENUITEM "Cu&t", IDM_EDIT_CUT
|
MENUITEM "Cu&t", IDM_EDIT_CUT
|
||||||
MENUITEM "&Copy", IDM_EDIT_COPY
|
MENUITEM "&Copy", IDM_EDIT_COPY
|
||||||
MENUITEM "&Paste", IDM_EDIT_PASTE
|
MENUITEM "&Paste", IDM_EDIT_PASTE
|
||||||
|
MENUITEM "&Delete", IDM_EDIT_DELETE
|
||||||
MENUITEM "Select A&ll", IDM_EDIT_SELECTALL
|
MENUITEM "Select A&ll", IDM_EDIT_SELECTALL
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
POPUP "Copy to clipboard"
|
POPUP "Copy to clipboard"
|
||||||
|
|
|
@ -1191,19 +1191,49 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle)
|
||||||
::GetMenuString(mainMenuHadle, i, menuEntryString, 64, MF_BYPOSITION);
|
::GetMenuString(mainMenuHadle, i, menuEntryString, 64, MF_BYPOSITION);
|
||||||
if (generic_stricmp(menuEntryName, purgeMenuItemString(menuEntryString).c_str()) == 0)
|
if (generic_stricmp(menuEntryName, purgeMenuItemString(menuEntryString).c_str()) == 0)
|
||||||
{
|
{
|
||||||
HMENU subMenu = ::GetSubMenu(mainMenuHadle, i);
|
vector< pair<HMENU, int> > parentMenuPos;
|
||||||
int nbSubMenuCmd = ::GetMenuItemCount(subMenu);
|
HMENU topMenu = ::GetSubMenu(mainMenuHadle, i);
|
||||||
for (int j = 0 ; j < nbSubMenuCmd ; j++)
|
int maxTopMenuPos = ::GetMenuItemCount(topMenu);
|
||||||
{
|
HMENU currMenu = topMenu;
|
||||||
|
int currMaxMenuPos = maxTopMenuPos;
|
||||||
|
|
||||||
|
int currMenuPos = 0;
|
||||||
|
bool notFound = false;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if ( ::GetSubMenu( currMenu, currMenuPos ) ) {
|
||||||
|
// Go into sub menu
|
||||||
|
parentMenuPos.push_back( ::make_pair( currMenu, currMenuPos ) );
|
||||||
|
currMenu = ::GetSubMenu( currMenu, currMenuPos );
|
||||||
|
currMenuPos = 0;
|
||||||
|
currMaxMenuPos = ::GetMenuItemCount(currMenu);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Check current menu position.
|
||||||
TCHAR cmdStr[256];
|
TCHAR cmdStr[256];
|
||||||
::GetMenuString(subMenu, j, cmdStr, 256, MF_BYPOSITION);
|
::GetMenuString(currMenu, currMenuPos, cmdStr, 256, MF_BYPOSITION);
|
||||||
if (generic_stricmp(menuItemName, purgeMenuItemString(cmdStr).c_str()) == 0)
|
if (generic_stricmp(menuItemName, purgeMenuItemString(cmdStr).c_str()) == 0)
|
||||||
{
|
{
|
||||||
int cmdId = ::GetMenuItemID(subMenu, j);
|
int cmdId = ::GetMenuItemID(currMenu, currMenuPos);
|
||||||
_contextMenuItems.push_back(MenuItemUnit(cmdId, TEXT("")));
|
_contextMenuItems.push_back(MenuItemUnit(cmdId, TEXT("")));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ( currMenuPos >= currMaxMenuPos ) && ( parentMenuPos.size() > 0 ) ) {
|
||||||
|
currMenu = parentMenuPos.back().first;
|
||||||
|
currMenuPos = parentMenuPos.back().second;
|
||||||
|
parentMenuPos.pop_back();
|
||||||
|
currMaxMenuPos = ::GetMenuItemCount( currMenu );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ( currMenu == topMenu ) && ( currMenuPos >= maxTopMenuPos ) ) {
|
||||||
|
notFound = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
currMenuPos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (! notFound );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue