IDE: Use scaled images in trees of Install/Uninstall package form.

git-svn-id: trunk@59267 -
This commit is contained in:
wp 2018-10-07 16:38:47 +00:00
parent cf7cf15624
commit a6008a5186
2 changed files with 48 additions and 45 deletions

View File

@ -16,7 +16,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
OnResize = InstallPkgSetDialogResize OnResize = InstallPkgSetDialogResize
OnShow = InstallPkgSetDialogShow OnShow = InstallPkgSetDialogShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.9.0.0' LCLVersion = '2.1.0.0'
object PkgInfoGroupBox: TGroupBox object PkgInfoGroupBox: TGroupBox
AnchorSideBottom.Control = BtnPanel AnchorSideBottom.Control = BtnPanel
Left = 6 Left = 6
@ -27,13 +27,13 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
Caption = 'PkgInfoGroupBox' Caption = 'PkgInfoGroupBox'
ClientHeight = 109 ClientHeight = 107
ClientWidth = 591 ClientWidth = 591
Constraints.MinHeight = 70 Constraints.MinHeight = 70
TabOrder = 0 TabOrder = 0
object PkgInfoMemo: TMemo object PkgInfoMemo: TMemo
Left = 6 Left = 6
Height = 97 Height = 95
Top = 6 Top = 6
Width = 579 Width = 579
Align = alClient Align = alClient
@ -69,10 +69,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
TabOrder = 0 TabOrder = 0
end end
object CancelButton: TBitBtn object CancelButton: TBitBtn
Left = 216 Left = 193
Height = 26 Height = 26
Top = 6 Top = 6
Width = 78 Width = 82
Align = alRight Align = alRight
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -84,10 +84,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
TabOrder = 1 TabOrder = 1
end end
object SaveAndExitButton: TBitBtn object SaveAndExitButton: TBitBtn
Left = 462 Left = 455
Height = 26 Height = 26
Top = 6 Top = 6
Width = 139 Width = 146
Align = alRight Align = alRight
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -133,10 +133,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
TabOrder = 3 TabOrder = 3
end end
object SaveAndRebuildButton: TBitBtn object SaveAndRebuildButton: TBitBtn
Left = 300 Left = 281
Height = 26 Height = 26
Top = 6 Top = 6
Width = 156 Width = 168
Align = alRight Align = alRight
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -209,7 +209,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
TabOrder = 3 TabOrder = 3
object NoteLabel: TLabel object NoteLabel: TLabel
Left = 0 Left = 0
Height = 13 Height = 15
Top = 0 Top = 0
Width = 595 Width = 595
Align = alTop Align = alTop
@ -236,23 +236,23 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideBottom.Control = Panel1 AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 379 Height = 377
Top = 19 Top = 21
Width = 294 Width = 294
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = True AutoSize = True
Caption = 'InstallPkgGroupBox' Caption = 'InstallPkgGroupBox'
ClientHeight = 361 ClientHeight = 357
ClientWidth = 290 ClientWidth = 290
TabOrder = 0 TabOrder = 0
object ImportButton: TButton object ImportButton: TButton
AnchorSideLeft.Control = InstallTreeView AnchorSideLeft.Control = InstallTreeView
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = ExportButton AnchorSideBottom.Control = ExportButton
Left = 100 Left = 96
Height = 23 Height = 25
Top = 303 Top = 295
Width = 90 Width = 98
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
@ -265,10 +265,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = InstallPkgGroupBox AnchorSideBottom.Control = InstallPkgGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 100 Left = 98
Height = 23 Height = 25
Top = 332 Top = 326
Width = 90 Width = 95
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
@ -284,8 +284,8 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = UninstallButton AnchorSideBottom.Control = UninstallButton
Left = 6 Left = 6
Height = 239 Height = 227
Top = 29 Top = 31
Width = 278 Width = 278
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
MultiSelect = True MultiSelect = True
@ -304,10 +304,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideLeft.Control = InstallTreeView AnchorSideLeft.Control = InstallTreeView
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = ImportButton AnchorSideBottom.Control = ImportButton
Left = 96 Left = 91
Height = 23 Height = 25
Top = 274 Top = 264
Width = 98 Width = 108
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -323,7 +323,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideRight.Control = InstallPkgGroupBox AnchorSideRight.Control = InstallPkgGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 6 Left = 6
Height = 21 Height = 23
Top = 2 Top = 2
Width = 278 Width = 278
ButtonWidth = 23 ButtonWidth = 23
@ -351,12 +351,12 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideBottom.Control = Panel1 AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 300 Left = 300
Height = 379 Height = 377
Top = 19 Top = 21
Width = 295 Width = 295
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
Caption = 'AvailablePkgGroupBox' Caption = 'AvailablePkgGroupBox'
ClientHeight = 361 ClientHeight = 357
ClientWidth = 291 ClientWidth = 291
TabOrder = 1 TabOrder = 1
object AvailableTreeView: TTreeView object AvailableTreeView: TTreeView
@ -367,8 +367,8 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = AddToInstallButton AnchorSideBottom.Control = AddToInstallButton
Left = 6 Left = 6
Height = 297 Height = 289
Top = 29 Top = 31
Width = 279 Width = 279
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
MultiSelect = True MultiSelect = True
@ -388,10 +388,10 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideBottom.Control = AvailablePkgGroupBox AnchorSideBottom.Control = AvailablePkgGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 86 Left = 81
Height = 23 Height = 25
Top = 332 Top = 326
Width = 118 Width = 129
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -406,7 +406,7 @@ object InstallPkgSetDialog: TInstallPkgSetDialog
AnchorSideRight.Control = AvailablePkgGroupBox AnchorSideRight.Control = AvailablePkgGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 6 Left = 6
Height = 21 Height = 23
Top = 2 Top = 2
Width = 279 Width = 279
ButtonWidth = 23 ButtonWidth = 23

