Make filling find field of Find dialog with selected word(s) optional

Close #3243
This commit is contained in:
Don HO 2019-12-25 13:32:40 +05:00
parent c2f84b4cc6
commit 7a1096de5b
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
7 changed files with 70 additions and 45 deletions

View File

@ -252,8 +252,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
bool isFirstTime = not _findReplaceDlg.isCreated();
_findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL());
const NppGUI & nppGui = nppParam.getNppGUI();
if (!nppGui._stopFillingFindField)
{
_pEditView->getGenericSelectedText(str, strSize);
_findReplaceDlg.setSearchText(str);
}
if (isFirstTime)
_nativeLangSpeaker.changeFindReplaceDlgLang(_findReplaceDlg);
_findReplaceDlg.launchFindInFilesDlg();

View File

@ -986,8 +986,13 @@ void Notepad_plus::command(int id)
dlgID = MARK_DLG;
_findReplaceDlg.doDialog(dlgID, _nativeLangSpeaker.isRTL());
const NppGUI & nppGui = (NppParameters::getInstance()).getNppGUI();
if (!nppGui._stopFillingFindField)
{
_pEditView->getGenericSelectedText(str, strSize);
_findReplaceDlg.setSearchText(str);
}
setFindReplaceFolderFilter(NULL, NULL);
if (isFirstTime)

View File

@ -5080,6 +5080,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
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);
const TCHAR * optNameNewStyleSaveDlg = element->Attribute(TEXT("newStyleSaveDlg"));
if (optNameNewStyleSaveDlg)
_nppGUI._useNewStyleSaveDlg = (lstrcmp(optNameNewStyleSaveDlg, TEXT("yes")) == 0);
@ -5846,6 +5850,7 @@ 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("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"));

View File

@ -824,6 +824,7 @@ struct NppGUI final
char _rightmostDelimiter = ')';
bool _delimiterSelectionOnEntireDocument = false;
bool _backSlashIsEscapeCharacterForSql = true;
bool _stopFillingFindField = false;
bool _monospacedFontFindDlg = false;
bool _isWordCharDefault = true;
std::string _customWordChars;

View File

@ -123,10 +123,10 @@ BEGIN
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 "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,113,217,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,128,217,10
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,143,217,10
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,158,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 "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
@ -317,38 +317,40 @@ IDD_PREFERENCE_AUTOCOMPLETION_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Auto-Completion",IDD_AUTOC_GRPSTATIC,86,4,289,84,BS_CENTER
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,15,100,10
GROUPBOX "Auto-Completion",IDD_AUTOC_GRPSTATIC,131,4,289,84,BS_CENTER
CONTROL "Enable auto-completion on each input",IDD_AUTOC_ENABLECHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,91,15,150,10
CONTROL "Function completion",IDD_AUTOC_FUNCRADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,118,27,145,10
CONTROL "Word completion",IDD_AUTOC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,118,41,145,10
CONTROL "Function and word completion",IDD_AUTOC_BOTHRADIO,"Button",BS_AUTORADIOBUTTON,118,55,145,10
RTEXT "From",IDD_AUTOC_STATIC_FROM,248,15,47,8
CTEXT "1",IDD_AUTOC_STATIC_N,299,15,8,8,WS_TABSTOP
LTEXT "th character",IDD_AUTOC_STATIC_CHAR,313,15,57,8
LTEXT "Valid value : 1 - 9",IDD_AUTOC_STATIC_NOTE,278,25,93,8
CONTROL "Ignore numbers",IDD_AUTOC_IGNORENUMBERS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,278,55,80,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,15,150,10
CONTROL "Function completion",IDD_AUTOC_FUNCRADIO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,163,27,145,10
CONTROL "Word completion",IDD_AUTOC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,163,41,145,10
CONTROL "Function and word completion",IDD_AUTOC_BOTHRADIO,
"Button",BS_AUTORADIOBUTTON,163,55,145,10
RTEXT "From",IDD_AUTOC_STATIC_FROM,293,15,47,8
CTEXT "1",IDD_AUTOC_STATIC_N,344,15,8,8,WS_TABSTOP
LTEXT "th character",IDD_AUTOC_STATIC_CHAR,358,15,57,8
LTEXT "Valid value : 1 - 9",IDD_AUTOC_STATIC_NOTE,323,25,93,8
CONTROL "Ignore numbers",IDD_AUTOC_IGNORENUMBERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,323,55,80,10
CONTROL "Function parameters hint on input",IDD_FUNC_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,91,72,160,10
GROUPBOX "Auto-Insert",IDD_AUTOCINSERT_GRPSTATIC,86,94,289,84,BS_CENTER
CONTROL " (",IDD_AUTOCPARENTHESES_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,115,24,10
CONTROL " [",IDD_AUTOCBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,133,24,10
CONTROL " {",IDD_AUTOCCURLYBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,101,152,24,10
CONTROL " """,IDD_AUTOC_DOUBLEQUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,116,24,10
CONTROL " '",IDD_AUTOC_QUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,133,24,10
CONTROL " html/xml close tag",IDD_AUTOCTAG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,145,152,76,10
RTEXT "Open",IDC_MACHEDPAIROPEN_STATIC,307,103,25,8
LTEXT "Close",IDC_MACHEDPAIRCLOSE_STATIC,345,103,25,8
RTEXT "Matched pair 1:",IDC_MACHEDPAIR_STATIC1,248,117,70,8
EDITTEXT IDC_MACHEDPAIROPEN_EDIT1,320,115,14,14
EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT1,348,115,14,14
RTEXT "Matched pair 2:",IDC_MACHEDPAIR_STATIC2,248,137,70,8
EDITTEXT IDC_MACHEDPAIROPEN_EDIT2,320,135,14,14
EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT2,348,135,14,14
RTEXT "Matched pair 3:",IDC_MACHEDPAIR_STATIC3,248,157,70,8
EDITTEXT IDC_MACHEDPAIROPEN_EDIT3,320,155,14,14
EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT3,348,155,14,14
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,136,72,160,10
GROUPBOX "Auto-Insert",IDD_AUTOCINSERT_GRPSTATIC,131,94,289,84,BS_CENTER
CONTROL " (",IDD_AUTOCPARENTHESES_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,115,24,10
CONTROL " [",IDD_AUTOCBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,133,24,10
CONTROL " {",IDD_AUTOCCURLYBRACKET_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,146,152,24,10
CONTROL " """,IDD_AUTOC_DOUBLEQUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,116,24,10
CONTROL " '",IDD_AUTOC_QUOTESCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,133,24,10
CONTROL " html/xml close tag",IDD_AUTOCTAG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,190,152,76,10
RTEXT "Open",IDC_MACHEDPAIROPEN_STATIC,352,103,25,8
LTEXT "Close",IDC_MACHEDPAIRCLOSE_STATIC,390,103,25,8
RTEXT "Matched pair 1:",IDC_MACHEDPAIR_STATIC1,293,117,70,8
EDITTEXT IDC_MACHEDPAIROPEN_EDIT1,365,115,14,14
EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT1,393,115,14,14
RTEXT "Matched pair 2:",IDC_MACHEDPAIR_STATIC2,293,137,70,8
EDITTEXT IDC_MACHEDPAIROPEN_EDIT2,365,135,14,14
EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT2,393,135,14,14
RTEXT "Matched pair 3:",IDC_MACHEDPAIR_STATIC3,293,157,70,8
EDITTEXT IDC_MACHEDPAIROPEN_EDIT3,365,155,14,14
EDITTEXT IDC_MACHEDPAIRCLOSE_EDIT3,393,155,14,14
END
IDD_PREFERENCE_MULTIINSTANCE_BOX DIALOGEX 0, 0, 455, 185

