mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 22:39:11 +02:00
IDE: open a build mode selection dialog for adding paths only if there are > 1 build modes.
git-svn-id: trunk@45263 -
This commit is contained in:
parent
b382abd6d3
commit
f40a7e6671
@ -718,10 +718,12 @@ resourcestring
|
|||||||
+'to project, because there is already a unit with the same name in the Project.';
|
+'to project, because there is already a unit with the same name in the Project.';
|
||||||
lisAddToProject = 'Add %s to project?';
|
lisAddToProject = 'Add %s to project?';
|
||||||
lisTheFile = 'The file %s%s%s';
|
lisTheFile = 'The file %s%s%s';
|
||||||
|
lisAddToUnitSearchPath = 'Add to unit search path?';
|
||||||
|
lisAddToIncludeSearchPath = 'Add to include search path?';
|
||||||
lisTheNewIncludeFileIsNotYetInTheIncludeSearchPathAdd =
|
lisTheNewIncludeFileIsNotYetInTheIncludeSearchPathAdd =
|
||||||
'The new include file is not yet in the include search path.%sAdd directory %s to build modes?';
|
'The new include file is not yet in the include search path.%sAdd directory %s?';
|
||||||
lisTheNewUnitIsNotYetInTheUnitSearchPathAddDirectory =
|
lisTheNewUnitIsNotYetInTheUnitSearchPathAddDirectory =
|
||||||
'The new unit is not yet in the unit search path.%sAdd directory %s to build modes?';
|
'The new unit is not yet in the unit search path.%sAdd directory %s?';
|
||||||
lisisAlreadyPartOfTheProject = '%s is already part of the Project.';
|
lisisAlreadyPartOfTheProject = '%s is already part of the Project.';
|
||||||
lisRemoveFromProject = 'Remove from Project';
|
lisRemoveFromProject = 'Remove from Project';
|
||||||
lisCreateAProjectFirst = 'Create a project first!';
|
lisCreateAProjectFirst = 'Create a project first!';
|
||||||
|
@ -58,9 +58,12 @@ type
|
|||||||
|
|
||||||
TLazSourceFileManager = class
|
TLazSourceFileManager = class
|
||||||
private
|
private
|
||||||
|
function AddPathToBuildModes(aPath, CurDirectory: string; IsIncludeFile: Boolean): Boolean;
|
||||||
function CheckMainSrcLCLInterfaces(Silent: boolean): TModalResult;
|
function CheckMainSrcLCLInterfaces(Silent: boolean): TModalResult;
|
||||||
function FileExistsInIDE(const Filename: string;
|
function FileExistsInIDE(const Filename: string;
|
||||||
SearchFlags: TProjectFileSearchFlags): boolean;
|
SearchFlags: TProjectFileSearchFlags): boolean;
|
||||||
|
function ShowCheckListBuildModes(DlgMsg: String; out
|
||||||
|
ListForm: TGenericCheckListForm): TModalResult;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -2505,28 +2508,73 @@ begin
|
|||||||
PkgBoss.DoCloseAllPackageEditors;
|
PkgBoss.DoCloseAllPackageEditors;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TLazSourceFileManager.ShowCheckListBuildModes(DlgMsg: String;
|
||||||
|
out ListForm: TGenericCheckListForm): TModalResult;
|
||||||
|
begin
|
||||||
|
ListForm:=TGenericCheckListForm.Create(Nil);
|
||||||
|
//lisApplyForBuildModes = 'Apply for build modes:';
|
||||||
|
ListForm.Caption:=lisAvailableProjectBuildModes;
|
||||||
|
ListForm.InfoLabel.Caption:=DlgMsg;
|
||||||
|
for i:=0 to Project1.BuildModes.Count-1 do begin
|
||||||
|
ListForm.CheckListBox1.Items.Add(Project1.BuildModes[i].Identifier);
|
||||||
|
ListForm.CheckListBox1.Checked[i]:=True;
|
||||||
|
end;
|
||||||
|
Result:=ListForm.ShowModal=mrOK;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TLazSourceFileManager.AddPathToBuildModes(aPath, CurDirectory: string;
|
||||||
|
IsIncludeFile: Boolean): Boolean;
|
||||||
|
var
|
||||||
|
ListForm: TGenericCheckListForm;
|
||||||
|
DlgCapt, DlgMsg: String;
|
||||||
|
i: Integer;
|
||||||
|
Ok: Boolean;
|
||||||
|
begin
|
||||||
|
Result:=True;
|
||||||
|
ListForm:=Nil;
|
||||||
|
try
|
||||||
|
if IsIncludeFile then begin
|
||||||
|
DlgCapt:=lisAddToIncludeSearchPath;
|
||||||
|
DlgMsg:=lisTheNewIncludeFileIsNotYetInTheIncludeSearchPathAdd;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
DlgCapt:=lisAddToUnitSearchPath;
|
||||||
|
DlgMsg:=lisTheNewUnitIsNotYetInTheUnitSearchPathAddDirectory;
|
||||||
|
end;
|
||||||
|
DlgMsg:=Format(DlgMsg,[LineEnding,CurDirectory]);
|
||||||
|
if Project1.BuildModes.Count > 1 then
|
||||||
|
Ok:=ShowCheckListBuildModes(DlgMsg, ListForm)
|
||||||
|
else
|
||||||
|
Ok:=IDEMessageDialog(DlgCapt,DlgMsg,mtConfirmation,[mbYes,mbNo])=mrYes;
|
||||||
|
if not Ok then Exit(False);
|
||||||
|
for i:=0 to Project1.BuildModes.Count-1 do
|
||||||
|
if (ListForm=Nil) or ListForm.CheckListBox1.Checked[i] then
|
||||||
|
with Project1.BuildModes[i].CompilerOptions do
|
||||||
|
if IsIncludeFile then
|
||||||
|
IncludePath:=MergeSearchPaths(IncludePath,aPath)
|
||||||
|
else
|
||||||
|
OtherUnitFiles:=MergeSearchPaths(OtherUnitFiles,aPath);
|
||||||
|
finally
|
||||||
|
ListForm.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TLazSourceFileManager.CheckDirIsInSearchPath(UnitInfo: TUnitInfo;
|
function TLazSourceFileManager.CheckDirIsInSearchPath(UnitInfo: TUnitInfo;
|
||||||
AllowAddingDependencies, IsIncludeFile: Boolean): Boolean;
|
AllowAddingDependencies, IsIncludeFile: Boolean): Boolean;
|
||||||
// Check if the given unit's path is on Unit- or Include-search path.
|
// Check if the given unit's path is on Unit- or Include-search path.
|
||||||
// Returns true if it is OK to add the unit to current project.
|
// Returns true if it is OK to add the unit to current project.
|
||||||
var
|
var
|
||||||
CurDirectory, CurPath, ShortDir: String;
|
CurDirectory, CurPath, ShortDir: String;
|
||||||
DlgMsg: String;
|
|
||||||
Owners: TFPList;
|
Owners: TFPList;
|
||||||
APackage: TLazPackage;
|
APackage: TLazPackage;
|
||||||
ListForm: TGenericCheckListForm;
|
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=True;
|
Result:=True;
|
||||||
if UnitInfo.IsVirtual then exit;
|
if UnitInfo.IsVirtual then exit;
|
||||||
if IsIncludeFile then begin
|
if IsIncludeFile then
|
||||||
CurPath:=Project1.CompilerOptions.GetIncludePath(false);
|
CurPath:=Project1.CompilerOptions.GetIncludePath(false)
|
||||||
DlgMsg:=lisTheNewIncludeFileIsNotYetInTheIncludeSearchPathAdd;
|
else
|
||||||
end
|
|
||||||
else begin
|
|
||||||
CurPath:=Project1.CompilerOptions.GetUnitPath(false);
|
CurPath:=Project1.CompilerOptions.GetUnitPath(false);
|
||||||
DlgMsg:=lisTheNewUnitIsNotYetInTheUnitSearchPathAddDirectory;
|
|
||||||
end;
|
|
||||||
CurDirectory:=AppendPathDelim(UnitInfo.GetDirectory);
|
CurDirectory:=AppendPathDelim(UnitInfo.GetDirectory);
|
||||||
if SearchDirectoryInSearchPath(CurPath,CurDirectory)<1 then
|
if SearchDirectoryInSearchPath(CurPath,CurDirectory)<1 then
|
||||||
begin
|
begin
|
||||||
@ -2555,26 +2603,7 @@ begin
|
|||||||
ShortDir:=CurDirectory;
|
ShortDir:=CurDirectory;
|
||||||
if (not Project1.IsVirtual) then
|
if (not Project1.IsVirtual) then
|
||||||
ShortDir:=CreateRelativePath(ShortDir,Project1.ProjectDirectory);
|
ShortDir:=CreateRelativePath(ShortDir,Project1.ProjectDirectory);
|
||||||
ListForm:=TGenericCheckListForm.Create(Nil);
|
Result:=AddPathToBuildModes(ShortDir,CurDirectory,IsIncludeFile);
|
||||||
try
|
|
||||||
//lisApplyForBuildModes = 'Apply for build modes:';
|
|
||||||
ListForm.Caption:=lisAvailableProjectBuildModes;
|
|
||||||
ListForm.InfoLabel.Caption:=Format(DlgMsg,[LineEnding,CurDirectory]);
|
|
||||||
for i:=0 to Project1.BuildModes.Count-1 do begin
|
|
||||||
ListForm.CheckListBox1.Items.Add(Project1.BuildModes[i].Identifier);
|
|
||||||
ListForm.CheckListBox1.Checked[i]:=True;
|
|
||||||
end;
|
|
||||||
if ListForm.ShowModal<>mrOK then Exit(False);
|
|
||||||
for i:=0 to Project1.BuildModes.Count-1 do
|
|
||||||
if ListForm.CheckListBox1.Checked[i] then
|
|
||||||
with Project1.BuildModes[i].CompilerOptions do
|
|
||||||
if IsIncludeFile then
|
|
||||||
IncludePath:=MergeSearchPaths(IncludePath,ShortDir)
|
|
||||||
else
|
|
||||||
OtherUnitFiles:=MergeSearchPaths(OtherUnitFiles,ShortDir);
|
|
||||||
finally
|
|
||||||
ListForm.Free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user