View File

@ -399,6 +399,7 @@ var
ImgIndex: Integer; ImgIndex: Integer;
Unknown: Boolean; Unknown: Boolean;
PackageLink: TPackageLink; PackageLink: TPackageLink;
ImagesRes: TScaledImageListResolution;
begin begin
Tree:=Sender as TTreeView; Tree:=Sender as TTreeView;
if Stage=cdPostPaint then begin if Stage=cdPostPaint then begin
@ -420,25 +421,27 @@ begin
else else
PackageLink := FindOnlinePackageLink(Info.ID.Name); PackageLink := FindOnlinePackageLink(Info.ID.Name);
Images:=Tree.Images; Images:=Tree.Images;
if Images = nil then exit;
ImagesRes := Images.ResolutionForPPI[Tree.ImagesWidth, Font.PixelsPerInch, GetCanvasScaleFactor];
CurCanvas:=Tree.Canvas; CurCanvas:=Tree.Canvas;
NodeRect:=Node.DisplayRect(False); NodeRect:=Node.DisplayRect(False);
x:=Node.DisplayIconLeft+1; x:=Node.DisplayIconLeft+1;
y:=(NodeRect.Top+NodeRect.Bottom-Images.Height) div 2; y:=(NodeRect.Top+NodeRect.Bottom-ImagesRes.Height) div 2;
// draw image // draw image
ImgIndex:=GetPkgImgIndex(Installed,PackageInInstallList(PkgName), PackageLink <> nil); ImgIndex:=GetPkgImgIndex(Installed,PackageInInstallList(PkgName), PackageLink <> nil);
Images.Draw(CurCanvas,x,y,ImgIndex); ImagesRes.Draw(CurCanvas,x,y,ImgIndex);
// draw overlays // draw overlays
if InLazSrc then if InLazSrc then
Images.Draw(CurCanvas,x,y,ImgIndexOverlayLazarusPackage); ImagesRes.Draw(CurCanvas,x,y,ImgIndexOverlayLazarusPackage);
if IsBase then if IsBase then
Images.Draw(CurCanvas,x,y,ImgIndexOverlayBasePackage); ImagesRes.Draw(CurCanvas,x,y,ImgIndexOverlayBasePackage);
if PkgType=lptRunTimeOnly then if PkgType=lptRunTimeOnly then
Images.Draw(CurCanvas,x,y,ImgIndexOverlayRuntimePackage); ImagesRes.Draw(CurCanvas,x,y,ImgIndexOverlayRuntimePackage);
if PkgType=lptDesignTime then if PkgType=lptDesignTime then
Images.Draw(CurCanvas,x,y,ImgIndexOverlayDesigntimePackage); ImagesRes.Draw(CurCanvas,x,y,ImgIndexOverlayDesigntimePackage);
if Unknown then if Unknown then
Images.Draw(CurCanvas,x,y,ImgIndexOverlayUnknown); ImagesRes.Draw(CurCanvas,x,y,ImgIndexOverlayUnknown);
end; end;
PaintImages:=false; PaintImages:=false;
end; end;