IDE: auto renaming project title when renaming project, bug #10902

git-svn-id: trunk@14339 -
This commit is contained in:
mattias 2008-03-01 12:14:09 +00:00
parent 8f3ae0f07f
commit 22bd534fe8
2 changed files with 13 additions and 3 deletions

View File

@ -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;

View File

@ -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;