[NEW_FEATURE] Add hilighting all token wile selecting a word (finished).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@173 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
544a4916d9
commit
52ebeee049
|
@ -8251,6 +8251,10 @@ bool Notepad_plus::str2Cliboard(const char *str2cpy)
|
|||
|
||||
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.
|
||||
|
|
|
@ -2263,6 +2263,22 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
|||
}
|
||||
}
|
||||
|
||||
else if (!strcmp(nm, "SmartHighLight"))
|
||||
{
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!strcmp(val, "yes"))
|
||||
_nppGUI._enableSmartHilite = true;
|
||||
else
|
||||
_nppGUI._enableSmartHilite = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (!strcmp(nm, "TaskList"))
|
||||
{
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
|
@ -3001,6 +3017,7 @@ bool NppParameters::writeGUIParams()
|
|||
bool sessionExtExist = false;
|
||||
bool noUpdateExist = false;
|
||||
bool menuBarExist = false;
|
||||
bool smartHighLightExist = false;
|
||||
|
||||
TiXmlNode *dockingParamNode = NULL;
|
||||
|
||||
|
@ -3157,7 +3174,16 @@ bool NppParameters::writeGUIParams()
|
|||
else
|
||||
childNode->InsertEndChild(TiXmlText(pStr));
|
||||
}
|
||||
|
||||
else if (!strcmp(nm, "SmartHighLight"))
|
||||
{
|
||||
smartHighLightExist = true;
|
||||
const char *pStr = _nppGUI._enableSmartHilite?"yes":"no";
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
n->SetValue(pStr);
|
||||
else
|
||||
childNode->InsertEndChild(TiXmlText(pStr));
|
||||
}
|
||||
else if (!strcmp(nm, "SaveOpenFileInSameDir"))
|
||||
{
|
||||
saveOpenFileInSameDirExist = true;
|
||||
|
@ -3346,6 +3372,11 @@ bool NppParameters::writeGUIParams()
|
|||
insertGUIConfigBoolNode(GUIRoot, "MaitainIndent", _nppGUI._maitainIndent);
|
||||
}
|
||||
|
||||
if (!smartHighLightExist)
|
||||
{
|
||||
insertGUIConfigBoolNode(GUIRoot, "SmartHighLight", _nppGUI._enableSmartHilite);
|
||||
}
|
||||
|
||||
if (!rememberLastSessionExist)
|
||||
{
|
||||
insertGUIConfigBoolNode(GUIRoot, "RememberLastSession", _nppGUI._rememberLastSession);
|
||||
|
|
|
@ -526,7 +526,7 @@ struct NppGUI
|
|||
NppGUI() : _toolBarStatus(TB_LARGE), _toolbarShow(true), _statusBarShow(true), _menuBarShow(true),\
|
||||
_tabStatus(TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP),\
|
||||
_splitterPos(POS_HORIZOTAL), _userDefineDlgStatus(UDD_DOCKED), _tabSize(8),\
|
||||
_tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _checkHistoryFiles(true),\
|
||||
_tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _checkHistoryFiles(true) ,_enableSmartHilite(true),\
|
||||
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\
|
||||
_doTaskList(true), _maitainIndent(true), _saveOpenKeepInSameDir(false), _styleMRU(true), _styleURL(0),
|
||||
_autocStatus(autoc_none), _autocFromLen(1), _definedSessionExt(""), _neverUpdate(false), _doesExistUpdater(false){
|
||||
|
@ -568,6 +568,7 @@ struct NppGUI
|
|||
bool _rememberLastSession;
|
||||
bool _doTaskList;
|
||||
bool _maitainIndent;
|
||||
bool _enableSmartHilite;
|
||||
bool _saveOpenKeepInSameDir;
|
||||
bool _styleMRU;
|
||||
|
||||
|
|
|
@ -49,14 +49,17 @@ void Buffer::setFileName(const char *fn, LangType defaultLang)
|
|||
|
||||
LangType Buffer::getLangFromExt(const char *ext)
|
||||
{
|
||||
int i = 0;
|
||||
Lang *l = NppParameters::getInstance()->getLangFromIndex(i++);
|
||||
while (l)
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
int i = pNppParam->getNbLang();
|
||||
i--;
|
||||
while (i >= 0)
|
||||
{
|
||||
Lang *l = pNppParam->getLangFromIndex(i--);
|
||||
|
||||
const char *defList = l->getDefaultExtList();
|
||||
const char *userList = NULL;
|
||||
|
||||
LexerStylerArray &lsa = (NppParameters::getInstance())->getLStylerArray();
|
||||
LexerStylerArray &lsa = pNppParam->getLStylerArray();
|
||||
const char *lName = l->getLangName();
|
||||
LexerStyler *pLS = lsa.getLexerStylerByName(lName);
|
||||
|
||||
|
@ -73,7 +76,6 @@ LangType Buffer::getLangFromExt(const char *ext)
|
|||
}
|
||||
if (isInList(ext, list.c_str()))
|
||||
return l->getLangID();
|
||||
l = (NppParameters::getInstance())->getLangFromIndex(i++);
|
||||
}
|
||||
return L_TXT;
|
||||
}
|
||||
|
|
|
@ -343,13 +343,14 @@ private :
|
|||
|
||||
Lang * getCurrentLang() const {
|
||||
NppParameters *pNppParam = NppParameters::getInstance();
|
||||
int i = pNppParam->getNbLang();
|
||||
while (i >= 0)
|
||||
int i = 0;
|
||||
Lang *l = pNppParam->getLangFromIndex(i++);
|
||||
while (l)
|
||||
{
|
||||
Lang *l = pNppParam->getLangFromIndex(i--);
|
||||
if (l->_langID == _lang)
|
||||
return l;
|
||||
//l = (NppParameters::getInstance())->getLangFromIndex(i++);
|
||||
|
||||
l = pNppParam->getLangFromIndex(i++);
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
|
|
@ -91,32 +91,33 @@ BEGIN
|
|||
RTEXT "Tab size : ",IDC_TABSIZE_STATIC,18,14,58,8
|
||||
LTEXT "0",IDC_TABSIZEVAL_STATIC,78,14,18,8
|
||||
GROUPBOX "History File Setting",IDC_HISTORY_GB_STATIC,193,4,150,39,BS_CENTER
|
||||
CONTROL "Don't check at launch time",IDC_CHECK_DONTCHECKHISTORY,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,27,133,10
|
||||
CONTROL "Don't check at launch time",IDC_CHECK_DONTCHECKHISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,27,133,10
|
||||
RTEXT "Max number history file :",IDC_MAXNBFILE_STATIC,196,14,112,8
|
||||
LTEXT "0",IDC_MAXNBFILEVAL_STATIC,315,14,15,8
|
||||
CONTROL "Minimize to sys tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,163,130,10
|
||||
CONTROL "Remember the current session for next launch",IDC_CHECK_REMEMBERSESSION,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,133,217,11
|
||||
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,16,102,150,10
|
||||
CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,58,98,10
|
||||
GROUPBOX "Clickable link setting",IDC_CLICKABLELINK_STATIC,193,47,150,39,BS_CENTER
|
||||
CONTROL "Don't draw underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,71,119,10
|
||||
CONTROL "Don't draw underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,71,119,10
|
||||
EDITTEXT IDC_EDIT_SESSIONFILEEXT,298,162,67,14,ES_AUTOHSCROLL
|
||||
LTEXT "Session file ext:",IDC_SESSIONFILEEXT_STATIC,300,150,66,8
|
||||
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,117,130,10
|
||||
CONTROL "Remember the last operation directory",IDC_CHECK_KEEPINSAMEDIR,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,148,210,10
|
||||
CONTROL "Enable",IDC_CHECK_ENABLEDOCSWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,59,69,10
|
||||
CONTROL "Enable MRU behaviour",IDC_CHECK_STYLEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,72,134,10
|
||||
GROUPBOX "Document switcher (Ctrl+TAB)",IDC_DOCUMENTSWITCHER_STATIC,15,48,150,39,BS_CENTER
|
||||
CONTROL "Enable",IDC_CHECK_FILEAUTODETECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,100,98,10
|
||||
GROUPBOX "File Status Auto-detection",IDC_FILEAUTODETECTION_STATIC,193,90,150,50,BS_CENTER
|
||||
CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,112,103,10
|
||||
CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,124,141,10
|
||||
CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,201,124,141,10
|
||||
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,
|
||||
16,95,150,10
|
||||
CONTROL "Enable smart highlighting",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,
|
||||
16,109,150,10
|
||||
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
16,123,130,10
|
||||
CONTROL "Minimize to sys tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
16,137,130,10
|
||||
CONTROL "Remember the last operation directory",IDC_CHECK_KEEPINSAMEDIR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
16,151,210,10
|
||||
CONTROL "Remember the current session for next launch",IDC_CHECK_REMEMBERSESSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
|
||||
16,165,217,10
|
||||
END
|
||||
|
||||
IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 370, 180
|
||||
|
|
|
@ -506,11 +506,13 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
|
|||
bool enableMaintainIndent = nppGUI._maitainIndent;
|
||||
bool saveOpenKeepInSameDir = nppGUI._saveOpenKeepInSameDir;
|
||||
bool styleMRU = nppGUI._styleMRU;
|
||||
bool enableSmartHilite = nppGUI._enableSmartHilite;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCSWITCHER, BM_SETCHECK, enableTaskList, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_MAINTAININDENT, BM_SETCHECK, enableMaintainIndent, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_KEEPINSAMEDIR, BM_SETCHECK, saveOpenKeepInSameDir, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_STYLEMRU, BM_SETCHECK, styleMRU, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLSMARTHILITE, BM_SETCHECK, enableSmartHilite, 0);
|
||||
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
|
||||
if (enableDlgTheme)
|
||||
enableDlgTheme(_hSelf, ETDT_ENABLETAB);
|
||||
|
@ -633,7 +635,6 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
|
|||
|
||||
case IDC_CHECK_ENABLEDOCSWITCHER :
|
||||
{
|
||||
NppGUI & nppGUI = (NppGUI &)NppParameters::getInstance()->getNppGUI();
|
||||
nppGUI._doTaskList = !nppGUI._doTaskList;
|
||||
if (nppGUI._doTaskList)
|
||||
{
|
||||
|
@ -650,21 +651,24 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
|
|||
|
||||
case IDC_CHECK_KEEPINSAMEDIR :
|
||||
{
|
||||
NppGUI & nppGUI = (NppGUI &)NppParameters::getInstance()->getNppGUI();
|
||||
nppGUI._saveOpenKeepInSameDir = !nppGUI._saveOpenKeepInSameDir;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_CHECK_MAINTAININDENT :
|
||||
{
|
||||
NppGUI & nppGUI = (NppGUI &)NppParameters::getInstance()->getNppGUI();
|
||||
nppGUI._maitainIndent = !nppGUI._maitainIndent;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
case IDC_CHECK_ENABLSMARTHILITE :
|
||||
{
|
||||
nppGUI._enableSmartHilite = !nppGUI._enableSmartHilite;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case IDC_CHECK_STYLEMRU :
|
||||
{
|
||||
NppGUI & nppGUI = (NppGUI &)NppParameters::getInstance()->getNppGUI();
|
||||
nppGUI._styleMRU = !nppGUI._styleMRU;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|||
#define IDC_CHECK_AUTOUPDATE (IDD_PREFERENCE_SETTING_BOX + 23)
|
||||
#define IDC_DOCUMENTSWITCHER_STATIC (IDD_PREFERENCE_SETTING_BOX + 24)
|
||||
#define IDC_CHECK_UPDATEGOTOEOF (IDD_PREFERENCE_SETTING_BOX + 25)
|
||||
#define IDC_CHECK_ENABLEMAEKALLWORDS (IDD_PREFERENCE_SETTING_BOX + 26)
|
||||
#define IDC_CHECK_ENABLSMARTHILITE (IDD_PREFERENCE_SETTING_BOX + 26)
|
||||
|
||||
#define IDD_PREFERENCE_NEWDOCSETTING_BOX 6400 //(IDD_PREFERENCE_BOX + 400)
|
||||
#define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 1)
|
||||
|
|
Loading…
Reference in New Issue