From 23bd8e484c7a206c20b9c04ae13a6617b9ed577e Mon Sep 17 00:00:00 2001 From: Don HO Date: Sun, 17 Mar 2019 21:19:20 +0100 Subject: [PATCH] Use new "File Status Auto-Detection" option by default And make it compatible with the existent arguments. --- PowerEditor/src/Notepad_plus.cpp | 2 +- PowerEditor/src/NppBigSwitch.cpp | 8 +-- PowerEditor/src/Parameters.cpp | 52 +++++++++---------- PowerEditor/src/Parameters.h | 4 +- .../WinControls/Preference/preferenceDlg.cpp | 12 ++--- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 22a031b8f..1c04b1693 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3783,7 +3783,7 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne) return false; } - bool isCurrBuffDetection = (NppParameters::getInstance()->getNppGUI()._fileAutoDetection & cdEnabledCurrent) ? true : false; + bool isCurrBuffDetection = (NppParameters::getInstance()->getNppGUI()._fileAutoDetection & cdEnabledNew) ? true : false; if (reload) { diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 8daa47b16..7563a01b6 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1538,7 +1538,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa const NppGUI & nppgui = pNppParam->getNppGUI(); if (nppgui._fileAutoDetection != cdDisabled) { - bool bCheckOnlyCurrentBuffer = (nppgui._fileAutoDetection & cdEnabledCurrent) ? true : false; + bool bCheckOnlyCurrentBuffer = (nppgui._fileAutoDetection & cdEnabledNew) ? true : false; checkModifiedDocument(bCheckOnlyCurrentBuffer); return TRUE; @@ -1608,11 +1608,11 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa if (wParam == CHECKDOCOPT_NONE) nppgui._fileAutoDetection = cdDisabled; else if (wParam == CHECKDOCOPT_UPDATESILENTLY) - nppgui._fileAutoDetection = (cdEnabledAll | cdAutoUpdate); + nppgui._fileAutoDetection = (cdEnabledOld | cdAutoUpdate); else if (wParam == CHECKDOCOPT_UPDATEGO2END) - nppgui._fileAutoDetection = (cdEnabledAll | cdGo2end); + nppgui._fileAutoDetection = (cdEnabledOld | cdGo2end); else if (wParam == (CHECKDOCOPT_UPDATESILENTLY | CHECKDOCOPT_UPDATEGO2END)) - nppgui._fileAutoDetection = (cdEnabledAll | cdGo2end | cdAutoUpdate); + nppgui._fileAutoDetection = (cdEnabledOld | cdGo2end | cdAutoUpdate); return TRUE; } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 10b809867..4a81a76b8 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -4185,22 +4185,22 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) const TCHAR* val = n->Value(); if (val) { - if (!lstrcmp(val, TEXT("yesAll"))) - _nppGUI._fileAutoDetection = cdEnabledAll; - else if (!lstrcmp(val, TEXT("autoAll"))) - _nppGUI._fileAutoDetection = (cdEnabledAll | cdAutoUpdate); - else if (!lstrcmp(val, TEXT("Update2EndAll"))) - _nppGUI._fileAutoDetection = (cdEnabledAll | cdGo2end); - else if (!lstrcmp(val, TEXT("autoUpdate2EndAll"))) - _nppGUI._fileAutoDetection = (cdEnabledAll | cdAutoUpdate | cdGo2end); - else if (!lstrcmp(val, TEXT("yesCurrent"))) - _nppGUI._fileAutoDetection = cdEnabledCurrent; - else if (!lstrcmp(val, TEXT("autoCurrent"))) - _nppGUI._fileAutoDetection = (cdEnabledCurrent | cdAutoUpdate); - else if (!lstrcmp(val, TEXT("Update2EndCurrent"))) - _nppGUI._fileAutoDetection = (cdEnabledCurrent | cdGo2end); - else if (!lstrcmp(val, TEXT("autoUpdate2EndCurrent"))) - _nppGUI._fileAutoDetection = (cdEnabledCurrent | cdAutoUpdate | cdGo2end); + if (!lstrcmp(val, TEXT("yesOld"))) + _nppGUI._fileAutoDetection = cdEnabledOld; + else if (!lstrcmp(val, TEXT("autoOld"))) + _nppGUI._fileAutoDetection = (cdEnabledOld | cdAutoUpdate); + else if (!lstrcmp(val, TEXT("Update2EndOld"))) + _nppGUI._fileAutoDetection = (cdEnabledOld | cdGo2end); + else if (!lstrcmp(val, TEXT("autoUpdate2EndOld"))) + _nppGUI._fileAutoDetection = (cdEnabledOld | cdAutoUpdate | cdGo2end); + else if (!lstrcmp(val, TEXT("yes"))) + _nppGUI._fileAutoDetection = cdEnabledNew; + else if (!lstrcmp(val, TEXT("auto"))) + _nppGUI._fileAutoDetection = (cdEnabledNew | cdAutoUpdate); + else if (!lstrcmp(val, TEXT("Update2End"))) + _nppGUI._fileAutoDetection = (cdEnabledNew | cdGo2end); + else if (!lstrcmp(val, TEXT("autoUpdate2End"))) + _nppGUI._fileAutoDetection = (cdEnabledNew | cdAutoUpdate | cdGo2end); else //(!lstrcmp(val, TEXT("no"))) _nppGUI._fileAutoDetection = cdDisabled; } @@ -5564,38 +5564,38 @@ void NppParameters::createXmlTreeFromGUIParams() { const TCHAR *pStr = TEXT("no"); - if (_nppGUI._fileAutoDetection & cdEnabledAll) + if (_nppGUI._fileAutoDetection & cdEnabledOld) { - pStr = TEXT("yesAll"); + pStr = TEXT("yesOld"); if ((_nppGUI._fileAutoDetection & cdAutoUpdate) && (_nppGUI._fileAutoDetection & cdGo2end)) { - pStr = TEXT("autoUpdate2EndAll"); + pStr = TEXT("autoUpdate2EndOld"); } else if (_nppGUI._fileAutoDetection & cdAutoUpdate) { - pStr = TEXT("autoAll"); + pStr = TEXT("autoOld"); } else if (_nppGUI._fileAutoDetection & cdGo2end) { - pStr = TEXT("Update2EndAll"); + pStr = TEXT("Update2EndOld"); } } - else if (_nppGUI._fileAutoDetection & cdEnabledCurrent) + else if (_nppGUI._fileAutoDetection & cdEnabledNew) { - pStr = TEXT("yesCurrent"); + pStr = TEXT("yes"); if ((_nppGUI._fileAutoDetection & cdAutoUpdate) && (_nppGUI._fileAutoDetection & cdGo2end)) { - pStr = TEXT("autoUpdate2EndCurrent"); + pStr = TEXT("autoUpdate2End"); } else if (_nppGUI._fileAutoDetection & cdAutoUpdate) { - pStr = TEXT("autoCurrent"); + pStr = TEXT("auto"); } else if (_nppGUI._fileAutoDetection & cdGo2end) { - pStr = TEXT("Update2EndCurrent"); + pStr = TEXT("Update2End"); } } diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 62daa2e0c..5513cbd96 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -87,7 +87,7 @@ EolType convertIntToFormatType(int value, EolType defvalue = EolType::osdefault) enum UniMode {uni8Bit=0, uniUTF8=1, uni16BE=2, uni16LE=3, uniCookie=4, uni7Bit=5, uni16BE_NoBOM=6, uni16LE_NoBOM=7, uniEnd}; -enum ChangeDetect { cdDisabled = 0x0, cdEnabledAll = 0x01, cdEnabledCurrent = 0x02, cdAutoUpdate = 0x04, cdGo2end = 0x08 }; +enum ChangeDetect { cdDisabled = 0x0, cdEnabledOld = 0x01, cdEnabledNew = 0x02, cdAutoUpdate = 0x04, cdGo2end = 0x08 }; enum BackupFeature {bak_none = 0, bak_simple = 1, bak_verbose = 2}; enum OpenSaveDirSetting {dir_followCurrent = 0, dir_last = 1, dir_userDef = 2}; enum MultiInstSetting {monoInst = 0, multiInstOnSession = 1, multiInst = 2}; @@ -788,7 +788,7 @@ struct NppGUI final int _tabSize = 4; bool _tabReplacedBySpace = false; - int _fileAutoDetection = cdEnabledAll; + int _fileAutoDetection = cdEnabledNew; bool _checkHistoryFiles = false; diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 55de394c9..1680025d1 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -879,13 +879,13 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) { case WM_INITDIALOG : { - if (nppGUI._fileAutoDetection & cdEnabledAll) + if (nppGUI._fileAutoDetection & cdEnabledOld) { ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION_ALL, BM_SETCHECK, BST_CHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION_CURRENT, BM_SETCHECK, BST_UNCHECKED, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_FILEAUTODETECTION_CURRENT), FALSE); } - else if (nppGUI._fileAutoDetection & cdEnabledCurrent) + else if (nppGUI._fileAutoDetection & cdEnabledNew) { ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION_CURRENT, BM_SETCHECK, BST_CHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION_ALL, BM_SETCHECK, BST_UNCHECKED, 0); @@ -993,9 +993,9 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) if (isAllChecked | isCurrentChecked) { if (isAllChecked) - cd |= cdEnabledAll; + cd |= cdEnabledOld; else - cd |= cdEnabledCurrent; + cd |= cdEnabledNew; if (isSilent) cd |= cdAutoUpdate; @@ -1021,9 +1021,9 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) if (isAllChecked | isCurrentChecked) { if (isAllChecked) - cd |= cdEnabledAll; + cd |= cdEnabledOld; else - cd |= cdEnabledCurrent; + cd |= cdEnabledNew; if (isSilent) cd |= cdAutoUpdate;