IDE: new designer option: Force DPI scaling in design-time

git-svn-id: trunk@56975 -
This commit is contained in:
ondrej 2018-01-06 01:53:01 +00:00
parent 3da6552057
commit 09de874143
5 changed files with 38 additions and 8 deletions

View File

@ -501,6 +501,7 @@ type
FRubberbandSelectsGrandChilds: boolean;
FCheckPackagesOnFormCreate: boolean;
FFormTitleBarChangesObjectInspector: boolean;
FForceDPIScalingInDesignTime: boolean;
// object inspector
FObjectInspectorOptions: TOIOptions;
@ -755,6 +756,8 @@ type
write FSwitchToFavoritesOITab;
property FormTitleBarChangesObjectInspector: boolean read FFormTitleBarChangesObjectInspector
write FFormTitleBarChangesObjectInspector;
property ForceDPIScalingInDesignTime: boolean read FForceDPIScalingInDesignTime
write FForceDPIScalingInDesignTime;
// object inspector
property ObjectInspectorOptions: TOIOptions read FObjectInspectorOptions;
@ -1629,6 +1632,7 @@ begin
FCreateComponentFocusNameProperty:=false;
FSwitchToFavoritesOITab:=false;
FFormTitleBarChangesObjectInspector:=false;
FForceDPIScalingInDesignTime:=true;
// object inspector
FObjectInspectorOptions:=TOIOptions.Create;
@ -2071,6 +2075,7 @@ begin
Path+'FormEditor/CreateComponentFocusNameProperty/Value',false);
FSwitchToFavoritesOITab:=FXMLCfg.GetValue(Path+'FormEditor/SwitchToFavoritesOITab/Value',false);
FFormTitleBarChangesObjectInspector:=FXMLCfg.GetValue(Path+'FormEditor/FormTitleBarChangesObjectInspector/Value',false);
FForceDPIScalingInDesignTime:=FXMLCfg.GetValue(Path+'FormEditor/ForceDPIScalingInDesignTime/Value',true);
if not OnlyDesktop then
LoadNonDesktop(Path);
@ -2418,6 +2423,7 @@ begin
FCreateComponentFocusNameProperty,false);
FXMLCfg.SetDeleteValue(Path+'FormEditor/SwitchToFavoritesOITab/Value',FSwitchToFavoritesOITab,false);
FXMLCfg.SetDeleteValue(Path+'FormEditor/FormTitleBarChangesObjectInspector/Value',FFormTitleBarChangesObjectInspector,false);
FXMLCfg.SetDeleteValue(Path+'FormEditor/ForceDPIScalingInDesignTime/Value',FForceDPIScalingInDesignTime,true);
FXMLCfg.SetDeleteValue(Path+'ShowCompileDialog/Value',FShowCompileDialog,False);
FXMLCfg.SetDeleteValue(Path+'AutoCloseCompileDialog/Value',FAutoCloseCompileDialog,False);

View File

@ -142,14 +142,14 @@ object FormEditorOptionsFrame: TFormEditorOptionsFrame
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 205
Height = 250
Top = 238
Width = 769
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
Caption = 'FormEditMiscGroupBox'
ClientHeight = 185
ClientHeight = 230
ClientWidth = 765
TabOrder = 3
object ShowComponentCaptionsCheckBox: TCheckBox
@ -312,18 +312,34 @@ object FormEditorOptionsFrame: TFormEditorOptionsFrame
AnchorSideBottom.Control = FormEditMiscGroupBox
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 17
Top = 166
Width = 247
Anchors = [akTop, akLeft, akBottom]
Height = 19
Top = 182
Width = 270
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Bottom = 6
BorderSpacing.Bottom = 3
Caption = 'FormTitleBarChangesObjectInspectorCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 9
end
object ForceDPIScalingInDesignTimeCheckBox: TCheckBox
AnchorSideLeft.Control = FormEditMiscGroupBox
AnchorSideTop.Control = FormTitleBarChangesObjectInspectorCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 19
Top = 204
Width = 230
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Bottom = 6
Caption = 'ForceDPIScalingInDesignTimeCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 10
end
end
object GuideLinesGroupBox: TGroupBox
AnchorSideLeft.Control = DesignerColorsGroupBox

