diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index 9878e4bd3..b5206e995 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -1156,6 +1156,18 @@ You can define several column markers by using white space to separate the diffe
(don't choose it unless you know what you're doing)"/>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml
index 79cf87f4c..31fd0899e 100644
--- a/PowerEditor/installer/nativeLang/french.xml
+++ b/PowerEditor/installer/nativeLang/french.xml
@@ -1156,6 +1156,18 @@ Vous pouvez définir plusieurs marqueurs de colonne en utilisant un espace pour
(ne pas utiliser cette option si vous ne savez pas ce qu'elle fait)"/>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
index 8f680b615..ac8ddffe5 100644
--- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
+++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
@@ -1128,8 +1128,6 @@
-
-
@@ -1141,6 +1139,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp
index 414fe33f4..cb97ef138 100644
--- a/PowerEditor/src/Notepad_plus.cpp
+++ b/PowerEditor/src/Notepad_plus.cpp
@@ -2584,7 +2584,8 @@ void Notepad_plus::findMatchingBracePos(intptr_t& braceAtCaret, intptr_t& braceO
bool Notepad_plus::braceMatch()
{
Buffer* currentBuf = _pEditView->getCurrentBuffer();
- if (currentBuf->isLargeFile())
+ const NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
+ if (currentBuf->isLargeFile() && !nppGui._largeFileLimit._allowBraceMatch)
return false;
intptr_t braceAtCaret = -1;
diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp
index e49f9a6d8..e778726bc 100644
--- a/PowerEditor/src/NppBigSwitch.cpp
+++ b/PowerEditor/src/NppBigSwitch.cpp
@@ -2719,6 +2719,22 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE;
}
+ case NPPM_INTERNAL_CLEANBRACEMATCH:
+ {
+ _mainEditView.execute(SCI_SETHIGHLIGHTGUIDE, 0);
+ _subEditView.execute(SCI_SETHIGHLIGHTGUIDE, 0);
+ _mainEditView.execute(SCI_BRACEBADLIGHT, WPARAM(-1));
+ _subEditView.execute(SCI_BRACEBADLIGHT, WPARAM(-1));
+ return TRUE;
+ }
+
+ case NPPM_INTERNAL_CLEANSMARTHILITING:
+ {
+ _mainEditView.clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART);
+ _subEditView.clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART);
+ return TRUE;
+ }
+
case NPPM_INTERNAL_CRLFLAUNCHSTYLECONF:
{
// Launch _configStyleDlg (create or display it)
diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp
index aae1ce005..ee5e8a537 100644
--- a/PowerEditor/src/NppIO.cpp
+++ b/PowerEditor/src/NppIO.cpp
@@ -2074,15 +2074,22 @@ bool Notepad_plus::loadSession(Session & session, bool isSnapshotMode, bool shou
if (lastOpened != BUFFER_INVALID)
{
showView(MAIN_VIEW);
- const TCHAR *pLn = session._mainViewFiles[i]._langName.c_str();
- int id = getLangFromMenuName(pLn);
+ const TCHAR* pLn = nullptr;
LangType typeToSet = L_TEXT;
- if (id != 0 && id != IDM_LANG_USER)
- typeToSet = menuID2LangType(id);
- if (typeToSet == L_EXTERNAL )
- typeToSet = (LangType)(id - IDM_LANG_EXTERNAL + L_EXTERNAL);
+ Buffer* buf = MainFileManager.getBufferByID(lastOpened);
- Buffer *buf = MainFileManager.getBufferByID(lastOpened);
+ if (!buf->isLargeFile())
+ {
+ pLn = session._mainViewFiles[i]._langName.c_str();
+
+ int id = getLangFromMenuName(pLn);
+
+ if (id != 0 && id != IDM_LANG_USER)
+ typeToSet = menuID2LangType(id);
+ if (typeToSet == L_EXTERNAL)
+ typeToSet = (LangType)(id - IDM_LANG_EXTERNAL + L_EXTERNAL);
+ }
+
if (session._mainViewFiles[i]._foldStates.size() > 0)
{
diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp
index 62177fcb4..ecb86695e 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())
+ if (!currentBuf->isLargeFile() || nppGui._largeFileLimit._allowAutoCompletion)
{
AutoCompletion* autoC = isFromPrimary ? &_autoCompleteMain : &_autoCompleteSub;
bool isColumnMode = _pEditView->execute(SCI_GETSELECTIONS) > 1; // Multi-Selection || Column mode)
@@ -884,7 +884,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
Buffer* currentBuf = _pEditView->getCurrentBuffer();
- if (notification->nmhdr.hwndFrom != _pEditView->getHSelf() && !currentBuf->isLargeFile()) // notification come from unfocus view - both views ae visible
+ if (notification->nmhdr.hwndFrom != _pEditView->getHSelf() && (!currentBuf->isLargeFile() || nppGui._largeFileLimit._allowSmartHilite)) // notification come from unfocus view - both views ae visible
{
if (nppGui._smartHiliteOnAnotherView)
{
@@ -903,7 +903,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
xmlTagMatchHiliter.tagMatch(nppGui._enableTagAttrsHilite);
}
- if (nppGui._enableSmartHilite && !currentBuf->isLargeFile())
+ if (nppGui._enableSmartHilite && (!currentBuf->isLargeFile() || nppGui._largeFileLimit._allowSmartHilite))
{
if (nppGui._disableSmartHiliteTmp)
nppGui._disableSmartHiliteTmp = false;
diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp
index c7ef92854..8df703216 100644
--- a/PowerEditor/src/Parameters.cpp
+++ b/PowerEditor/src/Parameters.cpp
@@ -5387,6 +5387,43 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
else
_nppGUI._delimiterSelectionOnEntireDocument = false;
}
+ else if (!lstrcmp(nm, TEXT("largeFileLimit")))
+ {
+ int fileSizeLimit4StylingMB = 0;
+ element->Attribute(TEXT("fileSizeMB"), &fileSizeLimit4StylingMB);
+ if (fileSizeLimit4StylingMB > 0 && fileSizeLimit4StylingMB < 4096)
+ _nppGUI._largeFileLimit._largeFileSizeDefInByte = (fileSizeLimit4StylingMB * 1024 * 1024);
+
+ const TCHAR* boolVal = element->Attribute(TEXT("isEnabled"));
+ if (boolVal != NULL && !lstrcmp(boolVal, TEXT("yes")))
+ _nppGUI._largeFileLimit._isEnabled = true;
+ else
+ _nppGUI._largeFileLimit._isEnabled = false;
+
+ boolVal = element->Attribute(TEXT("allowAutoCompletion"));
+ if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no")))
+ _nppGUI._largeFileLimit._allowAutoCompletion = false;
+ else
+ _nppGUI._largeFileLimit._allowAutoCompletion = true;
+
+ boolVal = element->Attribute(TEXT("allowBraceMatch"));
+ if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no")))
+ _nppGUI._largeFileLimit._allowBraceMatch = false;
+ else
+ _nppGUI._largeFileLimit._allowBraceMatch = true;
+
+ boolVal = element->Attribute(TEXT("allowSmartHilite"));
+ if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no")))
+ _nppGUI._largeFileLimit._allowSmartHilite = false;
+ else
+ _nppGUI._largeFileLimit._allowSmartHilite = true;
+
+ boolVal = element->Attribute(TEXT("allowWordWrap"));
+ if (boolVal != NULL && !lstrcmp(boolVal, TEXT("no")))
+ _nppGUI._largeFileLimit._allowWordWrap = false;
+ else
+ _nppGUI._largeFileLimit._allowWordWrap = true;
+ }
else if (!lstrcmp(nm, TEXT("multiInst")))
{
int val = 0;
@@ -6607,6 +6644,18 @@ 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"));
+ }
+
//
{
TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h
index 35816ee7d..ceb4c0d3b 100644
--- a/PowerEditor/src/Parameters.h
+++ b/PowerEditor/src/Parameters.h
@@ -133,6 +133,8 @@ const int COPYDATA_FULL_CMDLINE = 3;
#define ONEDRIVE_AVAILABLE 2
#define GOOGLEDRIVE_AVAILABLE 4
+#define NPP_STYLING_FILESIZE_LIMIT_DEFAULT (200 * 1024 * 1024) // 200MB+ file won't be styled
+
const TCHAR fontSizeStrs[][3] = {TEXT(""), TEXT("5"), TEXT("6"), TEXT("7"), TEXT("8"), TEXT("9"), TEXT("10"), TEXT("11"), TEXT("12"), TEXT("14"), TEXT("16"), TEXT("18"), TEXT("20"), TEXT("22"), TEXT("24"), TEXT("26"), TEXT("28")};
const TCHAR localConfFile[] = TEXT("doLocalConf.xml");
@@ -720,6 +722,18 @@ struct DarkModeConf final
NppDarkMode::Colors _customColors = NppDarkMode::getDarkModeDefaultColors();
};
+
+struct LargeFileLimitSettings final
+{
+ int64_t _largeFileSizeDefInByte = NPP_STYLING_FILESIZE_LIMIT_DEFAULT;
+ bool _isEnabled = true;
+
+ bool _allowBraceMatch = false;
+ bool _allowAutoCompletion = false;
+ bool _allowSmartHilite = false;
+ bool _allowWordWrap = false;
+};
+
struct NppGUI final
{
NppGUI()
@@ -890,8 +904,11 @@ struct NppGUI final
DarkModeConf _darkmode;
DarkModeConf _darkmodeplugins;
+
+ LargeFileLimitSettings _largeFileLimit;
};
+
struct ScintillaViewParams
{
bool _lineNumberMarginShow = true;
diff --git a/PowerEditor/src/ScintillaComponent/Buffer.cpp b/PowerEditor/src/ScintillaComponent/Buffer.cpp
index 1f2b009ef..59e0327d4 100644
--- a/PowerEditor/src/ScintillaComponent/Buffer.cpp
+++ b/PowerEditor/src/ScintillaComponent/Buffer.cpp
@@ -38,6 +38,7 @@ static const int LF = 0x0A;
long Buffer::_recentTagCtr = 0;
+
namespace // anonymous
{
static EolType getEOLFormatForm(const char* const data, size_t length, EolType defvalue = EolType::osdefault)
@@ -669,10 +670,13 @@ BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding
// * the auto-completion feature will be disabled for large files
// * the session snapshotsand periodic backups feature will be disabled for large files
// * the backups on save feature will be disabled for large files
- bool isLargeFile = fileSize >= NPP_STYLING_FILESIZE_LIMIT;
+ NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
+ bool isLargeFile = false;
+ if (nppGui._largeFileLimit._isEnabled)
+ isLargeFile = fileSize >= nppGui._largeFileLimit._largeFileSizeDefInByte;
// Due to the performance issue, the Word Wrap feature will be disabled if it's ON
- if (isLargeFile)
+ if (isLargeFile && !nppGui._largeFileLimit._allowWordWrap)
{
bool isWrap = _pNotepadPlus->_pEditView->isWrap();
if (isWrap)
@@ -1511,6 +1515,8 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
if (isFirstTime)
{
+ NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
+
// check if file contain any BOM
if (Utf8_16_Read::determineEncoding((unsigned char *)data, lenFile) != uni8Bit)
{
@@ -1520,11 +1526,11 @@ bool FileManager::loadFileData(Document doc, int64_t fileSize, const TCHAR * fil
}
else if (fileFormat._encoding == -1)
{
- if (nppParam.getNppGUI()._detectEncoding)
+ if (nppGui._detectEncoding)
fileFormat._encoding = detectCodepage(data, lenFile);
}
-
- bool isLargeFile = fileSize >= NPP_STYLING_FILESIZE_LIMIT;
+
+ bool isLargeFile = fileSize >= nppGui._largeFileLimit._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 5b29408ca..c2b93ba31 100644
--- a/PowerEditor/src/ScintillaComponent/Buffer.h
+++ b/PowerEditor/src/ScintillaComponent/Buffer.h
@@ -13,18 +13,17 @@
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
+
#pragma once
+
#include
-
#include "Utf8_16.h"
-
class Notepad_plus;
class Buffer;
typedef Buffer* BufferID; //each buffer has unique ID by which it can be retrieved
#define BUFFER_INVALID reinterpret_cast(0)
-#define NPP_STYLING_FILESIZE_LIMIT (200 * 1024 * 1024) // 200MB+ file won't be styled
typedef sptr_t Document;
@@ -128,8 +127,6 @@ private:
bool loadFileData(Document doc, int64_t fileSize, const TCHAR* filename, char* buffer, Utf8_16_Read* UnicodeConvertor, LoadedFileFormat& fileFormat);
LangType detectLanguageFromTextBegining(const unsigned char *data, size_t dataLen);
-
-private:
Notepad_plus* _pNotepadPlus = nullptr;
ScintillaEditView* _pscratchTilla = nullptr;
Document _scratchDocDefault = 0;
diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc
index a98a0d2d6..b60f92718 100644
--- a/PowerEditor/src/WinControls/Preference/preference.rc
+++ b/PowerEditor/src/WinControls/Preference/preference.rc
@@ -474,6 +474,21 @@ BEGIN
LTEXT "Example: https://www.google.com/search?q=$(CURRENT_WORD)",IDD_SEARCHENGINE_NOTE_STATIC,114,134,245,20
END
+IDD_PREFERENCE_SUB_PERFORMANCE DIALOGEX 0, 0, 455, 185
+STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
+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
+ 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 "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
+END
IDD_PREFERENCE_SUB_MISC DIALOGEX 0, 0, 455, 200
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
index dbc470b64..379bfa057 100644
--- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
+++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
@@ -166,6 +166,9 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_delimiterSubDlg.init(_hInst, _hSelf);
_delimiterSubDlg.create(IDD_PREFERENCE_SUB_DELIMITER, false, false);
+
+ _performanceSubDlg.init(_hInst, _hSelf);
+ _performanceSubDlg.create(IDD_PREFERENCE_SUB_PERFORMANCE, false, false);
_cloudAndLinkSubDlg.init(_hInst, _hSelf);
_cloudAndLinkSubDlg.create(IDD_PREFERENCE_SUB_CLOUD_LINK, false, false);
@@ -189,6 +192,7 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_wVector.push_back(DlgInfo(&_autoCompletionSubDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion")));
_wVector.push_back(DlgInfo(&_multiInstanceSubDlg, TEXT("Multi-Instance & Date"), TEXT("MultiInstance")));
_wVector.push_back(DlgInfo(&_delimiterSubDlg, TEXT("Delimiter"), TEXT("Delimiter")));
+ _wVector.push_back(DlgInfo(&_performanceSubDlg, TEXT("Performance"), TEXT("Performance")));
_wVector.push_back(DlgInfo(&_cloudAndLinkSubDlg, TEXT("Cloud & Link"), TEXT("Cloud")));
_wVector.push_back(DlgInfo(&_searchEngineSubDlg, TEXT("Search Engine"), TEXT("SearchEngine")));
_wVector.push_back(DlgInfo(&_miscSubDlg, TEXT("MISC."), TEXT("MISC")));
@@ -219,6 +223,7 @@ intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
_autoCompletionSubDlg.reSizeTo(rc);
_multiInstanceSubDlg.reSizeTo(rc);
_delimiterSubDlg.reSizeTo(rc);
+ _performanceSubDlg.reSizeTo(rc);
_cloudAndLinkSubDlg.reSizeTo(rc);
_searchEngineSubDlg.reSizeTo(rc);
@@ -422,6 +427,7 @@ void PreferenceDlg::destroy()
_autoCompletionSubDlg.destroy();
_multiInstanceSubDlg.destroy();
_delimiterSubDlg.destroy();
+ _performanceSubDlg.destroy();
}
void GeneralSubDlg::setToolIconsFromStdToSmall()
@@ -3820,7 +3826,6 @@ void BackupSubDlg::updateBackupGUI()
isEnableGlobableCheck = true;
isEnableLocalCheck = BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_BACKUPDIR_CHECK, BM_GETCHECK, 0, 0);
}
- //::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_USERCUSTOMDIR_GRPSTATIC), isEnableGlobableCheck);
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_CHECK), isEnableGlobableCheck);
::EnableWindow(::GetDlgItem(_hSelf, IDC_BACKUPDIR_EDIT), isEnableLocalCheck);
@@ -4847,6 +4852,199 @@ intptr_t CALLBACK CloudAndLinkSubDlg::run_dlgProc(UINT message, WPARAM wParam, L
return FALSE;
}
+intptr_t CALLBACK PerformanceSubDlg::run_dlgProc(UINT message , WPARAM wParam, LPARAM lParam)
+{
+ NppGUI& nppGUI = NppParameters::getInstance().getNppGUI();
+
+ if (HIWORD(wParam) == EN_CHANGE)
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_EDIT_PERFORMANCE_FILESIZE:
+ {
+ const int stringSize = 16;
+ TCHAR str[stringSize];
+
+ ::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize);
+
+ if (lstrcmp(str, TEXT("")) == 0)
+ return TRUE;
+
+ size_t fileLenInMB = ::GetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, NULL, FALSE);
+
+ if (fileLenInMB > 4096)
+ {
+ fileLenInMB = 4096;
+ ::SetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, UINT(fileLenInMB), FALSE);
+ }
+
+ nppGUI._largeFileLimit._largeFileSizeDefInByte = fileLenInMB * 1024 * 1024;
+ }
+ return TRUE;
+ }
+ }
+ else if (HIWORD(wParam) == EN_KILLFOCUS)
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_EDIT_PERFORMANCE_FILESIZE:
+ {
+ const int stringSize = 16;
+ TCHAR str[stringSize];
+ ::GetDlgItemText(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, str, stringSize);
+
+ if (lstrcmp(str, TEXT("")) == 0)
+ {
+ ::SetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, (NPP_STYLING_FILESIZE_LIMIT_DEFAULT / 1024) / 1024, FALSE);
+ return TRUE;
+ }
+
+ size_t fileLenInMB = ::GetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, NULL, FALSE);
+
+ if (fileLenInMB == 0)
+ {
+ fileLenInMB = (NPP_STYLING_FILESIZE_LIMIT_DEFAULT / 1024) / 1024;
+ ::SetDlgItemInt(_hSelf, IDC_EDIT_PERFORMANCE_FILESIZE, UINT(fileLenInMB), FALSE);
+ return TRUE;
+ }
+ }
+ return TRUE;
+ }
+ }
+
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ {
+ int64_t fileLenInMB = (nppGUI._largeFileLimit._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);
+
+ 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);
+
+ }
+ break;
+
+ case WM_CTLCOLOREDIT:
+ {
+ if (NppDarkMode::isEnabled())
+ {
+ return NppDarkMode::onCtlColorSofter(reinterpret_cast(wParam));
+ }
+ break;
+ }
+
+ case WM_CTLCOLORDLG:
+ {
+ if (NppDarkMode::isEnabled())
+ {
+ return NppDarkMode::onCtlColorDarker(reinterpret_cast(wParam));
+ }
+ break;
+ }
+
+ case WM_CTLCOLORSTATIC:
+ {
+ auto hdcStatic = reinterpret_cast(wParam);
+ auto dlgCtrlID = ::GetDlgCtrlID(reinterpret_cast(lParam));
+
+ bool isStaticText = (dlgCtrlID == IDC_STATIC_PERFORMANCE_FILESIZE || dlgCtrlID == IDC_STATIC_PERFORMANCE_MB);
+ //set the static text colors to show enable/disable instead of ::EnableWindow which causes blurry text
+ if (isStaticText)
+ {
+ bool isTextEnabled = isCheckedOrNot(IDC_CHECK_PERFORMANCE_ENABLE);
+ return NppDarkMode::onCtlColorDarkerBGStaticText(hdcStatic, isTextEnabled);
+ }
+
+ if (NppDarkMode::isEnabled())
+ {
+ if (dlgCtrlID == IDC_EDIT_PERFORMANCE_FILESIZE)
+ {
+ return NppDarkMode::onCtlColor(hdcStatic);
+ }
+ return NppDarkMode::onCtlColorDarker(hdcStatic);
+ }
+ return FALSE;
+ }
+
+ case WM_PRINTCLIENT:
+ {
+ if (NppDarkMode::isEnabled())
+ {
+ return TRUE;
+ }
+ break;
+ }
+
+ case WM_COMMAND:
+ {
+ switch (wParam)
+ {
+ case IDC_CHECK_PERFORMANCE_ENABLE:
+ {
+ bool largeFileRestrictionEnabled = isCheckedOrNot(IDC_CHECK_PERFORMANCE_ENABLE);
+ nppGUI._largeFileLimit._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);
+
+ redraw();
+ }
+ return TRUE;
+
+ case IDC_CHECK_PERFORMANCE_ALLOWBRACEMATCH:
+ {
+ bool isAllowed = isCheckedOrNot(int(wParam));
+ nppGUI._largeFileLimit._allowBraceMatch = isAllowed;
+ if (!isAllowed)
+ ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_CLEANBRACEMATCH, 0, 0);
+ }
+ return TRUE;
+
+ case IDC_CHECK_PERFORMANCE_ALLOWAUTOCOMPLETION:
+ {
+ bool isAllowed = isCheckedOrNot(int(wParam));
+ nppGUI._largeFileLimit._allowAutoCompletion = isAllowed;
+ }
+ return TRUE;
+
+ case IDC_CHECK_PERFORMANCE_ALLOWSMARTHILITE:
+ {
+ bool isAllowed = isCheckedOrNot(int(wParam));
+ nppGUI._largeFileLimit._allowSmartHilite = isAllowed;
+ if (!isAllowed)
+ ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_CLEANSMARTHILITING, 0, 0);
+ }
+ return TRUE;
+
+ case IDC_CHECK_PERFORMANCE_ALLOWWORDWRAP:
+ {
+ bool isAllowed = isCheckedOrNot(int(wParam));
+ nppGUI._largeFileLimit._allowWordWrap = isAllowed;
+ }
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ }
+ break;
+ }
+ return FALSE;
+}
+
intptr_t CALLBACK SearchEngineSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
{
NppParameters& nppParams = NppParameters::getInstance();
diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.h b/PowerEditor/src/WinControls/Preference/preferenceDlg.h
index 42e3f0ac9..d17b8440e 100644
--- a/PowerEditor/src/WinControls/Preference/preferenceDlg.h
+++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.h
@@ -252,6 +252,15 @@ private :
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
};
+class PerformanceSubDlg : public StaticDialog
+{
+public :
+ PerformanceSubDlg() = default;
+
+private :
+ intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
+};
+
class PreferenceDlg : public StaticDialog
{
friend class NativeLangSpeaker;
@@ -306,6 +315,7 @@ private :
AutoCompletionSubDlg _autoCompletionSubDlg;
MultiInstanceSubDlg _multiInstanceSubDlg;
DelimiterSubDlg _delimiterSubDlg;
+ PerformanceSubDlg _performanceSubDlg;
CloudAndLinkSubDlg _cloudAndLinkSubDlg;
SearchEngineSubDlg _searchEngineSubDlg;
SearchingSubDlg _searchingSubDlg;
diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h
index 71d13c6a9..bba5e784f 100644
--- a/PowerEditor/src/WinControls/Preference/preference_rc.h
+++ b/PowerEditor/src/WinControls/Preference/preference_rc.h
@@ -434,4 +434,16 @@
#define IDD_CUSTOMIZED_COLOR12_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 27)
#define IDD_CUSTOMIZED_RESET_BUTTON (IDD_PREFERENCE_SUB_DARKMODE + 30)
#define IDC_DARKMODE_TONES_GB_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 35)
+
+#define IDD_PREFERENCE_SUB_PERFORMANCE 7140 //(IDD_PREFERENCE_BOX + 1100)
+ #define IDC_GROUPSTATIC_PERFORMANCE_RESTRICTION (IDD_PREFERENCE_SUB_PERFORMANCE + 1)
+ #define IDC_STATIC_PERFORMANCE_TIP (IDD_PREFERENCE_SUB_PERFORMANCE + 2)
+ #define IDC_CHECK_PERFORMANCE_ENABLE (IDD_PREFERENCE_SUB_PERFORMANCE + 3)
+ #define IDC_STATIC_PERFORMANCE_FILESIZE (IDD_PREFERENCE_SUB_PERFORMANCE + 4)
+ #define IDC_EDIT_PERFORMANCE_FILESIZE (IDD_PREFERENCE_SUB_PERFORMANCE + 5)
+ #define IDC_STATIC_PERFORMANCE_MB (IDD_PREFERENCE_SUB_PERFORMANCE + 6)
+ #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)
#endif //PREFERENCE_RC_H
diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp
index 851444be4..388ed06ff 100644
--- a/PowerEditor/src/localization.cpp
+++ b/PowerEditor/src/localization.cpp
@@ -983,6 +983,13 @@ void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference)
preference.renameDialogTitle(TEXT("Delimiter"), nameW);
}
+ changeDlgLang(preference._performanceSubDlg.getHSelf(), "Performance", titre, titreMaxSize);
+ if (titre[0] != '\0')
+ {
+ const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding);
+ preference.renameDialogTitle(TEXT("Performance"), nameW);
+ }
+
changeDlgLang(preference._cloudAndLinkSubDlg.getHSelf(), "Cloud", titre, titreMaxSize);
if (titre[0] != '\0')
{
diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h
index 16d8bab65..428ae0968 100644
--- a/PowerEditor/src/resource.h
+++ b/PowerEditor/src/resource.h
@@ -641,6 +641,8 @@
#define NPPM_INTERNAL_CRLFLAUNCHSTYLECONF (NOTEPADPLUS_USER_INTERNAL + 65)
#define NPPM_INTERNAL_LAUNCHPREFERENCES (NOTEPADPLUS_USER_INTERNAL + 66)
#define NPPM_INTERNAL_ENABLECHANGEHISTORY (NOTEPADPLUS_USER_INTERNAL + 67)
+ #define NPPM_INTERNAL_CLEANSMARTHILITING (NOTEPADPLUS_USER_INTERNAL + 68)
+ #define NPPM_INTERNAL_CLEANBRACEMATCH (NOTEPADPLUS_USER_INTERNAL + 69)
// See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000)