Add confirmation preference for Replace All in All Opened Documents operation
Close #8527, close #8708
This commit is contained in:
parent
47bb08ee6c
commit
209ccb97ec
|
@ -908,6 +908,7 @@ You can define several column markers by using white space to separate the diffe
|
|||
<Item id="6901" name="Don't fill find field in Find dialog with selected word"/>
|
||||
<Item id="6902" name="Use monospaced font in Find dialog (Need to restart Notepad++)"/>
|
||||
<Item id="6903" name="Find dialog remains open after search that outputs to results window"/>
|
||||
<Item id="6904" name="Confirm Replace All in All Opened Documents"/>
|
||||
</Searching>
|
||||
|
||||
<RecentFilesHistory title="Recent Files History">
|
||||
|
|
|
@ -5150,6 +5150,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
|||
const TCHAR* optFindDlgAlwaysVisible = element->Attribute(TEXT("findDlgAlwaysVisible"));
|
||||
if (optFindDlgAlwaysVisible)
|
||||
_nppGUI._findDlgAlwaysVisible = (lstrcmp(optFindDlgAlwaysVisible, TEXT("yes")) == 0);
|
||||
|
||||
const TCHAR* optConfirmReplaceOpenDocs = element->Attribute(TEXT("confirmReplaceInAllOpenDocs"));
|
||||
if (optConfirmReplaceOpenDocs)
|
||||
_nppGUI._confirmReplaceInAllOpenDocs = (lstrcmp(optConfirmReplaceOpenDocs, TEXT("yes")) == 0);
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("MISC")))
|
||||
{
|
||||
|
@ -5964,7 +5968,7 @@ void NppParameters::createXmlTreeFromGUIParams()
|
|||
GUIConfigElement->SetAttribute(TEXT("docPeekOnMap"), _nppGUI._isDocPeekOnMap ? TEXT("yes") : TEXT("no"));
|
||||
}
|
||||
|
||||
// <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" findDlgAlwaysVisible="no" />
|
||||
// <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" findDlgAlwaysVisible="no" confirmReplaceOpenDocs="yes" confirmMacroReplaceOpenDocs="yes" confirmReplaceInFiles="yes" confirmMacroReplaceInFiles="yes" />
|
||||
{
|
||||
TiXmlElement* GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
||||
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Searching"));
|
||||
|
@ -5972,6 +5976,7 @@ void NppParameters::createXmlTreeFromGUIParams()
|
|||
GUIConfigElement->SetAttribute(TEXT("monospacedFontFindDlg"), _nppGUI._monospacedFontFindDlg ? TEXT("yes") : TEXT("no"));
|
||||
GUIConfigElement->SetAttribute(TEXT("stopFillingFindField"), _nppGUI._stopFillingFindField ? TEXT("yes") : TEXT("no"));
|
||||
GUIConfigElement->SetAttribute(TEXT("findDlgAlwaysVisible"), _nppGUI._findDlgAlwaysVisible ? TEXT("yes") : TEXT("no"));
|
||||
GUIConfigElement->SetAttribute(TEXT("confirmReplaceInAllOpenDocs"), _nppGUI._confirmReplaceInAllOpenDocs ? TEXT("yes") : TEXT("no"));
|
||||
}
|
||||
|
||||
// <GUIConfig name="searchEngine" searchEngineChoice="2" searchEngineCustom="" />
|
||||
|
|
|
@ -839,6 +839,7 @@ struct NppGUI final
|
|||
bool _stopFillingFindField = false;
|
||||
bool _monospacedFontFindDlg = false;
|
||||
bool _findDlgAlwaysVisible = false;
|
||||
bool _confirmReplaceInAllOpenDocs = true;
|
||||
writeTechnologyEngine _writeTechnologyEngine = defaultTechnology;
|
||||
bool _isWordCharDefault = true;
|
||||
std::string _customWordChars;
|
||||
|
|
|
@ -1256,7 +1256,9 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
|
||||
if (_currentStatus == REPLACE_DLG)
|
||||
{
|
||||
if (replaceInOpenDocsConfirmCheck())
|
||||
NppParameters& nppParam = NppParameters::getInstance();
|
||||
const NppGUI& nppGui = nppParam.getNppGUI();
|
||||
if (!nppGui._confirmReplaceInAllOpenDocs || replaceInOpenDocsConfirmCheck())
|
||||
{
|
||||
setStatusbarMessage(TEXT(""), FSNoMessage);
|
||||
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
|
||||
|
@ -2855,13 +2857,17 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
|
|||
nppParamInst._isFindReplacing = false;
|
||||
break;
|
||||
case IDC_REPLACE_OPENEDFILES:
|
||||
if (replaceInOpenDocsConfirmCheck())
|
||||
{
|
||||
NppParameters& nppParam = NppParameters::getInstance();
|
||||
const NppGUI& nppGui = nppParam.getNppGUI();
|
||||
if (!nppGui._confirmReplaceInAllOpenDocs || replaceInOpenDocsConfirmCheck())
|
||||
{
|
||||
nppParamInst._isFindReplacing = true;
|
||||
replaceAllInOpenedDocs();
|
||||
nppParamInst._isFindReplacing = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IDD_FINDINFILES_FIND_BUTTON:
|
||||
nppParamInst._isFindReplacing = true;
|
||||
findAllIn(FILES_IN_DIR);
|
||||
|
|
|
@ -148,6 +148,7 @@ BEGIN
|
|||
CONTROL "Don't fill find field in Find dialog with selected word", IDC_CHECK_STOPFILLINGFINDFIELD, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,37,10,350,10
|
||||
CONTROL "Use Monospaced font in Find dialog (Need to restart Notepad++)",IDC_CHECK_MONOSPACEDFONT_FINDDLG, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,37,25,350,10
|
||||
CONTROL "Find dialog remains open after search that outputs to results window",IDC_CHECK_FINDDLG_ALWAYS_VISIBLE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,37,40,350,10
|
||||
CONTROL "Confirm Replace All in All Opened Documents",IDC_CHECK_CONFIRMREPLOPENDOCS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,37,55,350,10
|
||||
END
|
||||
|
||||
IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 455, 185
|
||||
|
|
|
@ -3517,6 +3517,7 @@ INT_PTR CALLBACK SearchingSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
|||
::SendDlgItemMessage(_hSelf, IDC_CHECK_STOPFILLINGFINDFIELD, BM_SETCHECK, nppGUI._stopFillingFindField, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_MONOSPACEDFONT_FINDDLG, BM_SETCHECK, nppGUI._monospacedFontFindDlg, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_FINDDLG_ALWAYS_VISIBLE, BM_SETCHECK, nppGUI._findDlgAlwaysVisible, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_CONFIRMREPLOPENDOCS, BM_SETCHECK, nppGUI._confirmReplaceInAllOpenDocs, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -3545,6 +3546,13 @@ INT_PTR CALLBACK SearchingSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
|
|||
}
|
||||
break;
|
||||
|
||||
case IDC_CHECK_CONFIRMREPLOPENDOCS:
|
||||
{
|
||||
nppGUI._confirmReplaceInAllOpenDocs = isCheckedOrNot(IDC_CHECK_CONFIRMREPLOPENDOCS);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -359,5 +359,6 @@
|
|||
#define IDC_CHECK_STOPFILLINGFINDFIELD (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 1)
|
||||
#define IDC_CHECK_MONOSPACEDFONT_FINDDLG (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 2)
|
||||
#define IDC_CHECK_FINDDLG_ALWAYS_VISIBLE (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 3)
|
||||
#define IDC_CHECK_CONFIRMREPLOPENDOCS (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 4)
|
||||
|
||||
#endif //PREFERENCE_RC_H
|
||||
|
|
Loading…
Reference in New Issue