diff --git a/ide/main.pp b/ide/main.pp index 1782a82a08..28d4160db7 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -6039,6 +6039,7 @@ var Ext: string; NewBuf: TCodeBuffer; OldProjectPath: string; + TitleWasDefault: Boolean; begin OldProjectPath:=Project1.ProjectDirectory; @@ -6167,6 +6168,8 @@ begin if Result=mrCancel then exit; end; end; + + TitleWasDefault:=Project1.TitleIsDefault(true); // set new project filename Project1.ProjectInfoFile:=NewFilename; @@ -6222,6 +6225,12 @@ begin Project1.CompilerOptions.DebugPath:= RebaseSearchPath(Project1.CompilerOptions.DebugPath,OldProjectPath, Project1.ProjectDirectory,true); + + // change title + if TitleWasDefault then begin + Project1.Title:=Project1.GetDefaultTitle; + // title does not need to be removed from source, because it was default + end; // invalidate cached substituted macros IncreaseCompilerParseStamp; diff --git a/ide/project.pp b/ide/project.pp index 6c576f0016..3e83fcd8a1 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -608,7 +608,7 @@ type // title function GetDefaultTitle: string; - function TitleIsDefault: boolean; + function TitleIsDefault(Fuzzy: boolean = false): boolean; function IDAsString: string; function IDAsWord: string; @@ -1956,9 +1956,10 @@ begin Result:=ExtractFilenameOnly(ProjectInfoFile); end; -function TProject.TitleIsDefault: boolean; +function TProject.TitleIsDefault(Fuzzy: boolean): boolean; begin - Result:=(Title='') or (Title=GetDefaultTitle); + Result:=(Title='') or (Title=GetDefaultTitle) + or (Fuzzy and (SysUtils.CompareText(Title,GetDefaultTitle)=0)); end; function TProject.IDAsString: string;