View File

@ -43,6 +43,7 @@ type
TFormEditorOptionsFrame = class(TAbstractIDEOptionsEditor)
FormTitleBarChangesObjectInspectorCheckBox: TCheckBox;
ForceDPIScalingInDesignTimeCheckBox: TCheckBox;
SwitchToFavoritesOITabCheckBox:TCheckBox;
CheckPackagesOnFormCreateCheckBox: TCheckBox;
OpenDesignerOnOpenUnitCheckBox: TCheckBox;
@ -139,6 +140,8 @@ procedure TFormEditorOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
CheckPackagesOnFormCreateCheckBox.Hint:=dlgCheckPackagesOnFormCreateHint;
FormTitleBarChangesObjectInspectorCheckBox.Caption:=dlgFormTitleBarChangesObjectInspector;
FormTitleBarChangesObjectInspectorCheckBox.Hint:=dlgFormTitleBarChangesObjectInspectorHint;
ForceDPIScalingInDesignTimeCheckBox.Caption:=dlgForceDPIScalingInDesignTime;
ForceDPIScalingInDesignTimeCheckBox.Hint:=dlgForceDPIScalingInDesignTimeHint;
end;
begin
GridGroupBox.Caption := dlgEnvGrid;
@ -182,6 +185,7 @@ begin
SwitchToFavoritesOITabCheckBox.Checked := SwitchToFavoritesOITab;
SwitchToFavoritesOITabCheckBox.Enabled := CreateCompFocusNameCheckBox.Checked;
FormTitleBarChangesObjectInspectorCheckBox.Checked := FormTitleBarChangesObjectInspector;
ForceDPIScalingInDesignTimeCheckBox.Checked := ForceDPIScalingInDesignTime;
end;
FLoaded := True;
end;
@ -216,6 +220,7 @@ begin
CreateComponentFocusNameProperty := CreateCompFocusNameCheckBox.Checked;
SwitchToFavoritesOITab := SwitchToFavoritesOITabCheckBox.Checked;
FormTitleBarChangesObjectInspector := FormTitleBarChangesObjectInspectorCheckBox.Checked;
ForceDPIScalingInDesignTime := ForceDPIScalingInDesignTimeCheckBox.Checked;
end;
end;

View File

@ -1482,6 +1482,8 @@ resourcestring
dlgFormTitleBarChangesObjectInspector = 'Change Object Inspector contents on clicking form title bar';
dlgFormTitleBarChangesObjectInspectorHint = 'Show a form''s properties in Object Inspector '
+'by clicking on its title bar.';
dlgForceDPIScalingInDesignTime = 'Force DPI scaling in design-time';
dlgForceDPIScalingInDesignTimeHint = 'When checked the project scaling settings will be ignored - only the form/frame/datamodule Scaled property will be taken into account.';
dlgEnvGrid = 'Grid';
dlgEnvLGuideLines = 'Guide lines';

View File

@ -6508,7 +6508,8 @@ begin
if NewComponent is TCustomDesignControl then
begin
DsgControl := TCustomDesignControl(NewComponent);
if Project1.Scaled and DsgControl.Scaled and (DsgControl.DesignTimePPI<>Screen.PixelsPerInch) then
if (Project1.Scaled or EnvironmentOptions.ForceDPIScalingInDesignTime)
and DsgControl.Scaled and (DsgControl.DesignTimePPI<>Screen.PixelsPerInch) then
begin
DsgControl.AutoAdjustLayout(lapAutoAdjustForDPI, DsgControl.DesignTimePPI, Screen.PixelsPerInch, 0, 0);
DesignerProcs.ScaleNonVisual(DsgControl, DsgControl.DesignTimePPI, Screen.PixelsPerInch);