mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-20 11:39:29 +02:00
IDE: renamed TUnitInfo.Unit_Name to SrcUnitName and fixed updating it
git-svn-id: trunk@48911 -
This commit is contained in:
parent
1c8f99a192
commit
8b4e761edc
@ -613,7 +613,7 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
ClassUnitInfo:=Project1.UnitWithComponentClassName(aMissingTypes[i]);
|
ClassUnitInfo:=Project1.UnitWithComponentClassName(aMissingTypes[i]);
|
||||||
if ClassUnitInfo<>nil then
|
if ClassUnitInfo<>nil then
|
||||||
NeededUnitName:=ClassUnitInfo.Unit_Name;
|
NeededUnitName:=ClassUnitInfo.GetUsesUnitName;
|
||||||
end;
|
end;
|
||||||
if NeededUnitName<>'' then begin
|
if NeededUnitName<>'' then begin
|
||||||
if fUsedUnitsTool.AddUnitImmediately(NeededUnitName) then
|
if fUsedUnitsTool.AddUnitImmediately(NeededUnitName) then
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
<XPManifest>
|
<XPManifest>
|
||||||
<DpiAware Value="True"/>
|
<DpiAware Value="True"/>
|
||||||
</XPManifest>
|
</XPManifest>
|
||||||
<Icon Value="-1"/>
|
|
||||||
</General>
|
</General>
|
||||||
<LazDoc Paths="docs/xml/ide"/>
|
<LazDoc Paths="docs/xml/ide"/>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
@ -70,6 +69,7 @@
|
|||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="lazarus.pp"/>
|
<Filename Value="lazarus.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="Lazarus"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
<Unit1>
|
||||||
<Filename Value="frames/oi_options.pas"/>
|
<Filename Value="frames/oi_options.pas"/>
|
||||||
@ -322,6 +322,7 @@
|
|||||||
<Unit42>
|
<Unit42>
|
||||||
<Filename Value="project.pp"/>
|
<Filename Value="project.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="Project"/>
|
||||||
</Unit42>
|
</Unit42>
|
||||||
<Unit43>
|
<Unit43>
|
||||||
<Filename Value="customformeditor.pp"/>
|
<Filename Value="customformeditor.pp"/>
|
||||||
@ -565,6 +566,7 @@
|
|||||||
<Unit82>
|
<Unit82>
|
||||||
<Filename Value="sourcefilemanager.pas"/>
|
<Filename Value="sourcefilemanager.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="SourceFileManager"/>
|
||||||
</Unit82>
|
</Unit82>
|
||||||
<Unit83>
|
<Unit83>
|
||||||
<Filename Value="../packager/lpkcache.pas"/>
|
<Filename Value="../packager/lpkcache.pas"/>
|
||||||
@ -649,6 +651,7 @@
|
|||||||
<Unit97>
|
<Unit97>
|
||||||
<Filename Value="etquickfixes.pas"/>
|
<Filename Value="etquickfixes.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="etQuickFixes"/>
|
||||||
</Unit97>
|
</Unit97>
|
||||||
<Unit98>
|
<Unit98>
|
||||||
<Filename Value="etsrceditmarks.pas"/>
|
<Filename Value="etsrceditmarks.pas"/>
|
||||||
@ -783,6 +786,7 @@
|
|||||||
<Unit125>
|
<Unit125>
|
||||||
<Filename Value="mainintf.pas"/>
|
<Filename Value="mainintf.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="MainIntf"/>
|
||||||
</Unit125>
|
</Unit125>
|
||||||
<Unit126>
|
<Unit126>
|
||||||
<Filename Value="mainbase.pas"/>
|
<Filename Value="mainbase.pas"/>
|
||||||
@ -1223,6 +1227,7 @@
|
|||||||
<Filename Value="useunitdlg.pas"/>
|
<Filename Value="useunitdlg.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
|
<UnitName Value="UseUnitDlg"/>
|
||||||
</Unit220>
|
</Unit220>
|
||||||
<Unit221>
|
<Unit221>
|
||||||
<Filename Value="keymapping.pp"/>
|
<Filename Value="keymapping.pp"/>
|
||||||
@ -1317,13 +1322,11 @@
|
|||||||
<ComponentName Value="QFInitLocalVarDialog"/>
|
<ComponentName Value="QFInitLocalVarDialog"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="QFInitLocalVarDlg"/>
|
|
||||||
</Unit240>
|
</Unit240>
|
||||||
<Unit241>
|
<Unit241>
|
||||||
<Filename Value="../packager/interpkgconflictfiles.pas"/>
|
<Filename Value="../packager/interpkgconflictfiles.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<UnitName Value="InterPkgConflictFiles"/>
|
|
||||||
</Unit241>
|
</Unit241>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
@ -1334,7 +1337,7 @@
|
|||||||
</Target>
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<IncludeFiles Value="include"/>
|
<IncludeFiles Value="include"/>
|
||||||
<OtherUnitFiles Value="frames;../converter;../debugger;../debugger/frames;../packager;../designer;../packager/frames;../ide;../packager"/>
|
<OtherUnitFiles Value="frames;../converter;../debugger;../debugger/frames;../packager;../designer;../packager/frames;../ide"/>
|
||||||
<UnitOutputDirectory Value="$(LazarusDir)/units/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)"/>
|
<UnitOutputDirectory Value="$(LazarusDir)/units/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Linking>
|
<Linking>
|
||||||
|
@ -10665,7 +10665,7 @@ var
|
|||||||
ConflictingClass: TClass;
|
ConflictingClass: TClass;
|
||||||
s: string;
|
s: string;
|
||||||
begin
|
begin
|
||||||
if SysUtils.CompareText(ActiveUnitInfo.Unit_Name,AName)=0 then
|
if SysUtils.CompareText(ActiveUnitInfo.SrcUnitName,AName)=0 then
|
||||||
raise Exception.Create(Format(
|
raise Exception.Create(Format(
|
||||||
lisTheUnitItselfHasAlreadyTheNamePascalIdentifiersMus, [AName]));
|
lisTheUnitItselfHasAlreadyTheNamePascalIdentifiersMus, [AName]));
|
||||||
if ActiveUnitInfo.IsPartOfProject then begin
|
if ActiveUnitInfo.IsPartOfProject then begin
|
||||||
@ -11617,7 +11617,7 @@ begin
|
|||||||
OkToAdd:=SourceFileMgr.CheckDirIsInSearchPath(AnUnitInfo,False,False);
|
OkToAdd:=SourceFileMgr.CheckDirIsInSearchPath(AnUnitInfo,False,False);
|
||||||
if (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags) then begin
|
if (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags) then begin
|
||||||
AnUnitInfo.ReadUnitNameFromSource(false);
|
AnUnitInfo.ReadUnitNameFromSource(false);
|
||||||
ShortUnitName:=AnUnitInfo.Unit_Name;
|
ShortUnitName:=AnUnitInfo.SrcUnitName;
|
||||||
if (ShortUnitName<>'') then begin
|
if (ShortUnitName<>'') then begin
|
||||||
if CodeToolBoss.AddUnitToMainUsesSectionIfNeeded(
|
if CodeToolBoss.AddUnitToMainUsesSectionIfNeeded(
|
||||||
Project1.MainUnitInfo.Source,ShortUnitName,'') then begin
|
Project1.MainUnitInfo.Source,ShortUnitName,'') then begin
|
||||||
|
@ -556,7 +556,7 @@ procedure TFileDescInheritedComponent.SetInheritedUnit(const AValue: TUnitInfo);
|
|||||||
begin
|
begin
|
||||||
if FInheritedUnit=AValue then exit;
|
if FInheritedUnit=AValue then exit;
|
||||||
FInheritedUnit:=AValue;
|
FInheritedUnit:=AValue;
|
||||||
InheritedUnits:=FInheritedUnit.Unit_Name;
|
InheritedUnits:=FInheritedUnit.SrcUnitName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TFileDescInheritedComponent.Create;
|
constructor TFileDescInheritedComponent.Create;
|
||||||
|
140
ide/project.pp
140
ide/project.pp
@ -285,7 +285,7 @@ type
|
|||||||
FRunFileIfActive: boolean;
|
FRunFileIfActive: boolean;
|
||||||
FSessionModified: boolean;
|
FSessionModified: boolean;
|
||||||
fSource: TCodeBuffer;
|
fSource: TCodeBuffer;
|
||||||
fUnitName: String;
|
fSrcUnitName: String;
|
||||||
fUsageCount: extended;
|
fUsageCount: extended;
|
||||||
fUserReadOnly: Boolean;
|
fUserReadOnly: Boolean;
|
||||||
fSourceChangeStep: LongInt;
|
fSourceChangeStep: LongInt;
|
||||||
@ -324,7 +324,7 @@ type
|
|||||||
procedure SetRunFileIfActive(const AValue: boolean);
|
procedure SetRunFileIfActive(const AValue: boolean);
|
||||||
procedure SetSessionModified(const AValue: boolean);
|
procedure SetSessionModified(const AValue: boolean);
|
||||||
procedure SetSource(ABuffer: TCodeBuffer);
|
procedure SetSource(ABuffer: TCodeBuffer);
|
||||||
procedure SetUnitName(const NewUnitName:string);
|
procedure SetSrcUnitName(const NewUnitName:string);
|
||||||
procedure SetUserReadOnly(const NewValue: boolean);
|
procedure SetUserReadOnly(const NewValue: boolean);
|
||||||
protected
|
protected
|
||||||
function GetFileName: string; override;
|
function GetFileName: string; override;
|
||||||
@ -362,10 +362,9 @@ type
|
|||||||
procedure IgnoreCurrentFileDateOnDisk;
|
procedure IgnoreCurrentFileDateOnDisk;
|
||||||
procedure IncreaseAutoRevertLock; // do not auto revert from disk
|
procedure IncreaseAutoRevertLock; // do not auto revert from disk
|
||||||
procedure DecreaseAutoRevertLock;
|
procedure DecreaseAutoRevertLock;
|
||||||
function ParseUnitNameFromSource(TryCache: boolean): string;// fetch name fom source
|
function ReadUnitNameFromSource(TryCache: boolean): string;// fetch unit name from source and update property UnitName
|
||||||
procedure ReadUnitNameFromSource(TryCache: boolean);// fetch unit name from source and update property UnitName
|
function GetUsesUnitName: string;
|
||||||
function CreateUnitName: string;
|
function CreateUnitName: string;
|
||||||
procedure ImproveUnitNameCache(const NewUnitName: string);
|
|
||||||
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
||||||
Merge, IgnoreIsPartOfProject: boolean;
|
Merge, IgnoreIsPartOfProject: boolean;
|
||||||
FileVersion: integer);
|
FileVersion: integer);
|
||||||
@ -467,7 +466,7 @@ type
|
|||||||
property Source: TCodeBuffer read fSource write SetSource;
|
property Source: TCodeBuffer read fSource write SetSource;
|
||||||
property DefaultSyntaxHighlighter: TLazSyntaxHighlighter
|
property DefaultSyntaxHighlighter: TLazSyntaxHighlighter
|
||||||
read FDefaultSyntaxHighlighter write SetDefaultSyntaxHighlighter;
|
read FDefaultSyntaxHighlighter write SetDefaultSyntaxHighlighter;
|
||||||
property Unit_Name: String read fUnitName write SetUnitName;
|
property SrcUnitName: String read fSrcUnitName write SetSrcUnitName; // unit name in source
|
||||||
property UserReadOnly: Boolean read fUserReadOnly write SetUserReadOnly;
|
property UserReadOnly: Boolean read fUserReadOnly write SetUserReadOnly;
|
||||||
property SourceDirectoryReferenced: boolean read FSourceDirectoryReferenced;
|
property SourceDirectoryReferenced: boolean read FSourceDirectoryReferenced;
|
||||||
property AutoReferenceSourceDir: boolean read FAutoReferenceSourceDir
|
property AutoReferenceSourceDir: boolean read FAutoReferenceSourceDir
|
||||||
@ -1602,34 +1601,56 @@ begin
|
|||||||
end;
|
end;
|
||||||
until Result<>mrRetry;
|
until Result<>mrRetry;
|
||||||
if ReadUnitName then begin
|
if ReadUnitName then begin
|
||||||
fUnitName:=CodeToolBoss.GetSourceName(fSource,false);
|
ReadUnitNameFromSource(false);
|
||||||
end;
|
end;
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TUnitInfo.ReadUnitNameFromSource(TryCache: boolean);
|
function TUnitInfo.ReadUnitNameFromSource(TryCache: boolean): string;
|
||||||
var
|
|
||||||
NewUnitName: String;
|
|
||||||
begin
|
begin
|
||||||
NewUnitName:=ParseUnitNameFromSource(TryCache);
|
Result:='';
|
||||||
if NewUnitName<>'' then
|
if TryCache then
|
||||||
fUnitName:=NewUnitName;
|
Result:=CodeToolBoss.GetCachedSourceName(Source);
|
||||||
|
if Result='' then
|
||||||
|
Result:=CodeToolBoss.GetSourceName(fSource,false);
|
||||||
|
if Result<>'' then begin
|
||||||
|
// source can be parsed => update SrcUnitName
|
||||||
|
{$IFDEF VerboseIDESrcUnitName}
|
||||||
|
if CompareFilenames(ExtractFileNameOnly(Filename),'interpkgconflictfiles')=0 then
|
||||||
|
debugln(['TUnitInfo.ReadUnitNameFromSource ',Result]);
|
||||||
|
{$ENDIF}
|
||||||
|
fSrcUnitName:=Result;
|
||||||
|
end else begin
|
||||||
|
// unable to parse the source
|
||||||
|
if FilenameIsPascalSource(Filename) then begin
|
||||||
|
// use default: the filename
|
||||||
|
Result:=ExtractFileNameOnly(Filename);
|
||||||
|
if CompareText(Result,fSrcUnitName)=0 then begin
|
||||||
|
// the last stored unitname has the better case
|
||||||
|
Result:=SrcUnitName;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TUnitInfo.GetUsesUnitName: string;
|
||||||
|
begin
|
||||||
|
if not FilenameIsPascalUnit(Filename) then
|
||||||
|
Result:=''
|
||||||
|
else begin
|
||||||
|
Result:=SrcUnitName;
|
||||||
|
if (Result='') or (CompareText(Result,ExtractFileNameOnly(Filename))<>0) then
|
||||||
|
Result:=ExtractFileNameOnly(Filename);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TUnitInfo.CreateUnitName: string;
|
function TUnitInfo.CreateUnitName: string;
|
||||||
begin
|
begin
|
||||||
Result:=Unit_Name;
|
Result:=SrcUnitName;
|
||||||
if (Result='') and FilenameIsPascalSource(Filename) then
|
if (Result='') and FilenameIsPascalSource(Filename) then
|
||||||
Result:=ExtractFilenameOnly(Filename);
|
Result:=ExtractFilenameOnly(Filename);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TUnitInfo.ImproveUnitNameCache(const NewUnitName: string);
|
|
||||||
begin
|
|
||||||
if (fUnitName='') or (CompareText(fUnitName,NewUnitName)=0) then begin
|
|
||||||
fUnitName:=NewUnitName;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TUnitInfo Clear
|
TUnitInfo Clear
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -1655,7 +1676,7 @@ begin
|
|||||||
Modified := false;
|
Modified := false;
|
||||||
SessionModified := false;
|
SessionModified := false;
|
||||||
FRunFileIfActive:=false;
|
FRunFileIfActive:=false;
|
||||||
fUnitName := '';
|
fSrcUnitName := '';
|
||||||
fUsageCount:=-1;
|
fUsageCount:=-1;
|
||||||
fUserReadOnly := false;
|
fUserReadOnly := false;
|
||||||
if fSource<>nil then fSource.Clear;
|
if fSource<>nil then fSource.Clear;
|
||||||
@ -1708,6 +1729,7 @@ procedure TUnitInfo.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
|
|||||||
var
|
var
|
||||||
AFilename: String;
|
AFilename: String;
|
||||||
i, X, Y: Integer;
|
i, X, Y: Integer;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
// global data
|
// global data
|
||||||
AFilename:=Filename;
|
AFilename:=Filename;
|
||||||
@ -1732,7 +1754,9 @@ begin
|
|||||||
XMLConfig.SetDeleteValue(Path+'ResourceBaseClass/Value',
|
XMLConfig.SetDeleteValue(Path+'ResourceBaseClass/Value',
|
||||||
PFComponentBaseClassNames[FResourceBaseClass],
|
PFComponentBaseClassNames[FResourceBaseClass],
|
||||||
PFComponentBaseClassNames[pfcbcNone]);
|
PFComponentBaseClassNames[pfcbcNone]);
|
||||||
XMLConfig.SetDeleteValue(Path+'UnitName/Value',fUnitName,'');
|
s:=fSrcUnitName;
|
||||||
|
if (s<>'') and (ExtractFileNameOnly(Filename)=s) then s:=''; // only save if SrcUnitName differ from filename
|
||||||
|
XMLConfig.SetDeleteValue(Path+'UnitName/Value',s,'');
|
||||||
// save custom data
|
// save custom data
|
||||||
SaveStringToStringTree(XMLConfig,CustomData,Path+'CustomData/');
|
SaveStringToStringTree(XMLConfig,CustomData,Path+'CustomData/');
|
||||||
end;
|
end;
|
||||||
@ -1785,6 +1809,7 @@ procedure TUnitInfo.LoadFromXMLConfig(XMLConfig: TXMLConfig;
|
|||||||
var
|
var
|
||||||
AFilename: string;
|
AFilename: string;
|
||||||
c, i: Integer;
|
c, i: Integer;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
// project data
|
// project data
|
||||||
if not Merge then begin
|
if not Merge then begin
|
||||||
@ -1807,8 +1832,16 @@ begin
|
|||||||
AFilename:=XMLConfig.GetValue(Path+'ResourceFilename/Value','');
|
AFilename:=XMLConfig.GetValue(Path+'ResourceFilename/Value','');
|
||||||
if (AFilename<>'') and Assigned(fOnLoadSaveFilename) then
|
if (AFilename<>'') and Assigned(fOnLoadSaveFilename) then
|
||||||
fOnLoadSaveFilename(AFilename,true);
|
fOnLoadSaveFilename(AFilename,true);
|
||||||
if FilenameIsPascalSource(AFilename) then
|
if FilenameIsPascalSource(Filename) then begin
|
||||||
fUnitName:=XMLConfig.GetValue(Path+'UnitName/Value',ExtractFileNameOnly(AFilename));
|
s:=ExtractFileNameOnly(Filename);
|
||||||
|
fSrcUnitName:=XMLConfig.GetValue(Path+'UnitName/Value',s);
|
||||||
|
{$IFDEF VerboseIDESrcUnitName}
|
||||||
|
if CompareFilenames(ExtractFileNameOnly(Filename),'interpkgconflictfiles')=0 then
|
||||||
|
debugln(['TUnitInfo.LoadFromXMLConfig ',fSrcUnitName]);
|
||||||
|
{$ENDIF}
|
||||||
|
if fSrcUnitName='' then
|
||||||
|
fSrcUnitName:=s;
|
||||||
|
end;
|
||||||
|
|
||||||
// save custom data
|
// save custom data
|
||||||
LoadStringToStringTree(XMLConfig,CustomData,Path+'CustomData/');
|
LoadStringToStringTree(XMLConfig,CustomData,Path+'CustomData/');
|
||||||
@ -1845,35 +1878,15 @@ begin
|
|||||||
LoadStringToStringTree(XMLConfig,CustomSessionData,Path+'CustomSessionData/');
|
LoadStringToStringTree(XMLConfig,CustomSessionData,Path+'CustomSessionData/');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TUnitInfo.ParseUnitNameFromSource(TryCache: boolean): string;
|
procedure TUnitInfo.SetSrcUnitName(const NewUnitName:string);
|
||||||
begin
|
|
||||||
Result:='';
|
|
||||||
if TryCache then
|
|
||||||
Result:=CodeToolBoss.GetCachedSourceName(Source);
|
|
||||||
if Result='' then
|
|
||||||
Result:=CodeToolBoss.GetSourceName(fSource,false);
|
|
||||||
if Result='' then begin
|
|
||||||
// unable to parse the source
|
|
||||||
if FilenameIsPascalSource(Filename) then begin
|
|
||||||
// use default: the filename
|
|
||||||
Result:=ExtractFileNameOnly(Filename);
|
|
||||||
if CompareText(Result,fUnitName)=0 then begin
|
|
||||||
// the last stored unitname has the better case
|
|
||||||
Result:=fUnitName;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TUnitInfo.SetUnitName(const NewUnitName:string);
|
|
||||||
var
|
var
|
||||||
Allowed: boolean;
|
Allowed: boolean;
|
||||||
OldUnitName: String;
|
OldUnitName: String;
|
||||||
begin
|
begin
|
||||||
if (fUnitName <> NewUnitName) and (NewUnitName <> '') then
|
if (fSrcUnitName <> NewUnitName) and (NewUnitName <> '') then
|
||||||
begin
|
begin
|
||||||
Allowed := true;
|
Allowed := true;
|
||||||
OldUnitName := fUnitName;
|
OldUnitName := fSrcUnitName;
|
||||||
if OldUnitName = '' then
|
if OldUnitName = '' then
|
||||||
OldUnitName := ExtractFileNameOnly(Filename);
|
OldUnitName := ExtractFileNameOnly(Filename);
|
||||||
if Assigned(FOnUnitNameChange) then
|
if Assigned(FOnUnitNameChange) then
|
||||||
@ -1883,7 +1896,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
CodeToolBoss.RenameSource(fSource,NewUnitName);
|
CodeToolBoss.RenameSource(fSource,NewUnitName);
|
||||||
end;
|
end;
|
||||||
fUnitName := NewUnitName;
|
{$IFDEF VerboseIDESrcUnitName}
|
||||||
|
if CompareFilenames(ExtractFileNameOnly(Filename),'interpkgconflictfiles')=0 then
|
||||||
|
debugln(['TUnitInfo.SetSrcUnitName ',NewUnitName]);
|
||||||
|
{$ENDIF}
|
||||||
|
fSrcUnitName := NewUnitName;
|
||||||
Modified := true;
|
Modified := true;
|
||||||
if (Project <> nil) then Project.UnitModified(Self);
|
if (Project <> nil) then Project.UnitModified(Self);
|
||||||
end;
|
end;
|
||||||
@ -3449,6 +3466,7 @@ procedure TProject.AddFile(ProjectFile: TLazProjectFile; AddToProjectUsesClause:
|
|||||||
var
|
var
|
||||||
NewIndex: integer;
|
NewIndex: integer;
|
||||||
AnUnit: TUnitInfo;
|
AnUnit: TUnitInfo;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
AnUnit:=ProjectFile as TUnitInfo;
|
AnUnit:=ProjectFile as TUnitInfo;
|
||||||
//debugln('TProject.AddFile A ',AnUnit.Filename,' AddToProjectFile=',dbgs(AddToProjectFile));
|
//debugln('TProject.AddFile A ',AnUnit.Filename,' AddToProjectFile=',dbgs(AddToProjectFile));
|
||||||
@ -3467,8 +3485,11 @@ begin
|
|||||||
MainUnitInfo.IncreaseAutoRevertLock;
|
MainUnitInfo.IncreaseAutoRevertLock;
|
||||||
|
|
||||||
if AddToProjectUsesClause and (MainUnitID>=0) and (MainUnitID<>NewIndex) then
|
if AddToProjectUsesClause and (MainUnitID>=0) and (MainUnitID<>NewIndex) then
|
||||||
if AnUnit.Unit_Name<>'' then // add unit to uses section
|
begin
|
||||||
CodeToolBoss.AddUnitToMainUsesSectionIfNeeded(MainUnitInfo.Source,AnUnit.Unit_Name,'',true);
|
s:=AnUnit.GetUsesUnitName;
|
||||||
|
if s<>'' then // add unit to uses section
|
||||||
|
CodeToolBoss.AddUnitToMainUsesSectionIfNeeded(MainUnitInfo.Source,s,'',true);
|
||||||
|
end;
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
UnitModified(AnUnit);
|
UnitModified(AnUnit);
|
||||||
end;
|
end;
|
||||||
@ -3495,9 +3516,9 @@ begin
|
|||||||
// remove unit from uses section and from createforms in program file
|
// remove unit from uses section and from createforms in program file
|
||||||
if (OldUnitInfo.IsPartOfProject) then begin
|
if (OldUnitInfo.IsPartOfProject) then begin
|
||||||
if RemoveFromUsesSection then begin
|
if RemoveFromUsesSection then begin
|
||||||
if (OldUnitInfo.Unit_Name<>'') then begin
|
if (OldUnitInfo.SrcUnitName<>'') then begin
|
||||||
CodeToolBoss.RemoveUnitFromAllUsesSections(MainUnitInfo.Source,
|
CodeToolBoss.RemoveUnitFromAllUsesSections(MainUnitInfo.Source,
|
||||||
OldUnitInfo.Unit_Name);
|
OldUnitInfo.SrcUnitName);
|
||||||
end;
|
end;
|
||||||
if (OldUnitInfo.ComponentName<>'') then begin
|
if (OldUnitInfo.ComponentName<>'') then begin
|
||||||
CodeToolBoss.RemoveCreateFormStatement(MainUnitInfo.Source,
|
CodeToolBoss.RemoveCreateFormStatement(MainUnitInfo.Source,
|
||||||
@ -3858,8 +3879,7 @@ end;
|
|||||||
|
|
||||||
function TProject.RemoveCreateFormFromProjectFile(const AClassName,AName:string):boolean;
|
function TProject.RemoveCreateFormFromProjectFile(const AClassName,AName:string):boolean;
|
||||||
begin
|
begin
|
||||||
Result:=CodeToolBoss.RemoveCreateFormStatement(MainUnitInfo.Source,
|
Result:=CodeToolBoss.RemoveCreateFormStatement(MainUnitInfo.Source,AName);
|
||||||
AName);
|
|
||||||
if Result then begin
|
if Result then begin
|
||||||
MainUnitInfo.Modified:=true;
|
MainUnitInfo.Modified:=true;
|
||||||
end;
|
end;
|
||||||
@ -3882,9 +3902,9 @@ begin
|
|||||||
if ((OnlyProjectUnits and Units[Result].IsPartOfProject)
|
if ((OnlyProjectUnits and Units[Result].IsPartOfProject)
|
||||||
or (not OnlyProjectUnits))
|
or (not OnlyProjectUnits))
|
||||||
and (IgnoreUnit<>Units[Result])
|
and (IgnoreUnit<>Units[Result])
|
||||||
and (Units[Result].Unit_Name<>'')
|
and (Units[Result].SrcUnitName<>'')
|
||||||
then begin
|
then begin
|
||||||
if (CompareDottedIdentifiers(PChar(Units[Result].Unit_Name),PChar(AnUnitName))=0)
|
if (CompareDottedIdentifiers(PChar(Units[Result].SrcUnitName),PChar(AnUnitName))=0)
|
||||||
then
|
then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -5022,8 +5042,8 @@ begin
|
|||||||
// check if no other project unit has this name
|
// check if no other project unit has this name
|
||||||
for i:=0 to UnitCount-1 do begin
|
for i:=0 to UnitCount-1 do begin
|
||||||
if (Units[i].IsPartOfProject)
|
if (Units[i].IsPartOfProject)
|
||||||
and (Units[i]<>AnUnitInfo) and (Units[i].Unit_Name<>'')
|
and (Units[i]<>AnUnitInfo) and (Units[i].SrcUnitName<>'')
|
||||||
and (CompareText(Units[i].Unit_Name,NewUnitName)=0) then begin
|
and (CompareText(Units[i].SrcUnitName,NewUnitName)=0) then begin
|
||||||
Allowed:=false;
|
Allowed:=false;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -5543,7 +5563,7 @@ function TProject.ProjectUnitWithUnitname(const AnUnitName: string): TUnitInfo;
|
|||||||
begin
|
begin
|
||||||
Result:=fFirst[uilPartOfProject];
|
Result:=fFirst[uilPartOfProject];
|
||||||
while Result<>nil do begin
|
while Result<>nil do begin
|
||||||
if CompareText(AnUnitName,Result.Unit_Name)=0 then exit;
|
if CompareText(AnUnitName,Result.SrcUnitName)=0 then exit;
|
||||||
Result:=Result.fNext[uilPartOfProject];
|
Result:=Result.fNext[uilPartOfProject];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -435,7 +435,7 @@ begin
|
|||||||
if AnUnitInfo.OpenEditorInfoCount > 0 then
|
if AnUnitInfo.OpenEditorInfoCount > 0 then
|
||||||
AShareEditor := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent);
|
AShareEditor := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent);
|
||||||
NewSrcEdit:=SrcNotebook.NewFile(
|
NewSrcEdit:=SrcNotebook.NewFile(
|
||||||
CreateSrcEditPageName(AnUnitInfo.Unit_Name, AFilename, AShareEditor),
|
CreateSrcEditPageName(AnUnitInfo.SrcUnitName, AFilename, AShareEditor),
|
||||||
AnUnitInfo.Source, False, AShareEditor);
|
AnUnitInfo.Source, False, AShareEditor);
|
||||||
NewSrcEdit.EditorComponent.BeginUpdate;
|
NewSrcEdit.EditorComponent.BeginUpdate;
|
||||||
MainIDEBar.itmFileClose.Enabled:=True;
|
MainIDEBar.itmFileClose.Enabled:=True;
|
||||||
@ -1719,7 +1719,8 @@ begin
|
|||||||
end else
|
end else
|
||||||
NewUnitInfo:=TUnitInfo.Create(NewBuffer);
|
NewUnitInfo:=TUnitInfo.Create(NewBuffer);
|
||||||
//debugln(['TLazSourceFileManager.NewFile ',NewUnitInfo.Filename,' ',NewFilename]);
|
//debugln(['TLazSourceFileManager.NewFile ',NewUnitInfo.Filename,' ',NewFilename]);
|
||||||
NewUnitInfo.ImproveUnitNameCache(NewUnitName);
|
if (CompareText(NewUnitInfo.SrcUnitName,NewUnitName)=0) then
|
||||||
|
NewUnitInfo.SrcUnitName:=NewUnitName;
|
||||||
NewUnitInfo.BuildFileIfActive:=NewFileDescriptor.BuildFileIfActive;
|
NewUnitInfo.BuildFileIfActive:=NewFileDescriptor.BuildFileIfActive;
|
||||||
NewUnitInfo.RunFileIfActive:=NewFileDescriptor.RunFileIfActive;
|
NewUnitInfo.RunFileIfActive:=NewFileDescriptor.RunFileIfActive;
|
||||||
|
|
||||||
@ -1765,7 +1766,7 @@ begin
|
|||||||
if NewUnitInfo.OpenEditorInfoCount > 0 then
|
if NewUnitInfo.OpenEditorInfoCount > 0 then
|
||||||
AShareEditor := TSourceEditor(NewUnitInfo.OpenEditorInfo[0].EditorComponent);
|
AShareEditor := TSourceEditor(NewUnitInfo.OpenEditorInfo[0].EditorComponent);
|
||||||
NewSrcEdit := SrcNoteBook.NewFile(
|
NewSrcEdit := SrcNoteBook.NewFile(
|
||||||
CreateSrcEditPageName(NewUnitInfo.Unit_Name, NewUnitInfo.Filename, AShareEditor),
|
CreateSrcEditPageName(NewUnitInfo.SrcUnitName, NewUnitInfo.Filename, AShareEditor),
|
||||||
NewUnitInfo.Source, True, AShareEditor);
|
NewUnitInfo.Source, True, AShareEditor);
|
||||||
MainIDEBar.itmFileClose.Enabled:=True;
|
MainIDEBar.itmFileClose.Enabled:=True;
|
||||||
MainIDEBar.itmFileCloseAll.Enabled:=True;
|
MainIDEBar.itmFileCloseAll.Enabled:=True;
|
||||||
@ -2075,7 +2076,7 @@ begin
|
|||||||
|
|
||||||
OldUnitName:='';
|
OldUnitName:='';
|
||||||
if WasPascalSource then
|
if WasPascalSource then
|
||||||
OldUnitName:=AnUnitInfo.ParseUnitNameFromSource(true);
|
OldUnitName:=AnUnitInfo.ReadUnitNameFromSource(true);
|
||||||
OldFilename:=AnUnitInfo.Filename;
|
OldFilename:=AnUnitInfo.Filename;
|
||||||
|
|
||||||
if [sfSaveAs,sfSaveToTestDir]*Flags=[sfSaveAs] then begin
|
if [sfSaveAs,sfSaveToTestDir]*Flags=[sfSaveAs] then begin
|
||||||
@ -2151,7 +2152,7 @@ begin
|
|||||||
// fix all references
|
// fix all references
|
||||||
NewUnitName:='';
|
NewUnitName:='';
|
||||||
if FilenameIsPascalSource(AnUnitInfo.Filename) then
|
if FilenameIsPascalSource(AnUnitInfo.Filename) then
|
||||||
NewUnitName:=AnUnitInfo.ParseUnitNameFromSource(true);
|
NewUnitName:=AnUnitInfo.ReadUnitNameFromSource(true);
|
||||||
NewFilename:=AnUnitInfo.Filename;
|
NewFilename:=AnUnitInfo.Filename;
|
||||||
if (NewUnitName<>'')
|
if (NewUnitName<>'')
|
||||||
and ((OldUnitName<>NewUnitName) or (CompareFilenames(OldFilename,NewFilename)<>0))
|
and ((OldUnitName<>NewUnitName) or (CompareFilenames(OldFilename,NewFilename)<>0))
|
||||||
@ -2245,8 +2246,8 @@ begin
|
|||||||
// ask user
|
// ask user
|
||||||
if AnUnitInfo.Filename<>'' then
|
if AnUnitInfo.Filename<>'' then
|
||||||
AText:=Format(lisFileHasChangedSave, [AnUnitInfo.Filename])
|
AText:=Format(lisFileHasChangedSave, [AnUnitInfo.Filename])
|
||||||
else if AnUnitInfo.Unit_Name<>'' then
|
else if AnUnitInfo.SrcUnitName<>'' then
|
||||||
AText:=Format(lisUnitHasChangedSave, [AnUnitInfo.Unit_name])
|
AText:=Format(lisUnitHasChangedSave, [AnUnitInfo.SrcUnitName])
|
||||||
else
|
else
|
||||||
AText:=Format(lisSourceOfPageHasChangedSave, [TSourceEditor(AEditor).PageName]);
|
AText:=Format(lisSourceOfPageHasChangedSave, [TSourceEditor(AEditor).PageName]);
|
||||||
ACaption:=lisSourceModified;
|
ACaption:=lisSourceModified;
|
||||||
@ -2936,7 +2937,7 @@ begin
|
|||||||
if FileExistsCached(LFMFilename)
|
if FileExistsCached(LFMFilename)
|
||||||
and ReadLFMHeaderFromFile(LFMFilename,LFMType,LFMComponentName,LFMClassName)
|
and ReadLFMHeaderFromFile(LFMFilename,LFMType,LFMComponentName,LFMClassName)
|
||||||
then begin
|
then begin
|
||||||
anUnitName:=CurUnitInfo.Unit_Name;
|
anUnitName:=CurUnitInfo.SrcUnitName;
|
||||||
if anUnitName='' then
|
if anUnitName='' then
|
||||||
anUnitName:=ExtractFileNameOnly(LFMFilename);
|
anUnitName:=ExtractFileNameOnly(LFMFilename);
|
||||||
ItemList.Add(LFMComponentName, CurUnitInfo.Filename,
|
ItemList.Add(LFMComponentName, CurUnitInfo.Filename,
|
||||||
@ -3091,7 +3092,7 @@ begin
|
|||||||
AnUnitInfo.ResourceBaseClass:=FindLFMBaseClass(AnUnitInfo.Filename);
|
AnUnitInfo.ResourceBaseClass:=FindLFMBaseClass(AnUnitInfo.Filename);
|
||||||
if not ResourceFits(AnUnitInfo.ResourceBaseClass) then continue;
|
if not ResourceFits(AnUnitInfo.ResourceBaseClass) then continue;
|
||||||
end;
|
end;
|
||||||
AddUnit(AnUnitInfo.Unit_Name,AnUnitInfo.Filename);
|
AddUnit(AnUnitInfo.SrcUnitName,AnUnitInfo.Filename);
|
||||||
end;
|
end;
|
||||||
end else if APackage<>nil then begin
|
end else if APackage<>nil then begin
|
||||||
// add package units
|
// add package units
|
||||||
@ -3157,8 +3158,8 @@ begin
|
|||||||
s:='"'+ActiveUnitInfo.Filename+'"'
|
s:='"'+ActiveUnitInfo.Filename+'"'
|
||||||
else
|
else
|
||||||
s:='"'+ActiveSourceEditor.PageName+'"';
|
s:='"'+ActiveSourceEditor.PageName+'"';
|
||||||
if (ActiveUnitInfo.Unit_Name<>'')
|
if (ActiveUnitInfo.SrcUnitName<>'')
|
||||||
and (Project1.IndexOfUnitWithName(ActiveUnitInfo.Unit_Name,true,ActiveUnitInfo)>=0) then
|
and (Project1.IndexOfUnitWithName(ActiveUnitInfo.SrcUnitName,true,ActiveUnitInfo)>=0) then
|
||||||
begin
|
begin
|
||||||
IDEMessageDialog(lisInformation, Format(
|
IDEMessageDialog(lisInformation, Format(
|
||||||
lisUnableToAddToProjectBecauseThereIsAlreadyAUnitWith, [s]),
|
lisUnableToAddToProjectBecauseThereIsAlreadyAUnitWith, [s]),
|
||||||
@ -4271,7 +4272,7 @@ function TLazSourceFileManager.NewUniqueComponentName(Prefix: string): string;
|
|||||||
if CompareText(AnUnitInfo.Component.ClassName,Identifier)=0 then exit;
|
if CompareText(AnUnitInfo.Component.ClassName,Identifier)=0 then exit;
|
||||||
end else if (AnUnitInfo.ComponentName<>'')
|
end else if (AnUnitInfo.ComponentName<>'')
|
||||||
and ((AnUnitInfo.IsPartOfProject) or AnUnitInfo.Loaded) then begin
|
and ((AnUnitInfo.IsPartOfProject) or AnUnitInfo.Loaded) then begin
|
||||||
if SysUtils.CompareText(AnUnitInfo.Unit_Name,Identifier)=0 then exit;
|
if SysUtils.CompareText(AnUnitInfo.SrcUnitName,Identifier)=0 then exit;
|
||||||
if SysUtils.CompareText(AnUnitInfo.ComponentName,Identifier)=0 then exit;
|
if SysUtils.CompareText(AnUnitInfo.ComponentName,Identifier)=0 then exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -4367,7 +4368,7 @@ begin
|
|||||||
IsPascal:=FilenameIsPascalSource(AFilename);
|
IsPascal:=FilenameIsPascalSource(AFilename);
|
||||||
if IsPascal then begin
|
if IsPascal then begin
|
||||||
if AnUnitInfo<>nil then
|
if AnUnitInfo<>nil then
|
||||||
OldUnitName:=AnUnitInfo.ParseUnitNameFromSource(false)
|
OldUnitName:=AnUnitInfo.ReadUnitNameFromSource(false)
|
||||||
else
|
else
|
||||||
OldUnitName:=ExtractFileNameOnly(AFilename);
|
OldUnitName:=ExtractFileNameOnly(AFilename);
|
||||||
end else
|
end else
|
||||||
@ -4988,8 +4989,8 @@ begin
|
|||||||
OldLFMFilename:=ChangeFileExt(OldFilename,'.dfm');
|
OldLFMFilename:=ChangeFileExt(OldFilename,'.dfm');
|
||||||
end;
|
end;
|
||||||
if NewUnitName='' then
|
if NewUnitName='' then
|
||||||
NewUnitName:=AnUnitInfo.Unit_Name;
|
NewUnitName:=AnUnitInfo.SrcUnitName;
|
||||||
debugln(['TLazSourceFileManager.RenameUnit ',AnUnitInfo.Filename,' NewUnitName=',NewUnitName,' OldUnitName=',AnUnitInfo.Unit_Name,' LFMCode=',LFMCode<>nil,' LRSCode=',LRSCode<>nil,' NewFilename="',NewFilename,'"']);
|
debugln(['TLazSourceFileManager.RenameUnit ',AnUnitInfo.Filename,' NewUnitName=',NewUnitName,' OldUnitName=',AnUnitInfo.SrcUnitName,' LFMCode=',LFMCode<>nil,' LRSCode=',LRSCode<>nil,' NewFilename="',NewFilename,'"']);
|
||||||
|
|
||||||
// check new resource file
|
// check new resource file
|
||||||
NewLFMFilename:='';
|
NewLFMFilename:='';
|
||||||
@ -5130,7 +5131,7 @@ begin
|
|||||||
// the code is not changed, therefore the marks are kept
|
// the code is not changed, therefore the marks are kept
|
||||||
|
|
||||||
// change unitname in lpi and in main source file
|
// change unitname in lpi and in main source file
|
||||||
AnUnitInfo.Unit_Name:=NewUnitName;
|
AnUnitInfo.SrcUnitName:=NewUnitName;
|
||||||
if LRSCode<>nil then begin
|
if LRSCode<>nil then begin
|
||||||
// change resource filename in the source include directive
|
// change resource filename in the source include directive
|
||||||
if not CodeToolBoss.RenameMainInclude(AnUnitInfo.Source,
|
if not CodeToolBoss.RenameMainInclude(AnUnitInfo.Source,
|
||||||
@ -5339,7 +5340,7 @@ begin
|
|||||||
mtConfirmation,[mrYes,mrIgnore,lisNo,mrAbort],'');
|
mtConfirmation,[mrYes,mrIgnore,lisNo,mrAbort],'');
|
||||||
if Result<>mrYes then exit;
|
if Result<>mrYes then exit;
|
||||||
end;
|
end;
|
||||||
NewUnitName:=AnUnitInfo.Unit_Name;
|
NewUnitName:=AnUnitInfo.SrcUnitName;
|
||||||
if NewUnitName='' then begin
|
if NewUnitName='' then begin
|
||||||
AnUnitInfo.ReadUnitNameFromSource(false);
|
AnUnitInfo.ReadUnitNameFromSource(false);
|
||||||
NewUnitName:=AnUnitInfo.CreateUnitName;
|
NewUnitName:=AnUnitInfo.CreateUnitName;
|
||||||
@ -5711,7 +5712,7 @@ begin
|
|||||||
FormEditor1.ClearSelection;
|
FormEditor1.ClearSelection;
|
||||||
|
|
||||||
// create JIT component
|
// create JIT component
|
||||||
NewUnitName:=AnUnitInfo.Unit_Name;
|
NewUnitName:=AnUnitInfo.SrcUnitName;
|
||||||
if NewUnitName='' then
|
if NewUnitName='' then
|
||||||
NewUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
NewUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
||||||
DisableAutoSize:=true;
|
DisableAutoSize:=true;
|
||||||
@ -7146,7 +7147,7 @@ begin
|
|||||||
AFilename:='';
|
AFilename:='';
|
||||||
// build a nice project info filename suggestion
|
// build a nice project info filename suggestion
|
||||||
if UseMainSourceFile and (Project1.MainUnitID>=0) then
|
if UseMainSourceFile and (Project1.MainUnitID>=0) then
|
||||||
AFilename:=Project1.MainUnitInfo.Unit_Name;
|
AFilename:=Project1.MainUnitInfo.SrcUnitName;
|
||||||
if AFilename='' then
|
if AFilename='' then
|
||||||
AFilename:=ExtractFileName(Project1.ProjectInfoFile);
|
AFilename:=ExtractFileName(Project1.ProjectInfoFile);
|
||||||
if AFilename='' then
|
if AFilename='' then
|
||||||
@ -7327,7 +7328,7 @@ begin
|
|||||||
MainUnitSrcEdit.CodeBuffer:=NewBuf;
|
MainUnitSrcEdit.CodeBuffer:=NewBuf;
|
||||||
|
|
||||||
// change program name
|
// change program name
|
||||||
MainUnitInfo.Unit_Name:=NewProgramName;
|
MainUnitInfo.SrcUnitName:=NewProgramName;
|
||||||
MainUnitInfo.Modified:=true;
|
MainUnitInfo.Modified:=true;
|
||||||
|
|
||||||
// update source notebook page names
|
// update source notebook page names
|
||||||
|
@ -311,13 +311,13 @@ begin
|
|||||||
FImplUsedUnits.CaseSensitive := False;
|
FImplUsedUnits.CaseSensitive := False;
|
||||||
end;
|
end;
|
||||||
if SrcEdit.GetProjectFile is TUnitInfo then
|
if SrcEdit.GetProjectFile is TUnitInfo then
|
||||||
CurrentUnitName := TUnitInfo(SrcEdit.GetProjectFile).Unit_Name
|
CurrentUnitName := TUnitInfo(SrcEdit.GetProjectFile).SrcUnitName
|
||||||
else
|
else
|
||||||
CurrentUnitName := '';
|
CurrentUnitName := '';
|
||||||
// Add available unit names to list
|
// Add available unit names to list
|
||||||
ProjFile:=Project1.FirstPartOfProject;
|
ProjFile:=Project1.FirstPartOfProject;
|
||||||
while ProjFile <> nil do begin
|
while ProjFile <> nil do begin
|
||||||
s := ProjFile.Unit_Name;
|
s := ProjFile.SrcUnitName;
|
||||||
if s = CurrentUnitName then // current unit
|
if s = CurrentUnitName then // current unit
|
||||||
s := '';
|
s := '';
|
||||||
if (ProjFile <> Project1.MainUnitInfo) and (s <> '') then
|
if (ProjFile <> Project1.MainUnitInfo) and (s <> '') then
|
||||||
|
@ -2562,7 +2562,7 @@ var
|
|||||||
NewHasRegisterProc:=OldPkgFile.HasRegisterProc;
|
NewHasRegisterProc:=OldPkgFile.HasRegisterProc;
|
||||||
NewAddToUses:=OldPkgFile.AddToUsesPkgSection;
|
NewAddToUses:=OldPkgFile.AddToUsesPkgSection;
|
||||||
end else begin
|
end else begin
|
||||||
NewUnitName:=OldProjFile.Unit_Name;
|
NewUnitName:=OldProjFile.SrcUnitName;
|
||||||
NewFileType:=FileNameToPkgFileType(OldFilename);
|
NewFileType:=FileNameToPkgFileType(OldFilename);
|
||||||
NewCompPrio:=ComponentPriorityNormal;
|
NewCompPrio:=ComponentPriorityNormal;
|
||||||
NewResourceBaseClass:=OldProjFile.ResourceBaseClass;
|
NewResourceBaseClass:=OldProjFile.ResourceBaseClass;
|
||||||
@ -4332,7 +4332,7 @@ var
|
|||||||
end else begin
|
end else begin
|
||||||
ClassUnitInfo:=Project1.UnitWithComponentClassName(ComponentClassnames[i]);
|
ClassUnitInfo:=Project1.UnitWithComponentClassName(ComponentClassnames[i]);
|
||||||
if ClassUnitInfo<>nil then
|
if ClassUnitInfo<>nil then
|
||||||
NewUnitName:=ClassUnitInfo.Unit_Name;
|
NewUnitName:=ClassUnitInfo.SrcUnitName;
|
||||||
end;
|
end;
|
||||||
if (NewUnitName<>'') and (UnitNames.IndexOf(NewUnitName)<0) then begin
|
if (NewUnitName<>'') and (UnitNames.IndexOf(NewUnitName)<0) then begin
|
||||||
// new needed unit
|
// new needed unit
|
||||||
|
Loading…
Reference in New Issue
Block a user