RxFPC:TRxIniPropStorage - fix restore width and height property on different designtime and runtime PPI
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8939 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
		
							parent
							
								
									1d26d4121c
								
							
						
					
					
						commit
						7b24120fa7
					
				@ -111,12 +111,13 @@ function TRxIniPropStorage.DoReadString(const Section, Ident,
 | 
			
		||||
var
 | 
			
		||||
  S: String;
 | 
			
		||||
  ASize: LongInt;
 | 
			
		||||
  ASize1: Integer;
 | 
			
		||||
  ASize1, PP: Integer;
 | 
			
		||||
begin
 | 
			
		||||
  PP:=0;
 | 
			
		||||
  Result := inherited DoReadString(Section, Ident, DefaultValue);
 | 
			
		||||
  {$IfNDef FIX_WIDTH_WIDE_STRING96}
 | 
			
		||||
  S:=UpperCase(Ident);
 | 
			
		||||
  if (Pos('WIDTH', S) > 0) or (Pos('HEIGHT', S) > 0) then
 | 
			
		||||
  if (Pos('_WIDTH', S) > 0) or (Pos('_HEIGHT', S) > 0) then
 | 
			
		||||
  begin
 | 
			
		||||
    if Assigned(Screen) then
 | 
			
		||||
    begin
 | 
			
		||||
@ -125,8 +126,15 @@ begin
 | 
			
		||||
      begin
 | 
			
		||||
        //ASize1 := MulDiv(ASize, Screen.PixelsPerInch, 96);
 | 
			
		||||
        if Screen.PixelsPerInch <> 0 then
 | 
			
		||||
          ASize1 := MulDiv(ASize, 96, Screen.PixelsPerInch);
 | 
			
		||||
        Result := IntToStr(ASize1);
 | 
			
		||||
        begin
 | 
			
		||||
          if Owner is TForm then
 | 
			
		||||
            PP:=TForm(Owner).DesignTimePPI;
 | 
			
		||||
          if PP>0 then
 | 
			
		||||
          begin
 | 
			
		||||
            ASize1 := MulDiv(ASize, PP, Screen.PixelsPerInch);
 | 
			
		||||
            Result := IntToStr(ASize1);
 | 
			
		||||
          end;
 | 
			
		||||
        end;
 | 
			
		||||
      end;
 | 
			
		||||
    end;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
@ -3784,6 +3784,7 @@ var
 | 
			
		||||
  i: integer;
 | 
			
		||||
  S, S1: string;
 | 
			
		||||
  C: TRxColumn;
 | 
			
		||||
  SF: TCaption;
 | 
			
		||||
begin
 | 
			
		||||
  S := Owner.Name + '.' + Name;
 | 
			
		||||
  FPropertyStorageLink.Storage.WriteInteger(S + sVersion, FVersion);
 | 
			
		||||
@ -3793,8 +3794,8 @@ begin
 | 
			
		||||
  begin
 | 
			
		||||
    S1 := S + IntToStr(i);
 | 
			
		||||
    C := TRxColumn(Columns[i]);
 | 
			
		||||
    FPropertyStorageLink.Storage.WriteString(S1 + sCaption,
 | 
			
		||||
      StrToHexText(C.Title.Caption));
 | 
			
		||||
    SF:=StrToHexText(C.Title.Caption);
 | 
			
		||||
    FPropertyStorageLink.Storage.WriteString(S1 + sCaption, SF);
 | 
			
		||||
    //FPropertyStorageLink.Storage.WriteInteger(S1 + sWidth, C.Width);
 | 
			
		||||
    FPropertyStorageLink.Storage.WriteInteger(S1 + sWidth, C.StoredWidth);
 | 
			
		||||
    FPropertyStorageLink.Storage.WriteInteger(S1 + sIndex, C.Index);
 | 
			
		||||
@ -3817,7 +3818,7 @@ end;
 | 
			
		||||
procedure TRxDBGrid.OnIniLoad(Sender: TObject);
 | 
			
		||||
var
 | 
			
		||||
  i, ACount: integer;
 | 
			
		||||
  S, S1, ColumName: string;
 | 
			
		||||
  S, S1, ColumName, SF: string;
 | 
			
		||||
  C: TRxColumn;
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
@ -3831,8 +3832,8 @@ begin
 | 
			
		||||
    for i := 0 to ACount - 1 do
 | 
			
		||||
    begin
 | 
			
		||||
      S1 := S + IntToStr(i);
 | 
			
		||||
      ColumName := HexTextToStr(FPropertyStorageLink.Storage.ReadString(S1 +
 | 
			
		||||
        sCaption, ''));
 | 
			
		||||
      SF:=FPropertyStorageLink.Storage.ReadString(S1 + sCaption, '');
 | 
			
		||||
      ColumName := HexTextToStr(SF);
 | 
			
		||||
      if ColumName <> '' then
 | 
			
		||||
      begin
 | 
			
		||||
        C := ColumnByCaption(ColumName);
 | 
			
		||||
 | 
			
		||||
@ -259,7 +259,7 @@ const
 | 
			
		||||
  sCount        = '.Count';
 | 
			
		||||
  sVisible      = '.Visible';
 | 
			
		||||
  sItem         = '.Item';
 | 
			
		||||
  sWidth        = '.Width';
 | 
			
		||||
  sWidth        = '_Width';
 | 
			
		||||
//  sTop          = '.Top';
 | 
			
		||||
  sVersion      = '.Version';
 | 
			
		||||
  sVersion2     = '.Version2';
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user