IDE: Move Extend..SearchPath functions from MainIDE to Project.

git-svn-id: trunk@52697 -
This commit is contained in:
juha 2016-07-16 08:06:13 +00:00
parent 814b6b1395
commit 339d0f841f
3 changed files with 46 additions and 50 deletions

View File

@ -158,10 +158,6 @@ type
function DoPublishModule(Options: TPublishModuleOptions;
const SrcDirectory, DestDirectory: string
): TModalResult; virtual; abstract;
function ExtendProjectUnitSearchPath(AProject: TProject; NewUnitPaths: string): boolean;
function ExtendProjectIncSearchPath(AProject: TProject; NewIncPaths: string): boolean;
function DoFixupComponentReferences(RootComponent: TComponent;
OpenFlags: TOpenFlags): TModalResult; virtual; abstract;
@ -352,50 +348,6 @@ begin
UpdateCaption;
end;
function TMainIDEInterface.ExtendProjectUnitSearchPath(AProject: TProject;
NewUnitPaths: string): boolean;
var
CurUnitPaths: String;
r: TModalResult;
begin
CurUnitPaths:=AProject.CompilerOptions.ParsedOpts.GetParsedValue(pcosUnitPath);
NewUnitPaths:=RemoveSearchPaths(NewUnitPaths,CurUnitPaths);
if NewUnitPaths<>'' then begin
NewUnitPaths:=CreateRelativeSearchPath(NewUnitPaths,AProject.ProjectDirectory);
r:=IDEMessageDialog(lisExtendUnitPath,
Format(lisExtendUnitSearchPathOfProjectWith, [#13, NewUnitPaths]),
mtConfirmation, [mbYes, mbNo, mbCancel]);
case r of
mrYes: AProject.CompilerOptions.MergeToUnitPaths(NewUnitPaths);
mrNo: ;
else exit(false);
end;
end;
Result:=true;
end;
function TMainIDEInterface.ExtendProjectIncSearchPath(AProject: TProject;
NewIncPaths: string): boolean;
var
CurIncPaths: String;
r: TModalResult;
begin
CurIncPaths:=AProject.CompilerOptions.ParsedOpts.GetParsedValue(pcosIncludePath);
NewIncPaths:=RemoveSearchPaths(NewIncPaths,CurIncPaths);
if NewIncPaths<>'' then begin
NewIncPaths:=CreateRelativeSearchPath(NewIncPaths,AProject.ProjectDirectory);
r:=IDEMessageDialog(lisExtendIncludePath,
Format(lisExtendIncludeFilesSearchPathOfProjectWith, [#13, NewIncPaths]),
mtConfirmation, [mbYes, mbNo, mbCancel]);
case r of
mrYes: AProject.CompilerOptions.MergeToIncludePaths(NewIncPaths);
mrNo: ;
else exit(false);
end;
end;
Result:=true;
end;
function TMainIDEInterface.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
NewTopLine: integer; AddJumpPoint: boolean; MarkLine: Boolean): TModalResult;
var

View File

@ -1014,6 +1014,8 @@ type
function GetStateFilename: string;
function GetCompileSourceFilename: string;
procedure AutoAddOutputDirToIncPath;
function ExtendUnitSearchPath(NewUnitPaths: string): boolean;
function ExtendIncSearchPath(NewIncPaths: string): boolean;
// compile state file
function LoadStateFile(IgnoreErrors: boolean): TModalResult;
@ -4883,6 +4885,48 @@ begin
end;
end;
function TProject.ExtendUnitSearchPath(NewUnitPaths: string): boolean;
var
CurUnitPaths: String;
r: TModalResult;
begin
CurUnitPaths:=CompilerOptions.ParsedOpts.GetParsedValue(pcosUnitPath);
NewUnitPaths:=RemoveSearchPaths(NewUnitPaths,CurUnitPaths);
if NewUnitPaths<>'' then begin
NewUnitPaths:=CreateRelativeSearchPath(NewUnitPaths,ProjectDirectory);
r:=IDEMessageDialog(lisExtendUnitPath,
Format(lisExtendUnitSearchPathOfProjectWith, [#13, NewUnitPaths]),
mtConfirmation, [mbYes, mbNo, mbCancel]);
case r of
mrYes: CompilerOptions.MergeToUnitPaths(NewUnitPaths);
mrNo: ;
else exit(false);
end;
end;
Result:=true;
end;
function TProject.ExtendIncSearchPath(NewIncPaths: string): boolean;
var
CurIncPaths: String;
r: TModalResult;
begin
CurIncPaths:=CompilerOptions.ParsedOpts.GetParsedValue(pcosIncludePath);
NewIncPaths:=RemoveSearchPaths(NewIncPaths,CurIncPaths);
if NewIncPaths<>'' then begin
NewIncPaths:=CreateRelativeSearchPath(NewIncPaths,ProjectDirectory);
r:=IDEMessageDialog(lisExtendIncludePath,
Format(lisExtendIncludeFilesSearchPathOfProjectWith, [#13, NewIncPaths]),
mtConfirmation, [mbYes, mbNo, mbCancel]);
case r of
mrYes: CompilerOptions.MergeToIncludePaths(NewIncPaths);
mrNo: ;
else exit(false);
end;
end;
Result:=true;
end;
function TProject.LoadStateFile(IgnoreErrors: boolean): TModalResult;
var
XMLConfig: TXMLConfig;

View File

@ -1252,12 +1252,12 @@ end;
function TProjectInspectorForm.ExtendIncSearchPath(NewIncPaths: string): boolean;
begin
Result:=MainIDEInterface.ExtendProjectIncSearchPath(LazProject,NewIncPaths);
Result:=LazProject.ExtendIncSearchPath(NewIncPaths);
end;
function TProjectInspectorForm.ExtendUnitSearchPath(NewUnitPaths: string): boolean;
begin
Result:=MainIDEInterface.ExtendProjectUnitSearchPath(LazProject,NewUnitPaths);
Result:=LazProject.ExtendUnitSearchPath(NewUnitPaths);
end;
function TProjectInspectorForm.FilesBaseDirectory: string;