Changeset 558


Ignore:
Timestamp:
Apr 25, 2022, 6:32:09 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Updated Common package to version 0.10.
Location:
Common
Files:
2 deleted
30 edited

Legend:

Unmodified
Added
Removed
  • Common/Common.lpk

    r555 r558  
    3333      <Other>
    3434        <CompilerMessages>
    35           <IgnoredMessages idx6058="True" idx5024="True" idx3124="True" idx3123="True"/>
     35          <IgnoredMessages idx6058="True" idx5071="True" idx5024="True" idx3124="True" idx3123="True"/>
    3636        </CompilerMessages>
    3737      </Other>
     
    4141Source: https://svn.zdechov.net/PascalClassLibrary/Common/"/>
    4242    <License Value="Copy left."/>
    43     <Version Minor="9"/>
     43    <Version Minor="10"/>
    4444    <Files Count="29">
    4545      <Item1>
  • Common/StopWatch.pas

    r393 r558  
    55
    66uses
    7   {$IFDEF Windows}Windows,{$ENDIF}
     7  {$IFDEF WINDOWS}Windows,{$ENDIF}
    88  SysUtils, DateUtils;
    99
     
    3232  end;
    3333
     34
    3435implementation
    3536
     
    4041  fIsRunning := False;
    4142
    42   {$IFDEF Windows}
     43  {$IFDEF WINDOWS}
    4344  fIsHighResolution := QueryPerformanceFrequency(fFrequency) ;
    4445  {$ELSE}
  • Common/UAboutDialog.pas

    r555 r558  
    11unit UAboutDialog;
    2 
    3 {$mode delphi}
    42
    53interface
  • Common/UApplicationInfo.pas

    r548 r558  
    11unit UApplicationInfo;
    2 
    3 {$mode delphi}
    42
    53interface
     
    5957procedure Register;
    6058
     59
    6160implementation
    6261
  • Common/UCommon.pas

    r557 r558  
    11unit UCommon;
    2 
    3 {$mode delphi}
    42
    53interface
     
    86  {$IFDEF WINDOWS}Windows,{$ENDIF}
    97  {$IFDEF UNIX}baseunix,{$ENDIF}
    10   Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf,
     8  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, Graphics,
    119  FileUtil; //, ShFolder, ShellAPI;
    1210
     
    3432  DLLHandle1: HModule;
    3533
    36 {$IFDEF WINDOWS}
    37   GetUserNameEx: procedure (NameFormat: DWORD;
    38     lpNameBuffer: LPSTR; nSize: PULONG); stdcall;
    39 {$ENDIF}
     34  {$IFDEF WINDOWS}
     35    GetUserNameEx: procedure (NameFormat: DWORD;
     36      lpNameBuffer: LPSTR; nSize: PULONG); stdcall;
     37  {$ENDIF}
     38
     39const
     40  clLightBlue = TColor($FF8080);
     41  clLightGreen = TColor($80FF80);
     42  clLightRed = TColor($8080FF);
    4043
    4144function AddLeadingZeroes(const aNumber, Length : integer) : string;
  • Common/UDebugLog.pas

    r520 r558  
    11unit UDebugLog;
    2 
    3 {$mode delphi}
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, FileUtil, fgl, SyncObjs;
     6  Classes, SysUtils, FileUtil, Generics.Collections, SyncObjs;
    97
    108type
     
    1513    Group: string;
    1614    Text: string;
     15  end;
     16
     17  TDebugLogItems = class(TObjectList<TDebugLogItem>)
    1718  end;
    1819
     
    2930    procedure SetMaxCount(const AValue: Integer);
    3031  public
    31     Items: TFPGObjectList<TDebugLogItem>;
     32    Items: TDebugLogItems;
    3233    Lock: TCriticalSection;
    3334    procedure Add(Text: string; Group: string = '');
     
    4445
    4546procedure Register;
     47
    4648
    4749implementation
     
    117119begin
    118120  inherited;
    119   Items := TFPGObjectList<TDebugLogItem>.Create;
     121  Items := TDebugLogItems.Create;
    120122  Lock := TCriticalSection.Create;
    121123  MaxCount := 100;
     
    126128destructor TDebugLog.Destroy;
    127129begin
    128   Items.Free;
    129   Lock.Free;
     130  FreeAndNil(Items);
     131  FreeAndNil(Lock);
    130132  inherited;
    131133end;
  • Common/UDelay.pas

    r303 r558  
    11unit UDelay;
    2 
    3 {$mode delphi}
    42
    53interface
  • Common/UFindFile.pas

    r555 r558  
    3535  private
    3636    s : TStringList;
    37 
    3837    fSubFolder : boolean;
    3938    fAttr: TFileAttrib;
    4039    fPath : string;
    4140    fFileMask : string;
    42 
    4341    procedure SetPath(Value: string);
    4442    procedure FileSearch(const inPath : string);
     
    4644    constructor Create(AOwner: TComponent); override;
    4745    destructor Destroy; override;
    48 
    4946    function SearchForFiles: TStringList;
    5047  published
     
    6461
    6562procedure Register;
     63
    6664
    6765implementation
  • Common/UFormAbout.pas

    r553 r558  
    11unit UFormAbout;
    2 
    3 {$mode delphi}
    42
    53interface
  • Common/UGeometric.pas

    r555 r558  
    11unit UGeometric;
    2 
    3 {$mode delphi}
    42
    53interface
     
    2624function RectEnlarge(Rect: TRect; Value: Integer): TRect;
    2725function ShiftRect(ARect: TRect; Delta: TPoint): TRect;
     26
    2827
    2928implementation
  • Common/UJobProgressView.pas

    r555 r558  
    11unit UJobProgressView;
    2 
    3 {$MODE Delphi}
    42
    53interface
     
    75uses
    86  SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs,
    9   Dialogs, ComCtrls, StdCtrls, ExtCtrls, fgl, UThreading, Math,
     7  Dialogs, ComCtrls, StdCtrls, ExtCtrls, Generics.Collections, UThreading, Math,
    108  DateUtils;
    119
     
    7169  end;
    7270
    73   TJobs = class(TFPGObjectList<TJob>)
     71  TJobs = class(TObjectList<TJob>)
    7472  end;
    7573
     
    163161resourcestring
    164162  SExecuted = 'Executed';
     163
    165164
    166165implementation
  • Common/ULanguages.pas

    r554 r558  
    11unit ULanguages;
    22
    3 {$mode delphi}{$H+}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl;
     6  Classes, SysUtils, Generics.Collections;
    97
    108type
     
    1715  { TLanguages }
    1816
    19   TLanguages = class(TFPGObjectList<TLanguage>)
     17  TLanguages = class(TObjectList<TLanguage>)
    2018    function SearchByCode(ACode: string): TLanguage;
    2119    procedure AddNew(Code: string; Name: string);
  • Common/ULastOpenedList.pas

    r556 r558  
    11unit ULastOpenedList;
    2 
    3 {$mode delphi}
    42
    53interface
  • Common/UListViewSort.pas

    r552 r558  
    22
    33// Date: 2019-05-17
    4 
    5 {$mode delphi}
    64
    75interface
     
    97uses
    108  {$IFDEF Windows}Windows, CommCtrl, LMessages, {$ENDIF}Classes, Graphics, ComCtrls, SysUtils,
    11   Controls, DateUtils, Dialogs, fgl, Forms, Grids, StdCtrls, ExtCtrls,
    12   LclIntf, LclType, LResources;
     9  Controls, DateUtils, Dialogs, Forms, Grids, StdCtrls, ExtCtrls,
     10  LclIntf, LclType, LResources, Generics.Collections, Generics.Defaults;
    1311
    1412type
     
    1917  TCompareEvent = function (Item1, Item2: TObject): Integer of object;
    2018  TListFilterEvent = procedure (ListViewSort: TListViewSort) of object;
     19
     20  TObjects = TObjectList<TObject>;
    2121
    2222  { TListViewSort }
     
    5252    {$ENDIF}
    5353  public
    54     List: TFPGObjectList<TObject>;
    55     Source: TFPGObjectList<TObject>;
     54    Source: TObjects;
     55    List: TObjects;
    5656    constructor Create(AOwner: TComponent); override;
    5757    destructor Destroy; override;
     
    338338  ListViewSortCompare: TCompareEvent;
    339339
    340 function ListViewCompare(const Item1, Item2: TObject): Integer;
     340function ListViewCompare(constref Item1, Item2: TObject): Integer;
    341341begin
    342342  Result := ListViewSortCompare(Item1, Item2);
     
    349349  ListViewSortCompare := Compare;
    350350  if (List.Count > 0) then
    351     List.Sort(ListViewCompare);
     351    List.Sort(TComparer<TObject>.Construct(ListViewCompare));
    352352end;
    353353
     
    355355begin
    356356  if Assigned(FOnFilter) then FOnFilter(Self)
    357   else if Assigned(Source) then
    358     List.Assign(Source) else
     357  else if Assigned(Source) then begin
    359358    List.Clear;
     359    List.AddRange(Source);
     360  end else List.Clear;
    360361  if ListView.Items.Count <> List.Count then
    361362    ListView.Items.Count := List.Count;
     
    412413begin
    413414  inherited;
    414   List := TFPGObjectList<TObject>.Create;
    415   List.FreeObjects := False;
     415  List := TObjects.Create;
     416  List.OwnsObjects := False;
    416417end;
    417418
    418419destructor TListViewSort.Destroy;
    419420begin
    420   List.Free;
     421  FreeAndNil(List);
    421422  inherited;
    422423end;
  • Common/UMemory.pas

    r527 r558  
    11unit UMemory;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    4341    property Position: Integer read FPosition write FPosition;
    4442  end;
     43
    4544
    4645implementation
  • Common/UMetaCanvas.pas

    r555 r558  
    11unit UMetaCanvas;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, Graphics, Types, fgl;
     6  Classes, SysUtils, Graphics, Types, Generics.Collections;
    97
    108type
     
    1917  end;
    2018
    21   TCanvasObjects = class(TFPGObjectList<TCanvasObject>)
     19  TCanvasObjects = class(TObjectList<TCanvasObject>)
    2220  end;
    2321
  • Common/UPersistentForm.pas

    r548 r558  
    11unit UPersistentForm;
    2 
    3 {$mode delphi}
    42
    53// Date: 2020-11-26
  • Common/UPixelPointer.pas

    r551 r558  
    5959  function Color32ToColor(Color: TColor32): TColor;
    6060  function ColorToColor32(Color: TColor): TColor32;
     61
    6162
    6263implementation
  • Common/UPool.pas

    r520 r558  
    11unit UPool;
    22
    3 {$mode Delphi}{$H+}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, syncobjs, fgl, UThreading;
     6  Classes, SysUtils, syncobjs, Generics.Collections, UThreading;
    97
    108type
     
    2220    function NewItemObject: TObject; virtual;
    2321  public
    24     Items: TFPGObjectList<TObject>;
    25     FreeItems: TFPGObjectList<TObject>;
     22    Items: TObjectList<TObject>;
     23    FreeItems: TObjectList<TObject>;
    2624    function Acquire: TObject; virtual;
    2725    procedure Release(Item: TObject); virtual;
     
    185183begin
    186184  inherited;
    187   Items := TFPGObjectList<TObject>.Create;
    188   FreeItems := TFPGObjectList<TObject>.Create;
    189   FreeItems.FreeObjects := False;
     185  Items := TObjectList<TObject>.Create;
     186  FreeItems := TObjectList<TObject>.Create;
     187  FreeItems.OwnsObjects := False;
    190188  FReleaseEvent := TEvent.Create(nil, False, False, '');
    191189end;
  • Common/UPrefixMultiplier.pas

    r520 r558  
    22
    33// Date: 2010-06-01
    4 
    5 {$mode delphi}
    64
    75interface
  • Common/URegistry.pas

    r555 r558  
    11unit URegistry;
    2 
    3 {$MODE delphi}
    42
    53interface
     
    4846    HKEY_CURRENT_CONFIG, HKEY_DYN_DATA);
    4947
     48
    5049implementation
    51 
    5250
    5351{ TRegistryContext }
  • Common/UResetableThread.pas

    r510 r558  
    11unit UResetableThread;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
  • Common/UScaleDPI.pas

    r555 r558  
    33{ See: http://wiki.lazarus.freepascal.org/High_DPI }
    44
    5 {$mode delphi}{$H+}
    6 
    75interface
    86
    97uses
    10   Classes, Forms, Graphics, Controls, ComCtrls, LCLType, SysUtils, fgl;
     8  Classes, Forms, Graphics, Controls, ComCtrls, LCLType, SysUtils,
     9  Generics.Collections;
    1110
    1211type
     
    2827  end;
    2928
    30   TControlDimensions = class(TFPGObjectList<TControlDimension>)
     29  TControlDimensions = class(TObjectList<TControlDimension>)
    3130  end;
    3231
  • Common/UStringTable.pas

    r510 r558  
    11unit UStringTable;
    2 
    3 {$mode objfpc}{$H+}
    42
    53interface
  • Common/USyncCounter.pas

    r434 r558  
    11unit USyncCounter;
    2 
    3 {$mode delphi}
    42
    53interface
     
    2523    procedure Assign(Source: TSyncCounter);
    2624  end;
     25
    2726
    2827implementation
  • Common/UTheme.pas

    r552 r558  
    55uses
    66  Classes, SysUtils, Graphics, ComCtrls, Controls, ExtCtrls, Menus, StdCtrls,
    7   Spin, Forms, fgl, Grids;
     7  Spin, Forms, Generics.Collections, Grids;
    88
    99type
     
    1919  { TThemes }
    2020
    21   TThemes = class(TFPGObjectList<TTheme>)
     21  TThemes = class(TObjectList<TTheme>)
    2222    function AddNew(Name: string): TTheme;
    2323    function FindByName(Name: string): TTheme;
     
    4242  end;
    4343
     44const
     45  ThemeNameSystem = 'System';
     46  ThemeNameLight = 'Light';
     47  ThemeNameDark = 'Dark';
     48
    4449procedure Register;
     50
    4551
    4652implementation
     
    105111  inherited;
    106112  Themes := TThemes.Create;
    107   with Themes.AddNew('System') do begin
     113  with Themes.AddNew(ThemeNameSystem) do begin
    108114    ColorWindow := clWindow;
    109115    ColorWindowText := clWindowText;
     
    113119  end;
    114120  Theme := TTheme(Themes.First);
    115   with Themes.AddNew('Dark') do begin
     121  with Themes.AddNew(ThemeNameDark) do begin
    116122    ColorWindow := RGBToColor($20, $20, $20);
    117123    ColorWindowText := clWhite;
     
    120126    ColorControlSelected := RGBToColor(96, 125, 155);
    121127  end;
    122   with Themes.AddNew('Light') do begin
     128  with Themes.AddNew(ThemeNameLight) do begin
    123129    ColorWindow := clWhite;
    124130    ColorWindowText := clBlack;
     
    175181procedure TThemeManager.UseTheme(Form: TForm);
    176182begin
    177   if not Used and (FTheme.Name = 'System') then Exit;
     183  if not Used and (FTheme.Name = ThemeNameSystem) then Exit;
    178184  ApplyTheme(Form);
    179185  Used := True;
  • Common/UThreading.pas

    r550 r558  
    11unit UThreading;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, Forms, fgl, SyncObjs;
     6  Classes, SysUtils, Forms, Generics.Collections, SyncObjs;
    97
    108type
    119  TExceptionEvent = procedure (Sender: TObject; E: Exception) of object;
    1210  TMethodCall = procedure of object;
    13 
    1411
    1512  { TVirtualThread }
     
    10299  { TThreadList }
    103100
    104   TThreadList = class(TFPGObjectList<TVirtualThread>)
     101  TThreadList = class(TObjectList<TVirtualThread>)
    105102    function FindById(Id: TThreadID): TVirtualThread;
    106103    constructor Create; virtual;
     
    361358ThreadListLock := TCriticalSection.Create;
    362359ThreadList := TThreadList.Create;
    363 ThreadList.FreeObjects := False;
     360ThreadList.OwnsObjects := False;
    364361
    365362finalization
  • Common/UTranslator.pas

    r554 r558  
    11unit UTranslator;
    22
    3 {$mode delphi}{$H+}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, Forms, ExtCtrls, Controls, fgl, LazFileUtils, LazUTF8,
     6  Classes, SysUtils, Forms, ExtCtrls, Controls, LazFileUtils, LazUTF8,
    97  Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType,
    10   LCLVersion;
     8  LCLVersion, Generics.Collections;
    119
    1210type
    1311  THandleStringEvent = function (AValue: string): string of object;
    1412
    15   TPoFiles = class(TFPGObjectList<TPOFile>)
     13  TPoFiles = class(TObjectList<TPOFile>)
    1614  end;
    1715
     
    2725  { TComponentExcludesList }
    2826
    29   TComponentExcludesList = class(TFPGObjectList<TComponentExcludes>)
     27  TComponentExcludesList = class(TObjectList<TComponentExcludes>)
    3028    function FindByClassType(AClassType: TClass): TComponentExcludes;
    3129    procedure DumpToStrings(Strings: TStrings);
     
    290288  Item := Component.ClassType;
    291289  while Assigned(Item) do begin
    292     //ShowMessage(Component.Name + ', ' + Component.ClassName + ', ' + Item.ClassName + ', ' + PropertyName);
    293290    Excludes := ComponentExcludes.FindByClassType(Item.ClassType);
    294291    if Assigned(Excludes) then begin
  • Common/UURI.pas

    r510 r558  
    22
    33// Date: 2011-04-04
    4 
    5 {$mode delphi}
    64
    75interface
     
    8482    property AsString: string read GetAsString write SetAsString;
    8583  end;
     84
    8685
    8786implementation
  • Common/UXMLUtils.pas

    r518 r558  
    11unit UXMLUtils;
    2 
    3 {$mode delphi}
    42
    53interface
Note: See TracChangeset for help on using the changeset viewer.