mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 22:04:55 +02:00
Add search scope to Find window status bar output
Close #8632, close #8639
This commit is contained in:
parent
a82819972a
commit
5ba7f99590
@ -1238,6 +1238,10 @@ Find in all files except exe, obj && log:
|
||||
<find-status-replace-not-found value="Replace: no occurrence was found"/>
|
||||
<find-status-replace-readonly value="Replace: Cannot replace text. The current document is read only"/>
|
||||
<find-status-cannot-find value="Find: Can't find the text "$STR_REPLACE$""/>
|
||||
<find-status-scope-selection value="in selected text"/>
|
||||
<find-status-scope-all value="in entire file"/>
|
||||
<find-status-scope-backward value="from start-of-file to caret"/>
|
||||
<find-status-scope-forward value="from caret to end-of-file"/>
|
||||
<finder-find-in-finder value="Find in this found results..."/>
|
||||
<finder-close-this value="Close this finder"/>
|
||||
<finder-collapse-all value="Collapse all"/>
|
||||
|
@ -1307,13 +1307,15 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
{
|
||||
if (nbReplaced == 1)
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-1-replaced", TEXT("Replace All: 1 occurrence was replaced."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-1-replaced", TEXT("Replace All: 1 occurrence was replaced"));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-nb-replaced", TEXT("Replace All: $INT_REPLACE$ occurrences were replaced."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-nb-replaced", TEXT("Replace All: $INT_REPLACE$ occurrences were replaced"));
|
||||
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbReplaced));
|
||||
}
|
||||
}
|
||||
result += TEXT(" ");
|
||||
result += getScopeInfoForStatusBar(&_options);
|
||||
}
|
||||
setStatusbarMessage(result, FSMessage);
|
||||
getFocus();
|
||||
@ -1342,13 +1344,15 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
{
|
||||
if (nbCounted == 1)
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-1-match", TEXT("Count: 1 match."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-1-match", TEXT("Count: 1 match"));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-nb-matches", TEXT("Count: $INT_REPLACE$ matches."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-nb-matches", TEXT("Count: $INT_REPLACE$ matches"));
|
||||
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbCounted));
|
||||
}
|
||||
result += TEXT(" ");
|
||||
result += getScopeInfoForStatusBar(&_options);
|
||||
}
|
||||
|
||||
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND);
|
||||
@ -1382,13 +1386,15 @@ INT_PTR CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
||||
{
|
||||
if (nbMarked == 1)
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-1-match", TEXT("Mark: 1 match."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-1-match", TEXT("Mark: 1 match"));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-nb-matches", TEXT("Mark: $INT_REPLACE$ matches."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-nb-matches", TEXT("Mark: $INT_REPLACE$ matches"));
|
||||
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbMarked));
|
||||
}
|
||||
result += TEXT(" ");
|
||||
result += getScopeInfoForStatusBar(&_options);
|
||||
}
|
||||
setStatusbarMessage(result, FSMessage);
|
||||
getFocus();
|
||||
@ -2703,6 +2709,32 @@ void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus
|
||||
}
|
||||
}
|
||||
|
||||
generic_string FindReplaceDlg::getScopeInfoForStatusBar(FindOption const *pFindOpt) const
|
||||
{
|
||||
generic_string scope;
|
||||
|
||||
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||
|
||||
if (pFindOpt->_isInSelection)
|
||||
{
|
||||
scope += pNativeSpeaker->getLocalizedStrFromID("find-status-scope-selection", TEXT("in selected text"));
|
||||
}
|
||||
else if (pFindOpt->_isWrapAround)
|
||||
{
|
||||
scope += pNativeSpeaker->getLocalizedStrFromID("find-status-scope-all", TEXT("in entire file"));
|
||||
}
|
||||
else if (pFindOpt->_whichDirection == DIR_UP)
|
||||
{
|
||||
scope += pNativeSpeaker->getLocalizedStrFromID("find-status-scope-backward", TEXT("from start-of-file to caret"));
|
||||
}
|
||||
else
|
||||
{
|
||||
scope += pNativeSpeaker->getLocalizedStrFromID("find-status-scope-forward", TEXT("from caret to end-of-file"));
|
||||
}
|
||||
|
||||
return scope;
|
||||
}
|
||||
|
||||
void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_string& stringValue)
|
||||
{
|
||||
try
|
||||
@ -2852,13 +2884,15 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
|
||||
{
|
||||
if (nbReplaced == 1)
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-1-replaced", TEXT("Replace All: 1 occurrence was replaced."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-1-replaced", TEXT("Replace All: 1 occurrence was replaced"));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-nb-replaced", TEXT("Replace All: $INT_REPLACE$ occurrences were replaced."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-replaceall-nb-replaced", TEXT("Replace All: $INT_REPLACE$ occurrences were replaced"));
|
||||
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbReplaced));
|
||||
}
|
||||
result += TEXT(" ");
|
||||
result += getScopeInfoForStatusBar(_env);
|
||||
}
|
||||
|
||||
setStatusbarMessage(result, FSMessage);
|
||||
@ -2878,13 +2912,15 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
|
||||
{
|
||||
if (nbCounted == 1)
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-1-match", TEXT("Count: 1 match."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-1-match", TEXT("Count: 1 match"));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-nb-matches", TEXT("Count: $INT_REPLACE$ matches."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-count-nb-matches", TEXT("Count: $INT_REPLACE$ matches"));
|
||||
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbCounted));
|
||||
}
|
||||
result += TEXT(" ");
|
||||
result += getScopeInfoForStatusBar(_env);
|
||||
}
|
||||
setStatusbarMessage(result, FSMessage);
|
||||
break;
|
||||
@ -2906,13 +2942,15 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
|
||||
{
|
||||
if (nbMarked == 1)
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-1-match", TEXT("Mark: 1 match."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-1-match", TEXT("Mark: 1 match"));
|
||||
}
|
||||
else
|
||||
{
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-nb-matches", TEXT("Mark: $INT_REPLACE$ matches."));
|
||||
result = pNativeSpeaker->getLocalizedStrFromID("find-status-mark-nb-matches", TEXT("Mark: $INT_REPLACE$ matches"));
|
||||
result = stringReplace(result, TEXT("$INT_REPLACE$"), std::to_wstring(nbMarked));
|
||||
}
|
||||
result += TEXT(" ");
|
||||
result += getScopeInfoForStatusBar(_env);
|
||||
}
|
||||
|
||||
setStatusbarMessage(result, FSMessage);
|
||||
|
@ -334,6 +334,7 @@ public :
|
||||
void execSavedCommand(int cmd, uptr_t intValue, const generic_string& stringValue);
|
||||
void clearMarks(const FindOption& opt);
|
||||
void setStatusbarMessage(const generic_string & msg, FindStatus staus);
|
||||
generic_string getScopeInfoForStatusBar(FindOption const *pFindOpt) const;
|
||||
Finder * createFinder();
|
||||
bool removeFinder(Finder *finder2remove);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user