Make (Find) dlgAlwaysVisible a true Preference setting

Close #7908, close #8651
This commit is contained in:
Scott Sumner 2020-07-31 16:43:03 -04:00 committed by Don HO
parent 1581833f98
commit 33f042932f
7 changed files with 49 additions and 17 deletions

View File

@ -847,6 +847,7 @@ You can define several column markers by using white space to separate the diffe
<Searching title="Searching"> <Searching title="Searching">
<Item id="6901" name="Don't fill find field in Find dialog with selected word"/> <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="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"/>
</Searching> </Searching>
<RecentFilesHistory title="Recent Files History"> <RecentFilesHistory title="Recent Files History">

View File

@ -1804,9 +1804,16 @@ bool Notepad_plus::findInFiles()
_findReplaceDlg.putFindResult(nbTotal); _findReplaceDlg.putFindResult(nbTotal);
FindHistory & findHistory = (NppParameters::getInstance()).getFindHistory(); if (nbTotal != 0)
if (nbTotal && !findHistory._isDlgAlwaysVisible) {
_findReplaceDlg.display(false); const NppParameters& nppParam = NppParameters::getInstance();
const NppGUI& nppGui = nppParam.getNppGUI();
if (!nppGui._findDlgAlwaysVisible)
{
_findReplaceDlg.display(false);
}
}
return true; return true;
} }
@ -1866,9 +1873,16 @@ bool Notepad_plus::findInOpenedFiles()
_findReplaceDlg.putFindResult(nbTotal); _findReplaceDlg.putFindResult(nbTotal);
FindHistory & findHistory = (NppParameters::getInstance()).getFindHistory(); if (nbTotal != 0)
if (nbTotal && !findHistory._isDlgAlwaysVisible) {
_findReplaceDlg.display(false); const NppParameters& nppParam = NppParameters::getInstance();
const NppGUI& nppGui = nppParam.getNppGUI();
if (!nppGui._findDlgAlwaysVisible)
{
_findReplaceDlg.display(false);
}
}
return true; return true;
} }
@ -1916,9 +1930,16 @@ bool Notepad_plus::findInCurrentFile(bool isEntireDoc)
_findReplaceDlg.putFindResult(nbTotal); _findReplaceDlg.putFindResult(nbTotal);
FindHistory & findHistory = (NppParameters::getInstance()).getFindHistory(); if (nbTotal != 0)
if (nbTotal && !findHistory._isDlgAlwaysVisible) {
_findReplaceDlg.display(false); const NppParameters& nppParam = NppParameters::getInstance();
const NppGUI& nppGui = nppParam.getNppGUI();
if (!nppGui._findDlgAlwaysVisible)
{
_findReplaceDlg.display(false);
}
}
return true; return true;
} }

View File

@ -2343,10 +2343,6 @@ void NppParameters::feedFindHistoryParameters(TiXmlNode *node)
if (boolStr) if (boolStr)
_findHistory._isFifInHiddenFolder = (lstrcmp(TEXT("yes"), boolStr) == 0); _findHistory._isFifInHiddenFolder = (lstrcmp(TEXT("yes"), boolStr) == 0);
boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("dlgAlwaysVisible"));
if (boolStr)
_findHistory._isDlgAlwaysVisible = (lstrcmp(TEXT("yes"), boolStr) == 0);
boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("fifFilterFollowsDoc")); boolStr = (findHistoryRoot->ToElement())->Attribute(TEXT("fifFilterFollowsDoc"));
if (boolStr) if (boolStr)
_findHistory._isFilterFollowDoc = (lstrcmp(TEXT("yes"), boolStr) == 0); _findHistory._isFilterFollowDoc = (lstrcmp(TEXT("yes"), boolStr) == 0);
@ -5137,6 +5133,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
const TCHAR* optStopFillingFindField = element->Attribute(TEXT("stopFillingFindField")); const TCHAR* optStopFillingFindField = element->Attribute(TEXT("stopFillingFindField"));
if (optStopFillingFindField) if (optStopFillingFindField)
_nppGUI._stopFillingFindField = (lstrcmp(optStopFillingFindField, TEXT("yes")) == 0); _nppGUI._stopFillingFindField = (lstrcmp(optStopFillingFindField, TEXT("yes")) == 0);
const TCHAR* optFindDlgAlwaysVisible = element->Attribute(TEXT("findDlgAlwaysVisible"));
if (optFindDlgAlwaysVisible)
_nppGUI._findDlgAlwaysVisible = (lstrcmp(optFindDlgAlwaysVisible, TEXT("yes")) == 0);
} }
else if (!lstrcmp(nm, TEXT("MISC"))) else if (!lstrcmp(nm, TEXT("MISC")))
{ {
@ -5943,13 +5943,14 @@ void NppParameters::createXmlTreeFromGUIParams()
GUIConfigElement->SetAttribute(TEXT("docPeekOnMap"), _nppGUI._isDocPeekOnMap ? TEXT("yes") : TEXT("no")); GUIConfigElement->SetAttribute(TEXT("docPeekOnMap"), _nppGUI._isDocPeekOnMap ? TEXT("yes") : TEXT("no"));
} }
// <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" /> // <GUIConfig name="Searching" "monospacedFontFindDlg"="no" stopFillingFindField="no" findDlgAlwaysVisible="no" />
{ {
TiXmlElement* GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); TiXmlElement* GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Searching")); GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Searching"));
GUIConfigElement->SetAttribute(TEXT("monospacedFontFindDlg"), _nppGUI._monospacedFontFindDlg ? 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("stopFillingFindField"), _nppGUI._stopFillingFindField ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("findDlgAlwaysVisible"), _nppGUI._findDlgAlwaysVisible ? TEXT("yes") : TEXT("no"));
} }
// <GUIConfig name="searchEngine" searchEngineChoice="2" searchEngineCustom="" /> // <GUIConfig name="searchEngine" searchEngineChoice="2" searchEngineCustom="" />
@ -6015,7 +6016,6 @@ bool NppParameters::writeFindHistory()
(findHistoryRoot->ToElement())->SetAttribute(TEXT("fifRecuisive"), _findHistory._isFifRecuisive?TEXT("yes"):TEXT("no")); (findHistoryRoot->ToElement())->SetAttribute(TEXT("fifRecuisive"), _findHistory._isFifRecuisive?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("fifInHiddenFolder"), _findHistory._isFifInHiddenFolder?TEXT("yes"):TEXT("no")); (findHistoryRoot->ToElement())->SetAttribute(TEXT("fifInHiddenFolder"), _findHistory._isFifInHiddenFolder?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("dlgAlwaysVisible"), _findHistory._isDlgAlwaysVisible?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("fifFilterFollowsDoc"), _findHistory._isFilterFollowDoc?TEXT("yes"):TEXT("no")); (findHistoryRoot->ToElement())->SetAttribute(TEXT("fifFilterFollowsDoc"), _findHistory._isFilterFollowDoc?TEXT("yes"):TEXT("no"));
(findHistoryRoot->ToElement())->SetAttribute(TEXT("fifFolderFollowsDoc"), _findHistory._isFolderFollowDoc?TEXT("yes"):TEXT("no")); (findHistoryRoot->ToElement())->SetAttribute(TEXT("fifFolderFollowsDoc"), _findHistory._isFolderFollowDoc?TEXT("yes"):TEXT("no"));

