Opkman: Avoid unnecessary LCL scaling steps for VTV. Issue #37886.

git-svn-id: trunk@64737 -
This commit is contained in:
wp 2021-03-03 11:21:39 +00:00
parent e7683e534c
commit 09075a320b
2 changed files with 28 additions and 11 deletions

View File

@ -178,6 +178,9 @@ type
function UpdateP(const ADstDir: String; var ADoExtract: Boolean): TModalResult; function UpdateP(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
procedure Rebuild; procedure Rebuild;
function CheckDstDir(const ADstDir: String): Boolean; function CheckDstDir(const ADstDir: String): Boolean;
protected
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
public public
procedure ShowOptions(const AActivePageIndex: Integer = 0); procedure ShowOptions(const AActivePageIndex: Integer = 0);
end; end;
@ -346,6 +349,14 @@ begin
end; end;
procedure TMainFrm.DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double);
begin
inherited;
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
VisualTree.AutoAdjustLayout(AXProportion, AYProportion);
end;
function TMainFrm.Download(const ADstDir: String; var ADoExtract: Boolean): TModalResult; function TMainFrm.Download(const ADstDir: String; var ADoExtract: Boolean): TModalResult;
begin begin
if not CheckDstDir(ADstDir) then if not CheckDstDir(ADstDir) then

View File

@ -173,6 +173,7 @@ type
function ResolveDependencies: TModalResult; function ResolveDependencies: TModalResult;
function GetCheckedRepositoryPackages: Integer; function GetCheckedRepositoryPackages: Integer;
procedure SetupColors; procedure SetupColors;
procedure AutoAdjustLayout(AXProportion, AYProportion: Double);
published published
property OnChecking: TOnChecking read FOnChecking write FOnChecking; property OnChecking: TOnChecking read FOnChecking write FOnChecking;
property OnChecked: TNotifyEvent read FOnChecked write FOnChecked; property OnChecked: TNotifyEvent read FOnChecked write FOnChecked;
@ -201,24 +202,24 @@ begin
Anchors := [akLeft, akTop, akRight]; Anchors := [akLeft, akTop, akRight];
Images := AImgList; Images := AImgList;
PopupMenu := APopupMenu; PopupMenu := APopupMenu;
DefaultNodeHeight := FVST.Scale96ToForm(25); DefaultNodeHeight := 25;
Indent := FVST.Scale96ToForm(22); Indent := 22;
TabOrder := 1; TabOrder := 1;
DefaultText := ''; DefaultText := '';
Header.AutoSizeIndex := 4; Header.AutoSizeIndex := 4;
Header.Height := FVST.Scale96ToForm(25); Header.Height := 25;
Colors.DisabledColor := clBlack; Colors.DisabledColor := clBlack;
with Header.Columns.Add do with Header.Columns.Add do
begin begin
Position := 0; Position := 0;
Width := FVST.Scale96ToForm(270); Width := 270;
Text := rsMainFrm_VSTHeaderColumn_PackageName; Text := rsMainFrm_VSTHeaderColumn_PackageName;
end; end;
with Header.Columns.Add do with Header.Columns.Add do
begin begin
Position := 1; Position := 1;
Alignment := taCenter; Alignment := taCenter;
Width := FVST.Scale96ToForm(90); Width := 90;
{$IFDEF LCLCarbon} {$IFDEF LCLCarbon}
Options := Options - [coResizable]; Options := Options - [coResizable];
{$ENDIF} {$ENDIF}
@ -228,7 +229,7 @@ begin
begin begin
Position := 2; Position := 2;
Alignment := taCenter; Alignment := taCenter;
Width := FVST.Scale96ToForm(110); Width := 110;
{$IFDEF LCLCarbon} {$IFDEF LCLCarbon}
Options := Options - [coResizable]; Options := Options - [coResizable];
{$ENDIF} {$ENDIF}
@ -239,7 +240,7 @@ begin
begin begin
Position := 3; Position := 3;
Alignment := taCenter; Alignment := taCenter;
Width := FVST.Scale96ToForm(110); Width := 110;
{$IFDEF LCLCarbon} {$IFDEF LCLCarbon}
Options := Options - [coResizable]; Options := Options - [coResizable];
{$ENDIF} {$ENDIF}
@ -249,7 +250,7 @@ begin
with Header.Columns.Add do with Header.Columns.Add do
begin begin
Position := 4; Position := 4;
Width := FVST.Scale96ToForm(280); Width := 280;
{$IFDEF LCLCarbon} {$IFDEF LCLCarbon}
Options := Options - [coResizable]; Options := Options - [coResizable];
{$ENDIF} {$ENDIF}
@ -259,7 +260,7 @@ begin
begin begin
Position := 5; Position := 5;
Alignment := taCenter; Alignment := taCenter;
Width := FVST.Scale96ToForm(81); Width := 80;
Options := Options - [coResizable]; Options := Options - [coResizable];
Text := rsMainFrm_VSTHeaderColumn_Rating; Text := rsMainFrm_VSTHeaderColumn_Rating;
end; end;
@ -267,7 +268,7 @@ begin
begin begin
Position := 6; Position := 6;
Alignment := taCenter; Alignment := taCenter;
Width := FVST.Scale96ToForm(20); Width := 20;
Options := Options - [coResizable]; Options := Options - [coResizable];
end; end;
Header.Options := [hoAutoResize, hoColumnResize, hoRestrictDrag, hoShowSortGlyphs, hoVisible, hoShowHint]; Header.Options := [hoAutoResize, hoColumnResize, hoRestrictDrag, hoShowSortGlyphs, hoVisible, hoShowHint];
@ -313,7 +314,7 @@ begin
end; end;
FShowHintFrm := TShowHintFrm.Create(nil); FShowHintFrm := TShowHintFrm.Create(nil);
if AImgList <> nil then if AImgList <> nil then
FStarSize := Application.MainForm.Scale96ToForm(AImgList.Width) FStarSize := AImgList.Width
else else
FStarSize := 0; FStarSize := 0;
end; end;
@ -1440,6 +1441,11 @@ begin
end; end;
end; end;
procedure TVisualTree.AutoAdjustLayout(AXProportion, AYProportion: Double);
begin
FStarSize := round(FStarSize * AXProportion);
end;
procedure TVisualTree.VSTCompareNodes(Sender: TBaseVirtualTree; Node1, procedure TVisualTree.VSTCompareNodes(Sender: TBaseVirtualTree; Node1,
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer); Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
var var