IDE: Prevent "Open package of current unit" icon in toolbar blinking. From Ondrej.

git-svn-id: trunk@50063 -
This commit is contained in:
juha 2015-10-14 22:36:27 +00:00
parent 8dffe81769
commit 85531af32d

View File

@ -3729,16 +3729,19 @@ var
CanOpenPkgOfFile, CanAddCurFile: Boolean; CanOpenPkgOfFile, CanAddCurFile: Boolean;
begin begin
GetCurrentUnit(ASrcEdit,AUnitInfo); GetCurrentUnit(ASrcEdit,AUnitInfo);
if Assigned(AUnitInfo) and (AUnitInfo.Filename <> FLastUnitInfoFileName) then if Assigned(AUnitInfo) then
begin begin
PkgFile:=PackageGraph.FindFileInAllPackages(AUnitInfo.Filename,true, if (AUnitInfo.Filename <> FLastUnitInfoFileName) then
not AUnitInfo.IsPartOfProject); begin
CanOpenPkgOfFile:=Assigned(PkgFile); PkgFile:=PackageGraph.FindFileInAllPackages(AUnitInfo.Filename,true,
CanAddCurFile:=(not AUnitInfo.IsVirtual) and FileExistsUTF8(AUnitInfo.Filename) not AUnitInfo.IsPartOfProject);
and not AUnitInfo.IsPartOfProject; CanOpenPkgOfFile:=Assigned(PkgFile);
MainIDEBar.itmPkgOpenPackageOfCurUnit.Enabled:=CanOpenPkgOfFile; CanAddCurFile:=(not AUnitInfo.IsVirtual) and FileExistsUTF8(AUnitInfo.Filename)
MainIDEBar.itmPkgAddCurFileToPkg.Enabled:=CanAddCurFile; and not AUnitInfo.IsPartOfProject;
FLastUnitInfoFileName := AUnitInfo.Filename; MainIDEBar.itmPkgOpenPackageOfCurUnit.Enabled:=CanOpenPkgOfFile;
MainIDEBar.itmPkgAddCurFileToPkg.Enabled:=CanAddCurFile;
FLastUnitInfoFileName := AUnitInfo.Filename;
end;
end else end else
begin begin
MainIDEBar.itmPkgOpenPackageOfCurUnit.Enabled:=False; MainIDEBar.itmPkgOpenPackageOfCurUnit.Enabled:=False;