mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 01:00:34 +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
|
type
|
||||||
TLazarusIDEBootHandlerType = (
|
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);
|
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)
|
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)
|
pfSaveOnlyProjectUnits, // save no info about foreign files (not part of project)
|
||||||
pfMainUnitIsPascalSource,// main unit is pascal, even it does not end in .pas/.pp
|
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
|
pfMainUnitHasCreateFormStatements,// add/remove Application.CreateForm statements
|
||||||
pfMainUnitHasTitleStatement,// add/remove Application.Title:= statements
|
pfMainUnitHasTitleStatement,// add/remove Application.Title:= statements
|
||||||
pfRunnable, // project can be run
|
pfRunnable, // project can be run
|
||||||
|
@ -1388,6 +1388,8 @@ begin
|
|||||||
CompileProgress.SetEnabled(EnvironmentOptions.ShowCompileDialog);
|
CompileProgress.SetEnabled(EnvironmentOptions.ShowCompileDialog);
|
||||||
|
|
||||||
CreateDirUTF8(GetProjectSessionsConfigPath);
|
CreateDirUTF8(GetProjectSessionsConfigPath);
|
||||||
|
|
||||||
|
RunBootHandlers(libhEnvironmentOptionsLoaded);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.SetupInteractive;
|
procedure TMainIDE.SetupInteractive;
|
||||||
@ -5013,7 +5015,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
if (AProject.MainUnitID < 0) or
|
if (AProject.MainUnitID < 0) or
|
||||||
(not (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)) then
|
(not (pfMainUnitHasCreateFormStatements in AProject.Flags)) then
|
||||||
Exit;
|
Exit;
|
||||||
OldList := AProject.GetAutoCreatedFormsList;
|
OldList := AProject.GetAutoCreatedFormsList;
|
||||||
if (OldList = nil) then
|
if (OldList = nil) then
|
||||||
@ -5021,10 +5023,10 @@ var
|
|||||||
try
|
try
|
||||||
if OldList.Count = AProject.TmpAutoCreatedForms.Count then
|
if OldList.Count = AProject.TmpAutoCreatedForms.Count then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
{ Just exit if the form list is the same }
|
{ Just exit if the form list is the same }
|
||||||
i := OldList.Count - 1;
|
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);
|
Dec(i);
|
||||||
if i < 0 then
|
if i < 0 then
|
||||||
Exit;
|
Exit;
|
||||||
|
@ -5404,7 +5404,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if (OldUnitName<>'') then
|
if (OldUnitName<>'') then
|
||||||
begin
|
begin
|
||||||
if (pfMainUnitHasUsesSectionForAllUnits in Flags) then
|
if (pfMainUnitIsPascalSource in Flags) then
|
||||||
begin
|
begin
|
||||||
// rename unit in program uses section
|
// rename unit in program uses section
|
||||||
CodeToolBoss.RenameUsedUnit(MainUnitInfo.Source, OldUnitName,
|
CodeToolBoss.RenameUsedUnit(MainUnitInfo.Source, OldUnitName,
|
||||||
|
@ -5557,7 +5557,7 @@ begin
|
|||||||
ChompPathDelim(ExtractFilePath(AnUnitInfo.Filename)));
|
ChompPathDelim(ExtractFilePath(AnUnitInfo.Filename)));
|
||||||
// remove from project's unit section
|
// remove from project's unit section
|
||||||
if (AProject.MainUnitID>=0)
|
if (AProject.MainUnitID>=0)
|
||||||
and (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)
|
and (pfMainUnitIsPascalSource in AProject.Flags)
|
||||||
then begin
|
then begin
|
||||||
ShortUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
ShortUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
||||||
//debugln(['TLazSourceFileManager.RemoveUnitsFromProject UnitName=',ShortUnitName]);
|
//debugln(['TLazSourceFileManager.RemoveUnitsFromProject UnitName=',ShortUnitName]);
|
||||||
|
@ -1058,7 +1058,7 @@ var
|
|||||||
NewUnitName: String;
|
NewUnitName: String;
|
||||||
begin
|
begin
|
||||||
AProject:=Project1;
|
AProject:=Project1;
|
||||||
if (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)
|
if (pfMainUnitIsPascalSource in AProject.Flags)
|
||||||
and (AProject.MainUnitInfo<>nil) then begin
|
and (AProject.MainUnitInfo<>nil) then begin
|
||||||
OldUnitName:=OldPkgName;
|
OldUnitName:=OldPkgName;
|
||||||
NewUnitName:=APackage.Name;
|
NewUnitName:=APackage.Name;
|
||||||
@ -1545,7 +1545,8 @@ procedure TPkgManager.AddUnitToProjectMainUsesSection(AProject: TProject;
|
|||||||
const AnUnitName, AnUnitInFilename: string);
|
const AnUnitName, AnUnitInFilename: string);
|
||||||
begin
|
begin
|
||||||
// add unit to project main source file
|
// 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
|
and (AProject.MainUnitInfo<>nil) then begin
|
||||||
//debugln('TPkgManager.AddUnitToProjectMainUsesSection B ',AnUnitName);
|
//debugln('TPkgManager.AddUnitToProjectMainUsesSection B ',AnUnitName);
|
||||||
if (AnUnitName<>'') then begin
|
if (AnUnitName<>'') then begin
|
||||||
@ -4699,7 +4700,7 @@ begin
|
|||||||
Project1.RemoveRequiredDependency(ADependency);
|
Project1.RemoveRequiredDependency(ADependency);
|
||||||
//debugln('TPkgManager.OnProjectInspectorRemoveDependency A');
|
//debugln('TPkgManager.OnProjectInspectorRemoveDependency A');
|
||||||
if (Project1.MainUnitID>=0)
|
if (Project1.MainUnitID>=0)
|
||||||
and (pfMainUnitHasUsesSectionForAllUnits in Project1.Flags)
|
and (pfMainUnitIsPascalSource in Project1.Flags)
|
||||||
then begin
|
then begin
|
||||||
MainIDEInterface.SaveSourceEditorChangesToCodeCache(nil);
|
MainIDEInterface.SaveSourceEditorChangesToCodeCache(nil);
|
||||||
ShortUnitName:=ADependency.PackageName;
|
ShortUnitName:=ADependency.PackageName;
|
||||||
|
Loading…
Reference in New Issue
Block a user