[BUG_FIXED] Fix the search result inaccurate colorization bug.
[BUG_FIXED] Fix the Mark all in selection bug (while Find Replace Dialog loosing the focus). [NEW_FEATURE] Mark all extension : user can mark any occurrence with 5 different colours. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@449 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
741cd58e61
commit
6ed92acab2
@ -323,6 +323,33 @@ const char * WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, UI
|
|||||||
return _multiByteStr;
|
return _multiByteStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * WcharMbcsConvertor::wchar2char(const wchar_t * wcharStr2Convert, UINT codepage, long *mstart, long *mend)
|
||||||
|
{
|
||||||
|
if (!_multiByteStr)
|
||||||
|
{
|
||||||
|
_multiByteStr = new char[initSize];
|
||||||
|
_multiByteAllocLen = initSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
int len = WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, 0, NULL, NULL);
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
if (len > int(_multiByteAllocLen))
|
||||||
|
{
|
||||||
|
delete [] _multiByteStr;
|
||||||
|
_multiByteAllocLen = len;
|
||||||
|
_multiByteStr = new char[_multiByteAllocLen];
|
||||||
|
}
|
||||||
|
WideCharToMultiByte(codepage, 0, wcharStr2Convert, -1, _multiByteStr, len, NULL, NULL);
|
||||||
|
*mstart = WideCharToMultiByte(codepage, 0, wcharStr2Convert, *mstart, _multiByteStr, 0, NULL, NULL);
|
||||||
|
*mend = WideCharToMultiByte(codepage, 0, wcharStr2Convert, *mend, _multiByteStr, 0, NULL, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_multiByteStr[0] = 0;
|
||||||
|
|
||||||
|
return _multiByteStr;
|
||||||
|
}
|
||||||
|
|
||||||
std::wstring string2wstring(const std::string & rString, UINT codepage)
|
std::wstring string2wstring(const std::string & rString, UINT codepage)
|
||||||
{
|
{
|
||||||
int len = MultiByteToWideChar(codepage, 0, rString.c_str(), -1, NULL, 0);
|
int len = MultiByteToWideChar(codepage, 0, rString.c_str(), -1, NULL, 0);
|
||||||
|
@ -109,6 +109,7 @@ public:
|
|||||||
const wchar_t * char2wchar(const char* mbStr, UINT codepage);
|
const wchar_t * char2wchar(const char* mbStr, UINT codepage);
|
||||||
const wchar_t * char2wchar(const char * mbcs2Convert, UINT codepage, int *mstart, int *mend);
|
const wchar_t * char2wchar(const char * mbcs2Convert, UINT codepage, int *mstart, int *mend);
|
||||||
const char * wchar2char(const wchar_t* wcStr, UINT codepage);
|
const char * wchar2char(const wchar_t* wcStr, UINT codepage);
|
||||||
|
const char * wchar2char(const wchar_t * wcStr, UINT codepage, long *mstart, long *mend);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WcharMbcsConvertor() : _multiByteStr(NULL), _wideCharStr(NULL), _multiByteAllocLen(0), _wideCharAllocLen(0), initSize(1024) {
|
WcharMbcsConvertor() : _multiByteStr(NULL), _wideCharStr(NULL), _multiByteAllocLen(0), _wideCharAllocLen(0), initSize(1024) {
|
||||||
|
@ -3306,19 +3306,7 @@ void Notepad_plus::command(int id)
|
|||||||
_findReplaceDlg.processFindNext(text2Find, &op);
|
_findReplaceDlg.processFindNext(text2Find, &op);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDM_SEARCH_MARKALL :
|
|
||||||
{
|
|
||||||
const int strSize = FINDREPLACE_MAXLENGTH;
|
|
||||||
TCHAR text2Find[strSize];
|
|
||||||
_pEditView->getGenericSelectedText(text2Find, strSize);
|
|
||||||
|
|
||||||
FindOption op;
|
|
||||||
op._isWholeWord = false;
|
|
||||||
//op._whichDirection = (id == IDM_SEARCH_VOLATILE_FINDNEXT?DIR_DOWN:DIR_UP);
|
|
||||||
_findReplaceDlg.markAll(text2Find);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case IDM_SEARCH_UNMARKALL :
|
case IDM_SEARCH_UNMARKALL :
|
||||||
{
|
{
|
||||||
@ -3326,6 +3314,64 @@ void Notepad_plus::command(int id)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IDM_SEARCH_MARKALLEXT1 :
|
||||||
|
case IDM_SEARCH_MARKALLEXT2 :
|
||||||
|
case IDM_SEARCH_MARKALLEXT3 :
|
||||||
|
case IDM_SEARCH_MARKALLEXT4 :
|
||||||
|
case IDM_SEARCH_MARKALLEXT5 :
|
||||||
|
{
|
||||||
|
int styleID;
|
||||||
|
if (id == IDM_SEARCH_MARKALLEXT1)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1;
|
||||||
|
else if (id == IDM_SEARCH_MARKALLEXT2)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2;
|
||||||
|
else if (id == IDM_SEARCH_MARKALLEXT3)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3;
|
||||||
|
else if (id == IDM_SEARCH_MARKALLEXT4)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4;
|
||||||
|
else // (id == IDM_SEARCH_MARKALLEXT5)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5;
|
||||||
|
|
||||||
|
const int strSize = FINDREPLACE_MAXLENGTH;
|
||||||
|
TCHAR text2Find[strSize];
|
||||||
|
_pEditView->getGenericSelectedText(text2Find, strSize);
|
||||||
|
|
||||||
|
_findReplaceDlg.markAll(text2Find, styleID);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case IDM_SEARCH_UNMARKALLEXT1 :
|
||||||
|
case IDM_SEARCH_UNMARKALLEXT2 :
|
||||||
|
case IDM_SEARCH_UNMARKALLEXT3 :
|
||||||
|
case IDM_SEARCH_UNMARKALLEXT4 :
|
||||||
|
case IDM_SEARCH_UNMARKALLEXT5 :
|
||||||
|
{
|
||||||
|
int styleID;
|
||||||
|
if (id == IDM_SEARCH_UNMARKALLEXT1)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1;
|
||||||
|
else if (id == IDM_SEARCH_UNMARKALLEXT2)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2;
|
||||||
|
else if (id == IDM_SEARCH_UNMARKALLEXT3)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3;
|
||||||
|
else if (id == IDM_SEARCH_UNMARKALLEXT4)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4;
|
||||||
|
else // (id == IDM_SEARCH_UNMARKALLEXT5)
|
||||||
|
styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5;
|
||||||
|
|
||||||
|
_pEditView->clearIndicator(styleID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDM_SEARCH_CLEARALLMARKS :
|
||||||
|
{
|
||||||
|
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT1);
|
||||||
|
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT2);
|
||||||
|
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT3);
|
||||||
|
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT4);
|
||||||
|
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_EXT5);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IDM_SEARCH_GOTOLINE :
|
case IDM_SEARCH_GOTOLINE :
|
||||||
{
|
{
|
||||||
bool isFirstTime = !_goToLineDlg.isCreated();
|
bool isFirstTime = !_goToLineDlg.isCreated();
|
||||||
|
@ -249,13 +249,31 @@ BEGIN
|
|||||||
MENUITEM "Find &Previous", IDM_SEARCH_FINDPREV
|
MENUITEM "Find &Previous", IDM_SEARCH_FINDPREV
|
||||||
MENUITEM "Find (volatile) Next", IDM_SEARCH_VOLATILE_FINDNEXT
|
MENUITEM "Find (volatile) Next", IDM_SEARCH_VOLATILE_FINDNEXT
|
||||||
MENUITEM "Find (volatile) Previous", IDM_SEARCH_VOLATILE_FINDPREV
|
MENUITEM "Find (volatile) Previous", IDM_SEARCH_VOLATILE_FINDPREV
|
||||||
MENUITEM "Mark all", IDM_SEARCH_MARKALL
|
|
||||||
MENUITEM "Unmark all", IDM_SEARCH_UNMARKALL
|
|
||||||
MENUITEM "&Replace...", IDM_SEARCH_REPLACE
|
MENUITEM "&Replace...", IDM_SEARCH_REPLACE
|
||||||
MENUITEM "&Incremental Search...", IDM_SEARCH_FINDINCREMENT
|
MENUITEM "&Incremental Search...", IDM_SEARCH_FINDINCREMENT
|
||||||
MENUITEM "&Go to...", IDM_SEARCH_GOTOLINE
|
MENUITEM "&Go to...", IDM_SEARCH_GOTOLINE
|
||||||
MENUITEM SEPARATOR
|
|
||||||
MENUITEM "Go to matching brace", IDM_SEARCH_GOTOMATCHINGBRACE
|
MENUITEM "Go to matching brace", IDM_SEARCH_GOTOMATCHINGBRACE
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
|
||||||
|
POPUP "Mark all with..."
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Mark all with the 1st style", IDM_SEARCH_MARKALLEXT1
|
||||||
|
MENUITEM "Mark all with the 2nd style", IDM_SEARCH_MARKALLEXT2
|
||||||
|
MENUITEM "Mark all with the 3rd style", IDM_SEARCH_MARKALLEXT3
|
||||||
|
MENUITEM "Mark all with the 4th style", IDM_SEARCH_MARKALLEXT4
|
||||||
|
MENUITEM "Mark all with the 5th style", IDM_SEARCH_MARKALLEXT5
|
||||||
|
END
|
||||||
|
POPUP "Unark all with..."
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Unmark all the 1st style", IDM_SEARCH_UNMARKALLEXT1
|
||||||
|
MENUITEM "Unmark all the 2nd style", IDM_SEARCH_UNMARKALLEXT2
|
||||||
|
MENUITEM "Unmark all the 3rd style", IDM_SEARCH_UNMARKALLEXT3
|
||||||
|
MENUITEM "Unmark all the 4th style", IDM_SEARCH_UNMARKALLEXT4
|
||||||
|
MENUITEM "Unmark all the 5th style", IDM_SEARCH_UNMARKALLEXT5
|
||||||
|
MENUITEM "Clear all marks", IDM_SEARCH_CLEARALLMARKS
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "Toggle Bookmark" , IDM_SEARCH_TOGGLE_BOOKMARK
|
MENUITEM "Toggle Bookmark" , IDM_SEARCH_TOGGLE_BOOKMARK
|
||||||
MENUITEM "Next Bookmark", IDM_SEARCH_NEXT_BOOKMARK
|
MENUITEM "Next Bookmark", IDM_SEARCH_NEXT_BOOKMARK
|
||||||
|
@ -652,12 +652,14 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||||||
}
|
}
|
||||||
|
|
||||||
case WM_ACTIVATE :
|
case WM_ACTIVATE :
|
||||||
|
{
|
||||||
|
if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE)
|
||||||
{
|
{
|
||||||
CharacterRange cr = (*_ppEditView)->getSelection();
|
CharacterRange cr = (*_ppEditView)->getSelection();
|
||||||
int nbSelected = cr.cpMax - cr.cpMin;
|
int nbSelected = cr.cpMax - cr.cpMin;
|
||||||
|
|
||||||
int checkVal;
|
int checkVal;
|
||||||
if (nbSelected <= 64)
|
if (nbSelected <= 1024)
|
||||||
{
|
{
|
||||||
checkVal = BST_UNCHECKED;
|
checkVal = BST_UNCHECKED;
|
||||||
_isInSelection = false;
|
_isInSelection = false;
|
||||||
@ -675,14 +677,13 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||||||
_isInSelection = false;
|
_isInSelection = false;
|
||||||
nbSelected = 0;
|
nbSelected = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, checkVal, 0);
|
|
||||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), nbSelected);
|
::EnableWindow(::GetDlgItem(_hSelf, IDC_IN_SELECTION_CHECK), nbSelected);
|
||||||
|
::SendDlgItemMessage(_hSelf, IDC_IN_SELECTION_CHECK, BM_SETCHECK, checkVal, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (isCheckedOrNot(IDC_TRANSPARENT_LOSSFOCUS_RADIO))
|
if (isCheckedOrNot(IDC_TRANSPARENT_LOSSFOCUS_RADIO))
|
||||||
{
|
{
|
||||||
if (wParam == WA_INACTIVE)
|
if (LOWORD(wParam) == WA_INACTIVE)
|
||||||
{
|
{
|
||||||
int percent = ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0);
|
int percent = ::SendDlgItemMessage(_hSelf, IDC_PERCENTAGE_SLIDER, TBM_GETPOS, 0, 0);
|
||||||
(NppParameters::getInstance())->SetTransparent(_hSelf, percent);
|
(NppParameters::getInstance())->SetTransparent(_hSelf, percent);
|
||||||
@ -1218,10 +1219,15 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
|
|||||||
return processFindNext(txt2find); //after replacing, find the next section for selection
|
return processFindNext(txt2find); //after replacing, find the next section for selection
|
||||||
}
|
}
|
||||||
|
|
||||||
int FindReplaceDlg::markAll(const TCHAR *txt2find)
|
|
||||||
|
int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID)
|
||||||
{
|
{
|
||||||
_doStyleFoundToken = true;
|
_doStyleFoundToken = true;
|
||||||
int nbFound = processAll(ProcessMarkAll, txt2find, NULL, true, NULL);
|
FindOption opt;
|
||||||
|
opt._isMatchCase = true;
|
||||||
|
opt._isWholeWord = false;
|
||||||
|
|
||||||
|
int nbFound = processAll(ProcessMarkAllExt, txt2find, NULL, true, NULL, &opt, styleID);
|
||||||
return nbFound;
|
return nbFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1234,13 +1240,15 @@ int FindReplaceDlg::markAll2(const TCHAR *txt2find)
|
|||||||
return nbFound;
|
return nbFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int FindReplaceDlg::markAllInc(const TCHAR *txt2find, FindOption *opt)
|
int FindReplaceDlg::markAllInc(const TCHAR *txt2find, FindOption *opt)
|
||||||
{
|
{
|
||||||
int nbFound = processAll(ProcessMarkAll_IncSearch, txt2find, NULL, true, NULL, opt);
|
int nbFound = processAll(ProcessMarkAll_IncSearch, txt2find, NULL, true, NULL, opt);
|
||||||
return nbFound;
|
return nbFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire, const TCHAR *fileName, FindOption *opt)
|
int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire, const TCHAR *fileName, FindOption *opt, int colourStyleID)
|
||||||
{
|
{
|
||||||
FindOption *pOptions = opt?opt:&_options;
|
FindOption *pOptions = opt?opt:&_options;
|
||||||
|
|
||||||
@ -1282,10 +1290,16 @@ int FindReplaceDlg::processAll(ProcessOperation op, const TCHAR *txt2find, const
|
|||||||
endPosition = cr.cpMax;
|
endPosition = cr.cpMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
return processRange(op, txt2find, txt2replace, startPosition, endPosition, fileName, opt);
|
if (ProcessMarkAllExt && colourStyleID != -1)
|
||||||
|
{
|
||||||
|
startPosition = 0;
|
||||||
|
endPosition = docLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
return processRange(op, txt2find, txt2replace, startPosition, endPosition, fileName, opt, colourStyleID);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName, FindOption *opt)
|
int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName, FindOption *opt, int colourStyleID)
|
||||||
{
|
{
|
||||||
int nbProcessed = 0;
|
int nbProcessed = 0;
|
||||||
|
|
||||||
@ -1360,7 +1374,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (op == ProcessMarkAll) //if marking, check if purging is needed
|
if (op == ProcessMarkAll && colourStyleID == -1) //if marking, check if purging is needed
|
||||||
{
|
{
|
||||||
if (_doPurge) {
|
if (_doPurge) {
|
||||||
if (_doMarkLine)
|
if (_doMarkLine)
|
||||||
@ -1474,6 +1488,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ProcessMarkAllExt:
|
||||||
|
{
|
||||||
|
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, colourStyleID);
|
||||||
|
(*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ProcessMarkAll_2:
|
case ProcessMarkAll_2:
|
||||||
{
|
{
|
||||||
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_2);
|
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_2);
|
||||||
|
@ -54,7 +54,7 @@ struct TargetRange {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum SearchType { FindNormal, FindExtended, FindRegex };
|
enum SearchType { FindNormal, FindExtended, FindRegex };
|
||||||
enum ProcessOperation { ProcessFindAll, ProcessReplaceAll, ProcessCountAll, ProcessMarkAll, ProcessMarkAll_2, ProcessMarkAll_IncSearch };
|
enum ProcessOperation { ProcessFindAll, ProcessReplaceAll, ProcessCountAll, ProcessMarkAll, ProcessMarkAll_2, ProcessMarkAll_IncSearch, ProcessMarkAllExt };
|
||||||
|
|
||||||
struct FindOption {
|
struct FindOption {
|
||||||
bool _isWholeWord;
|
bool _isWholeWord;
|
||||||
@ -149,13 +149,14 @@ public:
|
|||||||
|
|
||||||
void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb) {
|
void add(FoundInfo fi, SearchResultMarking mi, const TCHAR* foundline, int lineNb) {
|
||||||
_pMainFoundInfos->push_back(fi);
|
_pMainFoundInfos->push_back(fi);
|
||||||
_pMainMarkings->push_back(mi);
|
|
||||||
std::generic_string str = TEXT("\tLine ");
|
std::generic_string str = TEXT("\tLine ");
|
||||||
|
|
||||||
TCHAR lnb[16];
|
TCHAR lnb[16];
|
||||||
wsprintf(lnb, TEXT("%d"), lineNb);
|
wsprintf(lnb, TEXT("%d"), lineNb);
|
||||||
str += lnb;
|
str += lnb;
|
||||||
str += TEXT(": ");
|
str += TEXT(": ");
|
||||||
|
mi._start += str.length();
|
||||||
|
mi._end += str.length();
|
||||||
str += foundline;
|
str += foundline;
|
||||||
|
|
||||||
if (str.length() >= SC_SEARCHRESULT_LINEBUFFERMAXLENGTH)
|
if (str.length() >= SC_SEARCHRESULT_LINEBUFFERMAXLENGTH)
|
||||||
@ -165,8 +166,9 @@ public:
|
|||||||
str += endOfLongLine;
|
str += endOfLongLine;
|
||||||
}
|
}
|
||||||
setFinderReadOnly(false);
|
setFinderReadOnly(false);
|
||||||
_scintView.addGenericText(str.c_str());
|
_scintView.addGenericText(str.c_str(), &mi._start, &mi._end);
|
||||||
setFinderReadOnly(true);
|
setFinderReadOnly(true);
|
||||||
|
_pMainMarkings->push_back(mi);
|
||||||
};
|
};
|
||||||
|
|
||||||
void setFinderStyle();
|
void setFinderStyle();
|
||||||
@ -311,12 +313,13 @@ public :
|
|||||||
bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL);
|
bool processFindNext(const TCHAR *txt2find, FindOption *options = NULL);
|
||||||
bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = NULL);
|
bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, FindOption *options = NULL);
|
||||||
|
|
||||||
int markAll(const TCHAR *str2find);
|
int markAll(const TCHAR *txt2find, int styleID);
|
||||||
int markAll2(const TCHAR *str2find);
|
int markAll2(const TCHAR *str2find);
|
||||||
int markAllInc(const TCHAR *str2find, FindOption *opt);
|
int markAllInc(const TCHAR *str2find, FindOption *opt);
|
||||||
|
|
||||||
int processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire = false, const TCHAR *fileName = NULL, FindOption *opt = NULL);
|
|
||||||
int processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName = NULL, FindOption *opt = NULL);
|
int processAll(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, bool isEntire = false, const TCHAR *fileName = NULL, FindOption *opt = NULL, int colourStyleID = -1);
|
||||||
|
int processRange(ProcessOperation op, const TCHAR *txt2find, const TCHAR *txt2replace, int startRange, int endRange, const TCHAR *fileName = NULL, FindOption *opt = NULL, int colourStyleID = -1);
|
||||||
void replaceAllInOpenedDocs();
|
void replaceAllInOpenedDocs();
|
||||||
void findAllIn(InWhat op);
|
void findAllIn(InWhat op);
|
||||||
|
|
||||||
|
@ -187,20 +187,33 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
|
|||||||
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_INC, INDIC_ROUNDBOX);
|
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_INC, INDIC_ROUNDBOX);
|
||||||
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_TAGMATCH, INDIC_ROUNDBOX);
|
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_TAGMATCH, INDIC_ROUNDBOX);
|
||||||
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_TAGATTR, INDIC_ROUNDBOX);
|
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_TAGATTR, INDIC_ROUNDBOX);
|
||||||
|
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT1, INDIC_ROUNDBOX);
|
||||||
|
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT2, INDIC_ROUNDBOX);
|
||||||
|
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT3, INDIC_ROUNDBOX);
|
||||||
|
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT4, INDIC_ROUNDBOX);
|
||||||
|
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_EXT5, INDIC_ROUNDBOX);
|
||||||
|
|
||||||
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_2, 100);
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_2, 100);
|
||||||
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE, 100);
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE, 100);
|
||||||
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_INC, 100);
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_INC, 100);
|
||||||
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_TAGMATCH, 100);
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_TAGMATCH, 100);
|
||||||
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_TAGATTR, 100);
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_TAGATTR, 100);
|
||||||
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT1, 100);
|
||||||
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT2, 100);
|
||||||
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT3, 100);
|
||||||
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT4, 100);
|
||||||
|
execute(SCI_INDICSETALPHA, SCE_UNIVERSAL_FOUND_STYLE_EXT5, 100);
|
||||||
|
|
||||||
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_2, true);
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_2, true);
|
||||||
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE, true);
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE, true);
|
||||||
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_INC, true);
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_INC, true);
|
||||||
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_TAGMATCH, true);
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_TAGMATCH, true);
|
||||||
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_TAGATTR, true);
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_TAGATTR, true);
|
||||||
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT1, true);
|
||||||
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT2, true);
|
||||||
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT3, true);
|
||||||
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT4, true);
|
||||||
|
execute(SCI_INDICSETUNDER, SCE_UNIVERSAL_FOUND_STYLE_EXT5, true);
|
||||||
_pParameter = NppParameters::getInstance();
|
_pParameter = NppParameters::getInstance();
|
||||||
|
|
||||||
_codepage = ::GetACP();
|
_codepage = ::GetACP();
|
||||||
@ -978,16 +991,58 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
|||||||
pStyle = &(stylers.getStyler(iFind));
|
pStyle = &(stylers.getStyler(iFind));
|
||||||
}
|
}
|
||||||
setSpecialIndicator(*pStyle);
|
setSpecialIndicator(*pStyle);
|
||||||
/*
|
|
||||||
iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_SELECT_STYLE);
|
|
||||||
|
defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT1;
|
||||||
|
defaultIndicatorStyle._bgColor = cyan;
|
||||||
|
pStyle = &defaultIndicatorStyle;
|
||||||
|
iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT1);
|
||||||
if (iFind != -1)
|
if (iFind != -1)
|
||||||
{
|
{
|
||||||
Style & styleFind = stylers.getStyler(iFind);
|
pStyle = &(stylers.getStyler(iFind));
|
||||||
setSpecialStyle(styleFind);
|
|
||||||
}
|
}
|
||||||
*/
|
setSpecialIndicator(*pStyle);
|
||||||
int caretWidth = 1;
|
|
||||||
|
|
||||||
|
defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT2;
|
||||||
|
defaultIndicatorStyle._bgColor = orange;
|
||||||
|
pStyle = &defaultIndicatorStyle;
|
||||||
|
iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT2);
|
||||||
|
if (iFind != -1)
|
||||||
|
{
|
||||||
|
pStyle = &(stylers.getStyler(iFind));
|
||||||
|
}
|
||||||
|
setSpecialIndicator(*pStyle);
|
||||||
|
|
||||||
|
defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT3;
|
||||||
|
defaultIndicatorStyle._bgColor = yellow;
|
||||||
|
pStyle = &defaultIndicatorStyle;
|
||||||
|
iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT3);
|
||||||
|
if (iFind != -1)
|
||||||
|
{
|
||||||
|
pStyle = &(stylers.getStyler(iFind));
|
||||||
|
}
|
||||||
|
setSpecialIndicator(*pStyle);
|
||||||
|
|
||||||
|
defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT4;
|
||||||
|
defaultIndicatorStyle._bgColor = purple;
|
||||||
|
pStyle = &defaultIndicatorStyle;
|
||||||
|
iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT4);
|
||||||
|
if (iFind != -1)
|
||||||
|
{
|
||||||
|
pStyle = &(stylers.getStyler(iFind));
|
||||||
|
}
|
||||||
|
setSpecialIndicator(*pStyle);
|
||||||
|
|
||||||
|
defaultIndicatorStyle._styleID = SCE_UNIVERSAL_FOUND_STYLE_EXT5;
|
||||||
|
defaultIndicatorStyle._bgColor = darkGreen;
|
||||||
|
pStyle = &defaultIndicatorStyle;
|
||||||
|
iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_FOUND_STYLE_EXT5);
|
||||||
|
if (iFind != -1)
|
||||||
|
{
|
||||||
|
pStyle = &(stylers.getStyler(iFind));
|
||||||
|
}
|
||||||
|
setSpecialIndicator(*pStyle);
|
||||||
|
int caretWidth = 1;
|
||||||
|
|
||||||
// Il faut surtout faire un test ici avant d'exécuter SCI_SETCODEPAGE
|
// Il faut surtout faire un test ici avant d'exécuter SCI_SETCODEPAGE
|
||||||
// Sinon y'aura un soucis de performance!
|
// Sinon y'aura un soucis de performance!
|
||||||
@ -1597,6 +1652,18 @@ void ScintillaEditView::addGenericText(const TCHAR * text2Append) const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScintillaEditView::addGenericText(const TCHAR * text2Append, long *mstart, long *mend) const
|
||||||
|
{
|
||||||
|
#ifdef UNICODE
|
||||||
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
|
unsigned int cp = execute(SCI_GETCODEPAGE);
|
||||||
|
const char *text2AppendA =wmc->wchar2char(text2Append, cp, mstart, mend);
|
||||||
|
execute(SCI_ADDTEXT, strlen(text2AppendA), (LPARAM)text2AppendA);
|
||||||
|
#else
|
||||||
|
execute(SCI_ADDTEXT, strlen(text2Append), (LPARAM)text2Append);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int ScintillaEditView::replaceTarget(const TCHAR * str2replace, int fromTargetPos, int toTargetPos) const
|
int ScintillaEditView::replaceTarget(const TCHAR * str2replace, int fromTargetPos, int toTargetPos) const
|
||||||
{
|
{
|
||||||
if (fromTargetPos != -1 || toTargetPos != -1)
|
if (fromTargetPos != -1 || toTargetPos != -1)
|
||||||
|
@ -193,6 +193,7 @@ public:
|
|||||||
int searchInTarget(const TCHAR * Text2Find, int fromPos, int toPos) const;
|
int searchInTarget(const TCHAR * Text2Find, int fromPos, int toPos) const;
|
||||||
void appandGenericText(const TCHAR * text2Append) const;
|
void appandGenericText(const TCHAR * text2Append) const;
|
||||||
void addGenericText(const TCHAR * text2Append) const;
|
void addGenericText(const TCHAR * text2Append) const;
|
||||||
|
void addGenericText(const TCHAR * text2Append, long *mstart, long *mend) const;
|
||||||
int replaceTarget(const TCHAR * str2replace, int fromTargetPos = -1, int toTargetPos = -1) const;
|
int replaceTarget(const TCHAR * str2replace, int fromTargetPos = -1, int toTargetPos = -1) const;
|
||||||
int replaceTargetRegExMode(const TCHAR * re, int fromTargetPos = -1, int toTargetPos = -1) const;
|
int replaceTargetRegExMode(const TCHAR * re, int fromTargetPos = -1, int toTargetPos = -1) const;
|
||||||
void showAutoComletion(int lenEntered, const TCHAR * list);
|
void showAutoComletion(int lenEntered, const TCHAR * list);
|
||||||
|
@ -6,8 +6,18 @@
|
|||||||
<Item MenuEntryName="Edit" MenuItemName="Delete"/>
|
<Item MenuEntryName="Edit" MenuItemName="Delete"/>
|
||||||
<Item MenuEntryName="Edit" MenuItemName="Select all"/>
|
<Item MenuEntryName="Edit" MenuItemName="Select all"/>
|
||||||
<Item id="0"/>
|
<Item id="0"/>
|
||||||
<Item MenuEntryName="Search" MenuItemName="Mark all"/>
|
<Item id="43022"/>
|
||||||
<Item MenuEntryName="Search" MenuItemName="Unmark all"/>
|
<Item id="43024"/>
|
||||||
|
<Item id="43026"/>
|
||||||
|
<Item id="43028"/>
|
||||||
|
<Item id="43030"/>
|
||||||
|
<Item id="0"/>
|
||||||
|
<Item id="43023"/>
|
||||||
|
<Item id="43025"/>
|
||||||
|
<Item id="43027"/>
|
||||||
|
<Item id="43029"/>
|
||||||
|
<Item id="43031"/>
|
||||||
|
<Item id="43032"/>
|
||||||
<Item id="0"/>
|
<Item id="0"/>
|
||||||
<Item MenuEntryName="Edit" MenuItemName="to Upper case"/>
|
<Item MenuEntryName="Edit" MenuItemName="to Upper case"/>
|
||||||
<Item MenuEntryName="Edit" MenuItemName="to Lower case"/>
|
<Item MenuEntryName="Edit" MenuItemName="to Lower case"/>
|
||||||
|
@ -109,6 +109,17 @@
|
|||||||
#define IDM_SEARCH_COPYMARKEDLINES (IDM_SEARCH + 19)
|
#define IDM_SEARCH_COPYMARKEDLINES (IDM_SEARCH + 19)
|
||||||
#define IDM_SEARCH_PASTEMARKEDLINES (IDM_SEARCH + 20)
|
#define IDM_SEARCH_PASTEMARKEDLINES (IDM_SEARCH + 20)
|
||||||
#define IDM_SEARCH_DELETEMARKEDLINES (IDM_SEARCH + 21)
|
#define IDM_SEARCH_DELETEMARKEDLINES (IDM_SEARCH + 21)
|
||||||
|
#define IDM_SEARCH_MARKALLEXT1 (IDM_SEARCH + 22)
|
||||||
|
#define IDM_SEARCH_UNMARKALLEXT1 (IDM_SEARCH + 23)
|
||||||
|
#define IDM_SEARCH_MARKALLEXT2 (IDM_SEARCH + 24)
|
||||||
|
#define IDM_SEARCH_UNMARKALLEXT2 (IDM_SEARCH + 25)
|
||||||
|
#define IDM_SEARCH_MARKALLEXT3 (IDM_SEARCH + 26)
|
||||||
|
#define IDM_SEARCH_UNMARKALLEXT3 (IDM_SEARCH + 27)
|
||||||
|
#define IDM_SEARCH_MARKALLEXT4 (IDM_SEARCH + 28)
|
||||||
|
#define IDM_SEARCH_UNMARKALLEXT4 (IDM_SEARCH + 29)
|
||||||
|
#define IDM_SEARCH_MARKALLEXT5 (IDM_SEARCH + 30)
|
||||||
|
#define IDM_SEARCH_UNMARKALLEXT5 (IDM_SEARCH + 31)
|
||||||
|
#define IDM_SEARCH_CLEARALLMARKS (IDM_SEARCH + 32)
|
||||||
|
|
||||||
#define IDM_VIEW (IDM + 4000)
|
#define IDM_VIEW (IDM + 4000)
|
||||||
//#define IDM_VIEW_TOOLBAR_HIDE (IDM_VIEW + 1)
|
//#define IDM_VIEW_TOOLBAR_HIDE (IDM_VIEW + 1)
|
||||||
|
@ -714,6 +714,11 @@
|
|||||||
<WidgetStyle name="White space symbol" styleID="0" fgColor="FFB56A" />
|
<WidgetStyle name="White space symbol" styleID="0" fgColor="FFB56A" />
|
||||||
<WidgetStyle name="Smart HighLighting" styleID="29" bgColor="00FF00" />
|
<WidgetStyle name="Smart HighLighting" styleID="29" bgColor="00FF00" />
|
||||||
<WidgetStyle name="Find Mark Style" styleID="31" bgColor="FF0000" />
|
<WidgetStyle name="Find Mark Style" styleID="31" bgColor="FF0000" />
|
||||||
|
<WidgetStyle name="Mark Style 1" styleID="25" bgColor="00FFFF" />
|
||||||
|
<WidgetStyle name="Mark Style 2" styleID="24" bgColor="FF8000" />
|
||||||
|
<WidgetStyle name="Mark Style 3" styleID="23" bgColor="FFFF00" />
|
||||||
|
<WidgetStyle name="Mark Style 4" styleID="22" bgColor="8000FF" />
|
||||||
|
<WidgetStyle name="Mark Style 5" styleID="21" bgColor="008000" />
|
||||||
<WidgetStyle name="Incremental highlight all" styleID="28" bgColor="0080FF" />
|
<WidgetStyle name="Incremental highlight all" styleID="28" bgColor="0080FF" />
|
||||||
<WidgetStyle name="Tags match highlighting" styleID="27" bgColor="8000FF" />
|
<WidgetStyle name="Tags match highlighting" styleID="27" bgColor="8000FF" />
|
||||||
<WidgetStyle name="Tags attribute" styleID="26" bgColor="FFFF00" />
|
<WidgetStyle name="Tags attribute" styleID="26" bgColor="FFFF00" />
|
||||||
|
@ -113,6 +113,11 @@
|
|||||||
#define SCE_UNIVERSAL_FOUND_STYLE_INC 28
|
#define SCE_UNIVERSAL_FOUND_STYLE_INC 28
|
||||||
#define SCE_UNIVERSAL_TAGMATCH 27
|
#define SCE_UNIVERSAL_TAGMATCH 27
|
||||||
#define SCE_UNIVERSAL_TAGATTR 26
|
#define SCE_UNIVERSAL_TAGATTR 26
|
||||||
|
#define SCE_UNIVERSAL_FOUND_STYLE_EXT1 25
|
||||||
|
#define SCE_UNIVERSAL_FOUND_STYLE_EXT2 24
|
||||||
|
#define SCE_UNIVERSAL_FOUND_STYLE_EXT3 23
|
||||||
|
#define SCE_UNIVERSAL_FOUND_STYLE_EXT4 22
|
||||||
|
#define SCE_UNIVERSAL_FOUND_STYLE_EXT5 21
|
||||||
|
|
||||||
#define SCE_P_DEFAULT 0
|
#define SCE_P_DEFAULT 0
|
||||||
#define SCE_P_COMMENTLINE 1
|
#define SCE_P_COMMENTLINE 1
|
||||||
|
@ -77,8 +77,8 @@ static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lin
|
|||||||
SearchResultMarking mi = pMarkings->_markings[linenum];
|
SearchResultMarking mi = pMarkings->_markings[linenum];
|
||||||
|
|
||||||
currentPos += 2; // skip ": "
|
currentPos += 2; // skip ": "
|
||||||
unsigned int match_start = startLine + currentPos + mi._start - 1;
|
unsigned int match_start = startLine + mi._start - 1;
|
||||||
unsigned int match_end = startLine + currentPos + mi._end - 1;
|
unsigned int match_end = startLine + mi._end - 1;
|
||||||
|
|
||||||
if (match_start <= endPos) {
|
if (match_start <= endPos) {
|
||||||
styler.ColourTo(match_start, SCE_SEARCHRESULT_DEFAULT);
|
styler.ColourTo(match_start, SCE_SEARCHRESULT_DEFAULT);
|
||||||
|
Loading…
Reference in New Issue
Block a user