From a4f36f3685b68615d009b526e67d5f4957ddd612 Mon Sep 17 00:00:00 2001 From: donho Date: Sat, 5 Apr 2008 22:11:25 +0000 Subject: [PATCH] [BUG_FIXED] If plugin function pointer is null, then it'll be added in menu as separator, but it won't be added in shortcut mapper list. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@162 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 3c1704d31..87ca7afa3 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -204,7 +204,14 @@ void PluginsManager::setMenu(HMENU hMenu, const char *menuName) for (int j = 0 ; j < _pluginInfos[i]->_nbFuncItem ; j++) { + if (_pluginInfos[i]->_funcItems[j]._pFunc == NULL) + { + ::InsertMenu(_pluginInfos[i]->_pluginMenu, j, MF_BYPOSITION | MF_SEPARATOR, 0, ""); + continue; + } + _pluginsCommands.push_back(PluginCommand(_pluginInfos[i]->_moduleName, j, _pluginInfos[i]->_funcItems[j]._pFunc)); + int cmdID = ID_PLUGINS_CMD + (_pluginsCommands.size() - 1); _pluginInfos[i]->_funcItems[j]._cmdID = (_pluginInfos[i]->_funcItems[j]._pFunc == NULL)?0:cmdID; string itemName = _pluginInfos[i]->_funcItems[j]._itemName; @@ -222,8 +229,7 @@ void PluginsManager::setMenu(HMENU hMenu, const char *menuName) PluginCmdShortcut pcs(Shortcut(itemName.c_str(), false, false, false, 0x00), cmdID, _pluginInfos[i]->_moduleName, j); //VK_NULL and everything disabled, the menu name is left alone pluginCmdSCList.push_back(pcs); } - unsigned int flag = MF_BYPOSITION | ((_pluginInfos[i]->_funcItems[j]._pFunc == NULL)?MF_SEPARATOR:0); - ::InsertMenu(_pluginInfos[i]->_pluginMenu, j, flag, (_pluginInfos[i]->_funcItems[j]._pFunc == NULL)?0:cmdID, itemName.c_str()); + ::InsertMenu(_pluginInfos[i]->_pluginMenu, j, MF_BYPOSITION, cmdID, itemName.c_str()); if (_pluginInfos[i]->_funcItems[j]._init2Check) ::CheckMenuItem(_hPluginsMenu, cmdID, MF_BYCOMMAND | MF_CHECKED);