Add 'Searching' subpage to Preferences for Find-Replace-Mark settings

Fix #8131, close #8541
This commit is contained in:
Scott Sumner 2020-07-08 16:51:00 -04:00 committed by Don HO
parent 7d289139e8
commit 84ea510b67
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
7 changed files with 107 additions and 36 deletions

View File

@ -842,6 +842,11 @@ You can define several column markers by using white space to separate the diffe
<Item id="6728" name="Header and Footer"/>
</Print>
<Searching title="Searching">
<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++)"/>
</Searching>
<RecentFilesHistory title="Recent Files History">
<Item id="6304" name="Recent Files History"/>
<Item id="6306" name="Max. number of entries :"/>
@ -943,7 +948,6 @@ You can define several column markers by using white space to separate the diffe
<Item id="6324" name="Document Switcher (Ctrl+TAB)"/>
<Item id="6331" name="Show only filename in title bar"/>
<Item id="6334" name="Autodetect character encoding"/>
<Item id="6314" name="Use monospaced font in Find dialog (Need to restart Notepad++)"/>
<Item id="6349" name="Use DirectWrite (May improve rendering special characters, need to restart Notepad++)"/>
<Item id="6337" name="Workspace file ext.:"/>
<Item id="6114" name="Enable"/>
@ -951,7 +955,6 @@ You can define several column markers by using white space to separate the diffe
<Item id="6344" name="Document Peeker"/>
<Item id="6345" name="Peek on tab"/>
<Item id="6346" name="Peek on document map"/>
<Item id="6348" name="Don't fill find field in Find dialog with selected word"/>
</MISC>
</Preference>
<MultiMacro title="Run a Macro Multiple Times">

View File

