mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-06 18:38:23 +02:00
IDE: when renaming the main source, auto rename the project
git-svn-id: trunk@18927 -
This commit is contained in:
parent
ce37d3d700
commit
e9e078db85
17
ide/main.pp
17
ide/main.pp
@ -7112,6 +7112,7 @@ var ActiveSrcEdit:TSourceEditor;
|
|||||||
ActiveUnitInfo:TUnitInfo;
|
ActiveUnitInfo:TUnitInfo;
|
||||||
TestFilename, DestFilename: string;
|
TestFilename, DestFilename: string;
|
||||||
ResourceCode, LFMCode: TCodeBuffer;
|
ResourceCode, LFMCode: TCodeBuffer;
|
||||||
|
MainUnitInfo: TUnitInfo;
|
||||||
begin
|
begin
|
||||||
{$IFDEF IDE_VERBOSE}
|
{$IFDEF IDE_VERBOSE}
|
||||||
writeln('TMainIDE.DoSaveEditorFile A PageIndex=',PageIndex,' Flags=',SaveFlagsToString(Flags));
|
writeln('TMainIDE.DoSaveEditorFile A PageIndex=',PageIndex,' Flags=',SaveFlagsToString(Flags));
|
||||||
@ -7155,6 +7156,22 @@ begin
|
|||||||
if (not (sfSaveToTestDir in Flags)) and (ActiveUnitInfo.IsVirtual) then
|
if (not (sfSaveToTestDir in Flags)) and (ActiveUnitInfo.IsVirtual) then
|
||||||
Include(Flags,sfSaveAs);
|
Include(Flags,sfSaveAs);
|
||||||
|
|
||||||
|
// if this is the main source and has the same name as the lpi
|
||||||
|
// rename the project
|
||||||
|
// Note:
|
||||||
|
// Changing the main source file without the .lpi is possible only by
|
||||||
|
// manually editing the lpi file, because this is only needed in
|
||||||
|
// special cases.
|
||||||
|
MainUnitInfo:=ActiveUnitInfo.Project.MainUnitInfo;
|
||||||
|
if (sfSaveAs in Flags) and (not (sfProjectSaving in Flags))
|
||||||
|
and (ActiveUnitInfo=MainUnitInfo)
|
||||||
|
and (CompareFilenames(ExtractFileNameWithoutExt(ActiveUnitInfo.Filename),
|
||||||
|
ExtractFileNameWithoutExt(MainUnitInfo.Filename))=0) then
|
||||||
|
begin
|
||||||
|
Result:=DoSaveProject([sfSaveAs]);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
// update source notebook page names
|
// update source notebook page names
|
||||||
if (not (sfProjectSaving in Flags)) then
|
if (not (sfProjectSaving in Flags)) then
|
||||||
UpdateSourceNames;
|
UpdateSourceNames;
|
||||||
|
Loading…
Reference in New Issue
Block a user