From 4fec26530448ad8bbc5ec6f746cd53b27b3674cf Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 10 Oct 2016 00:20:38 +0200 Subject: [PATCH] Reorganization of preferences dialog --- .../src/WinControls/Preference/preference.rc | 76 +-- .../WinControls/Preference/preferenceDlg.cpp | 566 +++++++++--------- .../WinControls/Preference/preferenceDlg.h | 9 +- 3 files changed, 332 insertions(+), 319 deletions(-) diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index 864c459e7..cc98c6d66 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -120,15 +120,16 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "Enable",IDC_CHECK_ENABLEDOCSWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,15,140,10 CONTROL "Enable MRU behaviour",IDC_CHECK_STYLEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,28,140,10 - CONTROL "Enable",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,45,57,142,10 - CONTROL "Match case",IDC_CHECK_SMARTHILITECASESENSITIVE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,45,71,142,10 - COMBOBOX IDC_COMBO_SMARTHILITEMODE, 45, 82, 142, 10, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,105,150,10 - CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,120,217,10 - CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,135,150,10 - CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,150,150,10 - CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,165,217,10 - CONTROL "Treat backslash as escape character for SQL",IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,180,217,10 + CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,83,150,10 + CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,98,217,10 + CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,113,150,10 + CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,128,150,10 + CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,143,217,10 + CONTROL "Treat backslash as escape character for SQL",IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,158,217,10 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 @@ -136,20 +137,13 @@ BEGIN 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 - 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 - EDITTEXT IDC_EDIT_SESSIONFILEEXT,381,157,34,14,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_WORKSPACEFILEEXT,381,174,34,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SESSIONFILEEXT,381,135,34,14,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_WORKSPACEFILEEXT,381,152,34,14,ES_AUTOHSCROLL GROUPBOX "Document Switcher (Ctrl+TAB)",IDC_DOCUMENTSWITCHER_STATIC,37,4,155,39,BS_CENTER - GROUPBOX "Smart Highlighting",IDC_SMARTHILITING_STATIC,37,47,155,52,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 - RTEXT "Workspace file ext.:",IDC_WORKSPACEFILEEXT_STATIC,271,177,108,8 + RTEXT "Session file ext.:",IDC_SESSIONFILEEXT_STATIC,271,138,108,8 + RTEXT "Workspace file ext.:",IDC_WORKSPACEFILEEXT_STATIC,271,155,108,8 END IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 455, 185 @@ -212,29 +206,39 @@ IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 455, 185 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Language Menu",IDC_CHECK_LANGMENU_GR_STATIC,111,3,220,172,BS_CENTER + GROUPBOX "Language Menu",IDC_CHECK_LANGMENU_GR_STATIC,34,3,220,172,BS_CENTER CONTROL "Make language menu compact",IDC_CHECK_LANGMENUCOMPACT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,14,174,10 - CTEXT "Available items",IDC_ENABLEDITEMS_STATIC,129,31,72,8 - LISTBOX IDC_LIST_ENABLEDLANG,124,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "->",IDC_BUTTON_REMOVE,209,76,25,14 - PUSHBUTTON "<-",IDC_BUTTON_RESTORE,209,107,25,14 - CTEXT "Disabled items",IDC_DISABLEDITEMS_STATIC,244,31,72,8 - LISTBOX IDC_LIST_DISABLEDLANG,241,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,14,174,10 + CTEXT "Available items",IDC_ENABLEDITEMS_STATIC,52,31,72,8 + LISTBOX IDC_LIST_ENABLEDLANG,47,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "->",IDC_BUTTON_REMOVE,132,76,25,14 + PUSHBUTTON "<-",IDC_BUTTON_RESTORE,132,107,25,14 + CTEXT "Disabled items",IDC_DISABLEDITEMS_STATIC,167,31,72,8 + LISTBOX IDC_LIST_DISABLEDLANG,164,44,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Tab Settings",IDC_TABSETTING_GB_STATIC,275,3,130,172,BS_CENTER + LISTBOX IDC_LIST_TABSETTNG,297,18,84,100,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + GROUPBOX "",IDC_GR_TABVALUE_STATIC,287,125,110,42,BS_CENTER + CONTROL "Use default value",IDC_CHECK_DEFAULTTABVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,283,125,85,10 + RTEXT "Tab size : ",IDC_TABSIZE_STATIC,288,138,58,8 + LTEXT "0",IDC_TABSIZEVAL_STATIC,348,138,18,8,WS_TABSTOP + LTEXT "0",IDC_TABSIZEVAL_DISABLE_STATIC,348,138,18,8 + CONTROL "Replace by space",IDC_CHECK_REPLACEBYSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,295,149,100,10 END IDD_PREFERENCE_TABSETTINGS_BOX DIALOGEX 0, 0, 455, 185 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Tab Settings",IDC_TABSETTING_GB_STATIC,156,3,130,172,BS_CENTER - LISTBOX IDC_LIST_TABSETTNG,178,18,84,100,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "",IDC_GR_TABVALUE_STATIC,168,125,110,42,BS_CENTER - CONTROL "Use default value",IDC_CHECK_DEFAULTTABVALUE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,164,125,85,10 - RTEXT "Tab size : ",IDC_TABSIZE_STATIC,169,138,58,8 - LTEXT "0",IDC_TABSIZEVAL_STATIC,229,138,18,8,WS_TABSTOP - LTEXT "0",IDC_TABSIZEVAL_DISABLE_STATIC,229,138,18,8 - CONTROL "Replace by space",IDC_CHECK_REPLACEBYSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,176,149,100,10 + CONTROL "Enable",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,71,69,142,10 + CONTROL "Match case",IDC_CHECK_SMARTHILITECASESENSITIVE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,71,83,142,10 + COMBOBOX IDC_COMBO_SMARTHILITEMODE,71,94,142,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Smart Highlighting",IDC_SMARTHILITING_STATIC,63,59,155,52,BS_CENTER + CONTROL "Enable",IDC_CHECK_ENABLTAGSMATCHHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,245,69,140,10 + CONTROL "Highlight tag attributes",IDC_CHECK_ENABLTAGATTRHILITE, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,245,81,140,10 + CONTROL "Highlight comment/php/asp zone",IDC_CHECK_HIGHLITENONEHTMLZONE, + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,245,94,140,10 + GROUPBOX "Highlight Matching Tags",IDC_TAGMATCHEDHILITE_STATIC,237,59,155,50,BS_CENTER END IDD_PREFERENCE_PRINT_BOX DIALOGEX 0, 0, 455, 185 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index f4a18c79d..22f105639 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -157,8 +157,8 @@ INT_PTR CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM _wVector.push_back(DlgInfo(&_defaultDirectoryDlg, TEXT("Default Directory"), TEXT("DefaultDir"))); _wVector.push_back(DlgInfo(&_recentFilesHistoryDlg, TEXT("Recent Files History"), TEXT("RecentFilesHistory"))); _wVector.push_back(DlgInfo(&_fileAssocDlg, TEXT("File Association"), TEXT("FileAssoc"))); - _wVector.push_back(DlgInfo(&_langMenuDlg, TEXT("Language Menu"), TEXT("LangMenu"))); - _wVector.push_back(DlgInfo(&_tabSettings, TEXT("Tab Settings"), TEXT("TabSettings"))); + _wVector.push_back(DlgInfo(&_langMenuDlg, TEXT("Language"), TEXT("Language"))); + _wVector.push_back(DlgInfo(&_tabSettings, TEXT("Highlighting"), TEXT("Highlighting"))); _wVector.push_back(DlgInfo(&_printSettingsDlg, TEXT("Print"), TEXT("Print"))); _wVector.push_back(DlgInfo(&_backupDlg, TEXT("Backup"), TEXT("Backup"))); _wVector.push_back(DlgInfo(&_autoCompletionDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion"))); @@ -926,36 +926,6 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) ::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLEDOCSWITCHER, BM_SETCHECK, nppGUI._doTaskList, 0); ::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); - - ::SendDlgItemMessage(_hSelf, IDC_COMBO_SMARTHILITEMODE, CB_ADDSTRING, 0, (LPARAM)TEXT("Match whole word only")); - ::SendDlgItemMessage(_hSelf, IDC_COMBO_SMARTHILITEMODE, CB_ADDSTRING, 0, (LPARAM)TEXT("Match any selection")); - ::SendDlgItemMessage(_hSelf, IDC_COMBO_SMARTHILITEMODE, CB_ADDSTRING, 0, (LPARAM)TEXT("Same as Find dialog")); - - switch (nppGUI._smartHiliteMode) - { - case NppGUI::SmartHiliteMode::wordOnly: - ::SendMessage(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), CB_SETCURSEL, 0, 0); - break; - - case NppGUI::SmartHiliteMode::anySelection: - ::SendMessage(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), CB_SETCURSEL, 1, 0); - break; - - case NppGUI::SmartHiliteMode::findDialog: - ::SendMessage(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), CB_SETCURSEL, 2, 0); - break; - } - - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE), nppGUI._enableTagsMatchHilite); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE), nppGUI._enableTagsMatchHilite); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), nppGUI._enableSmartHilite); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_SHORTTITLE, BM_SETCHECK, nppGUI._shortTitlebar, 0); ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); @@ -1088,60 +1058,6 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) return TRUE; } - case IDC_CHECK_ENABLSMARTHILITE : - { - nppGUI._enableSmartHilite = !nppGUI._enableSmartHilite; - if (!nppGUI._enableSmartHilite) - { - HWND grandParent = ::GetParent(_hParent); - ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0); - } - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), 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; - if (!nppGUI._enableTagsMatchHilite) - { - HWND grandParent = ::GetParent(_hParent); - ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATORTAGMATCH, 0, 0); - } - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE), nppGUI._enableTagsMatchHilite); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE), nppGUI._enableTagsMatchHilite); - return TRUE; - } - - case IDC_CHECK_ENABLTAGATTRHILITE: - { - nppGUI._enableTagAttrsHilite = !nppGUI._enableTagAttrsHilite; - if (!nppGUI._enableTagAttrsHilite) - { - HWND grandParent = ::GetParent(_hParent); - ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATORTAGATTR, 0, 0); - } - return TRUE; - } - - case IDC_CHECK_HIGHLITENONEHTMLZONE: - { - nppGUI._enableHiliteNonHTMLZone = !nppGUI._enableHiliteNonHTMLZone; - return TRUE; - } - case IDC_CHECK_STYLEMRU : { nppGUI._styleMRU = !nppGUI._styleMRU; @@ -1161,41 +1077,6 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) nppGUI._backSlashIsEscapeCharacterForSql = isCheckedOrNot(IDC_CHECK_BACKSLASHISESCAPECHARACTERFORSQL); return TRUE; } - - default: - switch (HIWORD(wParam)) - { - case CBN_SELCHANGE: - { - switch (LOWORD(wParam)) - { - case IDC_COMBO_SMARTHILITEMODE : - { - auto index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_SMARTHILITEMODE, CB_GETCURSEL, 0, 0); - - switch (index) - { - case 0: - nppGUI._smartHiliteMode = NppGUI::SmartHiliteMode::wordOnly; - break; - - case 1: - nppGUI._smartHiliteMode = NppGUI::SmartHiliteMode::anySelection; - break; - - case 2: - nppGUI._smartHiliteMode = NppGUI::SmartHiliteMode::findDialog; - break; - } - - return TRUE; - } - - default: - break; - } - } - } } } } @@ -1650,7 +1531,10 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP { case WM_INITDIALOG : { - int nbLang = pNppParam->getNbLang(); + // + // Lang Menu + // + const int nbLang = pNppParam->getNbLang(); for (int i = 0 ; i < nbLang ; ++i) { ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast(pNppParam->getLangFromIndex(i)->_langName.c_str())); @@ -1683,16 +1567,40 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP ::EnableWindow(::GetDlgItem(_hSelf, IDC_BUTTON_REMOVE), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_BUTTON_RESTORE), FALSE); + + // + // Tab settings + // + ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, nppGUI._tabSize, FALSE); + + _tabSizeVal.init(_hInst, _hSelf); + _tabSizeVal.create(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), IDC_TABSIZEVAL_STATIC); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_REPLACEBYSPACE, BM_SETCHECK, nppGUI._tabReplacedBySpace, 0); + + ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast(TEXT("[Default]"))); + for (int i = 0; i < nbLang; ++i) + { + ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast(pNppParam->getLangFromIndex(i)->_langName.c_str())); + } + const int index2Begin = 0; + ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_SETCURSEL, 0, index2Begin); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_GR_TABVALUE_STATIC), SW_HIDE); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), SW_HIDE); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), FALSE); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE); + ETDTProc enableDlgTheme = reinterpret_cast(pNppParam->getEnableThemeDlgTexture()); if (enableDlgTheme) enableDlgTheme(_hSelf, ETDT_ENABLETAB); return TRUE; } + case WM_COMMAND : { if (HIWORD(wParam) == LBN_SELCHANGE) { + // Lang Menu if (LOWORD(wParam) == IDC_LIST_DISABLEDLANG || LOWORD(wParam) == IDC_LIST_ENABLEDLANG) { HWND hEnableList = ::GetDlgItem(_hSelf, IDC_LIST_ENABLEDLANG); @@ -1730,10 +1638,61 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP return TRUE; } + // Tab setting + else if (LOWORD(wParam) == IDC_LIST_TABSETTNG) + { + auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0); + if (index == LB_ERR) + return FALSE; + ::ShowWindow(::GetDlgItem(_hSelf, IDC_GR_TABVALUE_STATIC), index ? SW_SHOW : SW_HIDE); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), index ? SW_SHOW : SW_HIDE); + + if (index) + { + Lang *lang = pNppParam->getLangFromIndex(index - 1); + if (!lang) return FALSE; + bool useDefaultTab = (lang->_tabSize == -1 || lang->_tabSize == 0); + + ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), BM_SETCHECK, useDefaultTab, 0); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), !useDefaultTab); + + int size = useDefaultTab ? nppGUI._tabSize : lang->_tabSize; + ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, size, FALSE); + ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC, size, FALSE); + + ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), useDefaultTab); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab); + ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, useDefaultTab ? nppGUI._tabReplacedBySpace : lang->_isTabReplacedBySpace, 0); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), !useDefaultTab); + + if (!useDefaultTab) + { + ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, lang->_tabSize, FALSE); + ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, lang->_isTabReplacedBySpace, 0); + } + } + else + { + ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), TRUE); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), TRUE); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), SW_SHOW); + ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, nppGUI._tabSize, FALSE); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), TRUE); + ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, nppGUI._tabReplacedBySpace, 0); + } + + return TRUE; + } + } switch (wParam) { + // + // Lang Menu + // case IDC_CHECK_LANGMENUCOMPACT : { nppGUI._isLangMenuCompact = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_LANGMENUCOMPACT), BM_GETCHECK, 0, 0)); @@ -1826,6 +1785,122 @@ INT_PTR CALLBACK LangMenuDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP ::DrawMenuBar(grandParent); return TRUE; } + + // + // Tab setting + // + case IDC_TABSIZEVAL_STATIC: + { + ValueDlg tabSizeDlg; + tabSizeDlg.init(_hInst, _hParent, nppGUI._tabSize, TEXT("Tab Size : ")); + POINT p; + ::GetCursorPos(&p); + int size = tabSizeDlg.doDialog(p); + + //Tab size 0 removal + if (size <= 0) return FALSE; + + ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, size, FALSE); + ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC, size, FALSE); + + auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0); + if (index == LB_ERR) return FALSE; + + if (index != 0) + { + Lang *lang = pNppParam->getLangFromIndex(index - 1); + if (!lang) return FALSE; + if (lang->_langID == L_JS) + { + Lang *ljs = pNppParam->getLangFromID(L_JAVASCRIPT); + ljs->_tabSize = size; + } + else if (lang->_langID == L_JAVASCRIPT) + { + Lang *ljavascript = pNppParam->getLangFromID(L_JS); + ljavascript->_tabSize = size; + } + + lang->_tabSize = size; + + // write in langs.xml + pNppParam->insertTabInfo(lang->getLangName(), lang->getTabInfo()); + } + else + { + nppGUI._tabSize = size; + } + + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETTING_TAB_SIZE, 0, 0); + return TRUE; + } + + case IDC_CHECK_REPLACEBYSPACE: + { + bool isTabReplacedBySpace = BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_GETCHECK, 0, 0); + auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0); + if (index == LB_ERR) return FALSE; + if (index != 0) + { + Lang *lang = pNppParam->getLangFromIndex(index - 1); + if (!lang) return FALSE; + if (!lang->_tabSize || lang->_tabSize == -1) + lang->_tabSize = nppGUI._tabSize; + + if (lang->_langID == L_JS) + { + Lang *ljs = pNppParam->getLangFromID(L_JAVASCRIPT); + ljs->_isTabReplacedBySpace = isTabReplacedBySpace; + } + else if (lang->_langID == L_JAVASCRIPT) + { + Lang *ljavascript = pNppParam->getLangFromID(L_JS); + ljavascript->_isTabReplacedBySpace = isTabReplacedBySpace; + } + + lang->_isTabReplacedBySpace = isTabReplacedBySpace; + + // write in langs.xml + pNppParam->insertTabInfo(lang->getLangName(), lang->getTabInfo()); + } + else + { + nppGUI._tabReplacedBySpace = isTabReplacedBySpace; + } + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETTING_TAB_REPLCESPACE, 0, 0); + return TRUE; + } + + case IDC_CHECK_DEFAULTTABVALUE: + { + bool useDefaultTab = BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), BM_GETCHECK, 0, 0); + auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0); + if (index == LB_ERR || index == 0) // index == 0 shouldn't happen + return FALSE; + + Lang *lang = pNppParam->getLangFromIndex(index - 1); + if (!lang) + return FALSE; + + //- Set tab setting in choosed language + lang->_tabSize = useDefaultTab ? 0 : nppGUI._tabSize; + lang->_isTabReplacedBySpace = useDefaultTab ? false : nppGUI._tabReplacedBySpace; + + //- set visual effect + ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), !useDefaultTab); + ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, useDefaultTab ? nppGUI._tabSize : lang->_tabSize, FALSE); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), useDefaultTab); + ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab); + ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, useDefaultTab ? nppGUI._tabReplacedBySpace : lang->_isTabReplacedBySpace, 0); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), !useDefaultTab); + + // write in langs.xml + if (useDefaultTab) + pNppParam->insertTabInfo(lang->getLangName(), -1); + + return TRUE; + } } } } @@ -1841,24 +1916,35 @@ INT_PTR CALLBACK TabSettings::run_dlgProc(UINT message, WPARAM wParam, LPARAM/* { case WM_INITDIALOG : { - ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, nppGUI._tabSize, FALSE); + ::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); - _tabSizeVal.init(_hInst, _hSelf); - _tabSizeVal.create(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), IDC_TABSIZEVAL_STATIC); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_REPLACEBYSPACE, BM_SETCHECK, nppGUI._tabReplacedBySpace, 0); + ::SendDlgItemMessage(_hSelf, IDC_COMBO_SMARTHILITEMODE, CB_ADDSTRING, 0, (LPARAM)TEXT("Match whole word only")); + ::SendDlgItemMessage(_hSelf, IDC_COMBO_SMARTHILITEMODE, CB_ADDSTRING, 0, (LPARAM)TEXT("Match any selection")); + ::SendDlgItemMessage(_hSelf, IDC_COMBO_SMARTHILITEMODE, CB_ADDSTRING, 0, (LPARAM)TEXT("Same as Find dialog")); - int nbLang = pNppParam->getNbLang(); - ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast(TEXT("[Default]"))); - for (int i = 0 ; i < nbLang ; ++i) - { - ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, reinterpret_cast(pNppParam->getLangFromIndex(i)->_langName.c_str())); - } - const int index2Begin = 0; - ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_SETCURSEL, 0, index2Begin); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_GR_TABVALUE_STATIC), SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), SW_HIDE); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), FALSE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE); + switch (nppGUI._smartHiliteMode) + { + case NppGUI::SmartHiliteMode::wordOnly: + ::SendMessage(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), CB_SETCURSEL, 0, 0); + break; + + case NppGUI::SmartHiliteMode::anySelection: + ::SendMessage(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), CB_SETCURSEL, 1, 0); + break; + + case NppGUI::SmartHiliteMode::findDialog: + ::SendMessage(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), CB_SETCURSEL, 2, 0); + break; + } + + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE), nppGUI._enableTagsMatchHilite); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE), nppGUI._enableTagsMatchHilite); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), nppGUI._enableSmartHilite); ETDTProc enableDlgTheme = reinterpret_cast(pNppParam->getEnableThemeDlgTexture()); if (enableDlgTheme) @@ -1870,168 +1956,90 @@ INT_PTR CALLBACK TabSettings::run_dlgProc(UINT message, WPARAM wParam, LPARAM/* { if (HIWORD(wParam) == LBN_SELCHANGE) { - if (LOWORD(wParam) == IDC_LIST_TABSETTNG) + switch (LOWORD(wParam)) { - auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0); - if (index == LB_ERR) - return FALSE; - ::ShowWindow(::GetDlgItem(_hSelf, IDC_GR_TABVALUE_STATIC), index?SW_SHOW:SW_HIDE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), index?SW_SHOW:SW_HIDE); - - if (index) + case IDC_COMBO_SMARTHILITEMODE: { - Lang *lang = pNppParam->getLangFromIndex(index - 1); - if (!lang) return FALSE; - bool useDefaultTab = (lang->_tabSize == -1 || lang->_tabSize == 0); - - ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), BM_SETCHECK, useDefaultTab, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), !useDefaultTab); + auto index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_SMARTHILITEMODE, CB_GETCURSEL, 0, 0); - int size = useDefaultTab?nppGUI._tabSize:lang->_tabSize; - ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, size, FALSE); - ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC, size, FALSE); + switch (index) + { + case 0: + nppGUI._smartHiliteMode = NppGUI::SmartHiliteMode::wordOnly; + break; - ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), useDefaultTab); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab); - ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, useDefaultTab?nppGUI._tabReplacedBySpace:lang->_isTabReplacedBySpace, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), !useDefaultTab); + case 1: + nppGUI._smartHiliteMode = NppGUI::SmartHiliteMode::anySelection; + break; - if (!useDefaultTab) - { - ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, lang->_tabSize, FALSE); - ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, lang->_isTabReplacedBySpace, 0); + case 2: + nppGUI._smartHiliteMode = NppGUI::SmartHiliteMode::findDialog; + break; } - } - else - { - ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), TRUE); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), TRUE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), SW_SHOW); - ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, nppGUI._tabSize, FALSE); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), TRUE); - ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, nppGUI._tabReplacedBySpace, 0); + + return TRUE; } - return TRUE; + default: + break; } } switch (wParam) { - case IDC_TABSIZEVAL_STATIC: + case IDC_CHECK_ENABLSMARTHILITE: { - ValueDlg tabSizeDlg; - tabSizeDlg.init(_hInst, _hParent, nppGUI._tabSize, TEXT("Tab Size : ")); - POINT p; - ::GetCursorPos(&p); - int size = tabSizeDlg.doDialog(p); - - //Tab size 0 removal - if (size <= 0) return FALSE; - - ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, size, FALSE); - ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC, size, FALSE); - - auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0); - if (index == LB_ERR) return FALSE; - - if (index != 0) - { - Lang *lang = pNppParam->getLangFromIndex(index - 1); - if (!lang) return FALSE; - if (lang->_langID == L_JS) - { - Lang *ljs = pNppParam->getLangFromID(L_JAVASCRIPT); - ljs->_tabSize = size; - } - else if (lang->_langID == L_JAVASCRIPT) - { - Lang *ljavascript = pNppParam->getLangFromID(L_JS); - ljavascript->_tabSize = size; - } - - lang->_tabSize = size; - - // write in langs.xml - pNppParam->insertTabInfo(lang->getLangName(), lang->getTabInfo()); - } - else - { - nppGUI._tabSize = size; - } - - ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETTING_TAB_SIZE, 0, 0); + nppGUI._enableSmartHilite = !nppGUI._enableSmartHilite; + if (!nppGUI._enableSmartHilite) + { + HWND grandParent = ::GetParent(_hParent); + ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0); + } + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_COMBO_SMARTHILITEMODE), nppGUI._enableSmartHilite); return TRUE; } - case IDC_CHECK_REPLACEBYSPACE: - { - bool isTabReplacedBySpace = BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_GETCHECK, 0, 0); - auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0); - if (index == LB_ERR) return FALSE; - if (index != 0) - { - Lang *lang = pNppParam->getLangFromIndex(index - 1); - if (!lang) return FALSE; - if (!lang->_tabSize || lang->_tabSize == -1) - lang->_tabSize = nppGUI._tabSize; - - if (lang->_langID == L_JS) - { - Lang *ljs = pNppParam->getLangFromID(L_JAVASCRIPT); - ljs->_isTabReplacedBySpace = isTabReplacedBySpace; - } - else if (lang->_langID == L_JAVASCRIPT) - { - Lang *ljavascript = pNppParam->getLangFromID(L_JS); - ljavascript->_isTabReplacedBySpace = isTabReplacedBySpace; - } - - lang->_isTabReplacedBySpace = isTabReplacedBySpace; - - // write in langs.xml - pNppParam->insertTabInfo(lang->getLangName(), lang->getTabInfo()); - } - else - { - nppGUI._tabReplacedBySpace = isTabReplacedBySpace; - } - ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_SETTING_TAB_REPLCESPACE, 0, 0); + 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_DEFAULTTABVALUE: - { - bool useDefaultTab = BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_DEFAULTTABVALUE), BM_GETCHECK, 0, 0); - auto index = ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_GETCURSEL, 0, 0); - if (index == LB_ERR || index == 0) // index == 0 shouldn't happen - return FALSE; - - Lang *lang = pNppParam->getLangFromIndex(index - 1); - if (!lang) - return FALSE; - - //- Set tab setting in choosed language - lang->_tabSize = useDefaultTab?0:nppGUI._tabSize; - lang->_isTabReplacedBySpace = useDefaultTab?false:nppGUI._tabReplacedBySpace; + } - //- set visual effect - ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZE_STATIC), !useDefaultTab); - ::SetDlgItemInt(_hSelf, IDC_TABSIZEVAL_STATIC, useDefaultTab?nppGUI._tabSize:lang->_tabSize, FALSE); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), useDefaultTab); - ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_STATIC), !useDefaultTab); - ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), BM_SETCHECK, useDefaultTab?nppGUI._tabReplacedBySpace:lang->_isTabReplacedBySpace, 0); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_REPLACEBYSPACE), !useDefaultTab); + case IDC_CHECK_ENABLTAGSMATCHHILITE: + { + nppGUI._enableTagsMatchHilite = !nppGUI._enableTagsMatchHilite; + if (!nppGUI._enableTagsMatchHilite) + { + HWND grandParent = ::GetParent(_hParent); + ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATORTAGMATCH, 0, 0); + } + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE), nppGUI._enableTagsMatchHilite); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_HIGHLITENONEHTMLZONE), nppGUI._enableTagsMatchHilite); + return TRUE; + } - // write in langs.xml - if (useDefaultTab) - pNppParam->insertTabInfo(lang->getLangName(), -1); + case IDC_CHECK_ENABLTAGATTRHILITE: + { + nppGUI._enableTagAttrsHilite = !nppGUI._enableTagAttrsHilite; + if (!nppGUI._enableTagAttrsHilite) + { + HWND grandParent = ::GetParent(_hParent); + ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATORTAGATTR, 0, 0); + } + return TRUE; + } - return TRUE; - } + case IDC_CHECK_HIGHLITENONEHTMLZONE: + { + nppGUI._enableHiliteNonHTMLZone = !nppGUI._enableHiliteNonHTMLZone; + return TRUE; + } } } } diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index 8d6a50a65..adac760b7 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -117,9 +117,13 @@ class LangMenuDlg : public StaticDialog { public : LangMenuDlg() {}; + virtual void destroy() { + _tabSizeVal.destroy(); + }; private : LexerStylerArray _lsArray; + URLCtrl _tabSizeVal; INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); std::vector _langList; }; @@ -128,12 +132,9 @@ class TabSettings : public StaticDialog { public : TabSettings() {}; - virtual void destroy() { - _tabSizeVal.destroy(); - }; private : - URLCtrl _tabSizeVal; + INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam); };