Make ReplaceInFiles confirmation prompt translation capable
Close #8139, close #8165
This commit is contained in:
parent
fbf6668a80
commit
924e4b23fe
@ -1265,6 +1265,9 @@ Find in all files except exe, obj && log:
|
|||||||
<summary-nbsel1 value=" selected characters ("/>
|
<summary-nbsel1 value=" selected characters ("/>
|
||||||
<summary-nbsel2 value=" bytes) in "/>
|
<summary-nbsel2 value=" bytes) in "/>
|
||||||
<summary-nbrange value=" ranges"/>
|
<summary-nbrange value=" ranges"/>
|
||||||
|
<replace-in-files-confirm-title value="Are you sure?"/>
|
||||||
|
<replace-in-files-confirm-directory value="Are you sure you want to replace all occurrences in :"/>
|
||||||
|
<replace-in-files-confirm-filetype value="For file type :"/>
|
||||||
</MiscStrings>
|
</MiscStrings>
|
||||||
</Native-Langue>
|
</Native-Langue>
|
||||||
</NotepadPlus>
|
</NotepadPlus>
|
||||||
|
@ -1192,12 +1192,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
if ((lstrlen(directory) > 0) && (directory[lstrlen(directory)-1] != '\\'))
|
if ((lstrlen(directory) > 0) && (directory[lstrlen(directory)-1] != '\\'))
|
||||||
_options._directory += TEXT("\\");
|
_options._directory += TEXT("\\");
|
||||||
|
|
||||||
generic_string msg = TEXT("Are you sure you want to replace all occurrences in :\r");
|
if (replaceInFilesConfirmCheck(_options._directory, _options._filters))
|
||||||
msg += _options._directory;
|
|
||||||
msg += TEXT("\rfor file type : ");
|
|
||||||
msg += _options._filters[0]?_options._filters:TEXT("*.*");
|
|
||||||
int res = ::MessageBox(NULL, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL | MB_DEFBUTTON2 | MB_TASKMODAL);
|
|
||||||
if (res == IDOK)
|
|
||||||
{
|
{
|
||||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||||
_options._str2Search = getTextFromCombo(hFindCombo);
|
_options._str2Search = getTextFromCombo(hFindCombo);
|
||||||
@ -2712,12 +2707,7 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
|
|||||||
|
|
||||||
case IDD_FINDINFILES_REPLACEINFILES:
|
case IDD_FINDINFILES_REPLACEINFILES:
|
||||||
{
|
{
|
||||||
generic_string msg = TEXT("Are you sure you want to replace all occurrences in :\r");
|
if (replaceInFilesConfirmCheck(_env->_directory, _env->_filters))
|
||||||
msg += _env->_directory;
|
|
||||||
msg += TEXT("\rfor file type : ");
|
|
||||||
msg += (_env->_filters[0]) ? _env->_filters : TEXT("*.*");
|
|
||||||
|
|
||||||
if (::MessageBox(_hParent, msg.c_str(), TEXT("Are you sure?"), MB_OKCANCEL | MB_DEFBUTTON2) == IDOK)
|
|
||||||
{
|
{
|
||||||
nppParamInst._isFindReplacing = true;
|
nppParamInst._isFindReplacing = true;
|
||||||
::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0);
|
::SendMessage(_hParent, WM_REPLACEINFILES, 0, 0);
|
||||||
@ -3081,6 +3071,36 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
|||||||
::DrawText(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
|
::DrawText(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FindReplaceDlg::replaceInFilesConfirmCheck(generic_string directory, generic_string fileTypes)
|
||||||
|
{
|
||||||
|
bool confirmed = false;
|
||||||
|
|
||||||
|
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||||
|
|
||||||
|
generic_string title = pNativeSpeaker->getLocalizedStrFromID("replace-in-files-confirm-title", TEXT("Are you sure?"));
|
||||||
|
|
||||||
|
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("replace-in-files-confirm-directory", TEXT("Are you sure you want to replace all occurrences in :"));
|
||||||
|
msg += TEXT("\r\r");
|
||||||
|
msg += directory;
|
||||||
|
|
||||||
|
msg += TEXT("\r\r");
|
||||||
|
|
||||||
|
generic_string msg2 = pNativeSpeaker->getLocalizedStrFromID("replace-in-files-confirm-filetype", TEXT("For file type :"));
|
||||||
|
msg2 += TEXT("\r\r");
|
||||||
|
msg2 += fileTypes[0] ? fileTypes : TEXT("*.*");
|
||||||
|
|
||||||
|
msg += msg2;
|
||||||
|
|
||||||
|
int res = ::MessageBox(NULL, msg.c_str(), title.c_str(), MB_OKCANCEL | MB_DEFBUTTON2 | MB_TASKMODAL);
|
||||||
|
|
||||||
|
if (res == IDOK)
|
||||||
|
{
|
||||||
|
confirmed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return confirmed;
|
||||||
|
}
|
||||||
|
|
||||||
void Finder::addSearchLine(const TCHAR *searchName)
|
void Finder::addSearchLine(const TCHAR *searchName)
|
||||||
{
|
{
|
||||||
generic_string str = TEXT("Search \"");
|
generic_string str = TEXT("Search \"");
|
||||||
|
@ -410,7 +410,7 @@ private :
|
|||||||
static const int FR_OP_GLOBAL = 8;
|
static const int FR_OP_GLOBAL = 8;
|
||||||
void saveInMacro(size_t cmd, int cmdType);
|
void saveInMacro(size_t cmd, int cmdType);
|
||||||
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
|
||||||
|
bool replaceInFilesConfirmCheck(generic_string directory, generic_string fileTypes);
|
||||||
};
|
};
|
||||||
|
|
||||||
//FindIncrementDlg: incremental search dialog, docked in rebar
|
//FindIncrementDlg: incremental search dialog, docked in rebar
|
||||||
|
Loading…
Reference in New Issue
Block a user