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.
This commit is contained in:
Don Ho 2022-10-20 05:07:17 +02:00
parent 546745fe34
commit 6755daf223
14 changed files with 99 additions and 71 deletions

View File

@ -1159,13 +1159,13 @@ You can define several column markers by using white space to separate the diffe
<Performance title="Performance">
<Item id="7141" name="Large File Restriction"/>
<Item id="7142" name="While opening a large file, some features are turned off for optimizing the performance. You can customize them here."/>
<Item id="7143" name="Enable Large File Restriction"/>
<Item id="7143" name="Enable Large File Restriction (no syntax highlighting)"/>
<Item id="7144" name="Define Large File Size:"/>
<Item id="7146" name="MB (1 - 4096)"/>
<Item id="7147" name="Allow Brace Match"/>
<Item id="7148" name="Allow Auto-Completion"/>
<Item id="7149" name="Allow Smart Highlighting"/>
<Item id="7150" name="Allow Word Wrap"/>
<Item id="7150" name="Deactivate Word Wrap globally"/>
</Performance>
<Cloud title="Cloud &amp; Link">
@ -1607,6 +1607,7 @@ Find in all files but exclude all folders log or logs recursively:
<contextMenu-clearStyle value="Clear style" />
<enable-disable-largeFileRestriction-tip value="Toggling &quot;Enable Large File Restriction&quot; takes effect only after closing and re-opening the large file" />
<change-largeFileRestriction_fileLength-tip value="Modifying file size value takes effect only after closing and re-opening the large file" />
<largeFileRestriction_wordWrap-tip value="Enabling &quot;Deactivate Word Wrap globally&quot; option will deactivate Word Wrap for all opened documents after opening a large file. You can reactivate Word Wrap feature manually." />
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -1159,13 +1159,13 @@ Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour
<Performance title="Performance">
<Item id="7141" name="Restriction des fichiers volumineux"/>
<Item id="7142" name="Lors de l'ouverture d'un fichier volumineux, certaines fonctionnalités sont désactivées pour optimiser les performances. Vous pouvez les personnaliser ici."/>
<Item id="7143" name="Activer la restriction des fichiers volumineux"/>
<Item id="7143" name="Activer la restriction des fichiers volumineux (pas de coloration syntaxique)"/>
<Item id="7144" name="Définir la taille du fichier volumineux :"/>
<Item id="7146" name="Mo (1 - 4096)"/>
<Item id="7147" name="Permettre de colorer délimiteur symétrique"/>
<Item id="7148" name="Permettre d'activer la complétion automatique"/>
<Item id="7149" name="Permettre d'activer le coloriage automatique"/>
<Item id="7150" name="Permettre d'activer le retour automatique à la ligne"/>
<Item id="7150" name="Désactiver le retour automatique à la ligne globalement"/>
</Performance>
<Cloud title="Cloud &amp; Lien">
@ -1608,6 +1608,7 @@ Rechercher dans tous les fichiers mais pas dans les dossiers log ou logs récurs
<contextMenu-PluginCommands value="Modules d'extension" />
<enable-disable-largeFileRestriction-tip value="Basculer &quot;Activer la restriction des fichiers volumineux&quot; ne prend effet qu'après la fermeture et la réouverture du fichier volumineux" />
<change-largeFileRestriction_fileLength-tip value="La modification de la valeur de la taille du fichier ne prend effet qu'après la fermeture et la réouverture du fichier volumineux" />
<largeFileRestriction_wordWrap-tip value="L'activation de l'option &quot;Désactiver Retour automatique à la ligne globalement&quot; désactivera « Retour automatique à la ligne » pour tous les documents ouverts après l'ouverture d'un fichier volumineux. Vous pouvez réactiver la fonctionnalité « Retour automatique à la ligne » manuellement." />
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -1144,13 +1144,13 @@
<Performance title="性能">
<Item id="7141" name="大型檔案限制"/>
<Item id="7142" name="在開啟大型文件時,為了優化性能,一些功能會被關閉。 你可以在此處自開啟它們。"/>
<Item id="7143" name="啟動大型檔案限制"/>
<Item id="7143" name="啟動大型檔案限制(沒有語法醒目提示)"/>
<Item id="7144" name="定義大型檔案文件長度大小:"/>
<Item id="7146" name="MB (1 - 4096)"/>
<Item id="7147" name="允許顏色顯示對應括號"/>
<Item id="7148" name="允許自動完成功能"/>
<Item id="7149" name="允許智慧醒目提示"/>
<Item id="7150" name="允許自動換行"/>
<Item id="7150" name="停用自動換行"/>
</Performance>
<Cloud title="雲端與連結">
@ -1549,6 +1549,7 @@
<contextMenu-PluginCommands value="外掛模組" />
<enable-disable-largeFileRestriction-tip value="切換「啟動大型檔案限制」 僅在關閉並重新打開大型文件後生效" />
<change-largeFileRestriction_fileLength-tip value="修改大型檔案長度大小值只有在關閉並重新打開大文件後生效" />
<largeFileRestriction_wordWrap-tip value="啟用「停用自動換行」選項將在打開大型文件後為所有打開的文檔停用自動換行。 您可以自行重新啟動自動換行功能。" />
</MiscStrings>
</Native-Langue>
</NotepadPlus>

View File

@ -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;

View File

@ -676,7 +676,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
maintainIndentation(static_cast<TCHAR>(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;

View File

@ -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"));
}
// <GUIConfig name="largeFileLimit" fileSizeMB="200" isEnabled="yes" allowAutoCompletion="no" allowBraceMatch="no" allowSmartHilite="no" allowWordWrap="no" />
// <GUIConfig name="largeFileRestriction" fileSizeMB="200" isEnabled="yes" allowAutoCompletion="no" allowBraceMatch="no" deactivateWordWrap="yes" allowWordWrap="no" />
{
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("largeFileLimit"));
GUIConfigElement->SetAttribute(TEXT("fileSizeMB"), static_cast<int>((_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<int>((_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"));
}
// <GUIConfig name="multiInst" setting="0" />

View File

@ -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;
};

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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<PTSTR>(checkboxTip.c_str()), false);
_changeLargeFileLengthTip = CreateToolTip(IDC_EDIT_PERFORMANCE_FILESIZE, _hSelf, _hInst, const_cast<PTSTR>(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<PTSTR>(enablePerfTip.c_str()), false);
_changeLargeFileLengthTip = CreateToolTip(IDC_EDIT_PERFORMANCE_FILESIZE, _hSelf, _hInst, const_cast<PTSTR>(fileLenTip.c_str()), false);
_deactivateWordWrapTip = CreateToolTip(IDC_CHECK_PERFORMANCE_DEACTIVATEWORDWRAP, _hSelf, _hInst, const_cast<PTSTR>(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;

View File

@ -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

View File

@ -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