From 4a326db8b233b275b33da67c2cb853241767e8c5 Mon Sep 17 00:00:00 2001 From: alexs75 Date: Fri, 30 Mar 2018 08:50:27 +0000 Subject: [PATCH] RxFPC:temp fix save property WIDTH and HEGHT on screen with PPI<>96 git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6282 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/rx/trunk/rx.inc | 1 + .../rx/trunk/rxcontrols/rxinipropstorage.pas | 26 ++++++++++++++++++- components/rx/trunk/rxdb/rxdbgrid.pas | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/components/rx/trunk/rx.inc b/components/rx/trunk/rx.inc index 744d7f215..3774703cb 100644 --- a/components/rx/trunk/rx.inc +++ b/components/rx/trunk/rx.inc @@ -60,3 +60,4 @@ {.$DEFINE OLD_fpSPREADSHEET} {.$DEFINE DEVELOPER_RX} +{$DEFINE FIX_WIDTH_WIDE_STRING96} diff --git a/components/rx/trunk/rxcontrols/rxinipropstorage.pas b/components/rx/trunk/rxcontrols/rxinipropstorage.pas index 67741a3bf..d5e130a41 100644 --- a/components/rx/trunk/rxcontrols/rxinipropstorage.pas +++ b/components/rx/trunk/rxcontrols/rxinipropstorage.pas @@ -47,6 +47,7 @@ type FSeparateFiles: boolean; protected function GetIniFileName: string; override; + procedure FinishPropertyList(List: TStrings); override; public procedure StorageNeeded(ReadOnly: Boolean); override; { Public declarations } @@ -55,7 +56,7 @@ type end; implementation -uses rxapputils, LazUTF8, FileUtil, LazFileUtils, IniFiles; +uses rxapputils, LazUTF8, FileUtil, LazFileUtils, IniFiles, StrUtils; { TRxIniPropStorage } @@ -81,6 +82,29 @@ begin Result:=UTF8ToSys(Result); end; +procedure TRxIniPropStorage.FinishPropertyList(List: TStrings); +{$IFDEF FIX_WIDTH_WIDE_STRING96} +var + S: String; + i: Integer; + K: SizeInt; +{$ENDIF FIX_WIDTH_WIDE_STRING96} +begin + {$IFDEF FIX_WIDTH_WIDE_STRING96} + if Screen.PixelsPerInch<>96 then + for i:=List.Count-1 downto 0 do + begin + S:=UpperCase(List[I]); + K:=Pos('.', S); + if K > 0 then + Delete(S, 1, K); + if (S = 'WIDTH') or (S='HEIGHT') then + List.Delete(i); + end; + {$ENDIF FIX_WIDTH_WIDE_STRING96} + inherited FinishPropertyList(List); +end; + procedure TRxIniPropStorage.StorageNeeded(ReadOnly: Boolean); var F: Boolean; diff --git a/components/rx/trunk/rxdb/rxdbgrid.pas b/components/rx/trunk/rxdb/rxdbgrid.pas index b162497cc..faf6fb189 100644 --- a/components/rx/trunk/rxdb/rxdbgrid.pas +++ b/components/rx/trunk/rxdb/rxdbgrid.pas @@ -3781,6 +3781,9 @@ begin C := ColumnByCaption(ColumName); if Assigned(C) then begin +{$IFDEF FIX_WIDTH_WIDE_STRING96} + if Screen.PixelsPerInch = 96 then +{$ENDIF} C.Width := FPropertyStorageLink.Storage.ReadInteger(S1 + sWidth, C.Width); C.Visible := FPropertyStorageLink.Storage.ReadInteger(S1 + sVisible, Ord(C.Visible)) = 1; C.Index := Min(FPropertyStorageLink.Storage.ReadInteger(S1 + sIndex, C.Index), Columns.Count - 1);