IDE: Support Hi-DPI in registered plugin list in PackageEditor. Issue #40345, patch by Bruno K.

This commit is contained in:
Juha 2023-06-23 09:07:43 +03:00
parent 36a4b07e52
commit 8c18c23fc3
2 changed files with 8 additions and 3 deletions

View File

@ -1159,6 +1159,7 @@ var
IL: TCustomImageList;
II: TImageIndex;
Res: TScaledImageListResolution;
l25PPIScaled: integer;
begin
//DebugLn('TPackageEditorForm.RegisteredListBoxDrawItem START');
if LazPackage=nil then exit;
@ -1177,16 +1178,17 @@ begin
Canvas.FillRect(ARect);
IL:=CurComponent.Images;
II:=CurComponent.ImageIndex;
l25PPIScaled:=ARect.Bottom - ARect.Top;
//DebugLn('TPackageEditorForm.RegisteredListBoxDrawItem ',DbgSName(CurIcon),' ',CurComponent.ComponentClass.ClassName);
if (IL<>nil) and (II>=0) then begin
Res := IL.ResolutionForControl[0, Self];
IconWidth:=Res.Width;
IconHeight:=Res.Height;
Res.Draw(Canvas,
ARect.Left+(25-IconWidth) div 2,
ARect.Left+(l25PPIScaled-IconWidth) div 2,
ARect.Top+(ARect.Bottom-ARect.Top-IconHeight) div 2, II);
end;
Canvas.TextOut(ARect.Left+25,
Canvas.TextOut(ARect.Left+l25PPIScaled,
ARect.Top+(ARect.Bottom-ARect.Top-TxtH) div 2, CurStr);
end;
end;
@ -2200,6 +2202,8 @@ begin
// FPropGui.UpdateApplyDependencyButton(true);
if pefNeedUpdateStatusBar in fFlags then
UpdateStatusBar(true);
with FPropGui.CallRegisterProcCheckBox do // adjust top of groupbox now.
FPropGui.RegisteredPluginsGroupBox.Top := ScaleDesignToForm(Height);
IdleConnected:=false;
finally
ItemsTreeView.EndUpdate;

View File

@ -239,7 +239,8 @@ begin
RegisteredPluginsGroupBox.Parent := fOwner;
RegisteredPluginsGroupBox.Left := 3;
RegisteredPluginsGroupBox.Height := 165;
RegisteredPluginsGroupBox.Top := 27;
RegisteredPluginsGroupBox.Top := 27; // Too early to set final top according
// to screen PPI
RegisteredPluginsGroupBox.Width := 452;
RegisteredPluginsGroupBox.Align := alBottom;
RegisteredPluginsGroupBox.Anchors := [akTop, akLeft, akRight, akBottom];