mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:59:16 +02:00
IDE: remove/rename unit in lpr if it is a pascal source
git-svn-id: trunk@44170 -
This commit is contained in:
parent
ed3ddce5c9
commit
1c1300939f
@ -363,7 +363,8 @@ var
|
||||
|
||||
type
|
||||
TLazarusIDEBootHandlerType = (
|
||||
libhTransferMacrosCreated // called after IDEMacros were created
|
||||
libhTransferMacrosCreated, // called after IDEMacros were created
|
||||
libhEnvironmentOptionsLoaded // called after IDE loaded environment options
|
||||
);
|
||||
|
||||
procedure AddBootHandler(ht: TLazarusIDEBootHandlerType; const OnBoot: TProcedure);
|
||||
|
@ -238,7 +238,7 @@ type
|
||||
pfSaveClosedUnits, // save info about closed files (i.e. once closed the cursor position is lost)
|
||||
pfSaveOnlyProjectUnits, // save no info about foreign files (not part of project)
|
||||
pfMainUnitIsPascalSource,// main unit is pascal, even it does not end in .pas/.pp
|
||||
pfMainUnitHasUsesSectionForAllUnits,// add/remove pascal units to main uses section
|
||||
pfMainUnitHasUsesSectionForAllUnits,// add new units to main uses section
|
||||
pfMainUnitHasCreateFormStatements,// add/remove Application.CreateForm statements
|
||||
pfMainUnitHasTitleStatement,// add/remove Application.Title:= statements
|
||||
pfRunnable, // project can be run
|
||||
|
@ -1388,6 +1388,8 @@ begin
|
||||
CompileProgress.SetEnabled(EnvironmentOptions.ShowCompileDialog);
|
||||
|
||||
CreateDirUTF8(GetProjectSessionsConfigPath);
|
||||
|
||||
RunBootHandlers(libhEnvironmentOptionsLoaded);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupInteractive;
|
||||
@ -5013,7 +5015,7 @@ var
|
||||
begin
|
||||
Result := True;
|
||||
if (AProject.MainUnitID < 0) or
|
||||
(not (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)) then
|
||||
(not (pfMainUnitHasCreateFormStatements in AProject.Flags)) then
|
||||
Exit;
|
||||
OldList := AProject.GetAutoCreatedFormsList;
|
||||
if (OldList = nil) then
|
||||
@ -5021,10 +5023,10 @@ var
|
||||
try
|
||||
if OldList.Count = AProject.TmpAutoCreatedForms.Count then
|
||||
begin
|
||||
|
||||
{ Just exit if the form list is the same }
|
||||
i := OldList.Count - 1;
|
||||
while (i >= 0) and (SysUtils.CompareText(OldList[i], AProject.TmpAutoCreatedForms[i]) = 0) do
|
||||
while (i >= 0)
|
||||
and (SysUtils.CompareText(OldList[i], AProject.TmpAutoCreatedForms[i]) = 0) do
|
||||
Dec(i);
|
||||
if i < 0 then
|
||||
Exit;
|
||||
|
@ -5404,7 +5404,7 @@ begin
|
||||
end;
|
||||
if (OldUnitName<>'') then
|
||||
begin
|
||||
if (pfMainUnitHasUsesSectionForAllUnits in Flags) then
|
||||
if (pfMainUnitIsPascalSource in Flags) then
|
||||
begin
|
||||
// rename unit in program uses section
|
||||
CodeToolBoss.RenameUsedUnit(MainUnitInfo.Source, OldUnitName,
|
||||
|
@ -5557,7 +5557,7 @@ begin
|
||||
ChompPathDelim(ExtractFilePath(AnUnitInfo.Filename)));
|
||||
// remove from project's unit section
|
||||
if (AProject.MainUnitID>=0)
|
||||
and (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)
|
||||
and (pfMainUnitIsPascalSource in AProject.Flags)
|
||||
then begin
|
||||
ShortUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
||||
//debugln(['TLazSourceFileManager.RemoveUnitsFromProject UnitName=',ShortUnitName]);
|
||||
|
@ -1058,7 +1058,7 @@ var
|
||||
NewUnitName: String;
|
||||
begin
|
||||
AProject:=Project1;
|
||||
if (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)
|
||||
if (pfMainUnitIsPascalSource in AProject.Flags)
|
||||
and (AProject.MainUnitInfo<>nil) then begin
|
||||
OldUnitName:=OldPkgName;
|
||||
NewUnitName:=APackage.Name;
|
||||
@ -1545,7 +1545,8 @@ procedure TPkgManager.AddUnitToProjectMainUsesSection(AProject: TProject;
|
||||
const AnUnitName, AnUnitInFilename: string);
|
||||
begin
|
||||
// add unit to project main source file
|
||||
if (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)
|
||||
if (pfMainUnitIsPascalSource in AProject.Flags)
|
||||
and (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)
|
||||
and (AProject.MainUnitInfo<>nil) then begin
|
||||
//debugln('TPkgManager.AddUnitToProjectMainUsesSection B ',AnUnitName);
|
||||
if (AnUnitName<>'') then begin
|
||||
@ -4699,7 +4700,7 @@ begin
|
||||
Project1.RemoveRequiredDependency(ADependency);
|
||||
//debugln('TPkgManager.OnProjectInspectorRemoveDependency A');
|
||||
if (Project1.MainUnitID>=0)
|
||||
and (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags)
|
||||
and (pfMainUnitIsPascalSource in Project1.Flags)
|
||||
then begin
|
||||
MainIDEInterface.SaveSourceEditorChangesToCodeCache(nil);
|
||||
ShortUnitName:=ADependency.PackageName;
|
||||
|
Loading…
Reference in New Issue
Block a user