mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 08:17:25 +01:00
lcl, ide: set correct DesignTimePPI when creating a new form. Issue #31082
git-svn-id: trunk@53598 -
This commit is contained in:
parent
1b67af9431
commit
2d1d913087
@ -4773,6 +4773,11 @@ begin
|
||||
TControl(NewComponent).Caption:=NewComponent.Name;
|
||||
NewUnitInfo.Component := NewComponent;
|
||||
MainIDE.CreateDesignerForComponent(NewUnitInfo,NewComponent);
|
||||
if NewComponent is TCustomDesignControl then
|
||||
begin
|
||||
TCustomDesignControl(NewComponent).DesignTimePPI := Screen.PixelsPerInch;
|
||||
TCustomDesignControl(NewComponent).PixelsPerInch := Screen.PixelsPerInch;
|
||||
end;
|
||||
|
||||
NewUnitInfo.ComponentName:=NewComponent.Name;
|
||||
NewUnitInfo.ComponentResourceName:=NewUnitInfo.ComponentName;
|
||||
@ -6168,9 +6173,6 @@ begin
|
||||
Result:=LoadLFM(AnUnitInfo,LFMBuf,OpenFlags,CloseFlags);
|
||||
end;
|
||||
|
||||
type
|
||||
TAccessCustomDesignControl = class(TCustomDesignControl);
|
||||
|
||||
function TLazSourceFileManager.LoadLFM(AnUnitInfo: TUnitInfo; LFMBuf: TCodeBuffer;
|
||||
OpenFlags: TOpenFlags; CloseFlags: TCloseFlags): TModalResult;
|
||||
const
|
||||
@ -6385,7 +6387,7 @@ begin
|
||||
if DsgControl.DesignTimePPI<>Screen.PixelsPerInch then
|
||||
begin
|
||||
DsgControl.AutoAdjustLayout(lapAutoAdjustForDPI, DsgControl.DesignTimePPI, Screen.PixelsPerInch, 0, 0, False);
|
||||
TAccessCustomDesignControl(DsgControl).FDesignTimePPI := Screen.PixelsPerInch;
|
||||
DsgControl.DesignTimePPI := Screen.PixelsPerInch;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -31,8 +31,13 @@ end;
|
||||
|
||||
procedure TCustomDesignControl.SetDesignTimePPI(const ADesignTimePPI: Integer);
|
||||
begin
|
||||
if FDesignTimePPI=ADesignTimePPI then
|
||||
Exit;
|
||||
|
||||
if (csLoading in ComponentState) // allow setting only when loading
|
||||
or not (csDesigning in ComponentState) then // or in runtime (the programmer has to know why he is doing that)
|
||||
or not (csDesigning in ComponentState) // or in runtime (the programmer has to know why he is doing that)
|
||||
or ((csDesigning in ComponentState) and (ADesignTimePPI=Screen.PixelsPerInch)) // or in designtime when setting the correct value
|
||||
then
|
||||
FDesignTimePPI := ADesignTimePPI
|
||||
else
|
||||
raise EInvalidOperation.Create(sCannotSetDesignTimePPI);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user