@ -5127,6 +5127,16 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
if (searchEngineCustom && searchEngineCustom[0])
_nppGUI._searchEngineCustom = searchEngineCustom;
}
else if (!lstrcmp(nm, TEXT("Searching")))
{
const TCHAR* optNameMonoFont = element->Attribute(TEXT("monospacedFontFindDlg"));
if (optNameMonoFont)
_nppGUI._monospacedFontFindDlg = (lstrcmp(optNameMonoFont, TEXT("yes")) == 0);
const TCHAR* optStopFillingFindField = element->Attribute(TEXT("stopFillingFindField"));
if (optStopFillingFindField)
_nppGUI._stopFillingFindField = (lstrcmp(optStopFillingFindField, TEXT("yes")) == 0);
}
else if (!lstrcmp(nm, TEXT("MISC")))
{
const TCHAR * optName = element->Attribute(TEXT("fileSwitcherWithoutExtColumn"));
@ -5137,18 +5147,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
if (optNameBackSlashEscape && !lstrcmp(optNameBackSlashEscape, TEXT("no")))
_nppGUI._backSlashIsEscapeCharacterForSql = false;
const TCHAR * optNameMonoFont = element->Attribute(TEXT("monospacedFontFindDlg"));
if (optNameMonoFont)
_nppGUI._monospacedFontFindDlg = (lstrcmp(optNameMonoFont, TEXT("yes")) == 0);
const TCHAR * optNameWriteTechnologyEngine = element->Attribute(TEXT("writeTechnologyEngine"));
if (optNameWriteTechnologyEngine)
_nppGUI._writeTechnologyEngine = (lstrcmp(optNameWriteTechnologyEngine, TEXT("1")) == 0) ? directWriteTechnology : defaultTechnology;
const TCHAR * optStopFillingFindField = element->Attribute(TEXT("stopFillingFindField"));
if (optStopFillingFindField)
_nppGUI._stopFillingFindField = (lstrcmp(optStopFillingFindField, TEXT("yes")) == 0);
const TCHAR * optNameNewStyleSaveDlg = element->Attribute(TEXT("newStyleSaveDlg"));
if (optNameNewStyleSaveDlg)
_nppGUI._useNewStyleSaveDlg = (lstrcmp(optNameNewStyleSaveDlg, TEXT("yes")) == 0);
@ -5922,15 +5924,22 @@ void NppParameters::createXmlTreeFromGUIParams()
GUIConfigElement->SetAttribute(TEXT("fileSwitcherWithoutExtColumn"), _nppGUI._fileSwitcherWithoutExtColumn ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("backSlashIsEscapeCharacterForSql"), _nppGUI._backSlashIsEscapeCharacterForSql ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("monospacedFontFindDlg"), _nppGUI._monospacedFontFindDlg ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("writeTechnologyEngine"), _nppGUI._writeTechnologyEngine);
GUIConfigElement->SetAttribute(TEXT("stopFillingFindField"), _nppGUI._stopFillingFindField ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("newStyleSaveDlg"), _nppGUI._useNewStyleSaveDlg ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("isFolderDroppedOpenFiles"), _nppGUI._isFolderDroppedOpenFiles ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("docPeekOnTab"), _nppGUI._isDocPeekOnTab ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("docPeekOnMap"), _nppGUI._isDocPeekOnMap ? TEXT("yes") : TEXT("no"));
}
// <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" />
{
TiXmlElement* GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Searching"));
GUIConfigElement->SetAttribute(TEXT("monospacedFontFindDlg"), _nppGUI._monospacedFontFindDlg ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("stopFillingFindField"), _nppGUI._stopFillingFindField ? TEXT("yes") : TEXT("no"));
}
// <GUIConfig name="searchEngine" searchEngineChoice="2" searchEngineCustom="" />
{
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();

View File

@ -120,12 +120,10 @@ BEGIN
CONTROL "Enable MRU behaviour",IDC_CHECK_STYLEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,28,140,10
CONTROL "Peek on tab",IDC_CHECK_ENABLEDOCPEEKER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,58,140,10
CONTROL "Peek on document map", IDC_CHECK_ENABLEDOCPEEKONMAP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,71,140,10
CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,98,217,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,113,217,10
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,128,217,10
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,143,217,10
CONTROL "Don't fill find field in Find dialog with selected word", IDC_CHECK_STOPFILLINGFINDFIELD, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,158,217,10
CONTROL "Use Monospaced font in Find dialog (Need to restart Notepad++)",IDC_CHECK_MONOSPACEDFONT_FINDDLG, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,173,325,10
CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,128,217,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,143,217,10
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,158,217,10
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,173,217,10
CONTROL "Use DirectWrite (May improve rendering special characters, need to restart Notepad++)",IDC_CHECK_DIRECTWRITE_ENABLE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,188,377,10
CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10
CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10
@ -142,6 +140,14 @@ BEGIN
RTEXT "Workspace file ext.:",IDC_WORKSPACEFILEEXT_STATIC,271,155,108,8
END
IDD_PREFERENCE_SEARCHINGSETTINGS_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "Don't fill find field in Find dialog with selected word", IDC_CHECK_STOPFILLINGFINDFIELD, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | 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
END
IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
@ -413,4 +419,4 @@ BEGIN
CONTROL "Set your search engine here:",IDC_SEARCHENGINE_CUSTOM_RADIO, "Button",BS_AUTORADIOBUTTON,105,112,180,10
EDITTEXT IDC_SEARCHENGINE_EDIT,114,128,179,14,ES_AUTOHSCROLL
LTEXT "Example: https://www.google.com/search?q=$(CURRENT_WORD)",IDD_SEARCHENGINE_NOTE_STATIC,114,143,245,20
END
END

View File

@ -127,6 +127,9 @@ INT_PTR CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_printSettingsDlg.init(_hInst, _hSelf);
_printSettingsDlg.create(IDD_PREFERENCE_PRINT_BOX, false, false);
_searchingSettingsDlg.init(_hInst, _hSelf);
_searchingSettingsDlg.create(IDD_PREFERENCE_SEARCHINGSETTINGS_BOX, false, false);
_langMenuDlg.init(_hInst, _hSelf);
_langMenuDlg.create(IDD_PREFERENCE_LANG_BOX, false, false);
@ -161,6 +164,7 @@ INT_PTR CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_wVector.push_back(DlgInfo(&_langMenuDlg, TEXT("Language"), TEXT("Language")));
_wVector.push_back(DlgInfo(&_highlighting, TEXT("Highlighting"), TEXT("Highlighting")));
_wVector.push_back(DlgInfo(&_printSettingsDlg, TEXT("Print"), TEXT("Print")));
_wVector.push_back(DlgInfo(&_searchingSettingsDlg, TEXT("Searching"), TEXT("Searching")));
_wVector.push_back(DlgInfo(&_backupDlg, TEXT("Backup"), TEXT("Backup")));
_wVector.push_back(DlgInfo(&_autoCompletionDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion")));
_wVector.push_back(DlgInfo(&_multiInstDlg, TEXT("Multi-Instance"), TEXT("MultiInstance")));
@ -188,6 +192,7 @@ INT_PTR CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_langMenuDlg.reSizeTo(rc);
_highlighting.reSizeTo(rc);
_printSettingsDlg.reSizeTo(rc);
_searchingSettingsDlg.reSizeTo(rc);
_backupDlg.reSizeTo(rc);
_autoCompletionDlg.reSizeTo(rc);
_multiInstDlg.reSizeTo(rc);
@ -336,6 +341,7 @@ void PreferenceDlg::destroy()
_langMenuDlg.destroy();
_highlighting.destroy();
_printSettingsDlg.destroy();
_searchingSettingsDlg.destroy();
_defaultNewDocDlg.destroy();
_defaultDirectoryDlg.destroy();
_recentFilesHistoryDlg.destroy();
@ -902,7 +908,6 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_MONOSPACEDFONT_FINDDLG, BM_SETCHECK, nppGUI._monospacedFontFindDlg, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DIRECTWRITE_ENABLE, BM_SETCHECK, nppGUI._writeTechnologyEngine == directWriteTechnology, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKER, BM_SETCHECK, nppGUI._isDocPeekOnTab ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCPEEKONMAP, BM_SETCHECK, nppGUI._isDocPeekOnMap ? BST_CHECKED : BST_UNCHECKED, 0);
@ -934,7 +939,6 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_EDIT_WORKSPACEFILEEXT, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(nppGUI._definedWorkspaceExt.c_str()));
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCSWITCHER, BM_SETCHECK, nppGUI._doTaskList, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_STOPFILLINGFINDFIELD, BM_SETCHECK, nppGUI._stopFillingFindField, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_STYLEMRU, BM_SETCHECK, nppGUI._styleMRU, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHORTTITLE, BM_SETCHECK, nppGUI._shortTitlebar, 0);
@ -1046,12 +1050,6 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
return TRUE;
}
case IDC_CHECK_STOPFILLINGFINDFIELD:
{
nppGUI._stopFillingFindField = isCheckedOrNot(IDC_CHECK_STOPFILLINGFINDFIELD);
return TRUE;
}
case IDC_CHECK_STYLEMRU :
{
nppGUI._styleMRU = isCheckedOrNot(IDC_CHECK_STYLEMRU);
@ -1066,12 +1064,6 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
return TRUE;
}
case IDC_CHECK_MONOSPACEDFONT_FINDDLG:
{
nppGUI._monospacedFontFindDlg = isCheckedOrNot(IDC_CHECK_MONOSPACEDFONT_FINDDLG);
return TRUE;
}
case IDC_CHECK_DIRECTWRITE_ENABLE:
{
nppGUI._writeTechnologyEngine = isCheckedOrNot(IDC_CHECK_DIRECTWRITE_ENABLE) ? directWriteTechnology : defaultTechnology;
@ -3508,3 +3500,43 @@ INT_PTR CALLBACK SearchEngineChoiceDlg::run_dlgProc(UINT message, WPARAM wParam,
return FALSE;
}
INT_PTR CALLBACK SearchingSettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{
NppParameters& nppParams = NppParameters::getInstance();
NppGUI& nppGUI = const_cast<NppGUI&>(nppParams.getNppGUI());
switch (message)
{
case WM_INITDIALOG:
{
::SendDlgItemMessage(_hSelf, IDC_CHECK_STOPFILLINGFINDFIELD, BM_SETCHECK, nppGUI._stopFillingFindField, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_MONOSPACEDFONT_FINDDLG, BM_SETCHECK, nppGUI._monospacedFontFindDlg, 0);
}
break;
case WM_COMMAND:
{
switch (wParam)
{
case IDC_CHECK_STOPFILLINGFINDFIELD:
{
nppGUI._stopFillingFindField = isCheckedOrNot(IDC_CHECK_STOPFILLINGFINDFIELD);
return TRUE;
}
break;
case IDC_CHECK_MONOSPACEDFONT_FINDDLG:
{
nppGUI._monospacedFontFindDlg = isCheckedOrNot(IDC_CHECK_MONOSPACEDFONT_FINDDLG);
return TRUE;
}
break;
default:
return FALSE;
}
}
break;
}
return FALSE;
}

View File

@ -140,6 +140,15 @@ private :
};
class SearchingSettingsDlg : public StaticDialog
{
public:
SearchingSettingsDlg() = default;
private:
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
};
struct strCouple {
generic_string _varDesc;
generic_string _var;
@ -276,5 +285,6 @@ private :
DelimiterSettingsDlg _delimiterSettingsDlg;
SettingsOnCloudDlg _settingsOnCloudDlg;
SearchEngineChoiceDlg _searchEngineDlg;
SearchingSettingsDlg _searchingSettingsDlg;
};

