[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
pull/343/head^2
donho 17 years ago
parent a80ee0d2fa
commit a4f36f3685

@ -204,7 +204,14 @@ void PluginsManager::setMenu(HMENU hMenu, const char *menuName)
for (int j = 0 ; j < _pluginInfos[i]->_nbFuncItem ; j++) 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)); _pluginsCommands.push_back(PluginCommand(_pluginInfos[i]->_moduleName, j, _pluginInfos[i]->_funcItems[j]._pFunc));
int cmdID = ID_PLUGINS_CMD + (_pluginsCommands.size() - 1); int cmdID = ID_PLUGINS_CMD + (_pluginsCommands.size() - 1);
_pluginInfos[i]->_funcItems[j]._cmdID = (_pluginInfos[i]->_funcItems[j]._pFunc == NULL)?0:cmdID; _pluginInfos[i]->_funcItems[j]._cmdID = (_pluginInfos[i]->_funcItems[j]._pFunc == NULL)?0:cmdID;
string itemName = _pluginInfos[i]->_funcItems[j]._itemName; 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 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); pluginCmdSCList.push_back(pcs);
} }
unsigned int flag = MF_BYPOSITION | ((_pluginInfos[i]->_funcItems[j]._pFunc == NULL)?MF_SEPARATOR:0); ::InsertMenu(_pluginInfos[i]->_pluginMenu, j, MF_BYPOSITION, cmdID, itemName.c_str());
::InsertMenu(_pluginInfos[i]->_pluginMenu, j, flag, (_pluginInfos[i]->_funcItems[j]._pFunc == NULL)?0:cmdID, itemName.c_str());
if (_pluginInfos[i]->_funcItems[j]._init2Check) if (_pluginInfos[i]->_funcItems[j]._init2Check)
::CheckMenuItem(_hPluginsMenu, cmdID, MF_BYCOMMAND | MF_CHECKED); ::CheckMenuItem(_hPluginsMenu, cmdID, MF_BYCOMMAND | MF_CHECKED);

Loading…
Cancel
Save