From 2caef47609dfaff55f7623cb5b3ed54fe7782ec3 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Wed, 15 May 2019 18:36:47 +0200 Subject: [PATCH] + add: textual (T) "Always On Top" indicator in title-bar --- src/Dialogs.c | 18 +++++++++++------- src/Dialogs.h | 3 ++- src/Notepad3.c | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Dialogs.c b/src/Dialogs.c index 787f335ec..0325dbbda 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -3455,14 +3455,16 @@ void DialogAdminExe(HWND hwnd, bool bExecInstaller) // bool bFreezeAppTitle = false; -static const WCHAR *pszSep = L" - "; -static const WCHAR *pszMod = L"* "; +const WCHAR* const pszSep = L" - "; +const WCHAR* const pszMod = L"* "; +const WCHAR* const pszPin = L"(T) "; + static WCHAR szCachedFile[MAX_PATH] = { L'\0' }; static WCHAR szCachedDisplayName[MAX_PATH] = { L'\0' }; static WCHAR szAdditionalTitleInfo[MAX_PATH] = { L'\0' }; bool SetWindowTitle(HWND hwnd, UINT uIDAppName, bool bIsElevated, UINT uIDUntitled, - LPCWSTR lpszFile, int iFormat, bool bModified, + LPCWSTR lpszFile, int iFormat, bool bModified, bool bAlwaysOnTop, UINT uIDReadOnly, bool bReadOnly, LPCWSTR lpszExcerpt) { if (bFreezeAppTitle) @@ -3482,10 +3484,12 @@ bool SetWindowTitle(HWND hwnd, UINT uIDAppName, bool bIsElevated, UINT uIDUntitl WCHAR szTitle[MIDSZ_BUFFER] = { L'\0' }; - if (bModified) - StringCchCopy(szTitle, COUNTOF(szTitle), pszMod); - else - StringCchCopy(szTitle, COUNTOF(szTitle), L""); + if (bAlwaysOnTop) { + StringCchCat(szTitle, COUNTOF(szTitle), pszPin); + } + if (bModified) { + StringCchCat(szTitle, COUNTOF(szTitle), pszMod); + } if (StrIsNotEmpty(lpszExcerpt)) { WCHAR szExcrptFmt[32] = { L'\0' }; diff --git a/src/Dialogs.h b/src/Dialogs.h index 1360d55d1..8b337d313 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -52,7 +52,8 @@ int MessageBoxLng(UINT uType, UINT uIdMsg, ...); INT_PTR InfoBoxLng(UINT uType, LPCWSTR lpstrSetting, UINT uidMessage, ...); DWORD GetLastErrorToMsgBox(LPWSTR lpszFunction, DWORD dwErrID); -bool SetWindowTitle(HWND hwnd, UINT uIDAppName, bool, UINT uIDUntitled, LPCWSTR lpszFile, int iFormat, bool, UINT uIDReadOnly, bool, LPCWSTR lpszExcerpt); +bool SetWindowTitle(HWND hwnd, UINT uIDAppName, bool, UINT uIDUntitled, LPCWSTR lpszFile, int iFormat, + bool bModified, bool bAlwaysOnTop, UINT uIDReadOnly, bool bReadOnly, LPCWSTR lpszExcerpt); void SetAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo); void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode, int iOpacityLevel); void CenterDlgInParent(HWND hDlg); diff --git a/src/Notepad3.c b/src/Notepad3.c index 761b5e1eb..7fca6de3e 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -8474,7 +8474,7 @@ void UpdateToolbar() static void _UpdateToolbarDelayed() { SetWindowTitle(Globals.hwndMain, s_uidsAppTitle, s_bIsElevated, IDS_MUI_UNTITLED, Globals.CurrentFile, - Settings.PathNameFormat, IsSaveNeeded(ISN_GET), + Settings.PathNameFormat, IsSaveNeeded(ISN_GET), Settings.AlwaysOnTop, IDS_MUI_READONLY, s_bFileReadOnly, s_wchTitleExcerpt); if (!Settings.ShowToolbar) { return; }