View File

@ -171,7 +171,6 @@
#define IDC_MAXNBFILEVAL_STATIC (IDD_PREFERENCE_SETTING_BOX + 11)
#define IDC_FILEAUTODETECTION_STATIC (IDD_PREFERENCE_SETTING_BOX + 12)
#define IDC_CHECK_UPDATESILENTLY (IDD_PREFERENCE_SETTING_BOX + 13)
#define IDC_CHECK_MONOSPACEDFONT_FINDDLG (IDD_PREFERENCE_SETTING_BOX + 14)
#define IDC_RADIO_BKNONE (IDD_PREFERENCE_SETTING_BOX + 15)
#define IDC_RADIO_BKSIMPLE (IDD_PREFERENCE_SETTING_BOX + 16)
#define IDC_RADIO_BKVERBOSE (IDD_PREFERENCE_SETTING_BOX + 17)
@ -208,7 +207,6 @@
#define IDC_CHECK_ENABLEDOCPEEKER (IDD_PREFERENCE_SETTING_BOX + 45)
#define IDC_CHECK_ENABLEDOCPEEKONMAP (IDD_PREFERENCE_SETTING_BOX + 46)
#define IDC_COMBO_FILEUPDATECHOICE (IDD_PREFERENCE_SETTING_BOX + 47)
#define IDC_CHECK_STOPFILLINGFINDFIELD (IDD_PREFERENCE_SETTING_BOX + 48)
#define IDC_CHECK_DIRECTWRITE_ENABLE (IDD_PREFERENCE_SETTING_BOX + 49)
#define IDD_PREFERENCE_NEWDOCSETTING_BOX 6400 //(IDD_PREFERENCE_BOX + 400)
@ -355,4 +353,9 @@
#define IDC_MACHEDPAIR_STATIC3 (IDD_PREFERENCE_AUTOCOMPLETION_BOX + 16)
#define IDC_MACHEDPAIROPEN_EDIT3 (IDD_PREFERENCE_AUTOCOMPLETION_BOX + 17)
#define IDC_MACHEDPAIRCLOSE_EDIT3 (IDD_PREFERENCE_AUTOCOMPLETION_BOX + 18)
#define IDD_PREFERENCE_SEARCHINGSETTINGS_BOX 6900 //(IDD_PREFERENCE_BOX + 900)
#define IDC_CHECK_STOPFILLINGFINDFIELD (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 1)
#define IDC_CHECK_MONOSPACEDFONT_FINDDLG (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 2)
#endif //PREFERENCE_RC_H

View File

@ -888,6 +888,14 @@ void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference)
const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
preference.renameDialogTitle(TEXT("Print"), nameW);
}
changeDlgLang(preference._searchingSettingsDlg.getHSelf(), "Searching", titre, titreMaxSize);
if (titre[0] != '\0')
{
const wchar_t* nameW = wmc.char2wchar(titre, _nativeLangEncoding);
preference.renameDialogTitle(TEXT("Searching"), nameW);
}
changeDlgLang(preference._settingsDlg.getHSelf(), "MISC", titre, titreMaxSize);
if (titre[0] != '\0')
{
@ -1313,4 +1321,4 @@ int NativeLangSpeaker::messageBox(const char *msgBoxTagName, HWND hWnd, const TC
msg = stringReplace(msg, TEXT("$STR_REPLACE$"), strInfo);
}
return ::MessageBox(hWnd, msg.c_str(), title.c_str(), msgBoxType);
}
}