Changeset 129 for trunk/Packages/Common


Ignore:
Timestamp:
Jan 17, 2022, 10:11:05 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Eliminated compilation hints from Common package.
Location:
trunk/Packages/Common
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Common.lpk

    r122 r129  
    11<?xml version="1.0" encoding="UTF-8"?>
    22<CONFIG>
    3   <Package Version="4">
     3  <Package Version="5">
    44    <PathDelim Value="\"/>
    55    <Name Value="Common"/>
     
    3333      <Other>
    3434        <CompilerMessages>
    35           <IgnoredMessages idx5024="True"/>
     35          <IgnoredMessages idx6058="True" idx5024="True" idx3124="True" idx3123="True"/>
    3636        </CompilerMessages>
    3737      </Other>
     
    172172      </Item29>
    173173    </Files>
     174    <CompatibilityMode Value="True"/>
    174175    <i18n>
    175176      <EnableI18N Value="True"/>
  • trunk/Packages/Common/UAboutDialog.pas

    r122 r129  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    9   StdCtrls, ExtCtrls, UApplicationInfo, UCommon, UTranslator, UTheme, UFormAbout;
     9  ExtCtrls, UApplicationInfo, UCommon, UTranslator, UTheme, UFormAbout;
    1010
    1111type
  • trunk/Packages/Common/UCommon.pas

    r122 r129  
    66
    77uses
    8   {$ifdef Windows}Windows,{$endif}
    9   {$ifdef Linux}baseunix,{$endif}
     8  {$IFDEF WINDOWS}Windows,{$ENDIF}
     9  {$IFDEF UNIX}baseunix,{$ENDIF}
    1010  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf,
    1111  FileUtil; //, ShFolder, ShellAPI;
     
    3535  DLLHandle1: HModule;
    3636
    37 {$IFDEF Windows}
     37{$IFDEF WINDOWS}
    3838  GetUserNameEx: procedure (NameFormat: DWORD;
    3939    lpNameBuffer: LPSTR; nSize: PULONG); stdcall;
     
    292292function Explode(Separator: char; Data: string): TArrayOfString;
    293293begin
     294  Result := nil;
    294295  SetLength(Result, 0);
    295296  while Pos(Separator, Data) > 0 do begin
     
    346347  Name: UtsName;
    347348begin
     349  Name := Default(UtsName);
    348350  fpuname(Name);
    349351  Result := Name.Nodename;
     
    505507  I: Integer;
    506508begin
     509  Result := Default(TArrayOfString);
    507510  SetLength(Result, Length(A) + Length(B));
    508511  for I := 0 to Length(A) - 1 do
  • trunk/Packages/Common/UFindFile.pas

    r93 r129  
    5959  FilterAll = '*.*';
    6060{$ENDIF}
    61 {$IFDEF LINUX}
     61{$IFDEF UNIX}
    6262  FilterAll = '*';
    6363{$ENDIF}
  • trunk/Packages/Common/UGeometric.pas

    r116 r129  
    9696  I: Integer;
    9797begin
     98  Result := Default(TPointArray);
    9899  SetLength(Result, Length(P));
    99100  for I := 0 to High(P) do
  • trunk/Packages/Common/UMetaCanvas.pas

    r116 r129  
    142142    procedure RoundRect(const Rect: TRect; RX,RY: Integer); overload;
    143143    procedure TextOut(X,Y: Integer; const Text: String); override;
    144     procedure Polygon(Points: PPoint; NumPts: Integer; Winding: boolean = False); override;
     144    procedure Polygon(Points: PPoint; NumPts: Integer; Winding: Boolean = False); override;
    145145    procedure Ellipse(x1, y1, x2, y2: Integer); override;
    146146    procedure StretchDraw(const DestRect: TRect; SrcGraphic: TGraphic); override;
     
    502502end;
    503503
    504 procedure TMetaCanvas.Polygon(Points: PPoint; NumPts: Integer; Winding: boolean
     504procedure TMetaCanvas.Polygon(Points: PPoint; NumPts: Integer; Winding: Boolean
    505505  );
    506506var
     
    508508  I: Integer;
    509509begin
     510  APoints := nil;
    510511  SetLength(APoints, NumPts);
    511512  for I := 0 to High(APoints) do
  • trunk/Packages/Common/URegistry.pas

    r115 r129  
    132132function TRegistryEx.OpenKey(const Key: string; CanCreate: Boolean): Boolean;
    133133begin
    134   {$IFDEF Linux}
     134  {$IFDEF UNIX}
    135135  //CloseKey;
    136136  {$ENDIF}
     
    140140function TRegistryEx.GetCurrentContext: TRegistryContext;
    141141begin
    142   Result.Key := CurrentPath;
     142  Result.Key := String(CurrentPath);
    143143  Result.RootKey := RootKey;
    144144end;
  • trunk/Packages/Common/UScaleDPI.pas

    r116 r129  
    88
    99uses
    10   Classes, Forms, Graphics, Controls, ComCtrls, LCLType, SysUtils, StdCtrls,
    11   Contnrs;
     10  Classes, Forms, Graphics, Controls, ComCtrls, LCLType, SysUtils, fgl;
    1211
    1312type
     13  TControlDimensions = class;
    1414
    1515  { TControlDimension }
     
    1818    BoundsRect: TRect;
    1919    FontHeight: Integer;
    20     Controls: TObjectList; // TList<TControlDimension>
     20    Controls: TControlDimensions;
    2121    // Class specifics
    2222    ButtonSize: TPoint; // TToolBar
     
    2626    constructor Create;
    2727    destructor Destroy; override;
     28  end;
     29
     30  TControlDimensions = class(TFPGObjectList<TControlDimension>)
    2831  end;
    2932
     
    7376constructor TControlDimension.Create;
    7477begin
    75   Controls := TObjectList.Create;
     78  Controls := TControlDimensions.Create;
    7679end;
    7780
     
    7982begin
    8083  FreeAndNil(Controls);
    81   inherited Destroy;
     84  inherited;
    8285end;
    8386
     
    212215  TempBmp: TBitmap;
    213216  Temp: array of TBitmap;
    214   NewWidth, NewHeight: integer;
     217  NewWidth: Integer;
     218  NewHeight: Integer;
    215219  I: Integer;
    216220begin
    217221  ImgList.BeginUpdate;
    218   NewWidth := ScaleX(ImgList.Width, FromDPI.X);
    219   NewHeight := ScaleY(ImgList.Height, FromDPI.Y);
    220 
    221   SetLength(Temp, ImgList.Count);
    222   for I := 0 to ImgList.Count - 1 do
    223   begin
    224     TempBmp := TBitmap.Create;
    225     TempBmp.PixelFormat := pf32bit;
    226     ImgList.GetBitmap(I, TempBmp);
    227     Temp[I] := TBitmap.Create;
    228     Temp[I].SetSize(NewWidth, NewHeight);
    229     {$IFDEF Linux}
    230     Temp[I].PixelFormat := pf24bit;
    231     {$ELSE}
    232     Temp[I].PixelFormat := pf32bit;
    233     {$ENDIF}
    234     Temp[I].TransparentColor := TempBmp.TransparentColor;
    235     //Temp[I].TransparentMode := TempBmp.TransparentMode;
    236     Temp[I].Transparent := True;
    237     Temp[I].Canvas.Brush.Style := bsSolid;
    238     Temp[I].Canvas.Brush.Color := Temp[I].TransparentColor;
    239     Temp[I].Canvas.FillRect(0, 0, Temp[I].Width, Temp[I].Height);
    240 
    241     if (Temp[I].Width = 0) or (Temp[I].Height = 0) then Continue;
    242     Temp[I].Canvas.StretchDraw(Rect(0, 0, Temp[I].Width, Temp[I].Height), TempBmp);
    243     TempBmp.Free;
    244   end;
    245 
    246   ImgList.Clear;
    247   ImgList.Width := NewWidth;
    248   ImgList.Height := NewHeight;
    249 
    250   for I := 0 to High(Temp) do
    251   begin
    252     ImgList.Add(Temp[I], nil);
    253     Temp[i].Free;
    254   end;
    255   ImgList.EndUpdate;
     222  try
     223    NewWidth := ScaleX(ImgList.Width, FromDPI.X);
     224    NewHeight := ScaleY(ImgList.Height, FromDPI.Y);
     225
     226    Temp := nil;
     227    SetLength(Temp, ImgList.Count);
     228    for I := 0 to ImgList.Count - 1 do
     229    begin
     230      TempBmp := TBitmap.Create;
     231      try
     232        TempBmp.PixelFormat := pf32bit;
     233        ImgList.GetBitmap(I, TempBmp);
     234        Temp[I] := TBitmap.Create;
     235        Temp[I].SetSize(NewWidth, NewHeight);
     236        {$IFDEF UNIX}
     237        Temp[I].PixelFormat := pf24bit;
     238        {$ELSE}
     239        Temp[I].PixelFormat := pf32bit;
     240        {$ENDIF}
     241        Temp[I].TransparentColor := TempBmp.TransparentColor;
     242        //Temp[I].TransparentMode := TempBmp.TransparentMode;
     243        Temp[I].Transparent := True;
     244        Temp[I].Canvas.Brush.Style := bsSolid;
     245        Temp[I].Canvas.Brush.Color := Temp[I].TransparentColor;
     246        Temp[I].Canvas.FillRect(0, 0, Temp[I].Width, Temp[I].Height);
     247
     248        if (Temp[I].Width = 0) or (Temp[I].Height = 0) then Continue;
     249        Temp[I].Canvas.StretchDraw(Rect(0, 0, Temp[I].Width, Temp[I].Height), TempBmp);
     250      finally
     251        TempBmp.Free;
     252      end;
     253    end;
     254
     255    ImgList.Clear;
     256    ImgList.Width := NewWidth;
     257    ImgList.Height := NewHeight;
     258
     259    for I := 0 to High(Temp) do
     260    begin
     261      ImgList.Add(Temp[I], nil);
     262      Temp[i].Free;
     263    end;
     264  finally
     265    ImgList.EndUpdate;
     266  end;
    256267end;
    257268
     
    331342  with TCoolBar(Control) do begin
    332343    BeginUpdate;
    333     for I := 0 to Bands.Count - 1 do
    334       with Bands[I] do begin
    335         MinWidth := ScaleX(MinWidth, FromDPI.X);
    336         MinHeight := ScaleY(MinHeight, FromDPI.Y);
    337         // Workaround to bad band width auto sizing
    338         //Width := ScaleX(Width, FromDPI.X);
    339         Width := ScaleX(Control.Width + 28, FromDPI.X);
    340         //Control.Invalidate;
     344    try
     345      for I := 0 to Bands.Count - 1 do
     346        with Bands[I] do begin
     347          MinWidth := ScaleX(MinWidth, FromDPI.X);
     348          MinHeight := ScaleY(MinHeight, FromDPI.Y);
     349          // Workaround to bad band width auto sizing
     350          //Width := ScaleX(Width, FromDPI.X);
     351          Width := ScaleX(Control.Width + 28, FromDPI.X);
     352          //Control.Invalidate;
     353        end;
     354      // Workaround for bad autosizing of coolbar
     355      if AutoSize then begin
     356        AutoSize := False;
     357        Height := ScaleY(Height, FromDPI.Y);
     358        AutoSize := True;
    341359      end;
    342     // Workaround for bad autosizing of coolbar
    343     if AutoSize then begin
    344       AutoSize := False;
    345       Height := ScaleY(Height, FromDPI.Y);
    346       AutoSize := True;
    347     end;
    348     EndUpdate;
     360    finally
     361      EndUpdate;
     362    end;
    349363  end;
    350364
Note: See TracChangeset for help on using the changeset viewer.