mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 04:57:12 +01:00
Bug fix: button is wrongly displayed in the tree when scrolling/collapsing items.
git-svn-id: trunk@53473 -
This commit is contained in:
parent
f2bb8815c5
commit
bf805c48fb
@ -4,7 +4,6 @@ object CategoriesFrm: TCategoriesFrm
|
|||||||
Top = 265
|
Top = 265
|
||||||
Width = 343
|
Width = 343
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
BorderStyle = bsSingle
|
|
||||||
Caption = 'CategoriesFrm'
|
Caption = 'CategoriesFrm'
|
||||||
ClientHeight = 383
|
ClientHeight = 383
|
||||||
ClientWidth = 343
|
ClientWidth = 343
|
||||||
|
|||||||
@ -1,24 +1,46 @@
|
|||||||
object PackageDetailsFrm: TPackageDetailsFrm
|
object PackageDetailsFrm: TPackageDetailsFrm
|
||||||
Left = 455
|
Left = 455
|
||||||
Height = 490
|
Height = 310
|
||||||
Top = 264
|
Top = 264
|
||||||
Width = 735
|
Width = 477
|
||||||
BorderIcons = [biSystemMenu, biMaximize]
|
BorderIcons = [biSystemMenu]
|
||||||
ClientHeight = 490
|
ClientHeight = 310
|
||||||
ClientWidth = 735
|
ClientWidth = 477
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
PopupMode = pmExplicit
|
PopupMode = pmExplicit
|
||||||
Position = poOwnerFormCenter
|
Position = poOwnerFormCenter
|
||||||
LCLVersion = '1.7'
|
LCLVersion = '1.7'
|
||||||
object mDetails: TMemo
|
object mDetails: TMemo
|
||||||
Left = 0
|
Left = 5
|
||||||
Height = 490
|
Height = 259
|
||||||
Top = 0
|
Top = 5
|
||||||
Width = 735
|
Width = 467
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Color = clBtnFace
|
BorderSpacing.Around = 5
|
||||||
|
ParentColor = True
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
ScrollBars = ssBoth
|
ScrollBars = ssBoth
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
|
object pnButtons: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 41
|
||||||
|
Top = 269
|
||||||
|
Width = 477
|
||||||
|
Align = alBottom
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 41
|
||||||
|
ClientWidth = 477
|
||||||
|
TabOrder = 1
|
||||||
|
object bOk: TButton
|
||||||
|
Left = 390
|
||||||
|
Height = 26
|
||||||
|
Top = 8
|
||||||
|
Width = 75
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
|
Caption = 'Ok'
|
||||||
|
ModalResult = 1
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -5,14 +5,17 @@ unit opkman_packagedetailsfrm;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
|
ExtCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TPackageDetailsFrm }
|
{ TPackageDetailsFrm }
|
||||||
|
|
||||||
TPackageDetailsFrm = class(TForm)
|
TPackageDetailsFrm = class(TForm)
|
||||||
|
bOk: TButton;
|
||||||
mDetails: TMemo;
|
mDetails: TMemo;
|
||||||
|
pnButtons: TPanel;
|
||||||
private
|
private
|
||||||
|
|
||||||
public
|
public
|
||||||
|
|||||||
@ -111,8 +111,10 @@ type
|
|||||||
Node: PVirtualNode; Column: TColumnIndex; const {%H-}CellRect: TRect);
|
Node: PVirtualNode; Column: TColumnIndex; const {%H-}CellRect: TRect);
|
||||||
procedure VSTCollapsed(Sender: TBaseVirtualTree; {%H-}Node: PVirtualNode);
|
procedure VSTCollapsed(Sender: TBaseVirtualTree; {%H-}Node: PVirtualNode);
|
||||||
procedure VSTOnDblClick(Sender: TObject);
|
procedure VSTOnDblClick(Sender: TObject);
|
||||||
|
procedure VSTScroll(Sender: TBaseVirtualTree; {%H-}DeltaX, {%H-}DeltaY: Integer);
|
||||||
function IsAllChecked(const AChecking: PVirtualNode): Boolean;
|
function IsAllChecked(const AChecking: PVirtualNode): Boolean;
|
||||||
procedure ButtonClick(Sender: TObject);
|
procedure ButtonClick(Sender: TObject);
|
||||||
|
procedure ShowHideButtons;
|
||||||
public
|
public
|
||||||
constructor Create(const AParent: TWinControl; const AImgList: TImageList;
|
constructor Create(const AParent: TWinControl; const AImgList: TImageList;
|
||||||
APopupMenu: TPopupMenu);
|
APopupMenu: TPopupMenu);
|
||||||
@ -157,7 +159,7 @@ begin
|
|||||||
Indent := 22;
|
Indent := 22;
|
||||||
TabOrder := 1;
|
TabOrder := 1;
|
||||||
DefaultText := '';
|
DefaultText := '';
|
||||||
Header.AutoSizeIndex := 3;
|
Header.AutoSizeIndex := 4;
|
||||||
Header.Height := 25;
|
Header.Height := 25;
|
||||||
with Header.Columns.Add do
|
with Header.Columns.Add do
|
||||||
begin
|
begin
|
||||||
@ -222,6 +224,7 @@ begin
|
|||||||
OnGetHint := @VSTGetHint;
|
OnGetHint := @VSTGetHint;
|
||||||
OnAfterCellPaint := @VSTAfterCellPaint;
|
OnAfterCellPaint := @VSTAfterCellPaint;
|
||||||
OnCollapsed := @VSTCollapsed;
|
OnCollapsed := @VSTCollapsed;
|
||||||
|
OnScroll := @VSTScroll;
|
||||||
OnFreeNode := @VSTFreeNode;
|
OnFreeNode := @VSTFreeNode;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -311,16 +314,11 @@ begin
|
|||||||
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
||||||
GrandChildData^.PackageType := PackageFile.PackageType;
|
GrandChildData^.PackageType := PackageFile.PackageType;
|
||||||
GrandChildData^.DataType := 8;
|
GrandChildData^.DataType := 8;
|
||||||
//add dependencies(DataType = 9)
|
//add license(DataType = 9)
|
||||||
GrandChildNode := FVST.AddChild(ChildNode);
|
|
||||||
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
|
||||||
GrandChildData^.Dependencies := PackageFile.DependenciesAsString;
|
|
||||||
GrandChildData^.DataType := 9;
|
|
||||||
//add license(DataType = 10)
|
|
||||||
GrandChildNode := FVST.AddChild(ChildNode);
|
GrandChildNode := FVST.AddChild(ChildNode);
|
||||||
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
||||||
GrandChildData^.License := PackageFile.License;
|
GrandChildData^.License := PackageFile.License;
|
||||||
GrandChildData^.DataType := 10;
|
GrandChildData^.DataType := 9;
|
||||||
GrandChildData^.Button := TSpeedButton.Create(FVST);
|
GrandChildData^.Button := TSpeedButton.Create(FVST);
|
||||||
with GrandChildData^.Button do
|
with GrandChildData^.Button do
|
||||||
begin
|
begin
|
||||||
@ -333,6 +331,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
GrandChildData^.ButtonID := UniqueID;
|
GrandChildData^.ButtonID := UniqueID;
|
||||||
end;
|
end;
|
||||||
|
//add dependencies(DataType = 10)
|
||||||
|
GrandChildNode := FVST.AddChild(ChildNode);
|
||||||
|
GrandChildData := FVST.GetNodeData(GrandChildNode);
|
||||||
|
GrandChildData^.Dependencies := PackageFile.DependenciesAsString;
|
||||||
|
GrandChildData^.DataType := 10;
|
||||||
//add miscellaneous(DataType = 11)
|
//add miscellaneous(DataType = 11)
|
||||||
ChildNode := FVST.AddChild(Node);
|
ChildNode := FVST.AddChild(Node);
|
||||||
ChildData := FVST.GetNodeData(ChildNode);
|
ChildData := FVST.GetNodeData(ChildNode);
|
||||||
@ -422,7 +425,7 @@ begin
|
|||||||
Text := Data^.Description;
|
Text := Data^.Description;
|
||||||
FrmCaption := rsMainFrm_VSTText_Desc + ' "' + ParentData^.PackageFileName + '"';
|
FrmCaption := rsMainFrm_VSTText_Desc + ' "' + ParentData^.PackageFileName + '"';
|
||||||
end;
|
end;
|
||||||
10: begin
|
9: begin
|
||||||
Text := Data^.License;
|
Text := Data^.License;
|
||||||
FrmCaption := rsMainFrm_VSTText_Lic + ' "' + ParentData^.PackageFileName + '"';
|
FrmCaption := rsMainFrm_VSTText_Lic + ' "' + ParentData^.PackageFileName + '"';
|
||||||
end;
|
end;
|
||||||
@ -442,6 +445,42 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TVisualTree.ShowHideButtons;
|
||||||
|
var
|
||||||
|
ChildNode: PVirtualNode;
|
||||||
|
ChildData: PData;
|
||||||
|
R: TRect;
|
||||||
|
Text: String;
|
||||||
|
begin
|
||||||
|
ChildNode := VST.GetFirst;
|
||||||
|
while Assigned(ChildNode) do
|
||||||
|
begin
|
||||||
|
ChildData := VST.GetNodeData(ChildNode);
|
||||||
|
if Assigned(ChildData^.Button) then
|
||||||
|
begin
|
||||||
|
case ChildData^.DataType of
|
||||||
|
3: Text := ChildData^.Description;
|
||||||
|
9: Text := ChildData^.License;
|
||||||
|
end;
|
||||||
|
R := FVST.GetDisplayRect(ChildNode, 5, false);
|
||||||
|
ChildData^.Button.Visible := ((R.Bottom > FVST.Top) and (R.Bottom < FVST.Top + FVST.Height)) and (Trim(Text) <> '');
|
||||||
|
FVST.InvalidateNode(ChildNode);
|
||||||
|
end;
|
||||||
|
ChildNode := VST.GetNext(ChildNode);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TVisualTree.VSTScroll(Sender: TBaseVirtualTree; DeltaX,
|
||||||
|
DeltaY: Integer);
|
||||||
|
begin
|
||||||
|
ShowHideButtons;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TVisualTree.VSTCollapsed(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||||
|
begin
|
||||||
|
ShowHideButtons;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TVisualTree.VSTAfterCellPaint(Sender: TBaseVirtualTree;
|
procedure TVisualTree.VSTAfterCellPaint(Sender: TBaseVirtualTree;
|
||||||
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
|
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
|
||||||
const CellRect: TRect);
|
const CellRect: TRect);
|
||||||
@ -462,37 +501,13 @@ begin
|
|||||||
Data^.Button.Height := R.Bottom - R.Top - 2;
|
Data^.Button.Height := R.Bottom - R.Top - 2;
|
||||||
case Data^.DataType of
|
case Data^.DataType of
|
||||||
3: Text := Data^.Description;
|
3: Text := Data^.Description;
|
||||||
10: Text := Data^.License;
|
9: Text := Data^.License;
|
||||||
end;
|
end;
|
||||||
Data^.Button.Visible := ((R.Bottom > FVST.Top) and (R.Bottom < FVST.Top + FVST.Height)) and (Trim(Text) <> '')
|
Data^.Button.Visible := ((R.Bottom > FVST.Top) and (R.Bottom < FVST.Top + FVST.Height)) and (Trim(Text) <> '');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVisualTree.VSTCollapsed(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
|
||||||
var
|
|
||||||
ChildNode: PVirtualNode;
|
|
||||||
ChildData: PData;
|
|
||||||
R: TRect;
|
|
||||||
Text: String;
|
|
||||||
begin
|
|
||||||
ChildNode := VST.GetFirst;
|
|
||||||
while Assigned(ChildNode) do
|
|
||||||
begin
|
|
||||||
ChildData := VST.GetNodeData(ChildNode);
|
|
||||||
if Assigned(ChildData^.Button) then
|
|
||||||
begin
|
|
||||||
case ChildData^.DataType of
|
|
||||||
3: Text := ChildData^.Description;
|
|
||||||
10: Text := ChildData^.License;
|
|
||||||
end;
|
|
||||||
R := FVST.GetDisplayRect(ChildNode, 5, false);
|
|
||||||
ChildData^.Button.Visible := ((R.Bottom > FVST.Top) and (R.Bottom < FVST.Top + FVST.Height)) and (Trim(Text) <> '')
|
|
||||||
end;
|
|
||||||
ChildNode := VST.GetNext(ChildNode);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TVisualTree.CheckNodes(const Checked: Boolean);
|
procedure TVisualTree.CheckNodes(const Checked: Boolean);
|
||||||
var
|
var
|
||||||
Node: PVirtualNode;
|
Node: PVirtualNode;
|
||||||
@ -715,16 +730,16 @@ begin
|
|||||||
FilterNode(Node, '');
|
FilterNode(Node, '');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
fbDependecies:
|
|
||||||
begin
|
|
||||||
if Data^.DataType = 9 then
|
|
||||||
FilterNode(Node, Data^.Dependencies);
|
|
||||||
end;
|
|
||||||
fbLicense:
|
fbLicense:
|
||||||
begin
|
begin
|
||||||
if Data^.DataType = 10 then
|
if Data^.DataType = 9 then
|
||||||
FilterNode(Node, Data^.License);
|
FilterNode(Node, Data^.License);
|
||||||
end;
|
end;
|
||||||
|
fbDependecies:
|
||||||
|
begin
|
||||||
|
if Data^.DataType = 10 then
|
||||||
|
FilterNode(Node, Data^.Dependencies);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
Node := FVST.GetNext(Node);
|
Node := FVST.GetNext(Node);
|
||||||
end;
|
end;
|
||||||
@ -1052,8 +1067,8 @@ begin
|
|||||||
6: CellText := rsMainFrm_VSTText_FPCCompatibility;
|
6: CellText := rsMainFrm_VSTText_FPCCompatibility;
|
||||||
7: CellText := rsMainFrm_VSTText_SupportedWidgetsets;
|
7: CellText := rsMainFrm_VSTText_SupportedWidgetsets;
|
||||||
8: CellText := rsMainFrm_VSTText_Packagetype;
|
8: CellText := rsMainFrm_VSTText_Packagetype;
|
||||||
9: CellText := rsMainFrm_VSTText_Dependecies;
|
9: CellText := rsMainFrm_VSTText_License;
|
||||||
10: CellText := rsMainFrm_VSTText_License;
|
10: CellText := rsMainFrm_VSTText_Dependecies;
|
||||||
11: CellText := rsMainFrm_VSTText_PackageInfo;
|
11: CellText := rsMainFrm_VSTText_PackageInfo;
|
||||||
12: CellText := rsMainFrm_VSTText_Category;
|
12: CellText := rsMainFrm_VSTText_Category;
|
||||||
13: CellText := rsMainFrm_VSTText_RepositoryFilename;
|
13: CellText := rsMainFrm_VSTText_RepositoryFilename;
|
||||||
@ -1063,7 +1078,6 @@ begin
|
|||||||
17: CellText := rsMainFrm_VSTText_HomePageURL;
|
17: CellText := rsMainFrm_VSTText_HomePageURL;
|
||||||
18: CellText := rsMainFrm_VSTText_DownloadURL;
|
18: CellText := rsMainFrm_VSTText_DownloadURL;
|
||||||
19: CellText := rsMainFrm_VSTText_SVNURL;
|
19: CellText := rsMainFrm_VSTText_SVNURL;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else if Column = 1 then
|
else if Column = 1 then
|
||||||
@ -1114,8 +1128,8 @@ begin
|
|||||||
ptRunTime: CellText := rsMainFrm_VSTText_PackageType2;
|
ptRunTime: CellText := rsMainFrm_VSTText_PackageType2;
|
||||||
ptRunTimeOnly: CellText := rsMainFrm_VSTText_PackageType3;
|
ptRunTimeOnly: CellText := rsMainFrm_VSTText_PackageType3;
|
||||||
end;
|
end;
|
||||||
9: CellText := Data^.Dependencies;
|
9: CellText := Data^.License;
|
||||||
10: CellText := Data^.License;
|
10: CellText := Data^.Dependencies;
|
||||||
11: CellText := '';
|
11: CellText := '';
|
||||||
12: CellText := Data^.Category;
|
12: CellText := Data^.Category;
|
||||||
13: CellText := Data^.RepositoryFileName;
|
13: CellText := Data^.RepositoryFileName;
|
||||||
@ -1285,5 +1299,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user