Opkman: Automatically adjust memo height for metapackage description.

git-svn-id: trunk@58769 -
This commit is contained in:
balazs 2018-08-24 12:02:04 +00:00
parent 63c26a35ae
commit 5c2e3bcf94
3 changed files with 12 additions and 11 deletions

View File

@ -14,7 +14,6 @@ object ShowHintFrm: TShowHintFrm
OnDestroy = FormDestroy
OnKeyUp = FormKeyUp
PopupMode = pmExplicit
LCLVersion = '1.9.0.0'
object pnMain: TPanel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
@ -22,16 +21,17 @@ object ShowHintFrm: TShowHintFrm
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 10
Height = 315
Top = 0
Height = 305
Top = 10
Width = 543
Align = alClient
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 10
BorderSpacing.Top = 10
BorderSpacing.Right = 10
BorderSpacing.Bottom = 10
BevelInner = bvLowered
ClientHeight = 315
ClientHeight = 305
ClientWidth = 543
Color = 15460842
ParentColor = False
@ -106,7 +106,7 @@ object ShowHintFrm: TShowHintFrm
AnchorSideBottom.Control = pnMain
AnchorSideBottom.Side = asrBottom
Left = 12
Height = 228
Height = 218
Top = 83
Width = 519
HorzScrollBar.Page = 1

View File

@ -173,7 +173,7 @@ begin
Data := VisualTree.VST.GetNodeData(ANode);
Caption := Format(rsMainFrm_rsPackageInformation, [Data^.PackageDisplayName]);
pnPackageName.Caption := Data^.PackageDisplayName;
mDescription.Text := Data^.CommunityDescription;
CalcHeight(mDescription, Data^.CommunityDescription);
for I := FFrames.Count - 1 downto 0 do
begin
CurFrame := TfrShowHint(FFrames.Items[I]);
@ -197,8 +197,8 @@ begin
FFrames.Add(CurFrame);
CurFrame.pnBase.BorderSpacing.Bottom := 3;
CurFrame.Parent := sbLazPackages;
CurFrame.CalcHeight(CurFrame.mDescription, Trim(LazPackage.Description));
CurFrame.CalcHeight(CurFrame.mLicense, Trim(LazPackage.License));
CalcHeight(CurFrame.mDescription, Trim(LazPackage.Description));
CalcHeight(CurFrame.mLicense, Trim(LazPackage.License));
CurFrame.Height := CurFrame.pnPackageName.Height + CurFrame.pnDescription.Height + CurFrame.pnLicense.Height +
CurFrame.BorderSpacing.Top + CurFrame.pnBase.BorderSpacing.Bottom;
TotHeight := TotHeight + CurFrame.Height;
@ -212,7 +212,7 @@ begin
TfrShowHint(FFrames.Items[0]).BorderSpacing.Bottom := 0;
end;
TfrShowHint(FFrames.Items[FFrames.Count - 1]).pnBase.BorderSpacing.Top := 0;
TotHeight := TotHeight + pnPackageName.Height + pnDescription.Height + 15;
TotHeight := TotHeight + pnPackageName.Height + pnDescription.Height + 25;
if (TotHeight < 51) or (TotHeight > 365) then
TotHeight := 365;
Self.Height := TotHeight;

View File

@ -48,9 +48,10 @@ type
private
public
procedure Init;
procedure CalcHeight(AMemo: TMemo; AText: String);
end;
procedure CalcHeight(AMemo: TMemo; AText: String);
implementation
uses opkman_const, opkman_options;
@ -75,7 +76,7 @@ begin
end;
end;
procedure TfrShowHint.CalcHeight(AMemo: TMemo; AText: String);
procedure CalcHeight(AMemo: TMemo; AText: String);
var
R: TRect;
Increase: Integer;