View File

@ -944,7 +944,7 @@ 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_MAINTAININDENT, BM_SETCHECK, nppGUI._maitainIndent, 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);
@ -1052,21 +1052,21 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
return TRUE;
}
case IDC_CHECK_MAINTAININDENT :
case IDC_CHECK_STOPFILLINGFINDFIELD:
{
nppGUI._maitainIndent = !nppGUI._maitainIndent;
nppGUI._stopFillingFindField = isCheckedOrNot(IDC_CHECK_STOPFILLINGFINDFIELD);
return TRUE;
}
case IDC_CHECK_STYLEMRU :
{
nppGUI._styleMRU = !nppGUI._styleMRU;
nppGUI._styleMRU = isCheckedOrNot(IDC_CHECK_STYLEMRU);
return TRUE;
}
case IDC_CHECK_SHORTTITLE:
{
nppGUI._shortTitlebar = !nppGUI._shortTitlebar;
nppGUI._shortTitlebar = isCheckedOrNot(IDC_CHECK_SHORTTITLE);
HWND grandParent = ::GetParent(_hParent);
::SendMessage(grandParent, NPPM_INTERNAL_UPDATETITLEBAR, 0, 0);
return TRUE;
@ -2700,6 +2700,8 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_CHAR), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDD_AUTOC_STATIC_NOTE), FALSE);
}
::SendDlgItemMessage(_hSelf, IDC_CHECK_MAINTAININDENT, BM_SETCHECK, nppGUI._maitainIndent, 0);
::SendDlgItemMessage(_hSelf, IDD_FUNC_CHECK, BM_SETCHECK, nppGUI._funcParams ? BST_CHECKED : BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDD_AUTOCPARENTHESES_CHECK, BM_SETCHECK, nppGUI._matchedPairConf._doParentheses?BST_CHECKED:BST_UNCHECKED, 0);
@ -2802,6 +2804,11 @@ INT_PTR CALLBACK AutoCompletionDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
switch (wParam)
{
case IDC_CHECK_MAINTAININDENT:
{
nppGUI._maitainIndent = isCheckedOrNot(IDC_CHECK_MAINTAININDENT);
return TRUE;
}
case IDD_AUTOC_ENABLECHECK :
{

View File

@ -205,7 +205,7 @@
#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 IDD_PREFERENCE_NEWDOCSETTING_BOX 6400 //(IDD_PREFERENCE_BOX + 400)
#define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 1)