[ENHANCEMENT] Enhance warning message when the amount of files to open is too important.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@909 f5eea248-9336-0410-98b8-ebc06183d4e3
remotes/trunk
Don Ho 13 years ago
parent 5d28d74ac7
commit 43f4e4c45a

@ -610,6 +610,9 @@
<FileLockedWarning title="Save failed" message="Please check whether if this file is opened in another program"/>
<FileAlreadyOpenedInNpp title="" message="The file is already opened in the Notepad++."/>
<DeleteFileFailed title="Delete File" message="Delete File failed"/>
<!-- $INT_REPLACE$ is a place holder, don't translate it -->
<NbFileToOpenImportantWaring title="Amount of files to open is too large" message="$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?"/>
</MessageBox>
<ProjectManager>
<PanelTitle name="Project"/>

@ -197,9 +197,10 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
{
int answer = _nativeLangSpeaker.messageBox("NbFileToOpenImportantWaring",
_pPublicInterface->getHSelf(),
TEXT("Number of files to open are too important.\rAre you sure to open them?"),
TEXT("Amount of files to open is too large"),
MB_YESNO|MB_APPLMODAL);
TEXT("$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?"),
TEXT("Amount of files to open is too large"),
MB_YESNO|MB_APPLMODAL,
nbFiles2Open);
ok2Open = answer == IDYES;
}

@ -739,6 +739,13 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea
if(bufferSizeRequested > INT_MAX)
{
::MessageBox(NULL, TEXT("File is too big to be opened by Notepad++"), TEXT("File open problem"), MB_OK|MB_APPLMODAL);
/*
_nativeLangSpeaker.messageBox("NbFileToOpenImportantWaring",
_pPublicInterface->getHSelf(),
TEXT("File is too big to be opened by Notepad++"),
TEXT("File open problem"),
MB_OK|MB_APPLMODAL);
*/
fclose(fp);
return false;
}

@ -1321,12 +1321,49 @@ generic_string NativeLangSpeaker::getProjectPanelLangStr(const char *nodeName, c
return defaultStr;
}
int NativeLangSpeaker::messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *defaultMessage, TCHAR *defaultTitle, int msgBoxType)
int NativeLangSpeaker::messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *defaultMessage, TCHAR *defaultTitle, int msgBoxType, int intInfo, TCHAR *strInfo)
{
generic_string msg, title;
if (getMsgBoxLang(msgBoxTagName, title, msg))
size_t index;
TCHAR int2Write[256];
TCHAR intPlaceHolderSymbol[] = TEXT("$INT_REPLACE$");
TCHAR strPlaceHolderSymbol[] = TEXT("$STR_REPLACE$");
size_t intPlaceHolderLen = lstrlen(intPlaceHolderSymbol);
size_t strPlaceHolderLen = lstrlen(strPlaceHolderSymbol);
generic_sprintf(int2Write, TEXT("%d"), intInfo);
if (!getMsgBoxLang(msgBoxTagName, title, msg))
{
return ::MessageBox(hWnd, msg.c_str(), title.c_str(), msgBoxType);
title = defaultTitle;
msg = defaultMessage;
}
index = title.find(intPlaceHolderSymbol);
if (index != string::npos)
title.replace(index, intPlaceHolderLen, int2Write);
index = msg.find(intPlaceHolderSymbol);
if (index != string::npos)
msg.replace(index, intPlaceHolderLen, int2Write);
if (strInfo)
{
index = title.find(strPlaceHolderSymbol);
if (index != string::npos)
title.replace(index, strPlaceHolderLen, strInfo);
index = msg.find(strPlaceHolderSymbol);
if (index != string::npos)
msg.replace(index, strPlaceHolderLen, strInfo);
}
return ::MessageBox(hWnd, msg.c_str(), title.c_str(), msgBoxType);
/*
defaultTitle.replace(index, len, int2Write);
defaultTitle.replace(index, len, str2Write);
defaultMessage.replace(index, len, int2Write);
defaultMessage.replace(index, len, str2Write);
return ::MessageBox(hWnd, defaultMessage, defaultTitle, msgBoxType);
*/
}

@ -74,7 +74,7 @@ public:
bool getMsgBoxLang(const char *msgBoxTagName, generic_string & title, generic_string & message);
generic_string getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const TCHAR *defaultStr) const;
generic_string getProjectPanelLangStr(const char *nodeName, const TCHAR *defaultStr) const;
int messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *message, TCHAR *title, int msgBoxType);
int messageBox(const char *msgBoxTagName, HWND hWnd, TCHAR *message, TCHAR *title, int msgBoxType, int intInfo = 0, TCHAR *strInfo = NULL);
private:
TiXmlNodeA *_nativeLangA;
int _nativeLangEncoding;

Loading…
Cancel
Save