From e50e6057ea2b0e17e268d756cb781e12e9dd315f Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Wed, 4 Aug 2021 10:27:15 +0200 Subject: [PATCH 1/5] +add: File on disk changed notification in title bar --- src/Dialogs.c | 13 +++++++--- src/Dialogs.h | 4 ++-- src/Notepad3.c | 65 +++++++++++++++++++++++++++++++++----------------- 3 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/Dialogs.c b/src/Dialogs.c index 9e57e2265..1a3a18a1e 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -4829,8 +4829,9 @@ void AppendAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo) { StringCchCat(s_wchAdditionalTitleInfo, COUNTOF(s_wchAdditionalTitleInfo), lpszAddTitleInfo); } -static const WCHAR *pszSep = L" - "; -static const WCHAR *pszMod = L"* "; +static const WCHAR *pszFChg = L"@ "; +static const WCHAR *pszMod = L"* "; +static const WCHAR *pszSep = L" - "; static WCHAR s_wchCachedFile[MAX_PATH] = { L'\0' }; static WCHAR s_wchCachedDisplayName[MAX_PATH] = { L'\0' }; @@ -4838,7 +4839,7 @@ static WCHAR s_wchCachedDisplayName[MAX_PATH] = { L'\0' }; void SetWindowTitle(HWND hwnd, LPCWSTR lpszFile, int iFormat, bool bPasteBoard, bool bIsElevated, bool bModified, - bool bFileLocked, bool bReadOnly, LPCWSTR lpszExcerpt) { + bool bFileLocked, bool bFileChanged, bool bReadOnly, LPCWSTR lpszExcerpt) { if (s_bFreezeAppTitle) { return; @@ -4861,16 +4862,22 @@ void SetWindowTitle(HWND hwnd, LPCWSTR lpszFile, int iFormat, WCHAR szTitle[MIDSZ_BUFFER] = { L'\0' }; + if (bFileChanged) { + StringCchCat(szTitle, COUNTOF(szTitle), pszFChg); + } if (bModified) { StringCchCat(szTitle, COUNTOF(szTitle), pszMod); } if (StrIsNotEmpty(lpszExcerpt)) { + WCHAR szExcrptFmt[32] = { L'\0' }; WCHAR szExcrptQuot[SMALL_BUFFER] = { L'\0' }; GetLngString(IDS_MUI_TITLEEXCERPT, szExcrptFmt, COUNTOF(szExcrptFmt)); StringCchPrintf(szExcrptQuot, COUNTOF(szExcrptQuot), szExcrptFmt, lpszExcerpt); StringCchCat(szTitle, COUNTOF(szTitle), szExcrptQuot); + } else if (StrIsNotEmpty(lpszFile)) { + if ((iFormat < 2) && !PathIsRoot(lpszFile)) { if (StringCchCompareN(s_wchCachedFile, COUNTOF(s_wchCachedFile), lpszFile, MAX_PATH) != 0) { StringCchCopy(s_wchCachedFile, COUNTOF(s_wchCachedFile), lpszFile); diff --git a/src/Dialogs.h b/src/Dialogs.h index 0015e8a8f..1ca98fffe 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -81,8 +81,8 @@ LONG InfoBoxLng(UINT uType, LPCWSTR lpstrSetting, UINT uidMsg, ...); #define INFOBOX_MODE(_R_) HIWORD(_R_) void SetWindowTitle(HWND hwnd, LPCWSTR lpszFile, int iFormat, - bool bPasteBoard, bool bIsElevated, bool bModified, - bool bFileLocked, bool bReadOnly, LPCWSTR lpszExcerpt); + bool bPasteBoard, bool bIsElevated, bool bModified, + bool bFileLocked, bool bFileChanged, bool bReadOnly, LPCWSTR lpszExcerpt); void SetAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo); void AppendAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo); void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode, int iOpacityLevel); diff --git a/src/Notepad3.c b/src/Notepad3.c index 953ff5be1..988bea625 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -534,6 +534,34 @@ static void CALLBACK MQ_ExecuteNext(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWOR } +//============================================================================= +// +// HasCurrentFileChanged +// + +static WIN32_FIND_DATA s_fdCurFile = { 0 }; +static HANDLE s_hEventFileChangedExt = INVALID_HANDLE_VALUE; + +static inline bool HasCurrentFileChanged() { + if (StrIsEmpty(Paths.CurrentFile)) { + return false; + } + WIN32_FIND_DATA fdUpdated = { 0 }; + if (!GetFileAttributesEx(Paths.CurrentFile, GetFileExInfoStandard, &fdUpdated)) { + SetEvent(s_hEventFileChangedExt); + return true; // The current file has been removed + } + bool const changed = (s_fdCurFile.nFileSizeLow != fdUpdated.nFileSizeLow) || (s_fdCurFile.nFileSizeHigh != fdUpdated.nFileSizeHigh) + //~|| (CompareFileTime(&s_fdCurFile.ftLastWriteTime, &fdUpdated.ftLastWriteTime) != 0) + || (s_fdCurFile.ftLastWriteTime.dwLowDateTime != fdUpdated.ftLastWriteTime.dwLowDateTime) + || (s_fdCurFile.ftLastWriteTime.dwHighDateTime != fdUpdated.ftLastWriteTime.dwHighDateTime); + if (changed) { + SetEvent(s_hEventFileChangedExt); + } + return changed; +} + + //============================================================================= // // InvalidateStyleRedraw @@ -728,6 +756,11 @@ static void _CleanUpResources(const HWND hwnd, bool bIsInitialized) UndoRedoSelectionUTArray = NULL; } + if (IS_VALID_HANDLE(s_hEventFileChangedExt)) { + CloseHandle(s_hEventFileChangedExt); + s_hEventFileChangedExt = INVALID_HANDLE_VALUE; + } + // ------------------------------- // Save Settings is done elsewhere // ------------------------------- @@ -1369,8 +1402,8 @@ HWND InitInstance(const HINSTANCE hInstance, LPCWSTR pszCmdLine, int nCmdShow) SetDialogIconNP3(Globals.hwndMain); InitWindowCommon(Globals.hwndMain, true); - // manual reset und initially not signaled (TRUE , FALSE) - // s_hEvent = CreateEvent(NULL, TRUE, TRUE, NULL); + // manual (no automatic) reset & initial state: not signaled (TRUE, FALSE) + s_hEventFileChangedExt = CreateEvent(NULL, TRUE, FALSE, NULL); if (Settings.TransparentMode) { SetWindowTransparentMode(Globals.hwndMain, true, Settings2.OpacityLevel); @@ -9268,11 +9301,13 @@ void UpdateSaveSettingsCmds() void UpdateTitleBar(const HWND hwnd) { if (hwnd == Globals.hwndMain) { + bool const bFileLocked = (FileWatching.FileWatchingMode == FWM_EXCLUSIVELOCK); + bool const bFileChanged = (WaitForSingleObject(s_hEventFileChangedExt, 0) != WAIT_TIMEOUT); SetWindowTitle(Globals.hwndMain, Paths.CurrentFile, Settings.PathNameFormat, - s_flagPasteBoard, s_bIsProcessElevated, GetDocModified(), - bFileLocked, s_bFileReadOnly, s_wchTitleExcerpt); + s_flagPasteBoard, s_bIsProcessElevated, GetDocModified(), + bFileLocked, bFileChanged, s_bFileReadOnly, s_wchTitleExcerpt); } PostMessage(hwnd, WM_NCACTIVATE, FALSE, -1); // (!) PostMessage(hwnd, WM_NCACTIVATE, TRUE, 0); @@ -9746,6 +9781,10 @@ bool FileIO(bool fLoad, LPWSTR pszFileName, EditFileIOStatus *status, s_bFileReadOnly = IsReadOnly(GetFileAttributes(pszFileName)); + if (fSuccess) { + ResetEvent(s_hEventFileChangedExt); + } + EndWaitCursor(); return(fSuccess); @@ -11167,24 +11206,6 @@ void CALLBACK PasteBoardTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi // //============================================================================= -static WIN32_FIND_DATA s_fdCurFile = { 0 }; - -static inline bool HasCurrentFileChanged() { - if (StrIsEmpty(Paths.CurrentFile)) { - return false; - } - WIN32_FIND_DATA fdUpdated = { 0 }; - if (!GetFileAttributesEx(Paths.CurrentFile, GetFileExInfoStandard, &fdUpdated)) { - return true; // The current file has been removed - } - bool const changed = (s_fdCurFile.nFileSizeLow != fdUpdated.nFileSizeLow) || (s_fdCurFile.nFileSizeHigh != fdUpdated.nFileSizeHigh) - //~|| (CompareFileTime(&s_fdCurFile.ftLastWriteTime, &fdUpdated.ftLastWriteTime) != 0) - || (s_fdCurFile.ftLastWriteTime.dwLowDateTime != fdUpdated.ftLastWriteTime.dwLowDateTime) - || (s_fdCurFile.ftLastWriteTime.dwHighDateTime != fdUpdated.ftLastWriteTime.dwHighDateTime); - return changed; -} -// ---------------------------------------------------------------------------- - static DWORD s_dwFileChangeNotifyTime = 0UL; static inline void NotifyIfFileHasChanged(const bool forcedNotify) { From f73017968c8ff5df941769d440cfff75ad025401 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Wed, 4 Aug 2021 11:56:04 +0200 Subject: [PATCH 2/5] +fix: trigger reset file changed on disc flag --- src/Notepad3.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index 988bea625..55c8f3c7c 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -626,6 +626,7 @@ void SetSavePoint() SciCall_SetSavePoint(); } s_DocNeedSaving = false; + ResetEvent(s_hEventFileChangedExt); UpdateToolbar(); UpdateTitleBar(Globals.hwndMain); } @@ -9781,10 +9782,6 @@ bool FileIO(bool fLoad, LPWSTR pszFileName, EditFileIOStatus *status, s_bFileReadOnly = IsReadOnly(GetFileAttributes(pszFileName)); - if (fSuccess) { - ResetEvent(s_hEventFileChangedExt); - } - EndWaitCursor(); return(fSuccess); @@ -9908,6 +9905,7 @@ bool FileLoad(LPCWSTR lpszFile, bool bDontSave, bool bNew, bool bReload, if (SciCall_GetZoom() != 100) { ShowZoomCallTip(); } + ResetEvent(s_hEventFileChangedExt); return true; } @@ -10117,6 +10115,10 @@ bool FileLoad(LPCWSTR lpszFile, bool bDontSave, bool bNew, bool bReload, Flags.bHugeFileLoadState = false; // reset } + if (fSuccess) { + ResetEvent(s_hEventFileChangedExt); + } + UpdateTitleBar(Globals.hwndMain); UpdateToolbar(); UpdateMarginWidth(true); @@ -10353,6 +10355,7 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP } Globals.pFileMRU->pszBookMarks[idx] = StrDup(wchBookMarks); } + ResetEvent(s_hEventFileChangedExt); return true; } @@ -11417,7 +11420,6 @@ void InstallFileWatching(const bool bInstall) { if (bPrevReadOnlyAttrib && !s_bFileReadOnly) { SendWMCommand(Globals.hwndMain, IDM_FILE_READONLY); // try to reset } - } } UpdateTitleBar(Globals.hwndMain); From 42ae0e836768471a89f025fb6350722fb01a4aef Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Wed, 4 Aug 2021 12:52:55 +0200 Subject: [PATCH 3/5] +fix: File change notification in TitleBar --- src/Notepad3.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index 55c8f3c7c..bf4073ece 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -543,6 +543,7 @@ static WIN32_FIND_DATA s_fdCurFile = { 0 }; static HANDLE s_hEventFileChangedExt = INVALID_HANDLE_VALUE; static inline bool HasCurrentFileChanged() { + if (StrIsEmpty(Paths.CurrentFile)) { return false; } @@ -561,6 +562,20 @@ static inline bool HasCurrentFileChanged() { return changed; } +static inline void ResetFileOservationData(const bool bResetEvt) { + if (bResetEvt) { + ResetEvent(s_hEventFileChangedExt); + } + if (StrIsNotEmpty(Paths.CurrentFile)) { + if (!GetFileAttributesEx(Paths.CurrentFile, GetFileExInfoStandard, &s_fdCurFile)) { + ZeroMemory(&s_fdCurFile, sizeof(WIN32_FIND_DATA)); + } + } +} + +static inline bool IsFileChangedFlagSet() { + return (WaitForSingleObject(s_hEventFileChangedExt, 0) != WAIT_TIMEOUT); +} //============================================================================= // @@ -607,14 +622,13 @@ static void _UpdateToolbarDelayed(); // static bool s_DocNeedSaving = false; // dirty-flag -static void SetSaveNeeded() +static inline void SetSaveNeeded() { if (!s_DocNeedSaving) { s_DocNeedSaving = true; + UpdateToolbar(); UpdateTitleBar(Globals.hwndMain); } - UpdateToolbar(); - if (IsWindow(Globals.hwndDlgFindReplace)) { PostWMCommand(Globals.hwndDlgFindReplace, IDC_DOC_MODIFIED); } @@ -626,7 +640,7 @@ void SetSavePoint() SciCall_SetSavePoint(); } s_DocNeedSaving = false; - ResetEvent(s_hEventFileChangedExt); + ResetFileOservationData(true); UpdateToolbar(); UpdateTitleBar(Globals.hwndMain); } @@ -9304,11 +9318,10 @@ void UpdateTitleBar(const HWND hwnd) if (hwnd == Globals.hwndMain) { bool const bFileLocked = (FileWatching.FileWatchingMode == FWM_EXCLUSIVELOCK); - bool const bFileChanged = (WaitForSingleObject(s_hEventFileChangedExt, 0) != WAIT_TIMEOUT); SetWindowTitle(Globals.hwndMain, Paths.CurrentFile, Settings.PathNameFormat, s_flagPasteBoard, s_bIsProcessElevated, GetDocModified(), - bFileLocked, bFileChanged, s_bFileReadOnly, s_wchTitleExcerpt); + bFileLocked, IsFileChangedFlagSet(), s_bFileReadOnly, s_wchTitleExcerpt); } PostMessage(hwnd, WM_NCACTIVATE, FALSE, -1); // (!) PostMessage(hwnd, WM_NCACTIVATE, TRUE, 0); @@ -9905,7 +9918,7 @@ bool FileLoad(LPCWSTR lpszFile, bool bDontSave, bool bNew, bool bReload, if (SciCall_GetZoom() != 100) { ShowZoomCallTip(); } - ResetEvent(s_hEventFileChangedExt); + ResetFileOservationData(true); return true; } @@ -10116,7 +10129,7 @@ bool FileLoad(LPCWSTR lpszFile, bool bDontSave, bool bNew, bool bReload, } if (fSuccess) { - ResetEvent(s_hEventFileChangedExt); + ResetFileOservationData(true); } UpdateTitleBar(Globals.hwndMain); @@ -10355,7 +10368,7 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP } Globals.pFileMRU->pszBookMarks[idx] = StrDup(wchBookMarks); } - ResetEvent(s_hEventFileChangedExt); + ResetFileOservationData(true); return true; } @@ -11368,9 +11381,7 @@ void InstallFileWatching(const bool bInstall) { if (!IS_VALID_HANDLE(_hObserverThread)) { // Save data of current file - if (!GetFileAttributesEx(Paths.CurrentFile, GetFileExInfoStandard, &s_fdCurFile)) { - ZeroMemory(&s_fdCurFile, sizeof(WIN32_FIND_DATA)); - } + ResetFileOservationData(false); WCHAR tchDirectory[MAX_PATH] = { L'\0' }; StringCchCopy(tchDirectory, COUNTOF(tchDirectory), Paths.CurrentFile); From 2669d0bec48d8f0f83532a939ed1a9c289950f2b Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Wed, 4 Aug 2021 12:54:04 +0200 Subject: [PATCH 4/5] +fix: typo --- src/Notepad3.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index bf4073ece..c44875088 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -562,7 +562,7 @@ static inline bool HasCurrentFileChanged() { return changed; } -static inline void ResetFileOservationData(const bool bResetEvt) { +static inline void ResetFileObservationData(const bool bResetEvt) { if (bResetEvt) { ResetEvent(s_hEventFileChangedExt); } @@ -640,7 +640,7 @@ void SetSavePoint() SciCall_SetSavePoint(); } s_DocNeedSaving = false; - ResetFileOservationData(true); + ResetFileObservationData(true); UpdateToolbar(); UpdateTitleBar(Globals.hwndMain); } @@ -9918,7 +9918,7 @@ bool FileLoad(LPCWSTR lpszFile, bool bDontSave, bool bNew, bool bReload, if (SciCall_GetZoom() != 100) { ShowZoomCallTip(); } - ResetFileOservationData(true); + ResetFileObservationData(true); return true; } @@ -10129,7 +10129,7 @@ bool FileLoad(LPCWSTR lpszFile, bool bDontSave, bool bNew, bool bReload, } if (fSuccess) { - ResetFileOservationData(true); + ResetFileObservationData(true); } UpdateTitleBar(Globals.hwndMain); @@ -10368,7 +10368,7 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP } Globals.pFileMRU->pszBookMarks[idx] = StrDup(wchBookMarks); } - ResetFileOservationData(true); + ResetFileObservationData(true); return true; } @@ -11381,7 +11381,7 @@ void InstallFileWatching(const bool bInstall) { if (!IS_VALID_HANDLE(_hObserverThread)) { // Save data of current file - ResetFileOservationData(false); + ResetFileObservationData(false); WCHAR tchDirectory[MAX_PATH] = { L'\0' }; StringCchCopy(tchDirectory, COUNTOF(tchDirectory), Paths.CurrentFile); From bae890c596a65afebfb073a78bc1d243db3412ca Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Wed, 4 Aug 2021 13:56:17 +0200 Subject: [PATCH 5/5] + chg: minor changed regarding file changed indicator --- src/Notepad3.c | 74 +++++++++++++++++++++++++++----------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/src/Notepad3.c b/src/Notepad3.c index c44875088..c71b2d58a 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -626,6 +626,7 @@ static inline void SetSaveNeeded() { if (!s_DocNeedSaving) { s_DocNeedSaving = true; + HasCurrentFileChanged(); UpdateToolbar(); UpdateTitleBar(Globals.hwndMain); } @@ -640,15 +641,14 @@ void SetSavePoint() SciCall_SetSavePoint(); } s_DocNeedSaving = false; - ResetFileObservationData(true); UpdateToolbar(); UpdateTitleBar(Globals.hwndMain); } inline static bool GetDocModified() { - if (SciCall_GetModify() && !s_DocNeedSaving) { - SetSaveNeeded(); + if ((SciCall_GetModify() && !s_DocNeedSaving)) { + SetSaveNeeded(); } return s_DocNeedSaving; } @@ -8526,7 +8526,7 @@ static void _UpdateToolbarDelayed() } EnableTool(Globals.hwndToolbar, IDT_FILE_ADDTOFAV, StrIsNotEmpty(Paths.CurrentFile)); - EnableTool(Globals.hwndToolbar, IDT_FILE_SAVE, GetDocModified() /*&& !bReadOnly*/); + EnableTool(Globals.hwndToolbar, IDT_FILE_SAVE, GetDocModified() || IsFileChangedFlagSet() /*&& !bReadOnly*/); EnableTool(Globals.hwndToolbar, IDT_FILE_RECENT, (MRU_Count(Globals.pFileMRU) > 0)); CheckTool(Globals.hwndToolbar, IDT_VIEW_WORDWRAP, Globals.fvCurFile.bWordWrap); @@ -10167,44 +10167,45 @@ bool FileRevert(LPCWSTR szFileName, bool bIgnoreCmdLnEnc) WCHAR tchFileName2[MAX_PATH] = { L'\0' }; StringCchCopyW(tchFileName2, COUNTOF(tchFileName2), szFileName); - //InstallFileWatching(false); + //~InstallFileWatching(false); bool const result = FileLoad(tchFileName2, true, false, true, Settings.SkipUnicodeDetection, Settings.SkipANSICodePageDetection, false); - //InstallFileWatching(true); + //~InstallFileWatching(true); - if (!result) { - return false; - } + if (result) { - if (FileWatching.FileWatchingMode == FWM_AUTORELOAD) { - if (bIsAtDocEnd || FileWatching.MonitoringLog) { - bPreserveView = false; - SciCall_DocumentEnd(); - EditScrollSelectionToView(); + if (FileWatching.FileWatchingMode == FWM_AUTORELOAD) { + if (bIsAtDocEnd || FileWatching.MonitoringLog) { + bPreserveView = false; + SciCall_DocumentEnd(); + EditScrollSelectionToView(); + } } - } - if (SciCall_GetTextLength() >= 4) { - char tch[5] = { '\0','\0','\0','\0','\0' }; - SciCall_GetText(COUNTOF(tch), tch); - if (StringCchCompareXA(tch, ".LOG") == 0) { - SciCall_ClearSelections(); - bPreserveView = false; - SciCall_DocumentEnd(); - EditScrollSelectionToView(); + if (SciCall_GetTextLength() >= 4) { + char tch[5] = { '\0', '\0', '\0', '\0', '\0' }; + SciCall_GetText(COUNTOF(tch), tch); + if (StringCchCompareXA(tch, ".LOG") == 0) { + SciCall_ClearSelections(); + bPreserveView = false; + SciCall_DocumentEnd(); + EditScrollSelectionToView(); + } + } + + if (bPreserveView) { + SciCall_SetYCaretPolicy(s_iCaretPolicyV | CARET_JUMPS, Settings2.CurrentLineVerticalSlop); + EditJumpTo(curLineNum + 1, 0); + SciCall_SetYCaretPolicy(s_iCaretPolicyV, Settings2.CurrentLineVerticalSlop); } } SetSavePoint(); UpdateMarginWidth(true); UpdateStatusbar(true); + UpdateToolbar(); + UpdateTitleBar(Globals.hwndMain); - if (bPreserveView) { - SciCall_SetYCaretPolicy(s_iCaretPolicyV | CARET_JUMPS, Settings2.CurrentLineVerticalSlop); - EditJumpTo(curLineNum + 1, 0); - SciCall_SetYCaretPolicy(s_iCaretPolicyV, Settings2.CurrentLineVerticalSlop); - } - - return true; + return result; } @@ -10355,7 +10356,7 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP #endif - if (!bSaveAlways && (!GetDocModified() || bIsEmptyNewFile) && !bSaveAs) { + if (!bSaveAlways && (!GetDocModified() || IsFileChangedFlagSet() || bIsEmptyNewFile) && !bSaveAs) { int idx; if (MRU_FindFile(Globals.pFileMRU, Paths.CurrentFile, &idx)) { Globals.pFileMRU->iEncoding[idx] = Encoding_GetCurrent(); @@ -10521,6 +10522,9 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP } } } + if (fSuccess) { + ResetFileObservationData(true); + } return fSuccess; } @@ -11087,7 +11091,6 @@ void ShowNotifyIcon(HWND hwnd,bool bAdd) // // SetNotifyIconTitle() // -// void SetNotifyIconTitle(HWND hwnd) { NOTIFYICONDATA nid = { sizeof(NOTIFYICONDATA) }; @@ -11107,11 +11110,14 @@ void SetNotifyIconTitle(HWND hwnd) } else { GetLngString(IDS_MUI_UNTITLED, tchTitle, COUNTOF(tchTitle) - 4); } - if (GetDocModified()) { - StringCchCopy(nid.szTip, COUNTOF(nid.szTip), L"* "); + if (IsFileChangedFlagSet()) { + StringCchCopy(nid.szTip, COUNTOF(nid.szTip), L"@ "); } else { StringCchCopy(nid.szTip, COUNTOF(nid.szTip), L""); } + if (GetDocModified()) { + StringCchCat(nid.szTip, COUNTOF(nid.szTip), L"* "); + } StringCchCat(nid.szTip,COUNTOF(nid.szTip),tchTitle); Shell_NotifyIcon(NIM_MODIFY,&nid);