[BUG_FIXED] Fix the translated sub menu entries applying on the menu item.

[ENHANCED] Display more information while catching of plugins crash.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@585 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-12-06 03:06:59 +00:00
parent 759a950cfa
commit 0d2eee4ed5
2 changed files with 44 additions and 10 deletions

View File

@ -371,7 +371,9 @@ void PluginsManager::runPluginCommand(size_t i)
try { try {
_pluginsCommands[i]._pFunc(); _pluginsCommands[i]._pFunc();
} catch (...) { } catch (...) {
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), TEXT("runPluginCommand(size_t i)")); TCHAR funcInfo[128];
generic_sprintf(funcInfo, TEXT("runPluginCommand(size_t i : %d)"), i);
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), funcInfo);
} }
} }
} }
@ -389,7 +391,9 @@ void PluginsManager::runPluginCommand(const TCHAR *pluginName, int commandID)
try { try {
_pluginsCommands[i]._pFunc(); _pluginsCommands[i]._pFunc();
} catch (...) { } catch (...) {
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), TEXT("runPluginCommand(const TCHAR *pluginName, int commandID)")); TCHAR funcInfo[128];
generic_sprintf(funcInfo, TEXT("runPluginCommand(const TCHAR *pluginName : %s, int commandID : %d)"), pluginName, commandID);
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), funcInfo);
} }
} }
} }
@ -408,7 +412,10 @@ void PluginsManager::notify(SCNotification *notification)
try { try {
_pluginInfos[i]->_pBeNotified(&scNotif); _pluginInfos[i]->_pBeNotified(&scNotif);
} catch (...) { } catch (...) {
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), TEXT("notify(SCNotification *notification)")); TCHAR funcInfo[128];
generic_sprintf(funcInfo, TEXT("notify(SCNotification *notification) : \r notification->nmhdr.code == %d\r notification->nmhdr.hwndFrom == %d\r notification->nmhdr.idFrom == %d"),\
scNotif.nmhdr.code, scNotif.nmhdr.hwndFrom, scNotif.nmhdr.idFrom);
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), funcInfo);
} }
} }
} }
@ -423,7 +430,9 @@ void PluginsManager::relayNppMessages(UINT Message, WPARAM wParam, LPARAM lParam
try { try {
_pluginInfos[i]->_pMessageProc(Message, wParam, lParam); _pluginInfos[i]->_pMessageProc(Message, wParam, lParam);
} catch (...) { } catch (...) {
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), TEXT("relayNppMessages(UINT Message, WPARAM wParam, LPARAM lParam)")); TCHAR funcInfo[128];
generic_sprintf(funcInfo, TEXT("relayNppMessages(UINT Message : %d, WPARAM wParam : %d, LPARAM lParam : %d)"), Message, wParam, lParam);
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), TEXT(""));
} }
} }
} }
@ -444,7 +453,9 @@ bool PluginsManager::relayPluginMessages(UINT Message, WPARAM wParam, LPARAM lPa
try { try {
_pluginInfos[i]->_pMessageProc(Message, wParam, lParam); _pluginInfos[i]->_pMessageProc(Message, wParam, lParam);
} catch (...) { } catch (...) {
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), TEXT("relayPluginMessages(UINT Message, WPARAM wParam, LPARAM lParam)")); TCHAR funcInfo[128];
generic_sprintf(funcInfo, TEXT("relayPluginMessages(UINT Message : %d, WPARAM wParam : %d, LPARAM lParam : %d)"), Message, wParam, lParam);
pluginCrashAlert(_pluginsCommands[i]._pluginName.c_str(), funcInfo);
} }
return true; return true;
} }

View File

@ -6633,15 +6633,38 @@ void Notepad_plus::changeMenuLang(generic_string & pluginsTrans, generic_string
childNode = childNode->NextSibling("Item") ) childNode = childNode->NextSibling("Item") )
{ {
TiXmlElementA *element = childNode->ToElement(); TiXmlElementA *element = childNode->ToElement();
int x, y; int x, y, z;
element->Attribute("posX", &x); const char *xStr = element->Attribute("posX", &x);
element->Attribute("posY", &y); const char *yStr = element->Attribute("posY", &y);
const char *name = element->Attribute("name"); const char *name = element->Attribute("name");
if (!xStr || !yStr || !name)
continue;
HMENU hSubMenu = ::GetSubMenu(_mainMenuHandle, x);
if (!hSubMenu)
continue;
HMENU hSubMenu2 = ::GetSubMenu(hSubMenu, y);
if (!hSubMenu2)
continue;
HMENU hMenu = hSubMenu;
int pos = y;
const char *zStr = element->Attribute("posZ", &z);
if (zStr)
{
HMENU hSubMenu3 = ::GetSubMenu(hSubMenu2, z);
if (!hSubMenu3)
continue;
hMenu = hSubMenu2;
pos = z;
}
#ifdef UNICODE #ifdef UNICODE
const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding);
::ModifyMenu(::GetSubMenu(_mainMenuHandle, x), y, MF_BYPOSITION, 0, nameW); ::ModifyMenu(hMenu, pos, MF_BYPOSITION, 0, nameW);
#else #else
::ModifyMenu(::GetSubMenu(_mainMenuHandle, x), y, MF_BYPOSITION, 0, name); ::ModifyMenu(hMenu, pos, MF_BYPOSITION, 0, name);
#endif #endif
} }
::DrawMenuBar(_hSelf); ::DrawMenuBar(_hSelf);