View File

@ -836,6 +836,7 @@ struct NppGUI final
bool _backSlashIsEscapeCharacterForSql = true; bool _backSlashIsEscapeCharacterForSql = true;
bool _stopFillingFindField = false; bool _stopFillingFindField = false;
bool _monospacedFontFindDlg = false; bool _monospacedFontFindDlg = false;
bool _findDlgAlwaysVisible = false;
writeTechnologyEngine _writeTechnologyEngine = defaultTechnology; writeTechnologyEngine _writeTechnologyEngine = defaultTechnology;
bool _isWordCharDefault = true; bool _isWordCharDefault = true;
std::string _customWordChars; std::string _customWordChars;
@ -1171,7 +1172,6 @@ struct FindHistory final
transparencyMode _transparencyMode = onLossingFocus; transparencyMode _transparencyMode = onLossingFocus;
int _transparency = 150; int _transparency = 150;
bool _isDlgAlwaysVisible = false;
bool _isFilterFollowDoc = false; bool _isFilterFollowDoc = false;
bool _isFolderFollowDoc = false; bool _isFolderFollowDoc = false;

View File

@ -145,8 +145,9 @@ IDD_PREFERENCE_SEARCHINGSETTINGS_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN 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 "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 "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
END END
IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 455, 185 IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 455, 185

View File

@ -3516,6 +3516,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_STOPFILLINGFINDFIELD, BM_SETCHECK, nppGUI._stopFillingFindField, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_MONOSPACEDFONT_FINDDLG, BM_SETCHECK, nppGUI._monospacedFontFindDlg, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_MONOSPACEDFONT_FINDDLG, BM_SETCHECK, nppGUI._monospacedFontFindDlg, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_FINDDLG_ALWAYS_VISIBLE, BM_SETCHECK, nppGUI._findDlgAlwaysVisible, 0);
} }
break; break;
@ -3537,6 +3538,13 @@ INT_PTR CALLBACK SearchingSettingsDlg::run_dlgProc(UINT message, WPARAM wParam,
} }
break; break;
case IDC_CHECK_FINDDLG_ALWAYS_VISIBLE:
{
nppGUI._findDlgAlwaysVisible = isCheckedOrNot(IDC_CHECK_FINDDLG_ALWAYS_VISIBLE);
return TRUE;
}
break;
default: default:
return FALSE; return FALSE;
} }

View File

@ -358,5 +358,6 @@
#define IDD_PREFERENCE_SEARCHINGSETTINGS_BOX 6900 //(IDD_PREFERENCE_BOX + 900) #define IDD_PREFERENCE_SEARCHINGSETTINGS_BOX 6900 //(IDD_PREFERENCE_BOX + 900)
#define IDC_CHECK_STOPFILLINGFINDFIELD (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 1) #define IDC_CHECK_STOPFILLINGFINDFIELD (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 1)
#define IDC_CHECK_MONOSPACEDFONT_FINDDLG (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 2) #define IDC_CHECK_MONOSPACEDFONT_FINDDLG (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 2)
#define IDC_CHECK_FINDDLG_ALWAYS_VISIBLE (IDD_PREFERENCE_SEARCHINGSETTINGS_BOX + 3)
#endif //PREFERENCE_RC_H #endif //PREFERENCE_RC_H