mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-13 17:04:38 +02:00
Add confirmation prompt to Replace-in-all-opened-docs command
Fix #5253, fix #8432, close #8438
This commit is contained in:
parent
68d66a560c
commit
19bdbd093c
@ -1268,6 +1268,8 @@ Find in all files except exe, obj && log:
|
|||||||
<replace-in-files-confirm-title value="Are you sure?"/>
|
<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-directory value="Are you sure you want to replace all occurrences in :"/>
|
||||||
<replace-in-files-confirm-filetype value="For file type :"/>
|
<replace-in-files-confirm-filetype value="For file type :"/>
|
||||||
|
<replace-in-open-docs-confirm-title value="Are you sure?"/>
|
||||||
|
<replace-in-open-docs-confirm-message value="Are you sure you want to replace all occurrences in all open documents?"/>
|
||||||
<find-result-caption value="Find result"/>
|
<find-result-caption value="Find result"/>
|
||||||
<find-result-title value="Search"/>
|
<find-result-title value="Search"/>
|
||||||
<find-result-title-info value="($INT_REPLACE1$ hits in $INT_REPLACE2$ files of $INT_REPLACE3$ searched)"/>
|
<find-result-title-info value="($INT_REPLACE1$ hits in $INT_REPLACE2$ files of $INT_REPLACE3$ searched)"/>
|
||||||
|
@ -1265,6 +1265,8 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
std::lock_guard<std::mutex> lock(findOps_mutex);
|
std::lock_guard<std::mutex> lock(findOps_mutex);
|
||||||
|
|
||||||
if (_currentStatus == REPLACE_DLG)
|
if (_currentStatus == REPLACE_DLG)
|
||||||
|
{
|
||||||
|
if (replaceInOpenDocsConfirmCheck())
|
||||||
{
|
{
|
||||||
setStatusbarMessage(TEXT(""), FSNoMessage);
|
setStatusbarMessage(TEXT(""), FSNoMessage);
|
||||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||||
@ -1279,6 +1281,7 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||||||
nppParamInst._isFindReplacing = false;
|
nppParamInst._isFindReplacing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case IDREPLACEALL :
|
case IDREPLACEALL :
|
||||||
@ -2811,9 +2814,12 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
|
|||||||
nppParamInst._isFindReplacing = false;
|
nppParamInst._isFindReplacing = false;
|
||||||
break;
|
break;
|
||||||
case IDC_REPLACE_OPENEDFILES:
|
case IDC_REPLACE_OPENEDFILES:
|
||||||
|
if (replaceInOpenDocsConfirmCheck())
|
||||||
|
{
|
||||||
nppParamInst._isFindReplacing = true;
|
nppParamInst._isFindReplacing = true;
|
||||||
replaceAllInOpenedDocs();
|
replaceAllInOpenedDocs();
|
||||||
nppParamInst._isFindReplacing = false;
|
nppParamInst._isFindReplacing = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case IDD_FINDINFILES_FIND_BUTTON:
|
case IDD_FINDINFILES_FIND_BUTTON:
|
||||||
nppParamInst._isFindReplacing = true;
|
nppParamInst._isFindReplacing = true;
|
||||||
@ -3227,6 +3233,24 @@ bool FindReplaceDlg::replaceInFilesConfirmCheck(generic_string directory, generi
|
|||||||
return confirmed;
|
return confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FindReplaceDlg::replaceInOpenDocsConfirmCheck(void)
|
||||||
|
{
|
||||||
|
bool confirmed = false;
|
||||||
|
|
||||||
|
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||||
|
generic_string title = pNativeSpeaker->getLocalizedStrFromID("replace-in-open-docs-confirm-title", TEXT("Are you sure?"));
|
||||||
|
generic_string msg = pNativeSpeaker->getLocalizedStrFromID("replace-in-open-docs-confirm-message", TEXT("Are you sure you want to replace all occurrences in all open documents?"));
|
||||||
|
|
||||||
|
int res = ::MessageBox(NULL, msg.c_str(), title.c_str(), MB_OKCANCEL | MB_DEFBUTTON2 | MB_TASKMODAL);
|
||||||
|
|
||||||
|
if (res == IDOK)
|
||||||
|
{
|
||||||
|
confirmed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return confirmed;
|
||||||
|
}
|
||||||
|
|
||||||
generic_string Finder::getHitsString(int count) const
|
generic_string Finder::getHitsString(int count) const
|
||||||
{
|
{
|
||||||
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||||
|
@ -417,6 +417,7 @@ private :
|
|||||||
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);
|
bool replaceInFilesConfirmCheck(generic_string directory, generic_string fileTypes);
|
||||||
|
bool replaceInOpenDocsConfirmCheck(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
//FindIncrementDlg: incremental search dialog, docked in rebar
|
//FindIncrementDlg: incremental search dialog, docked in rebar
|
||||||
|
Loading…
x
Reference in New Issue
Block a user