mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 05:18:15 +02:00
Merged revision(s) 55022 #083ef5923c from trunk:
LCL: rename TControl.ScaleCoord* methods ........ git-svn-id: branches/fixes_1_8@55053 -
This commit is contained in:
parent
2f9eb3a4eb
commit
d3be8fabea
@ -1040,8 +1040,8 @@ begin
|
||||
ALayout:=Find(ADialog,true);
|
||||
//debugln(['TIDEDialogLayoutList.ApplyLayout ',ALayout.Name,' ',ALayout.SizeValid,' ',ALayout.Width,',',ALayout.Height]);
|
||||
if ALayout.SizeValid then begin
|
||||
NewWidth:=ADialog.ScaleCoord(ALayout.Width);
|
||||
NewHeight:=ADialog.ScaleCoord(ALayout.Height);
|
||||
NewWidth:=ADialog.Scale96ToForm(ALayout.Width);
|
||||
NewHeight:=ADialog.Scale96ToForm(ALayout.Height);
|
||||
end else begin
|
||||
NewWidth:=DefaultWidth;
|
||||
NewHeight:=DefaultHeight;
|
||||
@ -1064,8 +1064,8 @@ var
|
||||
begin
|
||||
if (ADialog=nil) or (Self=nil) then exit;
|
||||
ALayout:=Find(ADialog,true);
|
||||
ALayout.Width:=ADialog.ScaleCoordBack(ADialog.Width);
|
||||
ALayout.Height:=ADialog.ScaleCoordBack(ADialog.Height);
|
||||
ALayout.Width:=ADialog.ScaleFormTo96(ADialog.Width);
|
||||
ALayout.Height:=ADialog.ScaleFormTo96(ADialog.Height);
|
||||
end;
|
||||
|
||||
procedure TIDEDialogLayoutList.Clear;
|
||||
|
@ -1433,7 +1433,7 @@ function TOICustomPropertyGrid.RealDefaultItemHeight: integer;
|
||||
begin
|
||||
Result := FDefaultItemHeight;
|
||||
if (Result<=0) then
|
||||
Result := ScaleCoord96(22);
|
||||
Result := Scale96ToForm(22);
|
||||
end;
|
||||
|
||||
function TOICustomPropertyGrid.GetRowByPath(const PropPath: string): TOIPropertyGridRow;
|
||||
@ -2832,7 +2832,7 @@ begin
|
||||
// edit dialog button
|
||||
with EditBtnRect do begin
|
||||
Top := EditCompRect.Top;
|
||||
Left := EditCompRect.Right - ScaleCoord96(20);
|
||||
Left := EditCompRect.Right - Scale96ToForm(20);
|
||||
Bottom := EditCompRect.Bottom - 1;
|
||||
Right := EditCompRect.Right;
|
||||
EditCompRect.Right := Left;
|
||||
@ -4350,9 +4350,9 @@ begin
|
||||
with PropFilterLabel do
|
||||
begin
|
||||
Parent := PropertyPanel;
|
||||
Left := ScaleCoord96(5);
|
||||
Top := ScaleCoord96(7);
|
||||
Width := ScaleCoord96(53);
|
||||
Left := Scale96ToForm(5);
|
||||
Top := Scale96ToForm(7);
|
||||
Width := Scale96ToForm(53);
|
||||
Caption := oisBtnProperties;
|
||||
FocusControl := PropFilterEdit;
|
||||
end;
|
||||
@ -4366,7 +4366,7 @@ begin
|
||||
AnchorSideTop.Side := asrCenter;
|
||||
Width := PropertyPanel.Width - ( Left + 3);
|
||||
AutoSelect := False;
|
||||
ButtonWidth := ScaleCoord96(23);
|
||||
ButtonWidth := Scale96ToForm(23);
|
||||
Anchors := [akTop, akLeft, akRight];
|
||||
BorderSpacing.Left := 5;
|
||||
TabOrder := 0;
|
||||
@ -5252,8 +5252,8 @@ begin
|
||||
IDEImages.Images_16.Draw(
|
||||
ABox.Canvas, X, Y,
|
||||
IDEImages.LoadImage('issue_' + LCLPlatformDirNames[lclPlatform]));
|
||||
Inc(X, ScaleCoord96(16));
|
||||
Inc(X, ScaleCoord96(OutVertCentered(X, IntToStr(ARestrictions[lclPlatform])).CX));
|
||||
Inc(X, Scale96ToForm(16));
|
||||
Inc(X, Scale96ToForm(OutVertCentered(X, IntToStr(ARestrictions[lclPlatform])).CX));
|
||||
end;
|
||||
|
||||
if None then
|
||||
|
@ -909,7 +909,7 @@ begin
|
||||
xLbl.Caption := xPkgItem.Title;
|
||||
xLbl.Parent := FPanel;
|
||||
xLbl.PopupMenu := FTabLabelMenu;
|
||||
xLbl.Height := FPanel.ScaleCoord(TPackageTabButton.GetControlClassDefaultSize.cy);
|
||||
xLbl.Height := FPanel.Scale96ToForm(TPackageTabButton.GetControlClassDefaultSize.cy);
|
||||
xLbl.OnCloseAllFiles := @CloseAllFiles;
|
||||
if FPanel is TPackageTabScrollBox then
|
||||
begin
|
||||
|
@ -220,8 +220,8 @@ begin
|
||||
Pal := TComponentPalette(Palette);
|
||||
if Pal.PageControl<>nil then
|
||||
Pal.PageControl.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TComponentPage.ReAlignButtons'){$ENDIF};
|
||||
ComponentPaletteBtnWidthScaled := Pal.PageControl.ScaleCoord(ComponentPaletteBtnWidth);
|
||||
ComponentPaletteBtnHeightScaled := Pal.PageControl.ScaleCoord(ComponentPaletteBtnHeight);
|
||||
ComponentPaletteBtnWidthScaled := Pal.PageControl.Scale96ToForm(ComponentPaletteBtnWidth);
|
||||
ComponentPaletteBtnHeightScaled := Pal.PageControl.Scale96ToForm(ComponentPaletteBtnHeight);
|
||||
ButtonTree:=nil;
|
||||
try
|
||||
ScrollBox:=TScrollBox(PageComponent.Components[0]);
|
||||
@ -337,7 +337,7 @@ begin
|
||||
VertScrollBar.Visible := false;
|
||||
AutoScroll:=false;
|
||||
{$ENDIF}
|
||||
VertScrollBar.Increment := PageComponent.ScaleCoord(ComponentPaletteBtnHeight);
|
||||
VertScrollBar.Increment := PageComponent.Scale96ToForm(ComponentPaletteBtnHeight);
|
||||
VertScrollBar.Tracking := True;
|
||||
Parent := PageComponent;
|
||||
end;
|
||||
@ -414,7 +414,7 @@ begin
|
||||
Down := True;
|
||||
Hint := lisSelectionTool;
|
||||
ShowHint := EnvironmentOptions.ShowHintsForComponentPalette;
|
||||
SetBounds(0,0,aScrollBox.ScaleCoord(ComponentPaletteBtnWidth),aScrollBox.ScaleCoord(ComponentPaletteBtnHeight));
|
||||
SetBounds(0,0,aScrollBox.Scale96ToForm(ComponentPaletteBtnWidth),aScrollBox.Scale96ToForm(ComponentPaletteBtnHeight));
|
||||
Parent := aScrollBox;
|
||||
end;
|
||||
end;
|
||||
@ -442,7 +442,7 @@ begin
|
||||
Pal.fComponentButtons[CompCN] := Btn;
|
||||
Btn.Name := CompPaletteCompBtnPrefix + aButtonUniqueName + CompCN;
|
||||
// Left and Top will be set in ReAlignButtons.
|
||||
Btn.SetBounds(Btn.Left,Btn.Top,aScrollBox.ScaleCoord(ComponentPaletteBtnWidth),aScrollBox.ScaleCoord(ComponentPaletteBtnHeight));
|
||||
Btn.SetBounds(Btn.Left,Btn.Top,aScrollBox.Scale96ToForm(ComponentPaletteBtnWidth),aScrollBox.Scale96ToForm(ComponentPaletteBtnHeight));
|
||||
Btn.Glyph.Assign(aComp.Icon);
|
||||
Btn.GroupIndex := 1;
|
||||
Btn.Flat := true;
|
||||
|
@ -472,7 +472,7 @@ begin
|
||||
if ColorRectWidthStored then
|
||||
Result := FColorRectWidth
|
||||
else
|
||||
Result := MulDiv(cDefaultColorRectWidth, Font.PixelsPerInch, 96);
|
||||
Result := Scale96ToFont(cDefaultColorRectWidth);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -837,7 +837,7 @@ begin
|
||||
if ColorRectWidthStored then
|
||||
Result := FColorRectWidth
|
||||
else
|
||||
Result := MulDiv(cDefaultColorRectWidth, Font.PixelsPerInch, 96);
|
||||
Result := Scale96ToFont(cDefaultColorRectWidth);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -1481,10 +1481,14 @@ type
|
||||
function GetSelectedChildAccessibleObject: TLazAccessibleObject; virtual;
|
||||
function GetChildAccessibleObjectAtPos(APos: TPoint): TLazAccessibleObject; virtual;
|
||||
//scale support
|
||||
function ScaleCoord(const ASize: Integer): Integer;
|
||||
function ScaleCoordBack(const ASize: Integer): Integer;
|
||||
function ScaleCoord96(const ASize: Integer): Integer;
|
||||
function ScaleCoord96Back(const ASize: Integer): Integer;
|
||||
function ScaleDesignToForm(const ASize: Integer): Integer;
|
||||
function ScaleFormToDesign(const ASize: Integer): Integer;
|
||||
function Scale96ToForm(const ASize: Integer): Integer;
|
||||
function ScaleFormTo96(const ASize: Integer): Integer;
|
||||
function Scale96ToFont(const ASize: Integer): Integer;
|
||||
function ScaleFontTo96(const ASize: Integer): Integer;
|
||||
function ScaleScreenToFont(const ASize: Integer): Integer;
|
||||
function ScaleFontToScreen(const ASize: Integer): Integer;
|
||||
public
|
||||
// size
|
||||
procedure AdjustSize; virtual;// smart calling DoAutoSize
|
||||
|
@ -5235,7 +5235,7 @@ begin
|
||||
if FDefColWidth<0 then
|
||||
begin
|
||||
if FRealizedDefColWidth <= 0 then
|
||||
FRealizedDefColWidth := MulDiv(DEFCOLWIDTH, Font.PixelsPerInch, 96);
|
||||
FRealizedDefColWidth := Scale96ToFont(DEFCOLWIDTH);
|
||||
Result := FRealizedDefColWidth;
|
||||
end else
|
||||
Result := FDefColWidth;
|
||||
|
@ -764,7 +764,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TControl.ScaleCoord(const ASize: Integer): Integer;
|
||||
function TControl.ScaleDesignToForm(const ASize: Integer): Integer;
|
||||
var
|
||||
ParentForm: TCustomDesignControl;
|
||||
begin
|
||||
@ -772,7 +772,7 @@ begin
|
||||
Result := MulDiv(ASize, ParentForm.PixelsPerInch, ParentForm.DesignTimePPI);
|
||||
end;
|
||||
|
||||
function TControl.ScaleCoord96(const ASize: Integer): Integer;
|
||||
function TControl.Scale96ToForm(const ASize: Integer): Integer;
|
||||
var
|
||||
ParentForm: TCustomDesignControl;
|
||||
begin
|
||||
@ -780,7 +780,7 @@ begin
|
||||
Result := MulDiv(ASize, ParentForm.PixelsPerInch, 96);
|
||||
end;
|
||||
|
||||
function TControl.ScaleCoord96Back(const ASize: Integer): Integer;
|
||||
function TControl.ScaleFormTo96(const ASize: Integer): Integer;
|
||||
var
|
||||
ParentForm: TCustomDesignControl;
|
||||
begin
|
||||
@ -788,7 +788,7 @@ begin
|
||||
Result := MulDiv(ASize, 96, ParentForm.PixelsPerInch);
|
||||
end;
|
||||
|
||||
function TControl.ScaleCoordBack(const ASize: Integer): Integer;
|
||||
function TControl.ScaleFormToDesign(const ASize: Integer): Integer;
|
||||
var
|
||||
ParentForm: TCustomDesignControl;
|
||||
begin
|
||||
@ -796,6 +796,26 @@ begin
|
||||
Result := MulDiv(ASize, ParentForm.DesignTimePPI, ParentForm.PixelsPerInch);
|
||||
end;
|
||||
|
||||
function TControl.Scale96ToFont(const ASize: Integer): Integer;
|
||||
begin
|
||||
Result := MulDiv(ASize, Font.PixelsPerInch, 96);
|
||||
end;
|
||||
|
||||
function TControl.ScaleFontTo96(const ASize: Integer): Integer;
|
||||
begin
|
||||
Result := MulDiv(ASize, 96, Font.PixelsPerInch);
|
||||
end;
|
||||
|
||||
function TControl.ScaleScreenToFont(const ASize: Integer): Integer;
|
||||
begin
|
||||
Result := MulDiv(ASize, Font.PixelsPerInch, Screen.PixelsPerInch);
|
||||
end;
|
||||
|
||||
function TControl.ScaleFontToScreen(const ASize: Integer): Integer;
|
||||
begin
|
||||
Result := MulDiv(ASize, Screen.PixelsPerInch, Font.PixelsPerInch);
|
||||
end;
|
||||
|
||||
procedure TControl.ScaleFontsPPI(const AProportion: Double);
|
||||
begin
|
||||
// Problem: all fonts have to be scaled.
|
||||
|
@ -461,7 +461,7 @@ end;
|
||||
function TToolBar.GetRealButtonHeight: Integer;
|
||||
begin
|
||||
if FButtonHeight = 0 then
|
||||
Result := MulDiv(cDefButtonHeight, Font.PixelsPerInch, 96)
|
||||
Result := Scale96ToFont(cDefButtonHeight)
|
||||
else
|
||||
Result := FButtonHeight;
|
||||
end;
|
||||
@ -469,7 +469,7 @@ end;
|
||||
function TToolBar.GetRealButtonWidth: Integer;
|
||||
begin
|
||||
if FButtonWidth = 0 then
|
||||
Result := MulDiv(cDefButtonWidth, Font.PixelsPerInch, 96)
|
||||
Result := Scale96ToFont(cDefButtonWidth)
|
||||
else
|
||||
Result := FButtonWidth;
|
||||
end;
|
||||
|
@ -4513,15 +4513,15 @@ begin
|
||||
Result := FExpandSignSize
|
||||
else
|
||||
if ExpandSignType = tvestTheme then
|
||||
Result := MulDiv(FThemeExpandSignSize, Font.PixelsPerInch, Screen.PixelsPerInch)
|
||||
Result := ScaleScreenToFont(FThemeExpandSignSize)
|
||||
else
|
||||
Result := MulDiv(DefaultTreeNodeExpandSignSize, Font.PixelsPerInch, 96);
|
||||
Result := Scale96ToFont(DefaultTreeNodeExpandSignSize);
|
||||
end;
|
||||
|
||||
function TCustomTreeView.GetRealIndent: Integer;
|
||||
begin
|
||||
if FIndent=0 then
|
||||
Result := MulDiv(15, Font.PixelsPerInch, 96)
|
||||
Result := Scale96ToFont(15)
|
||||
else
|
||||
Result := FIndent;
|
||||
end;
|
||||
@ -4951,13 +4951,13 @@ var
|
||||
// draw a plus or a minus sign
|
||||
R := Rect(ALeft, ATop, ARight, ABottom);
|
||||
Rectangle(R);
|
||||
MoveTo(R.Left + MulDiv(2, Font.PixelsPerInch, 96), MidY);
|
||||
LineTo(R.Right - MulDiv(2, Font.PixelsPerInch, 96), MidY);
|
||||
MoveTo(R.Left + Scale96ToFont(2), MidY);
|
||||
LineTo(R.Right - Scale96ToFont(2), MidY);
|
||||
if not CollapseSign then
|
||||
begin
|
||||
MoveTo(MidX, R.Top + MulDiv(2, Font.PixelsPerInch, 96));
|
||||
LineTo(MidX, R.Bottom - MulDiv(2, Font.PixelsPerInch, 96));
|
||||
end;
|
||||
MoveTo(MidX, R.Top + Scale96ToFont(2));
|
||||
LineTo(MidX, R.Bottom - Scale96ToFont(2));
|
||||
end;
|
||||
end;
|
||||
tvestArrow,
|
||||
tvestArrowFill:
|
||||
|
Loading…
Reference in New Issue
Block a user