Merge pull request #5382 from RaiKoHoff/Dev_Master

Update Bars - check for changed filename always
This commit is contained in:
Pairi Daiza 2025-02-09 14:56:51 +01:00 committed by GitHub
commit dac1ff737b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 29 additions and 23 deletions

View File

@ -5276,7 +5276,6 @@ void SetWindowTitle(HWND hwnd, const HPATHL pthFilePath, const TITLEPROPS_T prop
s_pthCachedFilePath = Path_Allocate(L"");
}
if (!forceRedraw) {
if (s_properties.iFormat != properties.iFormat) {
forceRedraw = true;
@ -5302,20 +5301,19 @@ void SetWindowTitle(HWND hwnd, const HPATHL pthFilePath, const TITLEPROPS_T prop
else if (s_properties.bReadOnly != properties.bReadOnly) {
forceRedraw = true;
}
else {
for (int i = 0; i < COUNTOF(s_compTitleExcerpt); ++i) {
if (s_compTitleExcerpt[i] != lpszExcerpt[i]) {
forceRedraw = true;
bExcerptChanged = true;
break;
}
}
if (Path_StrgComparePath(s_pthCachedFilePath, pthFilePath, Paths.WorkingDirectory) != 0) {
forceRedraw = true;
bFilePathChanged = true;
}
}
for (int i = 0; i < COUNTOF(s_compTitleExcerpt); ++i) {
if (s_compTitleExcerpt[i] != lpszExcerpt[i]) {
forceRedraw = true;
bExcerptChanged = true;
break;
}
}
// assuming path is normalized (for speed)
if (Path_StrgComparePath(s_pthCachedFilePath, pthFilePath, Paths.WorkingDirectory, false) != 0) {
forceRedraw = true;
bFilePathChanged = true;
}
if (!forceRedraw) {
return;

View File

@ -1632,7 +1632,7 @@ static BOOL CALLBACK _EnumWndProc2(HWND hwnd, LPARAM lParam)
GetDlgItemText(hwnd, IDC_FILENAME, wchFileName, COUNTOF(wchFileName));
HPATHL hpthFileName = Path_Allocate(wchFileName);
if (Path_StrgComparePath(hpthFileName, s_pthCheckFilePath, Paths.WorkingDirectory) == 0) {
if (Path_StrgComparePath(hpthFileName, s_pthCheckFilePath, Paths.WorkingDirectory, true) == 0) {
*(HWND*)lParam = hwnd;
bContinue = FALSE;
}
@ -3699,7 +3699,7 @@ static LRESULT _OnDropOneFile(HWND hwnd, HPATHL hFilePath, WININFO* wi)
}
else if (Path_IsExistingFile(hFilePath)) {
//~ ignore Flags.bReuseWindow
bool const sameFile = (Path_StrgComparePath(hFilePath, Paths.CurrentFile, Paths.ModuleDirectory) == 0);
bool const sameFile = (Path_StrgComparePath(hFilePath, Paths.CurrentFile, Paths.ModuleDirectory, true) == 0);
if (IsKeyDown(VK_CONTROL) || wi) {
DialogNewWindow(hwnd, sameFile, hFilePath, wi);
} else {
@ -11576,7 +11576,7 @@ bool FileLoad(const HPATHL hfile_pth, const FileLoadFlags fLoadFlags, const DocP
Path_NormalizeEx(hopen_file, Paths.WorkingDirectory, true, Flags.bSearchPathIfRelative);
if (!bReloadFile && Path_StrgComparePath(hopen_file, Paths.CurrentFile, Paths.WorkingDirectory) == 0) {
if (!bReloadFile && Path_StrgComparePath(hopen_file, Paths.CurrentFile, Paths.WorkingDirectory, false) == 0) {
Path_Release(hopen_file);
return false;
}
@ -11714,7 +11714,7 @@ bool FileLoad(const HPATHL hfile_pth, const FileLoadFlags fLoadFlags, const DocP
}
// consistent settings file handling (if loaded in editor)
Flags.bSettingsFileSoftLocked = (Path_StrgComparePath(Paths.CurrentFile, Paths.IniFile, Paths.WorkingDirectory) == 0);
Flags.bSettingsFileSoftLocked = (Path_StrgComparePath(Paths.CurrentFile, Paths.IniFile, Paths.WorkingDirectory, true) == 0);
// the .LOG feature ...
if (IsFileVarLogFile()) {

View File

@ -976,10 +976,18 @@ static int _StrgComparePathNormalized(const HPATHL hpth1, const HPATHL hpth2)
// ----------------------------------------------------------------------------
int PTHAPI Path_StrgComparePath(const HPATHL hpth1, const HPATHL hpth2, const HPATHL hpth_wrkdir)
int PTHAPI Path_StrgComparePath(const HPATHL hpth1, const HPATHL hpth2, const HPATHL hpth_wrkdir, const bool bNormalize)
{
if (Path_IsEmpty(hpth1)) { return -1; }
if (Path_IsEmpty(hpth2)) { return +1; }
if (!bNormalize) {
return _StrgComparePathNormalized(hpth1, hpth2);
}
if (Path_IsEmpty(hpth1)) {
return -1;
}
if (Path_IsEmpty(hpth2)) {
return +1;
}
HPATHL hpth1_tmp = Path_Copy(hpth1);
HPATHL hpth2_tmp = Path_Copy(hpth2);

View File

@ -99,7 +99,7 @@ bool PTHAPI Path_IsRoot(const HPATHL hpth);
bool PTHAPI Path_IsValidUNC(const HPATHL hpth);
bool PTHAPI Path_IsExistingDirectory(const HPATHL hpth);
int PTHAPI Path_StrgComparePath(const HPATHL hpth1, const HPATHL hpth2, const HPATHL hpth_wrkdir);
int PTHAPI Path_StrgComparePath(const HPATHL hpth1, const HPATHL hpth2, const HPATHL hpth_wrkdir, const bool bNormalize);
bool PTHAPI Path_RemoveFileSpec(HPATHL hpth_in_out);
bool PTHAPI Path_RenameExtension(HPATHL hpth, LPCWSTR ext);
void PTHAPI Path_ExpandEnvStrings(HPATHL hpth_in_out);

View File

@ -927,7 +927,7 @@ static void _ReadFromIniCache() {
bool Style_ImportFromFile(const HPATHL hpath)
{
bool const bHaveFileResource = Path_IsNotEmpty(hpath);
bool const bIsStdIniFile = bHaveFileResource ? (Path_StrgComparePath(hpath, Paths.IniFile, Paths.ModuleDirectory) == 0) : false;
bool const bIsStdIniFile = bHaveFileResource ? (Path_StrgComparePath(hpath, Paths.IniFile, Paths.ModuleDirectory, true) == 0) : false;
bool result = bIsStdIniFile ? OpenSettingsFile(__func__) : (bHaveFileResource ? LoadIniFileCache(hpath) : true);
if (result) {
@ -1155,7 +1155,7 @@ bool Style_ExportToFile(const HPATHL hpath, bool bForceAll)
return false;
}
bool const bIsStdIniFile = (Path_StrgComparePath(hpath, Paths.IniFile, Paths.ModuleDirectory) == 0);
bool const bIsStdIniFile = (Path_StrgComparePath(hpath, Paths.IniFile, Paths.ModuleDirectory, true) == 0);
// special handling of standard .ini-file
bool ok = false;