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