diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 67c0f50ad..bccfab89a 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -1,6 +1,6 @@ - +
@@ -907,10 +907,11 @@ - + + diff --git a/PowerEditor/installer/nativeLang/hindi.xml b/PowerEditor/installer/nativeLang/hindi.xml index ba7143820..6aac3a18a 100644 --- a/PowerEditor/installer/nativeLang/hindi.xml +++ b/PowerEditor/installer/nativeLang/hindi.xml @@ -4,10 +4,10 @@ ** created By:- Rathin A. Dholakia ** Email- rathin2j@gmail.com - ** Last Updated on 18/02/2019 by Rajendra Singh (singh.rajen15@gmail.com) ** + ** Last Updated on 06/03/2019 by Rajendra Singh (singh.rajen15@gmail.com) ** --> - +
@@ -914,10 +914,11 @@ - + + @@ -1166,8 +1167,8 @@ - - + + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 837f26fef..22a031b8f 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -3328,10 +3328,10 @@ void Notepad_plus::dropFiles(HDROP hdrop) } } -void Notepad_plus::checkModifiedDocument() +void Notepad_plus::checkModifiedDocument(bool bCheckOnlyCurrentBuffer) { //this will trigger buffer updates. If the status changes, Notepad++ will be informed and can do its magic - MainFileManager->checkFilesystemChanges(); + MainFileManager->checkFilesystemChanges(bCheckOnlyCurrentBuffer); } void Notepad_plus::getMainClientRect(RECT &rc) const @@ -3783,10 +3783,18 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne) return false; } + bool isCurrBuffDetection = (NppParameters::getInstance()->getNppGUI()._fileAutoDetection & cdEnabledCurrent) ? true : false; + if (reload) { performPostReload(whichOne); } + else if(isCurrBuffDetection) + { + // Buffer has been activated, now check for file modification + // If enabled for current buffer + pBuf->checkFileState(); + } notifyBufferActivated(id, whichOne); return true; @@ -3795,7 +3803,7 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne) void Notepad_plus::performPostReload(int whichOne) { NppParameters *pNppParam = NppParameters::getInstance(); const NppGUI & nppGUI = pNppParam->getNppGUI(); - bool toEnd = (nppGUI._fileAutoDetection == cdAutoUpdateGo2end) || (nppGUI._fileAutoDetection == cdGo2end); + bool toEnd = (nppGUI._fileAutoDetection & cdGo2end) ? true : false; if (!toEnd) return; if (whichOne == MAIN_VIEW) { @@ -5125,7 +5133,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) } case DOC_MODIFIED: //ask for reloading { - bool autoUpdate = (nppGUI._fileAutoDetection == cdAutoUpdate) || (nppGUI._fileAutoDetection == cdAutoUpdateGo2end); + bool autoUpdate = (nppGUI._fileAutoDetection & cdAutoUpdate) ? true : false; if (!autoUpdate || buffer->isDirty()) { prepareBufferChangedDialog(buffer); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index b43183555..8e60e1382 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -456,7 +456,7 @@ private: void checkMacroState(); void checkSyncState(); void dropFiles(HDROP hdrop); - void checkModifiedDocument(); + void checkModifiedDocument(bool bCheckOnlyCurrentBuffer); void getMainClientRect(RECT & rc) const; void staticCheckMenuAndTB() const; diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index 79493e0f6..87743aa6f 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -311,7 +311,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin bool isSnapshotMode = nppGUI.isSnapshotMode(); if (isSnapshotMode) { - _notepad_plus_plus_core.checkModifiedDocument(); + _notepad_plus_plus_core.checkModifiedDocument(false); // Lauch backup task _notepad_plus_plus_core.launchDocumentBackupTask(); } diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 1c3c5a5a2..e9437f906 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -45,12 +45,6 @@ using namespace std; #define WM_DPICHANGED 0x02E0 -DWORD WINAPI CheckModifiedDocumentThread(LPVOID) -{ - MainFileManager->checkFilesystemChanges(); - return 0; -} - struct SortTaskListPred final { DocTabView *_views[2]; @@ -1544,7 +1538,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa const NppGUI & nppgui = pNppParam->getNppGUI(); if (nppgui._fileAutoDetection != cdDisabled) { - checkModifiedDocument(); + bool bCheckOnlyCurrentBuffer = (nppgui._fileAutoDetection & cdEnabledCurrent) ? true : false; + + checkModifiedDocument(bCheckOnlyCurrentBuffer); return TRUE; } return FALSE; @@ -1621,15 +1617,15 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case NPPM_INTERNAL_ENABLECHECKDOCOPT: { - NppGUI & nppgui = const_cast((pNppParam->getNppGUI())); + NppGUI& nppgui = const_cast((pNppParam->getNppGUI())); if (wParam == CHECKDOCOPT_NONE) nppgui._fileAutoDetection = cdDisabled; else if (wParam == CHECKDOCOPT_UPDATESILENTLY) - nppgui._fileAutoDetection = cdAutoUpdate; + nppgui._fileAutoDetection = (cdEnabledAll | cdAutoUpdate); else if (wParam == CHECKDOCOPT_UPDATEGO2END) - nppgui._fileAutoDetection = cdGo2end; + nppgui._fileAutoDetection = (cdEnabledAll | cdGo2end); else if (wParam == (CHECKDOCOPT_UPDATESILENTLY | CHECKDOCOPT_UPDATEGO2END)) - nppgui._fileAutoDetection = cdAutoUpdateGo2end; + nppgui._fileAutoDetection = (cdEnabledAll | cdGo2end | cdAutoUpdate); return TRUE; } diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index bb937f932..a2d023b62 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -1359,7 +1359,7 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy) // Disable file autodetection before opening save dialog to prevent use-after-delete bug. NppParameters *pNppParam = NppParameters::getInstance(); - ChangeDetect cdBefore = (const_cast(pNppParam->getNppGUI()))._fileAutoDetection; + auto cdBefore = pNppParam->getNppGUI()._fileAutoDetection; (const_cast(pNppParam->getNppGUI()))._fileAutoDetection = cdDisabled; TCHAR *pfn = fDlg.doSaveDlg(); @@ -1393,7 +1393,7 @@ bool Notepad_plus::fileSaveAs(BufferID id, bool isSaveCopy) } else // cancel button is pressed { - checkModifiedDocument(); + checkModifiedDocument(true); return false; } } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index dccdc6174..f0a896a59 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -4185,15 +4185,23 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) const TCHAR* val = n->Value(); if (val) { - if (!lstrcmp(val, TEXT("yes"))) - _nppGUI._fileAutoDetection = cdEnabled; - else if (!lstrcmp(val, TEXT("auto"))) - _nppGUI._fileAutoDetection = cdAutoUpdate; - else if (!lstrcmp(val, TEXT("Update2End"))) - _nppGUI._fileAutoDetection = cdGo2end; - else if (!lstrcmp(val, TEXT("autoUpdate2End"))) - _nppGUI._fileAutoDetection = cdAutoUpdateGo2end; - else //(!lstrcmp(val, TEXT("no"))) + 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); + else //(!lstrcmp(val, TEXT("no"))) _nppGUI._fileAutoDetection = cdDisabled; _nppGUI._fileAutoDetectionOriginalValue = _nppGUI._fileAutoDetection; @@ -5557,21 +5565,42 @@ void NppParameters::createXmlTreeFromGUIParams() // yes { const TCHAR *pStr = TEXT("no"); - switch (_nppGUI._fileAutoDetection) + + if (_nppGUI._fileAutoDetection & cdEnabledAll) { - case cdEnabled: - pStr = TEXT("yes"); - break; - case cdAutoUpdate: - pStr = TEXT("auto"); - break; - case cdGo2end: - pStr = TEXT("Update2End"); - break; - case cdAutoUpdateGo2end: - pStr = TEXT("autoUpdate2End"); - break; + pStr = TEXT("yesAll"); + + if ((_nppGUI._fileAutoDetection & cdAutoUpdate) && (_nppGUI._fileAutoDetection & cdGo2end)) + { + pStr = TEXT("autoUpdate2EndAll"); + } + else if (_nppGUI._fileAutoDetection & cdAutoUpdate) + { + pStr = TEXT("autoAll"); + } + else if (_nppGUI._fileAutoDetection & cdGo2end) + { + pStr = TEXT("Update2EndAll"); + } } + else if (_nppGUI._fileAutoDetection & cdEnabledCurrent) + { + pStr = TEXT("yesCurrent"); + + if ((_nppGUI._fileAutoDetection & cdAutoUpdate) && (_nppGUI._fileAutoDetection & cdGo2end)) + { + pStr = TEXT("autoUpdate2EndCurrent"); + } + else if (_nppGUI._fileAutoDetection & cdAutoUpdate) + { + pStr = TEXT("autoCurrent"); + } + else if (_nppGUI._fileAutoDetection & cdGo2end) + { + pStr = TEXT("Update2EndCurrent"); + } + } + TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); GUIConfigElement->SetAttribute(TEXT("name"), TEXT("Auto-detection")); GUIConfigElement->InsertEndChild(TiXmlText(pStr)); diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 251b47ed2..f39969e13 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=0, cdEnabled=1, cdAutoUpdate=2, cdGo2end=3, cdAutoUpdateGo2end=4}; +enum ChangeDetect { cdDisabled = 0x0, cdEnabledAll = 0x01, cdEnabledCurrent = 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,8 +788,8 @@ struct NppGUI final int _tabSize = 4; bool _tabReplacedBySpace = false; - ChangeDetect _fileAutoDetection = cdEnabled; - ChangeDetect _fileAutoDetectionOriginalValue = cdEnabled; + int _fileAutoDetection = cdEnabledAll; + int _fileAutoDetectionOriginalValue = cdEnabledAll; bool _checkHistoryFiles = false; RECT _appPos; diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 8f8f70d6b..93fa0f1f7 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -222,7 +222,7 @@ void Buffer::setFileName(const TCHAR *fn, LangType defaultLang) } -bool Buffer::checkFileState() //eturns true if the status has been changed (it can change into DOC_REGULAR too). false otherwise +bool Buffer::checkFileState() // returns true if the status has been changed (it can change into DOC_REGULAR too). false otherwise { if (_currentStatus == DOC_UNNAMED) //unsaved document cannot change by environment return false; @@ -485,7 +485,7 @@ void Buffer::setHideLineChanged(bool isHide, int location) void Buffer::setDeferredReload() // triggers a reload on the next Document access { - _isDirty = false; //when reloading, just set to false, since it sohuld be marked as clean + _isDirty = false; //when reloading, just set to false, since it should be marked as clean _needReloading = true; doNotify(BufferChangeDirty); } @@ -510,18 +510,26 @@ void FileManager::init(Notepad_plus * pNotepadPlus, ScintillaEditView * pscratch _pscratchTilla->execute(SCI_ADDREFDOCUMENT, 0, _scratchDocDefault); } -void FileManager::checkFilesystemChanges() +void FileManager::checkFilesystemChanges(bool bCheckOnlyCurrentBuffer) { - for (int i = int(_nbBufs) - 1; i >= 0 ; i--) - { - if (i >= int(_nbBufs)) - { - if (_nbBufs == 0) - return; + if (bCheckOnlyCurrentBuffer) + { + Buffer* buffer = _pNotepadPlus->getCurrentBuffer(); + buffer->checkFileState(); + } + else + { + for (int i = int(_nbBufs) - 1; i >= 0; i--) + { + if (i >= int(_nbBufs)) + { + if (_nbBufs == 0) + return; - i = int(_nbBufs) - 1; - } - _buffers[i]->checkFileState(); //something has changed. Triggers update automatically + i = int(_nbBufs) - 1; + } + _buffers[i]->checkFileState(); //something has changed. Triggers update automatically + } } } diff --git a/PowerEditor/src/ScitillaComponent/Buffer.h b/PowerEditor/src/ScitillaComponent/Buffer.h index f0a5cc7d0..b8d4a6a11 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.h +++ b/PowerEditor/src/ScitillaComponent/Buffer.h @@ -74,7 +74,7 @@ public: void init(Notepad_plus* pNotepadPlus, ScintillaEditView* pscratchTilla); //void activateBuffer(int index); - void checkFilesystemChanges(); + void checkFilesystemChanges(bool bCheckOnlyCurrentBuffer); size_t getNbBuffers() { return _nbBufs; }; int getBufferIndexByID(BufferID id); diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index d12c16988..6301410ce 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -130,15 +130,16 @@ BEGIN CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,173,217,10 CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10 CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10 - CONTROL "Enable",IDC_CHECK_FILEAUTODETECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,57,140,10 - CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,69,140,10 - CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,81,140,10 + CONTROL "Enable for all tabs",IDC_CHECK_FILEAUTODETECTION_ALL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,57,140,10 + CONTROL "Enable only for current tab",IDC_CHECK_FILEAUTODETECTION_CURRENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,69,140,10 + CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,81,140,10 + CONTROL "Scroll to the last line after update",IDC_CHECK_UPDATEGOTOEOF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,93,140,10 EDITTEXT IDC_EDIT_SESSIONFILEEXT,381,135,34,14,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_WORKSPACEFILEEXT,381,152,34,14,ES_AUTOHSCROLL GROUPBOX "Document Switcher (Ctrl+TAB)",IDC_DOCUMENTSWITCHER_STATIC,37,4,155,39,BS_CENTER GROUPBOX "Clickable Link Settings",IDC_CLICKABLELINK_STATIC,259,4,155,39,BS_CENTER GROUPBOX "Document Peeker",IDC_DOCUMENTPEEK_STATIC,37,47,155,39,BS_CENTER - GROUPBOX "File Status Auto-Detection",IDC_FILEAUTODETECTION_STATIC,259,47,155,50,BS_CENTER + GROUPBOX "File Status Auto-Detection",IDC_FILEAUTODETECTION_STATIC,259,47,155,62,BS_CENTER RTEXT "Session file ext.:",IDC_SESSIONFILEEXT_STATIC,271,138,108,8 RTEXT "Workspace file ext.:",IDC_WORKSPACEFILEEXT_STATIC,271,155,108,8 END diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 7fdd184a4..55de394c9 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -879,25 +879,17 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) { case WM_INITDIALOG : { - if (nppGUI._fileAutoDetection == cdEnabled) + if (nppGUI._fileAutoDetection & cdEnabledAll) { - ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION, BM_SETCHECK, BST_CHECKED, 0); + ::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 == cdAutoUpdate) + else if (nppGUI._fileAutoDetection & cdEnabledCurrent) { - ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION, BM_SETCHECK, BST_CHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_UPDATESILENTLY, BM_SETCHECK, BST_CHECKED, 0); - } - else if (nppGUI._fileAutoDetection == cdGo2end) - { - ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION, BM_SETCHECK, BST_CHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_UPDATEGOTOEOF, BM_SETCHECK, BST_CHECKED, 0); - } - else if (nppGUI._fileAutoDetection == cdAutoUpdateGo2end) - { - ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION, BM_SETCHECK, BST_CHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_UPDATESILENTLY, BM_SETCHECK, BST_CHECKED, 0); - ::SendDlgItemMessage(_hSelf, IDC_CHECK_UPDATEGOTOEOF, BM_SETCHECK, BST_CHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION_CURRENT, BM_SETCHECK, BST_CHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_FILEAUTODETECTION_ALL, BM_SETCHECK, BST_UNCHECKED, 0); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_FILEAUTODETECTION_ALL), FALSE); } else //cdDisabled { @@ -905,6 +897,12 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_UPDATEGOTOEOF), FALSE); } + bool bCheck = (nppGUI._fileAutoDetection & cdAutoUpdate) ? true : false; + ::SendDlgItemMessage(_hSelf, IDC_CHECK_UPDATESILENTLY, BM_SETCHECK, bCheck? BST_CHECKED: BST_UNCHECKED, 0); + + bCheck = (nppGUI._fileAutoDetection & cdGo2end) ? true : false; + ::SendDlgItemMessage(_hSelf, IDC_CHECK_UPDATEGOTOEOF, BM_SETCHECK, bCheck ? BST_CHECKED : BST_UNCHECKED, 0); + ::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0); @@ -975,27 +973,35 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) switch (wParam) { - case IDC_CHECK_FILEAUTODETECTION: + case IDC_CHECK_FILEAUTODETECTION_ALL: + case IDC_CHECK_FILEAUTODETECTION_CURRENT: { - bool isChecked = isCheckedOrNot(IDC_CHECK_FILEAUTODETECTION); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_UPDATESILENTLY), isChecked); - ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_UPDATEGOTOEOF), isChecked); + bool isAllChecked = isCheckedOrNot(IDC_CHECK_FILEAUTODETECTION_ALL); + bool isCurrentChecked = isCheckedOrNot(IDC_CHECK_FILEAUTODETECTION_CURRENT); + + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_UPDATESILENTLY), isAllChecked | isCurrentChecked); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_UPDATEGOTOEOF), isAllChecked | isCurrentChecked); + + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_FILEAUTODETECTION_ALL), !isCurrentChecked); + ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_FILEAUTODETECTION_CURRENT), !isAllChecked); bool isSilent = isCheckedOrNot(IDC_CHECK_UPDATESILENTLY); bool isGo2End = isCheckedOrNot(IDC_CHECK_UPDATEGOTOEOF); - ChangeDetect cd; + int cd = cdDisabled; - if (!isChecked) - cd = cdDisabled; - else if (!isSilent && !isGo2End) - cd = cdEnabled; - else if (!isSilent && isGo2End) - cd = cdGo2end; - else if (isSilent && !isGo2End) - cd = cdAutoUpdate; - else //(isSilent && isGo2End) - cd = cdAutoUpdateGo2end; + if (isAllChecked | isCurrentChecked) + { + if (isAllChecked) + cd |= cdEnabledAll; + else + cd |= cdEnabledCurrent; + + if (isSilent) + cd |= cdAutoUpdate; + if (isGo2End) + cd |= cdGo2end; + } nppGUI._fileAutoDetection = cd; } @@ -1007,16 +1013,23 @@ INT_PTR CALLBACK SettingsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM) bool isSilent = isCheckedOrNot(IDC_CHECK_UPDATESILENTLY); bool isGo2End = isCheckedOrNot(IDC_CHECK_UPDATEGOTOEOF); - ChangeDetect cd; + bool isAllChecked = isCheckedOrNot(IDC_CHECK_FILEAUTODETECTION_ALL); + bool isCurrentChecked = isCheckedOrNot(IDC_CHECK_FILEAUTODETECTION_CURRENT); - if (!isSilent && !isGo2End) - cd = cdEnabled; - else if (!isSilent && isGo2End) - cd = cdGo2end; - else if (isSilent && !isGo2End) - cd = cdAutoUpdate; - else //(isSilent && isGo2End) - cd = cdAutoUpdateGo2end; + int cd = cdDisabled; + + if (isAllChecked | isCurrentChecked) + { + if (isAllChecked) + cd |= cdEnabledAll; + else + cd |= cdEnabledCurrent; + + if (isSilent) + cd |= cdAutoUpdate; + if (isGo2End) + cd |= cdGo2end; + } nppGUI._fileAutoDetection = cd; } diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index 42cc8ec10..cd3893159 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -162,14 +162,14 @@ #define IDC_HISTORY_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 4) #define IDC_CHECK_DONTCHECKHISTORY (IDD_PREFERENCE_SETTING_BOX + 5) #define IDC_MAXNBFILE_STATIC (IDD_PREFERENCE_SETTING_BOX + 6) - #define IDC_CHECK_FILEAUTODETECTION (IDD_PREFERENCE_SETTING_BOX + 7) + #define IDC_CHECK_FILEAUTODETECTION_ALL (IDD_PREFERENCE_SETTING_BOX + 7) #define IDC_CHECK_MIN2SYSTRAY (IDD_PREFERENCE_SETTING_BOX + 8) #define IDC_CHECK_REMEMBERSESSION (IDD_PREFERENCE_SETTING_BOX + 9) #define IDC_TABSIZEVAL_STATIC (IDD_PREFERENCE_SETTING_BOX + 10) #define IDC_MAXNBFILEVAL_STATIC (IDD_PREFERENCE_SETTING_BOX + 11) #define IDC_FILEAUTODETECTION_STATIC (IDD_PREFERENCE_SETTING_BOX + 12) #define IDC_CHECK_UPDATESILENTLY (IDD_PREFERENCE_SETTING_BOX + 13) - //#define IDC_BACKUP_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 14) + #define IDC_CHECK_FILEAUTODETECTION_CURRENT (IDD_PREFERENCE_SETTING_BOX + 14) #define IDC_RADIO_BKNONE (IDD_PREFERENCE_SETTING_BOX + 15) #define IDC_RADIO_BKSIMPLE (IDD_PREFERENCE_SETTING_BOX + 16) #define IDC_RADIO_BKVERBOSE (IDD_PREFERENCE_SETTING_BOX + 17)