IDE: optimize a little + format.

git-svn-id: trunk@48808 -
This commit is contained in:
juha 2015-04-21 17:30:07 +00:00
parent abea0c63d2
commit ec2f4559ce
2 changed files with 12 additions and 20 deletions

View File

@ -1151,8 +1151,7 @@ begin
Result:=TPkgDependency(Item); Result:=TPkgDependency(Item);
end; end;
function TProjectInspectorForm.TreeViewToInspector(TV: TTreeView function TProjectInspectorForm.TreeViewToInspector(TV: TTreeView): TProjectInspectorForm;
): TProjectInspectorForm;
begin begin
if TV=ItemsTreeView then if TV=ItemsTreeView then
Result:=Self Result:=Self
@ -1185,14 +1184,12 @@ begin
ProjInspector:=nil; ProjInspector:=nil;
end; end;
function TProjectInspectorForm.ExtendIncSearchPath(NewIncPaths: string function TProjectInspectorForm.ExtendIncSearchPath(NewIncPaths: string): boolean;
): boolean;
begin begin
Result:=MainIDEInterface.ExtendProjectIncSearchPath(LazProject,NewIncPaths); Result:=MainIDEInterface.ExtendProjectIncSearchPath(LazProject,NewIncPaths);
end; end;
function TProjectInspectorForm.ExtendUnitSearchPath(NewUnitPaths: string function TProjectInspectorForm.ExtendUnitSearchPath(NewUnitPaths: string): boolean;
): boolean;
begin begin
Result:=MainIDEInterface.ExtendProjectUnitSearchPath(LazProject,NewUnitPaths); Result:=MainIDEInterface.ExtendProjectUnitSearchPath(LazProject,NewUnitPaths);
end; end;

View File

@ -1990,10 +1990,8 @@ begin
WasVirtual:=AnUnitInfo.IsVirtual; WasVirtual:=AnUnitInfo.IsVirtual;
WasPascalSource:=FilenameIsPascalSource(AnUnitInfo.Filename); WasPascalSource:=FilenameIsPascalSource(AnUnitInfo.Filename);
// if this file is part of the project and the project is virtual then save // if this file is part of a virtual project then save the project first
// project first if (not (sfProjectSaving in Flags)) and Project1.IsVirtual and AnUnitInfo.IsPartOfProject then
if (not (sfProjectSaving in Flags)) and Project1.IsVirtual
and AnUnitInfo.IsPartOfProject then
begin begin
SaveProjectFlags:=Flags*[sfSaveToTestDir]; SaveProjectFlags:=Flags*[sfSaveToTestDir];
if AnUnitInfo=Project1.MainUnitInfo then if AnUnitInfo=Project1.MainUnitInfo then
@ -2020,10 +2018,8 @@ begin
MacroListViewer.UpdateDisplay; MacroListViewer.UpdateDisplay;
AnUnitInfo.ClearModifieds; AnUnitInfo.ClearModifieds;
AEditor.Modified:=false; AEditor.Modified:=false;
Result := mrOK;
exit;
end; end;
// unknown internal file => skip // otherwise unknown internal file => skip
exit(mrOk); exit(mrOk);
end; end;
@ -2058,8 +2054,7 @@ begin
end; end;
// check if file is writable on disk // check if file is writable on disk
if (not AnUnitInfo.IsVirtual) if (not AnUnitInfo.IsVirtual) and FileExistsUTF8(AnUnitInfo.Filename) then
and FileExistsUTF8(AnUnitInfo.Filename) then
AnUnitInfo.FileReadOnly:=not FileIsWritable(AnUnitInfo.Filename) AnUnitInfo.FileReadOnly:=not FileIsWritable(AnUnitInfo.Filename)
else else
AnUnitInfo.FileReadOnly:=false; AnUnitInfo.FileReadOnly:=false;
@ -2159,8 +2154,7 @@ begin
NewUnitName:=AnUnitInfo.ParseUnitNameFromSource(true); NewUnitName:=AnUnitInfo.ParseUnitNameFromSource(true);
NewFilename:=AnUnitInfo.Filename; NewFilename:=AnUnitInfo.Filename;
if (NewUnitName<>'') if (NewUnitName<>'')
and ((OldUnitName<>NewUnitName) and ((OldUnitName<>NewUnitName) or (CompareFilenames(OldFilename,NewFilename)<>0))
or (CompareFilenames(OldFilename,NewFilename)<>0))
then begin then begin
if EnvironmentOptions.UnitRenameReferencesAction<>urraNever then if EnvironmentOptions.UnitRenameReferencesAction<>urraNever then
begin begin
@ -7477,10 +7471,11 @@ var
OnlyEditorFiles: Boolean; OnlyEditorFiles: Boolean;
aFilename: String; aFilename: String;
begin begin
if (CompareFilenames(OldFilename,NewFilename)=0) // compare unitnames case sensitive, maybe only the case changed
and (OldUnitName=NewUnitName) then // compare unitnames case sensitive, maybe only the case changed if (CompareFilenames(OldFilename,NewFilename)=0) and (OldUnitName=NewUnitName) then
exit(mrOk); exit(mrOk);
OnlyEditorFiles:=not FilenameIsAbsolute(OldFilename); // this was a new file, files on disk can not refer to it // this was a new file, files on disk can not refer to it
OnlyEditorFiles:=not FilenameIsAbsolute(OldFilename);
OwnerList:=nil; OwnerList:=nil;
OldCode:=nil; OldCode:=nil;