Use new "File Status Auto-Detection" option by default

And make it compatible with the existent arguments.
This commit is contained in:
Don HO 2019-03-17 21:19:20 +01:00
parent 193c4ecc5b
commit 23bd8e484c
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
5 changed files with 39 additions and 39 deletions

View File

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

View File

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

View File

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

View File

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

View File

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