diff --git a/converter/missingpropertiesdlg.pas b/converter/missingpropertiesdlg.pas
index be3a3e7e73..b208f64387 100644
--- a/converter/missingpropertiesdlg.pas
+++ b/converter/missingpropertiesdlg.pas
@@ -613,7 +613,7 @@ begin
end else begin
ClassUnitInfo:=Project1.UnitWithComponentClassName(aMissingTypes[i]);
if ClassUnitInfo<>nil then
- NeededUnitName:=ClassUnitInfo.Unit_Name;
+ NeededUnitName:=ClassUnitInfo.GetUsesUnitName;
end;
if NeededUnitName<>'' then begin
if fUsedUnitsTool.AddUnitImmediately(NeededUnitName) then
diff --git a/ide/lazarus.lpi b/ide/lazarus.lpi
index 7279ea31a2..beeaebe429 100644
--- a/ide/lazarus.lpi
+++ b/ide/lazarus.lpi
@@ -17,7 +17,6 @@
-
@@ -70,6 +69,7 @@
+
@@ -322,6 +322,7 @@
+
@@ -565,6 +566,7 @@
+
@@ -649,6 +651,7 @@
+
@@ -783,6 +786,7 @@
+
@@ -1223,6 +1227,7 @@
+
@@ -1317,13 +1322,11 @@
-
-
@@ -1334,7 +1337,7 @@
-
+
diff --git a/ide/main.pp b/ide/main.pp
index 2815339451..40d004727d 100644
--- a/ide/main.pp
+++ b/ide/main.pp
@@ -10665,7 +10665,7 @@ var
ConflictingClass: TClass;
s: string;
begin
- if SysUtils.CompareText(ActiveUnitInfo.Unit_Name,AName)=0 then
+ if SysUtils.CompareText(ActiveUnitInfo.SrcUnitName,AName)=0 then
raise Exception.Create(Format(
lisTheUnitItselfHasAlreadyTheNamePascalIdentifiersMus, [AName]));
if ActiveUnitInfo.IsPartOfProject then begin
@@ -11617,7 +11617,7 @@ begin
OkToAdd:=SourceFileMgr.CheckDirIsInSearchPath(AnUnitInfo,False,False);
if (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags) then begin
AnUnitInfo.ReadUnitNameFromSource(false);
- ShortUnitName:=AnUnitInfo.Unit_Name;
+ ShortUnitName:=AnUnitInfo.SrcUnitName;
if (ShortUnitName<>'') then begin
if CodeToolBoss.AddUnitToMainUsesSectionIfNeeded(
Project1.MainUnitInfo.Source,ShortUnitName,'') then begin
diff --git a/ide/mainintf.pas b/ide/mainintf.pas
index 93b30a00c6..5b64c8e2d9 100644
--- a/ide/mainintf.pas
+++ b/ide/mainintf.pas
@@ -556,7 +556,7 @@ procedure TFileDescInheritedComponent.SetInheritedUnit(const AValue: TUnitInfo);
begin
if FInheritedUnit=AValue then exit;
FInheritedUnit:=AValue;
- InheritedUnits:=FInheritedUnit.Unit_Name;
+ InheritedUnits:=FInheritedUnit.SrcUnitName;
end;
constructor TFileDescInheritedComponent.Create;
diff --git a/ide/project.pp b/ide/project.pp
index cfaf4d1f2d..ca82e60474 100644
--- a/ide/project.pp
+++ b/ide/project.pp
@@ -285,7 +285,7 @@ type
FRunFileIfActive: boolean;
FSessionModified: boolean;
fSource: TCodeBuffer;
- fUnitName: String;
+ fSrcUnitName: String;
fUsageCount: extended;
fUserReadOnly: Boolean;
fSourceChangeStep: LongInt;
@@ -324,7 +324,7 @@ type
procedure SetRunFileIfActive(const AValue: boolean);
procedure SetSessionModified(const AValue: boolean);
procedure SetSource(ABuffer: TCodeBuffer);
- procedure SetUnitName(const NewUnitName:string);
+ procedure SetSrcUnitName(const NewUnitName:string);
procedure SetUserReadOnly(const NewValue: boolean);
protected
function GetFileName: string; override;
@@ -362,10 +362,9 @@ type
procedure IgnoreCurrentFileDateOnDisk;
procedure IncreaseAutoRevertLock; // do not auto revert from disk
procedure DecreaseAutoRevertLock;
- function ParseUnitNameFromSource(TryCache: boolean): string;// fetch name fom source
- procedure ReadUnitNameFromSource(TryCache: boolean);// fetch unit name from source and update property UnitName
+ function ReadUnitNameFromSource(TryCache: boolean): string;// fetch unit name from source and update property UnitName
+ function GetUsesUnitName: string;
function CreateUnitName: string;
- procedure ImproveUnitNameCache(const NewUnitName: string);
procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string;
Merge, IgnoreIsPartOfProject: boolean;
FileVersion: integer);
@@ -467,7 +466,7 @@ type
property Source: TCodeBuffer read fSource write SetSource;
property DefaultSyntaxHighlighter: TLazSyntaxHighlighter
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 SourceDirectoryReferenced: boolean read FSourceDirectoryReferenced;
property AutoReferenceSourceDir: boolean read FAutoReferenceSourceDir
@@ -1602,34 +1601,56 @@ begin
end;
until Result<>mrRetry;
if ReadUnitName then begin
- fUnitName:=CodeToolBoss.GetSourceName(fSource,false);
+ ReadUnitNameFromSource(false);
end;
Result:=mrOk;
end;
-procedure TUnitInfo.ReadUnitNameFromSource(TryCache: boolean);
-var
- NewUnitName: String;
+function TUnitInfo.ReadUnitNameFromSource(TryCache: boolean): string;
begin
- NewUnitName:=ParseUnitNameFromSource(TryCache);
- if NewUnitName<>'' then
- fUnitName:=NewUnitName;
+ Result:='';
+ if TryCache then
+ 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;
function TUnitInfo.CreateUnitName: string;
begin
- Result:=Unit_Name;
+ Result:=SrcUnitName;
if (Result='') and FilenameIsPascalSource(Filename) then
Result:=ExtractFilenameOnly(Filename);
end;
-procedure TUnitInfo.ImproveUnitNameCache(const NewUnitName: string);
-begin
- if (fUnitName='') or (CompareText(fUnitName,NewUnitName)=0) then begin
- fUnitName:=NewUnitName;
- end;
-end;
-
{------------------------------------------------------------------------------
TUnitInfo Clear
------------------------------------------------------------------------------}
@@ -1655,7 +1676,7 @@ begin
Modified := false;
SessionModified := false;
FRunFileIfActive:=false;
- fUnitName := '';
+ fSrcUnitName := '';
fUsageCount:=-1;
fUserReadOnly := false;
if fSource<>nil then fSource.Clear;
@@ -1708,6 +1729,7 @@ procedure TUnitInfo.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string;
var
AFilename: String;
i, X, Y: Integer;
+ s: String;
begin
// global data
AFilename:=Filename;
@@ -1732,7 +1754,9 @@ begin
XMLConfig.SetDeleteValue(Path+'ResourceBaseClass/Value',
PFComponentBaseClassNames[FResourceBaseClass],
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
SaveStringToStringTree(XMLConfig,CustomData,Path+'CustomData/');
end;
@@ -1785,6 +1809,7 @@ procedure TUnitInfo.LoadFromXMLConfig(XMLConfig: TXMLConfig;
var
AFilename: string;
c, i: Integer;
+ s: String;
begin
// project data
if not Merge then begin
@@ -1807,8 +1832,16 @@ begin
AFilename:=XMLConfig.GetValue(Path+'ResourceFilename/Value','');
if (AFilename<>'') and Assigned(fOnLoadSaveFilename) then
fOnLoadSaveFilename(AFilename,true);
- if FilenameIsPascalSource(AFilename) then
- fUnitName:=XMLConfig.GetValue(Path+'UnitName/Value',ExtractFileNameOnly(AFilename));
+ if FilenameIsPascalSource(Filename) then begin
+ 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
LoadStringToStringTree(XMLConfig,CustomData,Path+'CustomData/');
@@ -1845,35 +1878,15 @@ begin
LoadStringToStringTree(XMLConfig,CustomSessionData,Path+'CustomSessionData/');
end;
-function TUnitInfo.ParseUnitNameFromSource(TryCache: boolean): 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);
+procedure TUnitInfo.SetSrcUnitName(const NewUnitName:string);
var
Allowed: boolean;
OldUnitName: String;
begin
- if (fUnitName <> NewUnitName) and (NewUnitName <> '') then
+ if (fSrcUnitName <> NewUnitName) and (NewUnitName <> '') then
begin
Allowed := true;
- OldUnitName := fUnitName;
+ OldUnitName := fSrcUnitName;
if OldUnitName = '' then
OldUnitName := ExtractFileNameOnly(Filename);
if Assigned(FOnUnitNameChange) then
@@ -1883,7 +1896,11 @@ begin
begin
CodeToolBoss.RenameSource(fSource,NewUnitName);
end;
- fUnitName := NewUnitName;
+ {$IFDEF VerboseIDESrcUnitName}
+ if CompareFilenames(ExtractFileNameOnly(Filename),'interpkgconflictfiles')=0 then
+ debugln(['TUnitInfo.SetSrcUnitName ',NewUnitName]);
+ {$ENDIF}
+ fSrcUnitName := NewUnitName;
Modified := true;
if (Project <> nil) then Project.UnitModified(Self);
end;
@@ -3449,6 +3466,7 @@ procedure TProject.AddFile(ProjectFile: TLazProjectFile; AddToProjectUsesClause:
var
NewIndex: integer;
AnUnit: TUnitInfo;
+ s: String;
begin
AnUnit:=ProjectFile as TUnitInfo;
//debugln('TProject.AddFile A ',AnUnit.Filename,' AddToProjectFile=',dbgs(AddToProjectFile));
@@ -3467,8 +3485,11 @@ begin
MainUnitInfo.IncreaseAutoRevertLock;
if AddToProjectUsesClause and (MainUnitID>=0) and (MainUnitID<>NewIndex) then
- if AnUnit.Unit_Name<>'' then // add unit to uses section
- CodeToolBoss.AddUnitToMainUsesSectionIfNeeded(MainUnitInfo.Source,AnUnit.Unit_Name,'',true);
+ begin
+ s:=AnUnit.GetUsesUnitName;
+ if s<>'' then // add unit to uses section
+ CodeToolBoss.AddUnitToMainUsesSectionIfNeeded(MainUnitInfo.Source,s,'',true);
+ end;
EndUpdate;
UnitModified(AnUnit);
end;
@@ -3495,9 +3516,9 @@ begin
// remove unit from uses section and from createforms in program file
if (OldUnitInfo.IsPartOfProject) then begin
if RemoveFromUsesSection then begin
- if (OldUnitInfo.Unit_Name<>'') then begin
+ if (OldUnitInfo.SrcUnitName<>'') then begin
CodeToolBoss.RemoveUnitFromAllUsesSections(MainUnitInfo.Source,
- OldUnitInfo.Unit_Name);
+ OldUnitInfo.SrcUnitName);
end;
if (OldUnitInfo.ComponentName<>'') then begin
CodeToolBoss.RemoveCreateFormStatement(MainUnitInfo.Source,
@@ -3858,8 +3879,7 @@ end;
function TProject.RemoveCreateFormFromProjectFile(const AClassName,AName:string):boolean;
begin
- Result:=CodeToolBoss.RemoveCreateFormStatement(MainUnitInfo.Source,
- AName);
+ Result:=CodeToolBoss.RemoveCreateFormStatement(MainUnitInfo.Source,AName);
if Result then begin
MainUnitInfo.Modified:=true;
end;
@@ -3882,9 +3902,9 @@ begin
if ((OnlyProjectUnits and Units[Result].IsPartOfProject)
or (not OnlyProjectUnits))
and (IgnoreUnit<>Units[Result])
- and (Units[Result].Unit_Name<>'')
+ and (Units[Result].SrcUnitName<>'')
then begin
- if (CompareDottedIdentifiers(PChar(Units[Result].Unit_Name),PChar(AnUnitName))=0)
+ if (CompareDottedIdentifiers(PChar(Units[Result].SrcUnitName),PChar(AnUnitName))=0)
then
exit;
end;
@@ -5022,8 +5042,8 @@ begin
// check if no other project unit has this name
for i:=0 to UnitCount-1 do begin
if (Units[i].IsPartOfProject)
- and (Units[i]<>AnUnitInfo) and (Units[i].Unit_Name<>'')
- and (CompareText(Units[i].Unit_Name,NewUnitName)=0) then begin
+ and (Units[i]<>AnUnitInfo) and (Units[i].SrcUnitName<>'')
+ and (CompareText(Units[i].SrcUnitName,NewUnitName)=0) then begin
Allowed:=false;
exit;
end;
@@ -5543,7 +5563,7 @@ function TProject.ProjectUnitWithUnitname(const AnUnitName: string): TUnitInfo;
begin
Result:=fFirst[uilPartOfProject];
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];
end;
end;
diff --git a/ide/sourcefilemanager.pas b/ide/sourcefilemanager.pas
index 95c5266d4a..837f01f367 100644
--- a/ide/sourcefilemanager.pas
+++ b/ide/sourcefilemanager.pas
@@ -435,7 +435,7 @@ begin
if AnUnitInfo.OpenEditorInfoCount > 0 then
AShareEditor := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent);
NewSrcEdit:=SrcNotebook.NewFile(
- CreateSrcEditPageName(AnUnitInfo.Unit_Name, AFilename, AShareEditor),
+ CreateSrcEditPageName(AnUnitInfo.SrcUnitName, AFilename, AShareEditor),
AnUnitInfo.Source, False, AShareEditor);
NewSrcEdit.EditorComponent.BeginUpdate;
MainIDEBar.itmFileClose.Enabled:=True;
@@ -1719,7 +1719,8 @@ begin
end else
NewUnitInfo:=TUnitInfo.Create(NewBuffer);
//debugln(['TLazSourceFileManager.NewFile ',NewUnitInfo.Filename,' ',NewFilename]);
- NewUnitInfo.ImproveUnitNameCache(NewUnitName);
+ if (CompareText(NewUnitInfo.SrcUnitName,NewUnitName)=0) then
+ NewUnitInfo.SrcUnitName:=NewUnitName;
NewUnitInfo.BuildFileIfActive:=NewFileDescriptor.BuildFileIfActive;
NewUnitInfo.RunFileIfActive:=NewFileDescriptor.RunFileIfActive;
@@ -1765,7 +1766,7 @@ begin
if NewUnitInfo.OpenEditorInfoCount > 0 then
AShareEditor := TSourceEditor(NewUnitInfo.OpenEditorInfo[0].EditorComponent);
NewSrcEdit := SrcNoteBook.NewFile(
- CreateSrcEditPageName(NewUnitInfo.Unit_Name, NewUnitInfo.Filename, AShareEditor),
+ CreateSrcEditPageName(NewUnitInfo.SrcUnitName, NewUnitInfo.Filename, AShareEditor),
NewUnitInfo.Source, True, AShareEditor);
MainIDEBar.itmFileClose.Enabled:=True;
MainIDEBar.itmFileCloseAll.Enabled:=True;
@@ -2075,7 +2076,7 @@ begin
OldUnitName:='';
if WasPascalSource then
- OldUnitName:=AnUnitInfo.ParseUnitNameFromSource(true);
+ OldUnitName:=AnUnitInfo.ReadUnitNameFromSource(true);
OldFilename:=AnUnitInfo.Filename;
if [sfSaveAs,sfSaveToTestDir]*Flags=[sfSaveAs] then begin
@@ -2151,7 +2152,7 @@ begin
// fix all references
NewUnitName:='';
if FilenameIsPascalSource(AnUnitInfo.Filename) then
- NewUnitName:=AnUnitInfo.ParseUnitNameFromSource(true);
+ NewUnitName:=AnUnitInfo.ReadUnitNameFromSource(true);
NewFilename:=AnUnitInfo.Filename;
if (NewUnitName<>'')
and ((OldUnitName<>NewUnitName) or (CompareFilenames(OldFilename,NewFilename)<>0))
@@ -2245,8 +2246,8 @@ begin
// ask user
if AnUnitInfo.Filename<>'' then
AText:=Format(lisFileHasChangedSave, [AnUnitInfo.Filename])
- else if AnUnitInfo.Unit_Name<>'' then
- AText:=Format(lisUnitHasChangedSave, [AnUnitInfo.Unit_name])
+ else if AnUnitInfo.SrcUnitName<>'' then
+ AText:=Format(lisUnitHasChangedSave, [AnUnitInfo.SrcUnitName])
else
AText:=Format(lisSourceOfPageHasChangedSave, [TSourceEditor(AEditor).PageName]);
ACaption:=lisSourceModified;
@@ -2936,7 +2937,7 @@ begin
if FileExistsCached(LFMFilename)
and ReadLFMHeaderFromFile(LFMFilename,LFMType,LFMComponentName,LFMClassName)
then begin
- anUnitName:=CurUnitInfo.Unit_Name;
+ anUnitName:=CurUnitInfo.SrcUnitName;
if anUnitName='' then
anUnitName:=ExtractFileNameOnly(LFMFilename);
ItemList.Add(LFMComponentName, CurUnitInfo.Filename,
@@ -3091,7 +3092,7 @@ begin
AnUnitInfo.ResourceBaseClass:=FindLFMBaseClass(AnUnitInfo.Filename);
if not ResourceFits(AnUnitInfo.ResourceBaseClass) then continue;
end;
- AddUnit(AnUnitInfo.Unit_Name,AnUnitInfo.Filename);
+ AddUnit(AnUnitInfo.SrcUnitName,AnUnitInfo.Filename);
end;
end else if APackage<>nil then begin
// add package units
@@ -3157,8 +3158,8 @@ begin
s:='"'+ActiveUnitInfo.Filename+'"'
else
s:='"'+ActiveSourceEditor.PageName+'"';
- if (ActiveUnitInfo.Unit_Name<>'')
- and (Project1.IndexOfUnitWithName(ActiveUnitInfo.Unit_Name,true,ActiveUnitInfo)>=0) then
+ if (ActiveUnitInfo.SrcUnitName<>'')
+ and (Project1.IndexOfUnitWithName(ActiveUnitInfo.SrcUnitName,true,ActiveUnitInfo)>=0) then
begin
IDEMessageDialog(lisInformation, Format(
lisUnableToAddToProjectBecauseThereIsAlreadyAUnitWith, [s]),
@@ -4271,7 +4272,7 @@ function TLazSourceFileManager.NewUniqueComponentName(Prefix: string): string;
if CompareText(AnUnitInfo.Component.ClassName,Identifier)=0 then exit;
end else if (AnUnitInfo.ComponentName<>'')
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;
end;
end;
@@ -4367,7 +4368,7 @@ begin
IsPascal:=FilenameIsPascalSource(AFilename);
if IsPascal then begin
if AnUnitInfo<>nil then
- OldUnitName:=AnUnitInfo.ParseUnitNameFromSource(false)
+ OldUnitName:=AnUnitInfo.ReadUnitNameFromSource(false)
else
OldUnitName:=ExtractFileNameOnly(AFilename);
end else
@@ -4988,8 +4989,8 @@ begin
OldLFMFilename:=ChangeFileExt(OldFilename,'.dfm');
end;
if NewUnitName='' then
- NewUnitName:=AnUnitInfo.Unit_Name;
- debugln(['TLazSourceFileManager.RenameUnit ',AnUnitInfo.Filename,' NewUnitName=',NewUnitName,' OldUnitName=',AnUnitInfo.Unit_Name,' LFMCode=',LFMCode<>nil,' LRSCode=',LRSCode<>nil,' NewFilename="',NewFilename,'"']);
+ NewUnitName:=AnUnitInfo.SrcUnitName;
+ debugln(['TLazSourceFileManager.RenameUnit ',AnUnitInfo.Filename,' NewUnitName=',NewUnitName,' OldUnitName=',AnUnitInfo.SrcUnitName,' LFMCode=',LFMCode<>nil,' LRSCode=',LRSCode<>nil,' NewFilename="',NewFilename,'"']);
// check new resource file
NewLFMFilename:='';
@@ -5130,7 +5131,7 @@ begin
// the code is not changed, therefore the marks are kept
// change unitname in lpi and in main source file
- AnUnitInfo.Unit_Name:=NewUnitName;
+ AnUnitInfo.SrcUnitName:=NewUnitName;
if LRSCode<>nil then begin
// change resource filename in the source include directive
if not CodeToolBoss.RenameMainInclude(AnUnitInfo.Source,
@@ -5339,7 +5340,7 @@ begin
mtConfirmation,[mrYes,mrIgnore,lisNo,mrAbort],'');
if Result<>mrYes then exit;
end;
- NewUnitName:=AnUnitInfo.Unit_Name;
+ NewUnitName:=AnUnitInfo.SrcUnitName;
if NewUnitName='' then begin
AnUnitInfo.ReadUnitNameFromSource(false);
NewUnitName:=AnUnitInfo.CreateUnitName;
@@ -5711,7 +5712,7 @@ begin
FormEditor1.ClearSelection;
// create JIT component
- NewUnitName:=AnUnitInfo.Unit_Name;
+ NewUnitName:=AnUnitInfo.SrcUnitName;
if NewUnitName='' then
NewUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
DisableAutoSize:=true;
@@ -7146,7 +7147,7 @@ begin
AFilename:='';
// build a nice project info filename suggestion
if UseMainSourceFile and (Project1.MainUnitID>=0) then
- AFilename:=Project1.MainUnitInfo.Unit_Name;
+ AFilename:=Project1.MainUnitInfo.SrcUnitName;
if AFilename='' then
AFilename:=ExtractFileName(Project1.ProjectInfoFile);
if AFilename='' then
@@ -7327,7 +7328,7 @@ begin
MainUnitSrcEdit.CodeBuffer:=NewBuf;
// change program name
- MainUnitInfo.Unit_Name:=NewProgramName;
+ MainUnitInfo.SrcUnitName:=NewProgramName;
MainUnitInfo.Modified:=true;
// update source notebook page names
diff --git a/ide/useunitdlg.pas b/ide/useunitdlg.pas
index dcfb1cf508..b7406136fc 100644
--- a/ide/useunitdlg.pas
+++ b/ide/useunitdlg.pas
@@ -311,13 +311,13 @@ begin
FImplUsedUnits.CaseSensitive := False;
end;
if SrcEdit.GetProjectFile is TUnitInfo then
- CurrentUnitName := TUnitInfo(SrcEdit.GetProjectFile).Unit_Name
+ CurrentUnitName := TUnitInfo(SrcEdit.GetProjectFile).SrcUnitName
else
CurrentUnitName := '';
// Add available unit names to list
ProjFile:=Project1.FirstPartOfProject;
while ProjFile <> nil do begin
- s := ProjFile.Unit_Name;
+ s := ProjFile.SrcUnitName;
if s = CurrentUnitName then // current unit
s := '';
if (ProjFile <> Project1.MainUnitInfo) and (s <> '') then
diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas
index 5f766878a3..676995c5ef 100644
--- a/packager/pkgmanager.pas
+++ b/packager/pkgmanager.pas
@@ -2562,7 +2562,7 @@ var
NewHasRegisterProc:=OldPkgFile.HasRegisterProc;
NewAddToUses:=OldPkgFile.AddToUsesPkgSection;
end else begin
- NewUnitName:=OldProjFile.Unit_Name;
+ NewUnitName:=OldProjFile.SrcUnitName;
NewFileType:=FileNameToPkgFileType(OldFilename);
NewCompPrio:=ComponentPriorityNormal;
NewResourceBaseClass:=OldProjFile.ResourceBaseClass;
@@ -4332,7 +4332,7 @@ var
end else begin
ClassUnitInfo:=Project1.UnitWithComponentClassName(ComponentClassnames[i]);
if ClassUnitInfo<>nil then
- NewUnitName:=ClassUnitInfo.Unit_Name;
+ NewUnitName:=ClassUnitInfo.SrcUnitName;
end;
if (NewUnitName<>'') and (UnitNames.IndexOf(NewUnitName)<0) then begin
// new needed unit