[NEW_FEATURE] (Author: Andreas Jonsson) Add case sensitive option for smart highlighting feature.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@945 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-08-29 09:39:13 +00:00
parent e86940390f
commit 4d11f5d26a
6 changed files with 61 additions and 10 deletions

View File

@ -3183,6 +3183,22 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
}
}
else if (!lstrcmp(nm, TEXT("SmartHighLightCaseSensitive")))
{
TiXmlNode *n = childNode->FirstChild();
if (n)
{
val = n->Value();
if (val)
{
if (!lstrcmp(val, TEXT("yes")))
_nppGUI._smartHiliteCaseSensitive = true;
else
_nppGUI._smartHiliteCaseSensitive = false;
}
}
}
else if (!lstrcmp(nm, TEXT("TagsMatchHighLight")))
{
TiXmlNode *n = childNode->FirstChild();
@ -4059,6 +4075,7 @@ bool NppParameters::writeGUIParams()
bool noUpdateExist = false;
bool menuBarExist = false;
bool smartHighLightExist = false;
bool smartHighLightCaseSensitiveExist = false;
bool tagsMatchHighLightExist = false;
bool caretExist = false;
bool ScintillaGlobalSettingsExist = false;
@ -4242,6 +4259,16 @@ bool NppParameters::writeGUIParams()
else
childNode->InsertEndChild(TiXmlText(pStr));
}
else if (!lstrcmp(nm, TEXT("SmartHighLightCaseSensitive")))
{
smartHighLightCaseSensitiveExist = true;
const TCHAR *pStr = _nppGUI._smartHiliteCaseSensitive?TEXT("yes"):TEXT("no");
TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
}
else if (!lstrcmp(nm, TEXT("TagsMatchHighLight")))
{
@ -4466,6 +4493,10 @@ bool NppParameters::writeGUIParams()
{
insertGUIConfigBoolNode(GUIRoot, TEXT("SmartHighLight"), _nppGUI._enableSmartHilite);
}
if( !smartHighLightCaseSensitiveExist)
{
insertGUIConfigBoolNode(GUIRoot, TEXT("SmartHighLightCaseSensitive"), _nppGUI._smartHiliteCaseSensitive);
}
if (!tagsMatchHighLightExist)
{
TiXmlElement * ele = insertGUIConfigBoolNode(GUIRoot, TEXT("TagsMatchHighLight"), _nppGUI._enableTagsMatchHilite);

View File

@ -671,7 +671,8 @@ struct NppGUI
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false) {
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),
_smartHiliteCaseSensitive(false) {
_appPos.left = 0;
_appPos.top = 0;
_appPos.right = 700;
@ -713,6 +714,7 @@ struct NppGUI
bool _doTaskList;
bool _maitainIndent;
bool _enableSmartHilite;
bool _smartHiliteCaseSensitive;
bool _disableSmartHiliteTmp;
bool _enableTagsMatchHilite;
bool _enableTagAttrsHilite;

View File

@ -97,8 +97,10 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
int currentLine = firstLine;
int prevDocLineChecked = -1; //invalid start
const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
FindOption fo;
fo._isMatchCase = false;
fo._isMatchCase = nppGUI._smartHiliteCaseSensitive;
fo._isWholeWord = true;
const TCHAR * searchText = NULL;

View File

@ -117,35 +117,36 @@ IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Document Switcher (Ctrl+TAB)",IDC_DOCUMENTSWITCHER_STATIC,37,4,155,39,BS_CENTER
CONTROL "Enable",IDC_CHECK_ENABLEDOCSWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,15,69,10
CONTROL "Enable MRU behaviour",IDC_CHECK_STYLEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,28,140,10
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,94,150,10
CONTROL "Smart highlighting",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,136,150,10
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,108,150,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,122,150,10
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,94,150,10
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,108,150,10
CONTROL "Smart highlighting",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,122,150,10
CONTROL "Highlighting is case sensitive",IDC_CHECK_SMARTHILITECASESENSITIVE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,136,150,10
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,150,217,10
CONTROL "Remember current session for next launch",IDC_CHECK_REMEMBERSESSION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,164,217,10
GROUPBOX "Clickable Link Settings",IDC_CLICKABLELINK_STATIC,259,4,155,39,BS_CENTER
CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10
CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10
GROUPBOX "File Status Auto-Detection",IDC_FILEAUTODETECTION_STATIC,259,47,155,50,BS_CENTER
CONTROL "Enable",IDC_CHECK_FILEAUTODETECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,57,140,10
CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,69,140,10
CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,81,140,10
GROUPBOX "Highlight Matching Tags",IDC_TAGMATCHEDHILITE_STATIC,259,101,155,50,BS_CENTER
CONTROL "Enable",IDC_CHECK_ENABLTAGSMATCHHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,267,111,140,10
CONTROL "Highlight tag attributes",IDC_CHECK_ENABLTAGATTRHILITE,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,267,123,140,10
CONTROL "Highlight comment/php/asp zone",IDC_CHECK_HIGHLITENONEHTMLZONE,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,267,136,140,10
RTEXT "Session file ext.:",IDC_SESSIONFILEEXT_STATIC,271,160,108,8
EDITTEXT IDC_EDIT_SESSIONFILEEXT,381,157,34,14,ES_AUTOHSCROLL
GROUPBOX "Document Switcher (Ctrl+TAB)",IDC_DOCUMENTSWITCHER_STATIC,37,4,155,39,BS_CENTER
GROUPBOX "Clickable Link Settings",IDC_CLICKABLELINK_STATIC,259,4,155,39,BS_CENTER
GROUPBOX "File Status Auto-Detection",IDC_FILEAUTODETECTION_STATIC,259,47,155,50,BS_CENTER
GROUPBOX "Highlight Matching Tags",IDC_TAGMATCHEDHILITE_STATIC,259,101,155,50,BS_CENTER
RTEXT "Session file ext.:",IDC_SESSIONFILEEXT_STATIC,271,160,108,8
END
IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 455, 185

View File

@ -753,12 +753,14 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_CHECK_MAINTAININDENT, BM_SETCHECK, nppGUI._maitainIndent, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_STYLEMRU, BM_SETCHECK, nppGUI._styleMRU, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLSMARTHILITE, BM_SETCHECK, nppGUI._enableSmartHilite, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE, BM_SETCHECK, nppGUI._smartHiliteCaseSensitive, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLTAGSMATCHHILITE, BM_SETCHECK, nppGUI._enableTagsMatchHilite, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE, BM_SETCHECK, nppGUI._enableTagAttrsHilite, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE, BM_SETCHECK, nppGUI._enableHiliteNonHTMLZone, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE), nppGUI._enableTagsMatchHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE), nppGUI._enableTagsMatchHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SHORTTITLE, BM_SETCHECK, nppGUI._shortTitlebar, 0);
@ -884,8 +886,20 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
HWND grandParent = ::GetParent(_hParent);
::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0);
}
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite);
return TRUE;
}
case IDC_CHECK_SMARTHILITECASESENSITIVE:
{
nppGUI._smartHiliteCaseSensitive = !nppGUI._smartHiliteCaseSensitive;
if (!nppGUI._smartHiliteCaseSensitive)
{
HWND grandParent = ::GetParent(_hParent);
::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0);
}
return TRUE;
}
case IDC_CHECK_ENABLTAGSMATCHHILITE:
{
nppGUI._enableTagsMatchHilite = !nppGUI._enableTagsMatchHilite;

View File

@ -135,6 +135,7 @@
#define IDC_TAGMATCHEDHILITE_STATIC (IDD_PREFERENCE_SETTING_BOX + 29)
#define IDC_CHECK_HIGHLITENONEHTMLZONE (IDD_PREFERENCE_SETTING_BOX + 30)
#define IDC_CHECK_SHORTTITLE (IDD_PREFERENCE_SETTING_BOX + 31)
#define IDC_CHECK_SMARTHILITECASESENSITIVE (IDD_PREFERENCE_SETTING_BOX + 32)
#define IDD_PREFERENCE_NEWDOCSETTING_BOX 6400 //(IDD_PREFERENCE_BOX + 400)
#define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 1)