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

View File

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

View File

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