mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 16:49:07 +02:00
IDE: package editor: multi updatebuttons
git-svn-id: trunk@45447 -
This commit is contained in:
parent
880415038e
commit
c2defd7c1f
@ -1437,15 +1437,14 @@ begin
|
|||||||
for i:=0 to ItemsTreeView.SelectionCount-1 do begin
|
for i:=0 to ItemsTreeView.SelectionCount-1 do begin
|
||||||
TVNode:=ItemsTreeView.Selections[i];
|
TVNode:=ItemsTreeView.Selections[i];
|
||||||
if not GetNodeDataItem(TVNode,NodeData,Item) then continue;
|
if not GetNodeDataItem(TVNode,NodeData,Item) then continue;
|
||||||
if Item is TPkgFile then begin
|
if not (Item is TPkgFile) then continue;
|
||||||
CurFile:=TPkgFile(Item);
|
CurFile:=TPkgFile(Item);
|
||||||
if not (CurFile.FileType in PkgFileUnitTypes) then continue;
|
if not (CurFile.FileType in PkgFileUnitTypes) then continue;
|
||||||
if CurFile.HasRegisterProc=CallRegisterProcCheckBox.Checked then exit;
|
if CurFile.HasRegisterProc=CallRegisterProcCheckBox.Checked then exit;
|
||||||
CurFile.HasRegisterProc:=CallRegisterProcCheckBox.Checked;
|
CurFile.HasRegisterProc:=CallRegisterProcCheckBox.Checked;
|
||||||
if not NodeData.Removed then
|
if not NodeData.Removed then
|
||||||
LazPackage.Modified:=true;
|
LazPackage.Modified:=true;
|
||||||
UpdateFiles;
|
UpdateFiles;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
@ -1984,26 +1983,42 @@ end;
|
|||||||
|
|
||||||
procedure TPackageEditorForm.UpdateButtons(Immediately: boolean);
|
procedure TPackageEditorForm.UpdateButtons(Immediately: boolean);
|
||||||
var
|
var
|
||||||
Removed: boolean;
|
i: Integer;
|
||||||
CurFile: TPkgFile;
|
TVNode: TTreeNode;
|
||||||
CurDependency: TPkgDependency;
|
NodeData: TPENodeData;
|
||||||
|
Item: TObject;
|
||||||
|
Writable: Boolean;
|
||||||
|
ActiveFileCnt: Integer;
|
||||||
|
ActiveDepCount: Integer;
|
||||||
|
FileCount: Integer;
|
||||||
|
DepCount: Integer;
|
||||||
begin
|
begin
|
||||||
if not CanUpdate(pefNeedUpdateButtons) then exit;
|
if not CanUpdate(pefNeedUpdateButtons) then exit;
|
||||||
|
|
||||||
CurFile:=GetCurrentFile(Removed);
|
FileCount:=0;
|
||||||
if CurFile=nil then
|
DepCount:=0;
|
||||||
CurDependency:=GetCurrentDependency(Removed)
|
ActiveFileCnt:=0;
|
||||||
else
|
ActiveDepCount:=0;
|
||||||
CurDependency:=nil;
|
for i:=0 to ItemsTreeView.SelectionCount-1 do begin
|
||||||
|
TVNode:=ItemsTreeView.Selections[i];
|
||||||
|
if not GetNodeDataItem(TVNode,NodeData,Item) then continue;
|
||||||
|
if Item is TPkgFile then begin
|
||||||
|
inc(FileCount);
|
||||||
|
if not NodeData.Removed then
|
||||||
|
inc(ActiveFileCnt);
|
||||||
|
end else if Item is TPkgDependency then begin
|
||||||
|
inc(DepCount);
|
||||||
|
if not NodeData.Removed then
|
||||||
|
inc(ActiveDepCount);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
SaveBitBtn.Enabled:=(not LazPackage.ReadOnly)
|
Writable:=not LazPackage.ReadOnly;
|
||||||
and (LazPackage.IsVirtual or LazPackage.Modified);
|
SaveBitBtn.Enabled:=Writable and (LazPackage.IsVirtual or LazPackage.Modified);
|
||||||
CompileBitBtn.Enabled:=(not LazPackage.IsVirtual) and LazPackage.CompilerOptions.HasCommands;
|
CompileBitBtn.Enabled:=(not LazPackage.IsVirtual) and LazPackage.CompilerOptions.HasCommands;
|
||||||
AddBitBtn.Enabled:=not LazPackage.ReadOnly;
|
AddBitBtn.Enabled:=Writable;
|
||||||
RemoveBitBtn.Enabled:=(not LazPackage.ReadOnly)
|
RemoveBitBtn.Enabled:=Writable and (ActiveFileCnt+ActiveDepCount>0);
|
||||||
and (not Removed)
|
OpenButton.Enabled:=(FileCount+DepCount>0);
|
||||||
and ((CurFile<>nil) or (CurDependency<>nil));
|
|
||||||
OpenButton.Enabled:=(CurFile<>nil) or (CurDependency<>nil);
|
|
||||||
UseBitBtn.Caption:=lisUseSub;
|
UseBitBtn.Caption:=lisUseSub;
|
||||||
UseBitBtn.Hint:=lisClickToSeeThePossibleUses;
|
UseBitBtn.Hint:=lisClickToSeeThePossibleUses;
|
||||||
UseBitBtn.OnClick:=nil;
|
UseBitBtn.OnClick:=nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user