[NEW_FEATURE] Smart HighLighting uses indicator instead of style.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@174 f5eea248-9336-0410-98b8-ebc06183d4e3pull/343/head^2
parent
52ebeee049
commit
4a6ca982e1
|
@ -130,7 +130,6 @@ public:
|
|||
|
||||
private:
|
||||
NppData _nppData;
|
||||
|
||||
HMENU _hPluginsMenu;
|
||||
|
||||
vector<PluginInfo *> _pluginInfos;
|
||||
|
|
|
@ -8248,7 +8248,7 @@ bool Notepad_plus::str2Cliboard(const char *str2cpy)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void Notepad_plus::markSelectedText()
|
||||
{
|
||||
const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI();
|
||||
|
@ -8283,7 +8283,39 @@ void Notepad_plus::markSelectedText()
|
|||
op._isWholeWord = false;
|
||||
_findReplaceDlg.markAll2(text2Find);
|
||||
}
|
||||
*/
|
||||
|
||||
void Notepad_plus::markSelectedText()
|
||||
{
|
||||
const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI();
|
||||
if (!nppGUI._enableSmartHilite)
|
||||
return;
|
||||
|
||||
//Get selection
|
||||
CharacterRange range = _pEditView->getSelection();
|
||||
//Dont mark if the selection has not changed.
|
||||
if (range.cpMin == _prevSelectedRange.cpMin && range.cpMax == _prevSelectedRange.cpMax)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_prevSelectedRange = range;
|
||||
|
||||
//Clear marks
|
||||
_pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_2);
|
||||
|
||||
//If nothing selected, dont mark anything
|
||||
if (range.cpMin == range.cpMax)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char text2Find[MAX_PATH];
|
||||
_pEditView->getSelectedText(text2Find, sizeof(text2Find), false); //do not expand selection (false)
|
||||
|
||||
FindOption op;
|
||||
op._isWholeWord = false;
|
||||
_findReplaceDlg.markAll2(text2Find);
|
||||
}
|
||||
|
||||
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
|
||||
|
||||
|
|
|
@ -939,10 +939,6 @@ int FindReplaceDlg::processAll(int op, bool isEntire, const char *fileName, cons
|
|||
(*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK);
|
||||
}
|
||||
}
|
||||
else if (op == MARK_ALL_2)
|
||||
{
|
||||
(*_ppEditView)->execute(SCI_SETLEXER, SCLEX_NULL);
|
||||
}
|
||||
|
||||
int posFind = int((*_ppEditView)->execute(SCI_SEARCHINTARGET, (WPARAM)str2Search.length(), (LPARAM)str2Search.c_str()));
|
||||
|
||||
|
@ -1009,9 +1005,9 @@ int FindReplaceDlg::processAll(int op, bool isEntire, const char *fileName, cons
|
|||
}
|
||||
else if (op == MARK_ALL_2)
|
||||
{
|
||||
(*_ppEditView)->execute(SCI_STARTSTYLING, start, STYLING_MASK);
|
||||
(*_ppEditView)->execute(SCI_SETSTYLING, end - start, SCE_UNIVERSAL_FOUND_STYLE_2);
|
||||
(*_ppEditView)->execute(SCI_COLOURISE, start, end+1);
|
||||
(*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_2);
|
||||
(*_ppEditView)->execute(SCI_INDICATORFILLRANGE, start, end - start);
|
||||
|
||||
startPosition = (direction == DIR_UP)?posFind - foundTextLen:posFind + foundTextLen;
|
||||
}
|
||||
else if (op == COUNT_ALL)
|
||||
|
|
|
@ -110,6 +110,10 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
|
|||
execute(SCI_SETFOLDFLAGS, 16);
|
||||
execute(SCI_SETSCROLLWIDTHTRACKING, true);
|
||||
|
||||
// smart hilighting
|
||||
execute(SCI_INDICSETSTYLE, SCE_UNIVERSAL_FOUND_STYLE_2, INDIC_ROUNDBOX);
|
||||
execute(SCI_INDICSETFORE, SCE_UNIVERSAL_FOUND_STYLE_2, blue);
|
||||
|
||||
_pParameter = NppParameters::getInstance();
|
||||
|
||||
_codepage = ::GetACP();
|
||||
|
@ -191,6 +195,14 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
|||
}
|
||||
return _callWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
void ScintillaEditView::setSpecialIndicator(Style & styleToSet)
|
||||
{
|
||||
//execute(SCI_INDICSETSTYLE, styleToSet._styleID, INDIC_ROUNDBOX);
|
||||
execute(SCI_INDICSETFORE, styleToSet._styleID, styleToSet._bgColor);
|
||||
}
|
||||
|
||||
|
||||
void ScintillaEditView::setSpecialStyle(Style & styleToSet)
|
||||
{
|
||||
int styleID = styleToSet._styleID;
|
||||
|
@ -655,7 +667,8 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
|
|||
if (iFind != -1)
|
||||
{
|
||||
Style & styleFind = stylers.getStyler(iFind);
|
||||
setSpecialStyle(styleFind);
|
||||
//setSpecialStyle(styleFind);
|
||||
setSpecialIndicator(styleFind);
|
||||
}
|
||||
|
||||
iFind = stylers.getStylerIndexByID(SCE_UNIVERSAL_SELECT_STYLE);
|
||||
|
|
|
@ -669,6 +669,14 @@ protected:
|
|||
|
||||
void setStyle(Style styleToSet); //NOT by reference (style edited)
|
||||
void setSpecialStyle(Style & styleToSet); //by reference
|
||||
void setSpecialIndicator(Style & styleToSet);
|
||||
void clearIndicator(int indicatorNumber) {
|
||||
int docStart = 0;
|
||||
int docEnd = getCurrentDocLen();
|
||||
execute(SCI_SETINDICATORCURRENT, indicatorNumber);
|
||||
execute(SCI_INDICATORCLEARRANGE, docStart, docEnd-docStart);
|
||||
};
|
||||
|
||||
void setCppLexer(LangType type);
|
||||
void setXmlLexer(LangType type);
|
||||
void setUserLexer();
|
||||
|
|
|
@ -35,7 +35,7 @@ const COLORREF darkBlue = RGB(0, 0, 0x80);
|
|||
const COLORREF blue = RGB(0, 0, 0xFF);
|
||||
const COLORREF black = RGB(0, 0, 0);
|
||||
const COLORREF white = RGB(0xFF, 0xFF, 0xFF);
|
||||
const COLORREF darkGrey = RGB(64, 64, 64);
|
||||
const COLORREF darkGrey = RGB(64, 64, 64);
|
||||
const COLORREF grey = RGB(128, 128, 128);
|
||||
const COLORREF liteGrey = RGB(192, 192, 192);
|
||||
const COLORREF veryLiteGrey = RGB(224, 224, 224);
|
||||
|
|
|
@ -576,10 +576,6 @@
|
|||
RelativePath="..\src\MISC\RegExt\regExtDlgRc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||
>
|
||||
|
@ -588,6 +584,10 @@
|
|||
RelativePath="..\src\MISC\RegExt\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue