View Issue Details

IDProjectCategoryView StatusLast Update
0031813FPCRTLpublic2017-05-20 08:29
ReporterOndrej Pokorny Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.1.1 
Target Version3.0.4Fixed in Version3.1.1 
Summary0031813: [Patch] Make TDataModule DPI-aware
DescriptionI added High-DPI support to Lazarus IDE 1.7/1.8. All components are scaled according to the current DPI settings both in design-time and run-time.

All non-visual components have to be scaled in design-time as well. For it I need a new property in TDataModule - the current DPI settings must be stored within the LFM so that scaling works fine.

Please review the attached patch. It would be great if you merged it to 3.0 fixes branch so that Lazarus 1.8.x could scale data modules correctly when FPC 3.0.4 is released.
Additional InformationRevision in Lazarus that adds support for this patch: 54932. You have build Lazarus with DataModulePPI define. See ide/sourcefilemanager.pas, search for "{$IFDEF DataModulePPI}".
TagsNo tags attached.
Fixed in Revision36212
FPCOldBugId
FPCTarget
Attached Files

Activities

Ondrej Pokorny

2017-05-14 22:10

developer  

datamodule-ppi-1.patch (2,603 bytes)   
Index: rtl/objpas/classes/classesh.inc
===================================================================
--- rtl/objpas/classes/classesh.inc	(revision 36114)
+++ rtl/objpas/classes/classesh.inc	(working copy)
@@ -2026,9 +2026,12 @@
   private
     FDPos: TPoint;
     FDSize: TPoint;
+    FDPPI: Integer;
     FOnCreate: TNotifyEvent;
     FOnDestroy: TNotifyEvent;
     FOldOrder : Boolean;
+    Procedure ReadP(Reader: TReader);
+    Procedure WriteP(Writer: TWriter);
     Procedure ReadT(Reader: TReader);
     Procedure WriteT(Writer: TWriter);
     Procedure ReadL(Reader: TReader);
@@ -2053,6 +2056,7 @@
     Procedure BeforeDestruction; override;
     property DesignOffset: TPoint read FDPos write FDPos;
     property DesignSize: TPoint read FDSize write FDSize;
+    property DesignPPI: Integer read FDPPI write FDPPI;
   published
     property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
     property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
Index: rtl/objpas/classes/dm.inc
===================================================================
--- rtl/objpas/classes/dm.inc	(revision 36114)
+++ rtl/objpas/classes/dm.inc	(working copy)
@@ -35,6 +35,7 @@
 constructor TDataModule.CreateNew(AOwner: TComponent; CreateMode: Integer);
 begin
   inherited Create(AOwner);
+  FDPPI := 96;
   if Assigned(AddDataModule) and (CreateMode>=0) then
     AddDataModule(Self);
 end;
@@ -97,11 +98,13 @@
             (FDSize.X<>Ancestor.FDSize.X) or
             (FDSize.Y<>Ancestor.FDSize.Y) or
             (FDPos.Y<>Ancestor.FDPos.Y) or
-            (FDPos.X<>Ancestor.FDPos.X);
+            (FDPos.X<>Ancestor.FDPos.X) or
+            (FDPPI<>Ancestor.FDPPI);
   Filer.DefineProperty('Height', @ReadH, @WriteH, HaveData);
   Filer.DefineProperty('HorizontalOffset', @ReadL, @WriteL, HaveData);
   Filer.DefineProperty('VerticalOffset', @ReadT,@WriteT, HaveData);
   Filer.DefineProperty('Width', @ReadW, @WriteW, HaveData);
+  Filer.DefineProperty('PPI', @ReadP, @WriteP, HaveData);
 end;
 
 procedure TDataModule.GetChildren(Proc: TGetChildProc; Root: TComponent);
@@ -125,6 +128,11 @@
     ApplicationHandleException(Self);
 end;
 
+Procedure TDataModule.ReadP(Reader: TReader);
+begin
+  FDPPI := Reader.ReadInteger;
+end;
+
 Procedure TDataModule.ReadState(Reader: TReader);
 begin
   FOldOrder := false;
@@ -156,6 +164,11 @@
   FDSIze.X := Reader.ReadInteger;
 end;
 
+Procedure TDataModule.WriteP(Writer: TWriter);
+begin
+  Writer.WriteInteger(FDPPI);
+end;
+
 Procedure TDataModule.WriteW(Writer: TWriter);
 begin
   Writer.WriteInteger(FDSIze.X);
datamodule-ppi-1.patch (2,603 bytes)   

Michael Van Canneyt

2017-05-15 09:16

administrator   ~0100313

Checked and applied, thanks for the patch!

Ondrej Pokorny

2017-05-20 07:32

developer   ~0100524

Just a question:

Do you plan it to merge to 3.0 fixes? And if yes, could you please merge it?

Otherwise Lazarus will have to wait with datamodule scaling for FPC 3.2.0.

Michael Van Canneyt

2017-05-20 08:13

administrator   ~0100527

merged in revision 36272.

Ondrej Pokorny

2017-05-20 08:29

developer   ~0100528

Great, thank you!

Issue History

Date Modified Username Field Change
2017-05-14 22:10 Ondrej Pokorny New Issue
2017-05-14 22:10 Ondrej Pokorny File Added: datamodule-ppi-1.patch
2017-05-15 09:16 Michael Van Canneyt Fixed in Revision => 36212
2017-05-15 09:16 Michael Van Canneyt Note Added: 0100313
2017-05-15 09:16 Michael Van Canneyt Status new => resolved
2017-05-15 09:16 Michael Van Canneyt Fixed in Version => 3.1.1
2017-05-15 09:16 Michael Van Canneyt Resolution open => fixed
2017-05-15 09:16 Michael Van Canneyt Assigned To => Michael Van Canneyt
2017-05-15 09:16 Michael Van Canneyt Target Version => 3.0.4
2017-05-20 07:32 Ondrej Pokorny Note Added: 0100524
2017-05-20 07:32 Ondrej Pokorny Status resolved => feedback
2017-05-20 07:32 Ondrej Pokorny Resolution fixed => reopened
2017-05-20 08:13 Michael Van Canneyt Note Added: 0100527
2017-05-20 08:13 Michael Van Canneyt Status feedback => resolved
2017-05-20 08:13 Michael Van Canneyt Resolution reopened => fixed
2017-05-20 08:29 Ondrej Pokorny Note Added: 0100528
2017-05-20 08:29 Ondrej Pokorny Status resolved => closed