[CLEAN] throw runtime_error instead of int.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@635 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
1953eea074
commit
52539b01b9
|
@ -183,9 +183,10 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
|
|||
|
||||
_pluginInfos.push_back(pi);
|
||||
return (_pluginInfos.size() - 1);
|
||||
}
|
||||
catch(generic_string s)
|
||||
{
|
||||
} catch(std::exception e) {
|
||||
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
|
||||
return -1;
|
||||
} catch(generic_string s) {
|
||||
s += TEXT("\n\n");
|
||||
s += USERMSG;
|
||||
if (::MessageBox(NULL, s.c_str(), pluginFilePath, MB_YESNO) == IDYES)
|
||||
|
@ -194,9 +195,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
|
|||
}
|
||||
delete pi;
|
||||
return -1;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
} catch(...) {
|
||||
generic_string msg = TEXT("Fail loaded");
|
||||
msg += TEXT("\n\n");
|
||||
msg += USERMSG;
|
||||
|
@ -370,6 +369,8 @@ void PluginsManager::runPluginCommand(size_t i)
|
|||
{
|
||||
try {
|
||||
_pluginsCommands[i]._pFunc();
|
||||
} catch(std::exception e) {
|
||||
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
|
||||
} catch (...) {
|
||||
TCHAR funcInfo[128];
|
||||
generic_sprintf(funcInfo, TEXT("runPluginCommand(size_t i : %d)"), i);
|
||||
|
@ -390,6 +391,8 @@ void PluginsManager::runPluginCommand(const TCHAR *pluginName, int commandID)
|
|||
{
|
||||
try {
|
||||
_pluginsCommands[i]._pFunc();
|
||||
} catch(std::exception e) {
|
||||
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
|
||||
} catch (...) {
|
||||
TCHAR funcInfo[128];
|
||||
generic_sprintf(funcInfo, TEXT("runPluginCommand(const TCHAR *pluginName : %s, int commandID : %d)"), pluginName, commandID);
|
||||
|
@ -411,6 +414,8 @@ void PluginsManager::notify(SCNotification *notification)
|
|||
SCNotification scNotif = *notification;
|
||||
try {
|
||||
_pluginInfos[i]->_pBeNotified(&scNotif);
|
||||
} catch(std::exception e) {
|
||||
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
|
||||
} catch (...) {
|
||||
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"),\
|
||||
|
@ -429,6 +434,8 @@ void PluginsManager::relayNppMessages(UINT Message, WPARAM wParam, LPARAM lParam
|
|||
{
|
||||
try {
|
||||
_pluginInfos[i]->_pMessageProc(Message, wParam, lParam);
|
||||
} catch(std::exception e) {
|
||||
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
|
||||
} catch (...) {
|
||||
TCHAR funcInfo[128];
|
||||
generic_sprintf(funcInfo, TEXT("relayNppMessages(UINT Message : %d, WPARAM wParam : %d, LPARAM lParam : %d)"), Message, wParam, lParam);
|
||||
|
@ -452,6 +459,8 @@ bool PluginsManager::relayPluginMessages(UINT Message, WPARAM wParam, LPARAM lPa
|
|||
{
|
||||
try {
|
||||
_pluginInfos[i]->_pMessageProc(Message, wParam, lParam);
|
||||
} catch(std::exception e) {
|
||||
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
|
||||
} catch (...) {
|
||||
TCHAR funcInfo[128];
|
||||
generic_sprintf(funcInfo, TEXT("relayPluginMessages(UINT Message : %d, WPARAM wParam : %d, LPARAM lParam : %d)"), Message, wParam, lParam);
|
||||
|
|
|
@ -45,8 +45,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
|
|||
|
||||
if (!::RegisterClass(&nppClass))
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(98);
|
||||
throw std::runtime_error("Notepad_plus_Window::init : RegisterClass() function failed");
|
||||
}
|
||||
|
||||
RECT workAreaRect;
|
||||
|
@ -74,8 +73,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(777);
|
||||
throw std::runtime_error("Notepad_plus_Window::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
gNppHWND = _hSelf;
|
||||
|
|
|
@ -2020,8 +2020,6 @@ bool NppParameters::getShortcuts(TiXmlNode *node, Shortcut & sc)
|
|||
}
|
||||
|
||||
|
||||
const int loadFailed = 100;
|
||||
const int missingName = 101;
|
||||
bool NppParameters::feedUserLang(TiXmlNode *node)
|
||||
{
|
||||
bool isEverythingOK = true;
|
||||
|
@ -2035,25 +2033,31 @@ bool NppParameters::feedUserLang(TiXmlNode *node)
|
|||
const TCHAR *ext = (childNode->ToElement())->Attribute(TEXT("ext"));
|
||||
hasFoundElement = true;
|
||||
try {
|
||||
if (!name || !name[0] || !ext) throw int(missingName);
|
||||
if (!name || !name[0] || !ext)
|
||||
throw std::runtime_error("NppParameters::feedUserLang : UserLang name is missing");
|
||||
|
||||
_userLangArray[_nbUserLang] = new UserLangContainer(name, ext);
|
||||
_nbUserLang++;
|
||||
|
||||
TiXmlNode *settingsRoot = childNode->FirstChildElement(TEXT("Settings"));
|
||||
if (!settingsRoot) throw int(loadFailed);
|
||||
if (!settingsRoot)
|
||||
throw std::runtime_error("NppParameters::feedUserLang : Settings node is missing");
|
||||
|
||||
feedUserSettings(settingsRoot);
|
||||
|
||||
TiXmlNode *keywordListsRoot = childNode->FirstChildElement(TEXT("KeywordLists"));
|
||||
if (!keywordListsRoot) throw int(loadFailed);
|
||||
if (!keywordListsRoot)
|
||||
throw std::runtime_error("NppParameters::feedUserLang : KeywordLists node is missing");
|
||||
|
||||
feedUserKeywordList(keywordListsRoot);
|
||||
|
||||
TiXmlNode *stylesRoot = childNode->FirstChildElement(TEXT("Styles"));
|
||||
if (!stylesRoot) throw int(loadFailed);
|
||||
if (!stylesRoot)
|
||||
throw std::runtime_error("NppParameters::feedUserLang : Styles node is missing");
|
||||
|
||||
feedUserStyles(stylesRoot);
|
||||
|
||||
} catch (int e) {
|
||||
if (e == loadFailed)
|
||||
} catch (std::exception e) {
|
||||
delete _userLangArray[--_nbUserLang];
|
||||
isEverythingOK = false;
|
||||
}
|
||||
|
|
|
@ -2188,7 +2188,8 @@ void FindIncrementDlg::init(HINSTANCE hInst, HWND hPere, FindReplaceDlg *pFRDlg,
|
|||
{
|
||||
Window::init(hInst, hPere);
|
||||
if (!pFRDlg)
|
||||
throw int(9910);
|
||||
throw std::runtime_error("FindIncrementDlg::init : Parameter pFRDlg is null");
|
||||
|
||||
_pFRDlg = pFRDlg;
|
||||
create(IDD_INCREMENT_FIND, isRTL);
|
||||
_isRTL = isRTL;
|
||||
|
|
|
@ -167,7 +167,7 @@ public :
|
|||
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
|
||||
Window::init(hInst, hPere);
|
||||
if (!ppEditView)
|
||||
throw int(9900);
|
||||
throw std::runtime_error("FindIncrementDlg::init : ppEditView is null.");
|
||||
_ppEditView = ppEditView;
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public :
|
|||
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
|
||||
Window::init(hInst, hPere);
|
||||
if (!ppEditView)
|
||||
throw int(9900);
|
||||
throw std::runtime_error("GoToLineDlg::init : ppEditView is null.");
|
||||
_ppEditView = ppEditView;
|
||||
};
|
||||
|
||||
|
|
|
@ -143,8 +143,7 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
|
|||
{
|
||||
if (!_hLib)
|
||||
{
|
||||
MessageBox( NULL, TEXT("Can not load the dynamic library"), TEXT("SCINTILLA ERROR : "), MB_OK | MB_ICONSTOP);
|
||||
throw int(106901);
|
||||
throw std::runtime_error("ScintillaEditView::init : SCINTILLA ERROR - Can not load the dynamic library");
|
||||
}
|
||||
|
||||
Window::init(hInst, hPere);
|
||||
|
@ -161,8 +160,7 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Error"));
|
||||
throw int(106901);
|
||||
throw std::runtime_error("ScintillaEditView::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
_pScintillaFunc = (SCINTILLA_FUNC)::SendMessage(_hSelf, SCI_GETDIRECTFUNCTION, 0, 0);
|
||||
|
@ -170,10 +168,14 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
|
|||
|
||||
_userDefineDlg.init(_hInst, _hParent, this);
|
||||
|
||||
if (!_pScintillaFunc || !_pScintillaPtr)
|
||||
if (!_pScintillaFunc)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(106901);
|
||||
throw std::runtime_error("ScintillaEditView::init : SCI_GETDIRECTFUNCTION message failed");
|
||||
}
|
||||
|
||||
if (!_pScintillaPtr)
|
||||
{
|
||||
throw std::runtime_error("ScintillaEditView::init : SCI_GETDIRECTPOINTER message failed");
|
||||
}
|
||||
|
||||
execute(SCI_SETMARGINMASKN, _SC_MARGE_FOLDER, SC_MASK_FOLDERS);
|
||||
|
|
|
@ -37,7 +37,7 @@ public :
|
|||
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
|
||||
Window::init(hInst, hPere);
|
||||
if (!ppEditView)
|
||||
throw int(9900);
|
||||
throw std::runtime_error("StaticDialog::init : ppEditView is null.");
|
||||
_ppEditView = ppEditView;
|
||||
};
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ void ColourPicker::init(HINSTANCE hInst, HWND parent)
|
|||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(6969);
|
||||
throw std::runtime_error("ColourPicker::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ void ColourPopup::create(int dialogID)
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("ColourPopup"));
|
||||
throw int(696);
|
||||
throw std::runtime_error("ColourPopup::create : CreateDialogParam() function return null");
|
||||
}
|
||||
Window::getClientRect(_rc);
|
||||
display();
|
||||
|
|
|
@ -105,8 +105,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
|
|||
|
||||
if (!::RegisterClass(&clz))
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(98);
|
||||
throw std::runtime_error("DockingManager::init : RegisterClass() function failed");
|
||||
}
|
||||
_isRegistered = TRUE;
|
||||
}
|
||||
|
@ -125,8 +124,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(777);
|
||||
throw std::runtime_error("DockingManager::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
setClientWnd(ppWin);
|
||||
|
@ -152,8 +150,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
|
|||
|
||||
if (!gWinCallHook)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(1000);
|
||||
throw std::runtime_error("DockingManager::init : SetWindowsHookEx() function return null");
|
||||
}
|
||||
|
||||
_dockData.hWnd = _hSelf;
|
||||
|
|
|
@ -87,8 +87,7 @@ void DockingSplitter::init(HINSTANCE hInst, HWND hWnd, HWND hMessage, UINT flags
|
|||
|
||||
if (!::RegisterClass(&wc))
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(98);
|
||||
throw std::runtime_error("DockingSplitter::init : RegisterClass() function failed");
|
||||
}
|
||||
else if (flags & DMS_HORIZONTAL)
|
||||
{
|
||||
|
@ -107,8 +106,7 @@ void DockingSplitter::init(HINSTANCE hInst, HWND hWnd, HWND hMessage, UINT flags
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(777);
|
||||
throw std::runtime_error("DockingSplitter::init : CreateWindowEx() function return null");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,8 +129,7 @@ void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr)
|
|||
|
||||
if (!::RegisterClass(&clz))
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(98);
|
||||
throw std::runtime_error("Gripper::startGrip : RegisterClass() function failed");
|
||||
}
|
||||
_isRegistered = TRUE;
|
||||
}
|
||||
|
@ -149,8 +148,7 @@ void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr)
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(777);
|
||||
throw std::runtime_error("Gripper::startGrip : CreateWindowEx() function return null");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ void IconList::create(HINSTANCE hInst, int iconSize)
|
|||
_iconSize = iconSize;
|
||||
_hImglst = ImageList_Create(iconSize, iconSize, ILC_COLOR32 | ILC_MASK, 0, nbMax);
|
||||
if (!_hImglst)
|
||||
throw int(25);
|
||||
throw std::runtime_error("IconList::create : ImageList_Create() function return null");
|
||||
};
|
||||
|
||||
void IconList::create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconIDArraySize)
|
||||
|
@ -42,7 +42,8 @@ void IconList::addIcon(int iconID) const
|
|||
{
|
||||
HICON hIcon = ::LoadIcon(_hInst, MAKEINTRESOURCE(iconID));
|
||||
if (!hIcon)
|
||||
throw int(26);
|
||||
throw std::runtime_error("IconList::addIcon : LoadIcon() function return null");
|
||||
|
||||
ImageList_AddIcon(_hImglst, hIcon);
|
||||
::DestroyIcon(hIcon);
|
||||
};
|
||||
|
|
|
@ -168,8 +168,9 @@ TCHAR * FileDialog::doOpenSingleFileDlg()
|
|||
::GetCurrentDirectory(MAX_PATH, dir);
|
||||
params->setWorkingDir(dir);
|
||||
}
|
||||
}
|
||||
catch(...) {
|
||||
} catch(std::exception e) {
|
||||
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
|
||||
} catch(...) {
|
||||
::MessageBox(NULL, TEXT("GetSaveFileName crashes!!!"), TEXT(""), MB_OK);
|
||||
}
|
||||
|
||||
|
@ -247,8 +248,9 @@ TCHAR * FileDialog::doSaveDlg()
|
|||
::GetCurrentDirectory(MAX_PATH, dir);
|
||||
params->setWorkingDir(dir);
|
||||
}
|
||||
}
|
||||
catch(...) {
|
||||
} catch(std::exception e) {
|
||||
::MessageBoxA(NULL, e.what(), "Exception", MB_OK);
|
||||
} catch(...) {
|
||||
::MessageBox(NULL, TEXT("GetSaveFileName crashes!!!"), TEXT(""), MB_OK);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,15 @@ Splitter::Splitter() : Window()
|
|||
void Splitter::init( HINSTANCE hInst, HWND hPere, int splitterSize,
|
||||
int iSplitRatio, DWORD dwFlags)
|
||||
{
|
||||
if (hPere == NULL)
|
||||
{
|
||||
throw std::runtime_error("Splitter::init : Parameter hPere is null");
|
||||
}
|
||||
if (iSplitRatio < 0)
|
||||
{
|
||||
throw std::runtime_error("Splitter::init : Parameter iSplitRatio shoulds be 0 < ratio < 100");
|
||||
}
|
||||
|
||||
Window::init(hInst, hPere);
|
||||
_spiltterSize = splitterSize;
|
||||
|
||||
|
@ -47,16 +56,7 @@ void Splitter::init( HINSTANCE hInst, HWND hPere, int splitterSize,
|
|||
DWORD dwExStyle = 0L;
|
||||
DWORD dwStyle = WS_CHILD | WS_VISIBLE;
|
||||
|
||||
if (hPere == NULL)
|
||||
{
|
||||
::MessageBox(NULL, TEXT("pas de pere?"), TEXT("Splitter::init"), MB_OK);
|
||||
throw int(96);
|
||||
}
|
||||
if (iSplitRatio < 0)
|
||||
{
|
||||
::MessageBox(NULL, TEXT("it shoulds be 0 < ratio < 100"), TEXT("Splitter::init"), MB_OK);
|
||||
throw int(96);
|
||||
}
|
||||
|
||||
_hParent = hPere;
|
||||
_dwFlags = dwFlags;
|
||||
|
||||
|
@ -70,8 +70,7 @@ void Splitter::init( HINSTANCE hInst, HWND hPere, int splitterSize,
|
|||
if (iSplitRatio >= 100)
|
||||
{
|
||||
//cant be 100 % or more
|
||||
::MessageBox(NULL, TEXT("it shoulds be 0 < ratio < 100"), TEXT("Splitter::init"), MB_OK);
|
||||
throw int(96);
|
||||
throw std::runtime_error("Splitter::init : Parameter iSplitRatio shoulds be 0 < ratio < 100");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,8 +187,7 @@ void Splitter::init( HINSTANCE hInst, HWND hPere, int splitterSize,
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(345);
|
||||
throw std::runtime_error("Splitter::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
RECT rc;
|
||||
|
|
|
@ -55,8 +55,7 @@ void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize,
|
|||
|
||||
if (!::RegisterClass(&splitterContainerClass))
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(98);
|
||||
throw std::runtime_error(" SplitterContainer::create : RegisterClass() function failed");
|
||||
}
|
||||
_isRegistered = true;
|
||||
}
|
||||
|
@ -75,8 +74,7 @@ void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize,
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(777);
|
||||
throw std::runtime_error(" SplitterContainer::create : CreateWindowEx() function return null");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,8 +99,6 @@ void StaticDialog::create(int dialogID, bool isRTL)
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
//systemMessage(TEXT("StaticDialog"));
|
||||
//throw int(666);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(9);
|
||||
throw std::runtime_error("StatusBar::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
_nbParts = nbParts;
|
||||
|
|
|
@ -61,10 +61,10 @@ void TabBar::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTraditio
|
|||
int multiLine = isMultiLine?(_isTraditional?TCS_MULTILINE:0):0;
|
||||
|
||||
int style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE |\
|
||||
/* WS_BORDER |*/TCS_FOCUSNEVER | TCS_TABS | vertical | multiLine;
|
||||
TCS_FOCUSNEVER | TCS_TABS | vertical | multiLine;
|
||||
|
||||
_hSelf = ::CreateWindowEx(
|
||||
0/*TCS_EX_FLATSEPARATORS*/ ,
|
||||
0,
|
||||
WC_TABCONTROL,
|
||||
TEXT("Tab"),
|
||||
style,
|
||||
|
@ -76,8 +76,7 @@ void TabBar::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTraditio
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(69);
|
||||
throw std::runtime_error("TabBar::init : CreateWindowEx() function return null");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,13 +238,10 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad
|
|||
int style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE |\
|
||||
TCS_TOOLTIPS | TCS_FOCUSNEVER | TCS_TABS | vertical | multiLine;
|
||||
|
||||
//if (isOwnerDrawTab() && (!_isTraditional))
|
||||
{
|
||||
style |= TCS_OWNERDRAWFIXED;
|
||||
//printStr(TEXT("ownerDraw"));
|
||||
}
|
||||
|
||||
_hSelf = ::CreateWindowEx(
|
||||
/*TCS_EX_FLATSEPARATORS */0,
|
||||
0,
|
||||
WC_TABCONTROL,
|
||||
TEXT("Tab"),
|
||||
style,
|
||||
|
@ -257,8 +253,7 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(69);
|
||||
throw std::runtime_error("TabBarPlus::init : CreateWindowEx() function return null");
|
||||
}
|
||||
if (!_isTraditional)
|
||||
{
|
||||
|
@ -277,9 +272,8 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad
|
|||
if (!found)
|
||||
{
|
||||
_ctrlID = -1;
|
||||
::MessageBox(NULL, TEXT("The nb of Tab Control is over its limit"), TEXT("Tab Control err"), MB_OK);
|
||||
destroy();
|
||||
throw int(96);
|
||||
throw std::runtime_error("TabBarPlus::init : Tab Control error - Tab Control # is over its limit");
|
||||
}
|
||||
_hwndArray[i] = _hSelf;
|
||||
_ctrlID = i;
|
||||
|
|
|
@ -55,8 +55,7 @@ void TaskList::init(HINSTANCE hInst, HWND parent, HIMAGELIST hImaLst, int nbItem
|
|||
NULL);
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(69);
|
||||
throw std::runtime_error("TaskList::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
|
||||
|
|
|
@ -228,8 +228,7 @@ void ToolBar::reset(bool create)
|
|||
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(9);
|
||||
throw std::runtime_error("ToolBar::reset : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
if (_state != TB_STANDARD)
|
||||
|
|
|
@ -35,8 +35,7 @@ void ToolTip::init(HINSTANCE hInst, HWND hParent)
|
|||
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL );
|
||||
if (!_hSelf)
|
||||
{
|
||||
systemMessage(TEXT("System Err"));
|
||||
throw int(6969);
|
||||
throw std::runtime_error("ToolTip::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
};
|
||||
|
||||
HWND getHSelf() const {
|
||||
//assert(_hSelf);
|
||||
assert(_hSelf != 0);
|
||||
return _hSelf;
|
||||
};
|
||||
|
||||
|
@ -94,11 +94,7 @@ public:
|
|||
};
|
||||
|
||||
HINSTANCE getHinst() const {
|
||||
if (!_hInst)
|
||||
{
|
||||
::MessageBox(NULL, TEXT("_hInst == NULL"), TEXT("class Window"), MB_OK);
|
||||
throw int(1999);
|
||||
}
|
||||
assert(_hInst != 0);
|
||||
return _hInst;
|
||||
};
|
||||
protected:
|
||||
|
|
|
@ -367,36 +367,26 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||
}
|
||||
}
|
||||
} catch(int i) {
|
||||
if (i == 106901)
|
||||
::MessageBox(NULL, TEXT("Scintilla.init is failed!"), TEXT("Notepad++ Exception: 106901"), MB_OK);
|
||||
else {
|
||||
TCHAR str[50] = TEXT("God Damned Exception : ");
|
||||
TCHAR code[10];
|
||||
wsprintf(code, TEXT("%d"), i);
|
||||
::MessageBox(Notepad_plus_Window::gNppHWND, lstrcat(str, code), TEXT("Notepad++ Exception"), MB_OK);
|
||||
::MessageBox(Notepad_plus_Window::gNppHWND, lstrcat(str, code), TEXT("Int Exception"), MB_OK);
|
||||
doException(notepad_plus_plus);
|
||||
} catch(std::runtime_error & ex) {
|
||||
::MessageBoxA(Notepad_plus_Window::gNppHWND, ex.what(), "Runtime Exception", MB_OK);
|
||||
doException(notepad_plus_plus);
|
||||
}
|
||||
} catch (const Win32Exception & ex) {
|
||||
TCHAR message[1024]; //TODO: sane number
|
||||
wsprintf(message, TEXT("An exception occured. Notepad++ cannot recover and must be shut down.\r\nThe exception details are as follows:\r\n")
|
||||
#ifdef UNICODE
|
||||
TEXT("Code:\t0x%08X\r\nType:\t%S\r\nException address: 0x%08X"),
|
||||
#else
|
||||
TEXT("Code:\t0x%08X\r\nType:\t%s\r\nException address: 0x%08X"),
|
||||
#endif
|
||||
ex.code(), ex.what(), ex.where());
|
||||
TEXT("Code:\t0x%08X\r\nType:\t%S\r\nException address: 0x%08X"), ex.code(), ex.what(), ex.where());
|
||||
::MessageBox(Notepad_plus_Window::gNppHWND, message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
|
||||
mdump.writeDump(ex.info());
|
||||
doException(notepad_plus_plus);
|
||||
} catch(std::exception ex) {
|
||||
#ifdef UNICODE
|
||||
const wchar_t * text = WcharMbcsConvertor::getInstance()->char2wchar(ex.what(), CP_ACP);
|
||||
::MessageBox(Notepad_plus_Window::gNppHWND, text, TEXT("C++ Exception"), MB_OK);
|
||||
#else
|
||||
::MessageBox(Notepad_plus_Window::gNppHWND, ex.what(), TEXT("C++ Exception"), MB_OK);
|
||||
#endif
|
||||
} catch(std::exception & ex) {
|
||||
::MessageBoxA(Notepad_plus_Window::gNppHWND, ex.what(), "General Exception", MB_OK);
|
||||
doException(notepad_plus_plus);
|
||||
} catch(...) { //this shouldnt ever have to happen
|
||||
::MessageBoxA(Notepad_plus_Window::gNppHWND, "An exception that we did not yet found its name is just caught", "Unknown Exception", MB_OK);
|
||||
doException(notepad_plus_plus);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue