From 6755daf223299ffcd49a8b6ca233c79627578f05 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Thu, 20 Oct 2022 05:07:17 +0200 Subject: [PATCH] Enhance Large File Restriction UI 1. Rename some labels to be more explicit. 2. Add a tooltip for "Deactivate Word Wrap globally". 3. Unchecking "Enable Large File Restriction" removes the sub-restrictions. --- PowerEditor/installer/nativeLang/english.xml | 5 +- PowerEditor/installer/nativeLang/french.xml | 5 +- .../nativeLang/taiwaneseMandarin.xml | 5 +- PowerEditor/src/Notepad_plus.cpp | 3 +- PowerEditor/src/NppNotification.cpp | 11 ++-- PowerEditor/src/Parameters.cpp | 50 +++++++++---------- PowerEditor/src/Parameters.h | 7 +-- PowerEditor/src/ScintillaComponent/Buffer.cpp | 25 ++++++++-- PowerEditor/src/ScintillaComponent/Buffer.h | 4 ++ .../xmlMatchedTagsHighlighter.cpp | 2 +- .../src/WinControls/Preference/preference.rc | 6 +-- .../WinControls/Preference/preferenceDlg.cpp | 42 ++++++++-------- .../WinControls/Preference/preferenceDlg.h | 3 ++ .../WinControls/Preference/preference_rc.h | 2 +- 14 files changed, 99 insertions(+), 71 deletions(-) diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 4a47c1559..bfcb410f3 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1159,13 +1159,13 @@ You can define several column markers by using white space to separate the diffe - + - + @@ -1607,6 +1607,7 @@ Find in all files but exclude all folders log or logs recursively: + diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml index 7d062ed18..d86d8d982 100644 --- a/PowerEditor/installer/nativeLang/french.xml +++ b/PowerEditor/installer/nativeLang/french.xml @@ -1159,13 +1159,13 @@ Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour - + - + @@ -1608,6 +1608,7 @@ Rechercher dans tous les fichiers mais pas dans les dossiers log ou logs récurs + diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml index 1e2f3a17b..80bd27c71 100644 --- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml +++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml @@ -1144,13 +1144,13 @@ - + - + @@ -1549,6 +1549,7 @@ + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index cb97ef138..04d4d7c4e 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2584,8 +2584,7 @@ void Notepad_plus::findMatchingBracePos(intptr_t& braceAtCaret, intptr_t& braceO bool Notepad_plus::braceMatch() { Buffer* currentBuf = _pEditView->getCurrentBuffer(); - const NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); - if (currentBuf->isLargeFile() && !nppGui._largeFileLimit._allowBraceMatch) + if (!currentBuf->allowBraceMach()) return false; intptr_t braceAtCaret = -1; diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index ecb86695e..6e5140a02 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -676,7 +676,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) maintainIndentation(static_cast(notification->ch)); Buffer* currentBuf = _pEditView->getCurrentBuffer(); - if (!currentBuf->isLargeFile() || nppGui._largeFileLimit._allowAutoCompletion) + if (currentBuf->allowAutoCompletion()) { AutoCompletion* autoC = isFromPrimary ? &_autoCompleteMain : &_autoCompleteSub; bool isColumnMode = _pEditView->execute(SCI_GETSELECTIONS) > 1; // Multi-Selection || Column mode) @@ -883,8 +883,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) break; Buffer* currentBuf = _pEditView->getCurrentBuffer(); - - if (notification->nmhdr.hwndFrom != _pEditView->getHSelf() && (!currentBuf->isLargeFile() || nppGui._largeFileLimit._allowSmartHilite)) // notification come from unfocus view - both views ae visible + if (notification->nmhdr.hwndFrom != _pEditView->getHSelf() && currentBuf->allowSmartHilite()) // notification come from unfocus view - both views ae visible { if (nppGui._smartHiliteOnAnotherView) { @@ -897,13 +896,13 @@ BOOL Notepad_plus::notify(SCNotification *notification) braceMatch(); - if (nppGui._enableTagsMatchHilite && !currentBuf->isLargeFile()) + if (nppGui._enableTagsMatchHilite) { XmlMatchedTagsHighlighter xmlTagMatchHiliter(_pEditView); xmlTagMatchHiliter.tagMatch(nppGui._enableTagAttrsHilite); } - - if (nppGui._enableSmartHilite && (!currentBuf->isLargeFile() || nppGui._largeFileLimit._allowSmartHilite)) + + if (nppGui._enableSmartHilite && !currentBuf->allowSmartHilite()) { if (nppGui._disableSmartHiliteTmp) nppGui._disableSmartHiliteTmp = false; diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 8df703216..e247d05f8 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -5387,42 +5387,42 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) else _nppGUI._delimiterSelectionOnEntireDocument = false; } - else if (!lstrcmp(nm, TEXT("largeFileLimit"))) + else if (!lstrcmp(nm, TEXT("largeFileRestriction"))) { int fileSizeLimit4StylingMB = 0; element->Attribute(TEXT("fileSizeMB"), &fileSizeLimit4StylingMB); if (fileSizeLimit4StylingMB > 0 && fileSizeLimit4StylingMB < 4096) - _nppGUI._largeFileLimit._largeFileSizeDefInByte = (fileSizeLimit4StylingMB * 1024 * 1024); + _nppGUI._largeFileRestriction._largeFileSizeDefInByte = (fileSizeLimit4StylingMB * 1024 * 1024); const TCHAR* boolVal = element->Attribute(TEXT("isEnabled")); - if (boolVal != NULL && !lstrcmp(boolVal, TEXT("yes"))) - _nppGUI._largeFileLimit._isEnabled = true; + if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no"))) + _nppGUI._largeFileRestriction._isEnabled = false; else - _nppGUI._largeFileLimit._isEnabled = false; + _nppGUI._largeFileRestriction._isEnabled = true; boolVal = element->Attribute(TEXT("allowAutoCompletion")); - if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no"))) - _nppGUI._largeFileLimit._allowAutoCompletion = false; + if (boolVal != NULL && !lstrcmp(boolVal, TEXT("yes"))) + _nppGUI._largeFileRestriction._allowAutoCompletion = true; else - _nppGUI._largeFileLimit._allowAutoCompletion = true; + _nppGUI._largeFileRestriction._allowAutoCompletion = false; boolVal = element->Attribute(TEXT("allowBraceMatch")); - if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no"))) - _nppGUI._largeFileLimit._allowBraceMatch = false; + if (boolVal != NULL && !lstrcmp(boolVal, TEXT("yes"))) + _nppGUI._largeFileRestriction._allowBraceMatch = true; else - _nppGUI._largeFileLimit._allowBraceMatch = true; + _nppGUI._largeFileRestriction._allowBraceMatch = false; boolVal = element->Attribute(TEXT("allowSmartHilite")); - if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no"))) - _nppGUI._largeFileLimit._allowSmartHilite = false; + if (boolVal != NULL && !lstrcmp(boolVal, TEXT("yes"))) + _nppGUI._largeFileRestriction._allowSmartHilite = true; else - _nppGUI._largeFileLimit._allowSmartHilite = true; + _nppGUI._largeFileRestriction._allowSmartHilite = false; - boolVal = element->Attribute(TEXT("allowWordWrap")); + boolVal = element->Attribute(TEXT("deactivateWordWrap")); if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no"))) - _nppGUI._largeFileLimit._allowWordWrap = false; + _nppGUI._largeFileRestriction._deactivateWordWrap = false; else - _nppGUI._largeFileLimit._allowWordWrap = true; + _nppGUI._largeFileRestriction._deactivateWordWrap = true; } else if (!lstrcmp(nm, TEXT("multiInst"))) { @@ -6644,16 +6644,16 @@ void NppParameters::createXmlTreeFromGUIParams() GUIConfigElement->SetAttribute(TEXT("delimiterSelectionOnEntireDocument"), _nppGUI._delimiterSelectionOnEntireDocument ? TEXT("yes") : TEXT("no")); } - // + // { TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); - GUIConfigElement->SetAttribute(TEXT("name"), TEXT("largeFileLimit")); - GUIConfigElement->SetAttribute(TEXT("fileSizeMB"), static_cast((_nppGUI._largeFileLimit._largeFileSizeDefInByte / 1024) / 1024)); - GUIConfigElement->SetAttribute(TEXT("isEnabled"), _nppGUI._largeFileLimit._isEnabled ? TEXT("yes") : TEXT("no")); - GUIConfigElement->SetAttribute(TEXT("allowAutoCompletion"), _nppGUI._largeFileLimit._allowAutoCompletion ? TEXT("yes") : TEXT("no")); - GUIConfigElement->SetAttribute(TEXT("allowBraceMatch"), _nppGUI._largeFileLimit._allowBraceMatch ? TEXT("yes") : TEXT("no")); - GUIConfigElement->SetAttribute(TEXT("allowSmartHilite"), _nppGUI._largeFileLimit._allowSmartHilite ? TEXT("yes") : TEXT("no")); - GUIConfigElement->SetAttribute(TEXT("allowWordWrap"), _nppGUI._largeFileLimit._allowWordWrap ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("name"), TEXT("largeFileRestriction")); + GUIConfigElement->SetAttribute(TEXT("fileSizeMB"), static_cast((_nppGUI._largeFileRestriction._largeFileSizeDefInByte / 1024) / 1024)); + GUIConfigElement->SetAttribute(TEXT("isEnabled"), _nppGUI._largeFileRestriction._isEnabled ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("allowAutoCompletion"), _nppGUI._largeFileRestriction._allowAutoCompletion ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("allowBraceMatch"), _nppGUI._largeFileRestriction._allowBraceMatch ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("allowSmartHilite"), _nppGUI._largeFileRestriction._allowSmartHilite ? TEXT("yes") : TEXT("no")); + GUIConfigElement->SetAttribute(TEXT("deactivateWordWrap"), _nppGUI._largeFileRestriction._deactivateWordWrap ? TEXT("yes") : TEXT("no")); } // diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index ceb4c0d3b..d660f1ebc 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -723,15 +723,16 @@ struct DarkModeConf final }; -struct LargeFileLimitSettings final +struct LargeFileRestriction final { int64_t _largeFileSizeDefInByte = NPP_STYLING_FILESIZE_LIMIT_DEFAULT; bool _isEnabled = true; + bool _deactivateWordWrap = true; + bool _allowBraceMatch = false; bool _allowAutoCompletion = false; bool _allowSmartHilite = false; - bool _allowWordWrap = false; }; struct NppGUI final @@ -905,7 +906,7 @@ struct NppGUI final DarkModeConf _darkmode; DarkModeConf _darkmodeplugins; - LargeFileLimitSettings _largeFileLimit; + LargeFileRestriction _largeFileRestriction; }; diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp index 59e0327d4..5629a680e 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp @@ -544,6 +544,23 @@ void Buffer::setDeferredReload() // triggers a reload on the next Document acces doNotify(BufferChangeDirty); } +bool Buffer::allowBraceMach() const +{ + NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); + return (!_isLargeFile || nppGui._largeFileRestriction._allowBraceMatch) || !nppGui._largeFileRestriction._isEnabled; +} + +bool Buffer::allowAutoCompletion() const +{ + NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); + return (!_isLargeFile || nppGui._largeFileRestriction._allowAutoCompletion) || !nppGui._largeFileRestriction._isEnabled; +} + +bool Buffer::allowSmartHilite() const +{ + NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); + return (!_isLargeFile || nppGui._largeFileRestriction._allowSmartHilite) || !nppGui._largeFileRestriction._isEnabled; +} //filemanager @@ -672,11 +689,11 @@ BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding // * the backups on save feature will be disabled for large files NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); bool isLargeFile = false; - if (nppGui._largeFileLimit._isEnabled) - isLargeFile = fileSize >= nppGui._largeFileLimit._largeFileSizeDefInByte; + if (nppGui._largeFileRestriction._isEnabled) + isLargeFile = fileSize >= nppGui._largeFileRestriction._largeFileSizeDefInByte; // Due to the performance issue, the Word Wrap feature will be disabled if it's ON - if (isLargeFile && !nppGui._largeFileLimit._allowWordWrap) + if (isLargeFile && nppGui._largeFileRestriction._deactivateWordWrap) { bool isWrap = _pNotepadPlus->_pEditView->isWrap(); if (isWrap) @@ -1530,7 +1547,7 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil fileFormat._encoding = detectCodepage(data, lenFile); } - bool isLargeFile = fileSize >= nppGui._largeFileLimit._largeFileSizeDefInByte; + bool isLargeFile = fileSize >= nppGui._largeFileRestriction._largeFileSizeDefInByte; if (!isLargeFile && fileFormat._language == L_TEXT) { // check the language du fichier diff --git a/PowerEditor/src/ScintillaComponent/Buffer.h b/PowerEditor/src/ScintillaComponent/Buffer.h index c2b93ba31..f777eee36 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.h +++ b/PowerEditor/src/ScintillaComponent/Buffer.h @@ -315,6 +315,10 @@ public: void langHasBeenSetFromMenu() { _hasLangBeenSetFromMenu = true; }; + bool allowBraceMach() const; + bool allowAutoCompletion() const; + bool allowSmartHilite() const; + private: int indexOfReference(const ScintillaEditView * identifier) const; diff --git a/PowerEditor/src/ScintillaComponent/xmlMatchedTagsHighlighter.cpp b/PowerEditor/src/ScintillaComponent/xmlMatchedTagsHighlighter.cpp index 63049a8d9..4e24051b9 100644 --- a/PowerEditor/src/ScintillaComponent/xmlMatchedTagsHighlighter.cpp +++ b/PowerEditor/src/ScintillaComponent/xmlMatchedTagsHighlighter.cpp @@ -620,7 +620,7 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr) XmlMatchedTagsPos xmlTags; - // Detect if it's a xml/html tag. If yes, Colour it! + // Detect if it's a xml/html tag. If yes, Colorize it if (getXmlMatchedTagsPos(xmlTags)) { _pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_TAGMATCH); diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index b60f92718..75723f39a 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -480,14 +480,14 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Large File Restriction",IDC_GROUPSTATIC_PERFORMANCE_RESTRICTION,73,7,301,151,BS_CENTER LTEXT "While opening a large file, some features are turned off for optimizing the performance. You can customize them here.",IDC_STATIC_PERFORMANCE_TIP,90,19,280,16 - CONTROL "Enable Large File Restriction",IDC_CHECK_PERFORMANCE_ENABLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,100,41,210,10 + CONTROL "Enable Large File Restriction (no syntax highlighting)",IDC_CHECK_PERFORMANCE_ENABLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,100,41,260,10 RTEXT "Define Large File Size:",IDC_STATIC_PERFORMANCE_FILESIZE,75,59,125,8 EDITTEXT IDC_EDIT_PERFORMANCE_FILESIZE,201,57,24,14,ES_RIGHT | ES_NUMBER LTEXT "MB (1 - 4096)",IDC_STATIC_PERFORMANCE_MB,228,59,90,8 - CONTROL "Allow Brace Match",IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,127,80,200,10 + CONTROL "Deactivate Word Wrap globally", IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP, 127, 80, 200, 10 CONTROL "Allow Auto-Completion",IDC_CHECK_PERFORMANCE_ALLOWAUTOCOMPLETION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,95,200,10 CONTROL "Allow Smart Highlighting",IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,110,200,10 - CONTROL "Allow Word Wrap",IDC_CHECK_PERFORMANCE_ALLOWWORDWRAP,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,127,125,200,10 + CONTROL "Allow Brace Match", IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH, "Button", BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP, 127, 125, 200, 10 END IDD_PREFERENCE_SUB_MISC DIALOGEX 0, 0, 455, 200 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 69679987a..b4abd5d05 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -4884,7 +4884,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L ::SetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, UINT(fileLenInMB), FALSE); } - nppGUI._largeFileLimit._largeFileSizeDefInByte = fileLenInMB * 1024 * 1024; + nppGUI._largeFileRestriction._largeFileSizeDefInByte = fileLenInMB * 1024 * 1024; } return TRUE; } @@ -4922,26 +4922,28 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L { case WM_INITDIALOG: { - int64_t fileLenInMB = (nppGUI._largeFileLimit._largeFileSizeDefInByte / 1024) / 1024; + int64_t fileLenInMB = (nppGUI._largeFileRestriction._largeFileSizeDefInByte / 1024) / 1024; ::SetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, UINT(fileLenInMB), FALSE); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ENABLE, BM_SETCHECK, nppGUI._largeFileLimit._isEnabled ? BST_CHECKED : BST_UNCHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH, BM_SETCHECK, nppGUI._largeFileLimit._allowBraceMatch ? BST_CHECKED : BST_UNCHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWAUTOCOMPLETION, BM_SETCHECK, nppGUI._largeFileLimit._allowAutoCompletion ? BST_CHECKED : BST_UNCHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE, BM_SETCHECK, nppGUI._largeFileLimit._allowSmartHilite ? BST_CHECKED : BST_UNCHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWWORDWRAP, BM_SETCHECK, nppGUI._largeFileLimit._allowWordWrap ? BST_CHECKED : BST_UNCHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ENABLE, BM_SETCHECK, nppGUI._largeFileRestriction._isEnabled ? BST_CHECKED : BST_UNCHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH, BM_SETCHECK, nppGUI._largeFileRestriction._allowBraceMatch ? BST_CHECKED : BST_UNCHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWAUTOCOMPLETION, BM_SETCHECK, nppGUI._largeFileRestriction._allowAutoCompletion ? BST_CHECKED : BST_UNCHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE, BM_SETCHECK, nppGUI._largeFileRestriction._allowSmartHilite ? BST_CHECKED : BST_UNCHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP, BM_SETCHECK, nppGUI._largeFileRestriction._deactivateWordWrap ? BST_CHECKED : BST_UNCHECKED, 0); bool largeFileRestrictionEnabled = isCheckedOrNot(IDC_CHECK_PERFORMANCE_ENABLE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWAUTOCOMPLETION), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE), largeFileRestrictionEnabled); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWWORDWRAP), largeFileRestrictionEnabled); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP), largeFileRestrictionEnabled); NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker(); - generic_string checkboxTip = pNativeSpeaker->getLocalizedStrFromID("enable-disable-largeFileRestriction-tip", TEXT("Toggling \"Enable Large File Restriction\" takes effect only after closing and re-opening the large file")); - generic_string editTip = pNativeSpeaker->getLocalizedStrFromID("change-largeFileRestriction_fileLength-tip", TEXT("Modifying file size value takes effect only after closing and re-opening the large file")); - _enableLargeFileRestrictionTip = CreateToolTip(IDC_CHECK_PERFORMANCE_ENABLE, _hSelf, _hInst, const_cast(checkboxTip.c_str()), false); - _changeLargeFileLengthTip = CreateToolTip(IDC_EDIT_PERFORMANCE_FILESIZE, _hSelf, _hInst, const_cast(editTip.c_str()), false); + generic_string enablePerfTip = pNativeSpeaker->getLocalizedStrFromID("enable-disable-largeFileRestriction-tip", TEXT("Toggling \"Enable Large File Restriction\" takes effect only after closing and re-opening the large file")); + generic_string fileLenTip = pNativeSpeaker->getLocalizedStrFromID("change-largeFileRestriction_fileLength-tip", TEXT("Modifying file size value takes effect only after closing and re-opening the large file")); + generic_string wordWrapLenTip = pNativeSpeaker->getLocalizedStrFromID("largeFileRestriction_wordWrap-tip", TEXT("Enabling \"Deactivate Word Wrap globally\" option will deactivate Word Wrap for all opened documents after opening a large file. You can reactivate Word Wrap feature manually.")); + _enableLargeFileRestrictionTip = CreateToolTip(IDC_CHECK_PERFORMANCE_ENABLE, _hSelf, _hInst, const_cast(enablePerfTip.c_str()), false); + _changeLargeFileLengthTip = CreateToolTip(IDC_EDIT_PERFORMANCE_FILESIZE, _hSelf, _hInst, const_cast(fileLenTip.c_str()), false); + _deactivateWordWrapTip = CreateToolTip(IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP, _hSelf, _hInst, const_cast(wordWrapLenTip.c_str()), false); } break; @@ -5003,13 +5005,13 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L case IDC_CHECK_PERFORMANCE_ENABLE: { bool largeFileRestrictionEnabled = isCheckedOrNot(IDC_CHECK_PERFORMANCE_ENABLE); - nppGUI._largeFileLimit._isEnabled = largeFileRestrictionEnabled; + nppGUI._largeFileRestriction._isEnabled = largeFileRestrictionEnabled; ::EnableWindow(::GetDlgItem(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWAUTOCOMPLETION), largeFileRestrictionEnabled); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE), largeFileRestrictionEnabled); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_ALLOWWORDWRAP), largeFileRestrictionEnabled); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP), largeFileRestrictionEnabled); redraw(); } @@ -5018,7 +5020,7 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L case IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH: { bool isAllowed = isCheckedOrNot(int(wParam)); - nppGUI._largeFileLimit._allowBraceMatch = isAllowed; + nppGUI._largeFileRestriction._allowBraceMatch = isAllowed; if (!isAllowed) ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_CLEANBRACEMATCH, 0, 0); } @@ -5027,23 +5029,23 @@ intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, L case IDC_CHECK_PERFORMANCE_ALLOWAUTOCOMPLETION: { bool isAllowed = isCheckedOrNot(int(wParam)); - nppGUI._largeFileLimit._allowAutoCompletion = isAllowed; + nppGUI._largeFileRestriction._allowAutoCompletion = isAllowed; } return TRUE; case IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE: { bool isAllowed = isCheckedOrNot(int(wParam)); - nppGUI._largeFileLimit._allowSmartHilite = isAllowed; + nppGUI._largeFileRestriction._allowSmartHilite = isAllowed; if (!isAllowed) ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_CLEANSMARTHILITING, 0, 0); } return TRUE; - case IDC_CHECK_PERFORMANCE_ALLOWWORDWRAP: + case IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP: { - bool isAllowed = isCheckedOrNot(int(wParam)); - nppGUI._largeFileLimit._allowWordWrap = isAllowed; + bool isDeactivated = isCheckedOrNot(int(wParam)); + nppGUI._largeFileRestriction._deactivateWordWrap = isDeactivated; } return TRUE; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h index 0f635006a..fa8618ae0 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h @@ -262,6 +262,8 @@ public : ::DestroyWindow(_enableLargeFileRestrictionTip); if (_changeLargeFileLengthTip) ::DestroyWindow(_changeLargeFileLengthTip); + if (_deactivateWordWrapTip) + ::DestroyWindow(_deactivateWordWrapTip); }; private : @@ -269,6 +271,7 @@ private : HWND _enableLargeFileRestrictionTip = nullptr; HWND _changeLargeFileLengthTip = nullptr; + HWND _deactivateWordWrapTip = nullptr; }; class PreferenceDlg : public StaticDialog diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index bba5e784f..01ecba8b7 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -445,5 +445,5 @@ #define IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH (IDD_PREFERENCE_SUB_PERFORMANCE + 7) #define IDC_CHECK_PERFORMANCE_ALLOWAUTOCOMPLETION (IDD_PREFERENCE_SUB_PERFORMANCE + 8) #define IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE (IDD_PREFERENCE_SUB_PERFORMANCE + 9) - #define IDC_CHECK_PERFORMANCE_ALLOWWORDWRAP (IDD_PREFERENCE_SUB_PERFORMANCE + 10) + #define IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP (IDD_PREFERENCE_SUB_PERFORMANCE + 10) #endif //PREFERENCE_RC_H