Changeset 86


Ignore:
Timestamp:
Jun 21, 2022, 5:04:48 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Calculation of tracks end.
  • Modified: Updated Common package to version 0.10.
  • Modified: Build with Lazarus 2.2.2.
  • Modified: Used Generics.Collections instead of fgl for generic lists.
Location:
trunk
Files:
12 added
1 deleted
45 edited

Legend:

Unmodified
Added
Removed
  • trunk/BigMetro.lpi

    r64 r86  
    22<CONFIG>
    33  <ProjectOptions>
    4     <Version Value="11"/>
     4    <Version Value="12"/>
    55    <General>
     6      <Flags>
     7        <CompatibilityMode Value="True"/>
     8      </Flags>
    69      <SessionStorage Value="InProjectDir"/>
    7       <MainUnit Value="0"/>
    810      <Title Value="BigMetro"/>
    911      <Scaled Value="True"/>
  • trunk/Forms/UFormImages.lfm

    r77 r86  
    88  ClientWidth = 1053
    99  DesignTimePPI = 144
    10   LCLVersion = '2.0.12.0'
     10  LCLVersion = '2.2.2.0'
    1111  object ImageLocomotive: TImage
    1212    Left = 48
  • trunk/Forms/UFormImages.pas

    r77 r86  
    11unit UFormImages;
    2 
    3 {$mode delphi}
    42
    53interface
     
    3028  FormImages: TFormImages;
    3129
     30
    3231implementation
    3332
  • trunk/Forms/UFormMain.lfm

    r76 r86  
    1515  OnKeyUp = FormKeyUp
    1616  OnShow = FormShow
    17   LCLVersion = '2.0.12.0'
     17  LCLVersion = '2.2.2.0'
    1818  object PaintBox1: TPaintBox
    1919    Left = 0
  • trunk/Forms/UFormMain.lrj

    r76 r86  
    11{"version":1,"strings":[
    2 {"hash":156468095,"name":"tformmain.caption","sourcebytes":[66,105,103,32,77,101,116,114,111],"value":"Big Metro"}
     2{"hash":156468095,"name":"tformmain.caption","sourcebytes":[66,105,103,32,77,101,116,114,111],"value":"Big Metro"},
     3{"hash":93038270,"name":"tformmain.applicationinfo1.description","sourcebytes":[69,110,106,111,121,97,98,108,101,32,114,101,97,108,45,116,105,109,101,32,109,101,116,114,111,32,98,117,105,108,100,105,110,103,32,103,97,109,101,46],"value":"Enjoyable real-time metro building game."}
    34]}
  • trunk/Forms/UFormMain.pas

    r78 r86  
    11unit UFormMain;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    6866procedure TFormMain.FormCreate(Sender: TObject);
    6967const
    70   LinuxLanguagesDir = '/usr/share/BigMetro/languages';
    71 begin
    72   {$IFDEF Linux}
    73   // If installed in Linux system then use installation directory for po files
    74   if not DirectoryExists(Translator1.POFilesFolder) and DirectoryExists(LinuxLanguagesDir) then
    75     Translator1.POFilesFolder := LinuxLanguagesDir;
     68  UnixLanguagesDir = '/usr/share/BigMetro/languages';
     69begin
     70  {$IFDEF UNIX}
     71  // If installed in UNIX system then use installation directory for po files
     72  if not DirectoryExists(Translator1.POFilesFolder) and DirectoryExists(UnixLanguagesDir) then
     73    Translator1.POFilesFolder := UnixLanguagesDir;
    7674  {$ENDIF}
    7775
     
    269267end;
    270268
    271 
    272269end.
    273270
  • trunk/Languages/BigMetro.cs.po

    r84 r86  
    1414#: tformimages.caption
    1515msgid "FormImages"
     16msgstr ""
     17
     18#: tformmain.applicationinfo1.description
     19msgid "Enjoyable real-time metro building game."
    1620msgstr ""
    1721
     
    4246
    4347#: uengine.sgameoverstatistic
     48#, object-pascal-format
    4449msgid "%d passengers travelled on your metro over %d days."
    4550msgstr "%d cestujících cestovalo ve vašem metru během %d dnů."
     
    5459
    5560#: uengine.soldhighscore
     61#, object-pascal-format
    5662msgid "Old high score was %d passengers in %d days."
    5763msgstr "Dřívější vysoké skóre bylo %d cestujících v %d dnech."
     
    6672
    6773#: uengine.strackpointnotfound
     74#, object-pascal-format
    6875msgid "Track point %d not found"
    6976msgstr ""
  • trunk/Packages/Common/Common.lpk

    r83 r86  
    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" 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>
     
    172172      </Item29>
    173173    </Files>
     174    <CompatibilityMode Value="True"/>
    174175    <i18n>
    175176      <EnableI18N Value="True"/>
  • trunk/Packages/Common/Languages/UJobProgressView.cs.po

    r55 r86  
    1313
    1414#: ujobprogressview.sestimatedtime
     15#, object-pascal-format
    1516msgid "Estimated time: %s"
    1617msgstr "Odhadovaný čas: %s"
     
    3334
    3435#: ujobprogressview.stotalestimatedtime
     36#, object-pascal-format
    3537msgid "Total estimated time: %s"
    3638msgstr "Celkový odhadovaný čas: %s"
  • trunk/Packages/Common/Languages/UScaleDPI.cs.po

    r55 r86  
    1313
    1414#: uscaledpi.swrongdpi
     15#, object-pascal-format
    1516msgid "Wrong DPI [%d,%d]"
    1617msgstr "Chybné DPI [%d,%d]"
  • trunk/Packages/Common/Languages/UThreading.cs.po

    r55 r86  
    1111
    1212#: uthreading.scurrentthreadnotfound
     13#, object-pascal-format
    1314msgid "Current thread ID %d not found in virtual thread list."
    1415msgstr "Aktuální vlákno ID %d nenalezeno v seznamu virtuálních vláken."
  • trunk/Packages/Common/StopWatch.pas

    r55 r86  
    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}
  • trunk/Packages/Common/UAboutDialog.pas

    r83 r86  
    11unit UAboutDialog;
    2 
    3 {$mode delphi}
    42
    53interface
     
    75uses
    86  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Menus,
    9   StdCtrls, ExtCtrls, UApplicationInfo, UCommon, UTranslator, UTheme, UFormAbout;
     7  ExtCtrls, UApplicationInfo, UCommon, UTranslator, UTheme, UFormAbout;
    108
    119type
  • trunk/Packages/Common/UApplicationInfo.pas

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

    r83 r86  
    11unit UCommon;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   {$ifdef Windows}Windows,{$endif}
    9   {$ifdef Linux}baseunix,{$endif}
    10   Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf,
     6  {$IFDEF WINDOWS}Windows,{$ENDIF}
     7  {$IFDEF UNIX}baseunix,{$ENDIF}
     8  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, Graphics,
    119  FileUtil; //, ShFolder, ShellAPI;
    1210
    1311type
    1412  TArrayOfByte = array of Byte;
    15   TArrayOfString = array of string;
    1613  TExceptionEvent = procedure(Sender: TObject; E: Exception) of object;
    1714
     
    3532  DLLHandle1: HModule;
    3633
    37 {$IFDEF Windows}
    38   GetUserNameEx: procedure (NameFormat: DWORD;
    39     lpNameBuffer: LPSTR; nSize: PULONG); stdcall;
    40 {$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);
    4143
    4244function AddLeadingZeroes(const aNumber, Length : integer) : string;
     
    5153function ComputerName: string;
    5254procedure DeleteFiles(APath, AFileSpec: string);
     55function Explode(Separator: Char; Data: string): TStringArray;
    5356procedure ExecuteProgram(Executable: string; Parameters: array of string);
    5457procedure FileDialogUpdateFilterFileType(FileDialog: TOpenDialog);
     
    6568function LoadFileToStr(const FileName: TFileName): AnsiString;
    6669function LoggedOnUserNameEx(Format: TUserNameFormat): string;
    67 function MergeArray(A, B: array of string): TArrayOfString;
     70function MergeArray(A, B: array of string): TStringArray;
    6871function OccurenceOfChar(What: Char; Where: string): Integer;
    6972procedure OpenWebPage(URL: string);
     73procedure OpenEmail(Email: string);
    7074procedure OpenFileInShell(FileName: string);
    7175function PosFromIndex(SubStr: string; Text: string;
     
    8387function SplitString(var Text: string; Count: Word): string;
    8488function StripTags(const S: string): string;
    85 function TryHexToInt(Data: string; var Value: Integer): Boolean;
    86 function TryBinToInt(Data: string; var Value: Integer): Boolean;
     89function TryHexToInt(Data: string; out Value: Integer): Boolean;
     90function TryBinToInt(Data: string; out Value: Integer): Boolean;
    8791procedure SortStrings(Strings: TStrings);
    8892
     
    246250end;
    247251
    248 function TryHexToInt(Data: string; var Value: Integer): Boolean;
     252function TryHexToInt(Data: string; out Value: Integer): Boolean;
    249253var
    250254  I: Integer;
     
    262266end;
    263267
    264 function TryBinToInt(Data: string; var Value: Integer): Boolean;
     268function TryBinToInt(Data: string; out Value: Integer): Boolean;
    265269var
    266270  I: Integer;
     
    290294end;
    291295
    292 function Explode(Separator: char; Data: string): TArrayOfString;
    293 begin
    294   SetLength(Result, 0);
    295   while Pos(Separator, Data) > 0 do begin
     296function Explode(Separator: Char; Data: string): TStringArray;
     297var
     298  Index: Integer;
     299begin
     300  Result := Default(TStringArray);
     301  repeat
     302    Index := Pos(Separator, Data);
     303    if Index > 0 then begin
     304      SetLength(Result, Length(Result) + 1);
     305      Result[High(Result)] := Copy(Data, 1, Index - 1);
     306      Delete(Data, 1, Index);
     307    end else Break;
     308  until False;
     309  if Data <> '' then begin
    296310    SetLength(Result, Length(Result) + 1);
    297     Result[High(Result)] := Copy(Data, 1, Pos(Separator, Data) - 1);
    298     Delete(Data, 1, Pos(Separator, Data));
    299   end;
    300   SetLength(Result, Length(Result) + 1);
    301   Result[High(Result)] := Data;
    302 end;
    303 
    304 {$IFDEF Windows}
     311    Result[High(Result)] := Data;
     312  end;
     313end;
     314
     315{$IFDEF WINDOWS}
    305316function GetUserName: string;
    306317const
     
    310321begin
    311322  L := MAX_USERNAME_LENGTH + 2;
     323  Result := Default(string);
    312324  SetLength(Result, L);
    313325  if Windows.GetUserName(PChar(Result), L) and (L > 0) then begin
     
    323335  end;
    324336end;
    325 {$endif}
     337{$ENDIF}
    326338
    327339function ComputerName: string;
    328 {$ifdef mswindows}
     340{$IFDEF WINDOWS}
    329341const
    330342 INFO_BUFFER_SIZE = 32767;
     
    341353  end;
    342354end;
    343 {$endif}
    344 {$ifdef unix}
     355{$ENDIF}
     356{$IFDEF UNIX}
    345357var
    346358  Name: UtsName;
    347359begin
     360  Name := Default(UtsName);
    348361  fpuname(Name);
    349362  Result := Name.Nodename;
    350363end;
    351 {$endif}
    352 
    353 {$ifdef windows}
     364{$ENDIF}
     365
     366{$IFDEF WINDOWS}
    354367function LoggedOnUserNameEx(Format: TUserNameFormat): string;
    355368const
     
    429442procedure LoadLibraries;
    430443begin
    431   {$IFDEF Windows}
     444  {$IFDEF WINDOWS}
    432445  DLLHandle1 := LoadLibrary('secur32.dll');
    433446  if DLLHandle1 <> 0 then
     
    440453procedure FreeLibraries;
    441454begin
    442   {$IFDEF Windows}
     455  {$IFDEF WINDOWS}
    443456  if DLLHandle1 <> 0 then FreeLibrary(DLLHandle1);
    444457  {$ENDIF}
     
    473486end;
    474487
     488procedure OpenEmail(Email: string);
     489begin
     490  OpenURL('mailto:' + Email);
     491end;
     492
    475493procedure OpenFileInShell(FileName: string);
    476494begin
     
    501519end;
    502520
    503 function MergeArray(A, B: array of string): TArrayOfString;
    504 var
    505   I: Integer;
    506 begin
     521function MergeArray(A, B: array of string): TStringArray;
     522var
     523  I: Integer;
     524begin
     525  Result := Default(TStringArray);
    507526  SetLength(Result, Length(A) + Length(B));
    508527  for I := 0 to Length(A) - 1 do
  • trunk/Packages/Common/UDebugLog.pas

    r55 r86  
    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;
  • trunk/Packages/Common/UDelay.pas

    r55 r86  
    11unit UDelay;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/Packages/Common/UFindFile.pas

    r55 r86  
    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
     
    5956  FilterAll = '*.*';
    6057{$ENDIF}
    61 {$IFDEF LINUX}
     58{$IFDEF UNIX}
    6259  FilterAll = '*';
    6360{$ENDIF}
    6461
    6562procedure Register;
     63
    6664
    6765implementation
  • trunk/Packages/Common/UFormAbout.pas

    r83 r86  
    11unit UFormAbout;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/Packages/Common/UGeometric.pas

    r55 r86  
    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
     
    9695  I: Integer;
    9796begin
     97  Result := Default(TPointArray);
    9898  SetLength(Result, Length(P));
    9999  for I := 0 to High(P) do
  • trunk/Packages/Common/UJobProgressView.lfm

    r55 r86  
    11object FormJobProgressView: TFormJobProgressView
    22  Left = 467
    3   Height = 345
     3  Height = 414
    44  Top = 252
    5   Width = 539
     5  Width = 647
    66  BorderIcons = [biSystemMenu]
    7   ClientHeight = 345
    8   ClientWidth = 539
    9   DesignTimePPI = 120
     7  ClientHeight = 414
     8  ClientWidth = 647
     9  DesignTimePPI = 144
    1010  OnClose = FormClose
    1111  OnCloseQuery = FormCloseQuery
    1212  OnCreate = FormCreate
    13   OnDestroy = FormDestroy
    1413  OnHide = FormHide
    1514  OnShow = FormShow
    1615  Position = poScreenCenter
    17   LCLVersion = '2.0.2.0'
     16  LCLVersion = '2.2.0.4'
    1817  object PanelOperationsTitle: TPanel
    1918    Left = 0
    20     Height = 32
     19    Height = 38
    2120    Top = 0
    22     Width = 539
     21    Width = 647
    2322    Align = alTop
    2423    BevelOuter = bvNone
    25     ClientHeight = 32
    26     ClientWidth = 539
     24    ClientHeight = 38
     25    ClientWidth = 647
    2726    FullRepaint = False
    2827    TabOrder = 0
    2928    object LabelOperation: TLabel
    30       Left = 8
    31       Height = 20
    32       Top = 8
    33       Width = 76
     29      Left = 10
     30      Height = 26
     31      Top = 10
     32      Width = 99
    3433      Caption = 'Operations:'
    35       ParentColor = False
    3634      ParentFont = False
    3735    end
     
    3937  object PanelLog: TPanel
    4038    Left = 0
    41     Height = 133
    42     Top = 212
    43     Width = 539
     39    Height = 161
     40    Top = 253
     41    Width = 647
    4442    Align = alClient
    4543    BevelOuter = bvSpace
    46     ClientHeight = 133
    47     ClientWidth = 539
     44    ClientHeight = 161
     45    ClientWidth = 647
    4846    TabOrder = 1
    4947    object MemoLog: TMemo
    50       Left = 8
    51       Height = 117
    52       Top = 8
    53       Width = 523
     48      Left = 10
     49      Height = 141
     50      Top = 10
     51      Width = 627
    5452      Anchors = [akTop, akLeft, akRight, akBottom]
    5553      ReadOnly = True
     
    6058  object PanelProgress: TPanel
    6159    Left = 0
    62     Height = 54
    63     Top = 106
    64     Width = 539
     60    Height = 65
     61    Top = 126
     62    Width = 647
    6563    Align = alTop
    6664    BevelOuter = bvNone
    67     ClientHeight = 54
    68     ClientWidth = 539
     65    ClientHeight = 65
     66    ClientWidth = 647
    6967    TabOrder = 2
    7068    object ProgressBarPart: TProgressBar
    71       Left = 10
    72       Height = 24
    73       Top = 24
    74       Width = 523
     69      Left = 12
     70      Height = 29
     71      Top = 29
     72      Width = 628
    7573      Anchors = [akTop, akLeft, akRight]
    7674      TabOrder = 0
    7775    end
    7876    object LabelEstimatedTimePart: TLabel
    79       Left = 8
    80       Height = 20
     77      Left = 10
     78      Height = 26
    8179      Top = -2
    82       Width = 103
     80      Width = 132
    8381      Caption = 'Estimated time:'
    84       ParentColor = False
    8582    end
    8683  end
    8784  object PanelOperations: TPanel
    8885    Left = 0
    89     Height = 42
    90     Top = 64
    91     Width = 539
     86    Height = 50
     87    Top = 76
     88    Width = 647
    9289    Align = alTop
    9390    BevelOuter = bvNone
    94     ClientHeight = 42
    95     ClientWidth = 539
     91    ClientHeight = 50
     92    ClientWidth = 647
    9693    FullRepaint = False
    9794    TabOrder = 3
    9895    object ListViewJobs: TListView
    99       Left = 8
    100       Height = 32
    101       Top = 5
    102       Width = 523
     96      Left = 10
     97      Height = 38
     98      Top = 6
     99      Width = 627
    103100      Anchors = [akTop, akLeft, akRight, akBottom]
    104101      AutoWidthLastColumn = True
     
    107104      Columns = <     
    108105        item
    109           Width = 523
     106          Width = 614
    110107        end>
    111108      OwnerData = True
     
    120117  object PanelProgressTotal: TPanel
    121118    Left = 0
    122     Height = 52
    123     Top = 160
    124     Width = 539
     119    Height = 62
     120    Top = 191
     121    Width = 647
    125122    Align = alTop
    126123    BevelOuter = bvNone
    127     ClientHeight = 52
    128     ClientWidth = 539
     124    ClientHeight = 62
     125    ClientWidth = 647
    129126    TabOrder = 4
    130127    object LabelEstimatedTimeTotal: TLabel
    131       Left = 8
    132       Height = 20
     128      Left = 10
     129      Height = 26
    133130      Top = 0
    134       Width = 141
     131      Width = 178
    135132      Caption = 'Total estimated time:'
    136       ParentColor = False
    137133    end
    138134    object ProgressBarTotal: TProgressBar
    139       Left = 8
    140       Height = 24
    141       Top = 24
    142       Width = 523
     135      Left = 10
     136      Height = 29
     137      Top = 29
     138      Width = 627
    143139      Anchors = [akTop, akLeft, akRight]
    144140      TabOrder = 0
     
    147143  object PanelText: TPanel
    148144    Left = 0
    149     Height = 32
    150     Top = 32
    151     Width = 539
     145    Height = 38
     146    Top = 38
     147    Width = 647
    152148    Align = alTop
    153149    BevelOuter = bvNone
    154     ClientHeight = 32
    155     ClientWidth = 539
     150    ClientHeight = 38
     151    ClientWidth = 647
    156152    TabOrder = 5
    157153    object LabelText: TLabel
    158       Left = 8
    159       Height = 24
    160       Top = 8
    161       Width = 525
     154      Left = 10
     155      Height = 29
     156      Top = 10
     157      Width = 630
    162158      Anchors = [akTop, akLeft, akRight]
    163159      AutoSize = False
    164       ParentColor = False
    165160    end
    166161  end
    167162  object ImageList1: TImageList
    168     BkColor = clForeground
    169     left = 200
    170     top = 8
     163    Left = 240
     164    Top = 10
    171165    Bitmap = {
    172       4C69020000001000000010000000FF00FF00FF00FF00FF00FF00FF00FF00FF00
    173       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    174       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    175       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    176       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    177       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    178       FF00000000FF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    179       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF000000
    180       00FF000000FF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    181       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF0000
    182       00FF000000FF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    183       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF0000
    184       00FF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    185       FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF0000
    186       00FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FFFF00FF00FF00
    187       FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF000000FFFF00
    188       FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FFFF00
    189       FF00FF00FF00FF00FF00000000FF000000FF000000FF000000FFFF00FF00FF00
    190       FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF0000
    191       00FFFF00FF00000000FF000000FF000000FF000000FFFF00FF00FF00FF00FF00
    192       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF0000
    193       00FF000000FF000000FF000000FF000000FFFF00FF00FF00FF00FF00FF00FF00
    194       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF0000
    195       00FF000000FF000000FF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00
    196       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF000000
    197       00FF000000FF000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    198       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    199       FF00000000FFFF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    200       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    201       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    202       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    203       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    204       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    205       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    206       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    207       FF00FF00FF00FF00FF00FF00FF00000000FFFF00FF00FF00FF00FF00FF00FF00
    208       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    209       FF00FF00FF00FF00FF00FF00FF00000000FF000000FFFF00FF00FF00FF00FF00
    210       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    211       FF00FF00FF00FF00FF00FF00FF00000000FF000084FF000000FFFF00FF00FF00
    212       FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF0000
    213       00FF000000FF000000FF000000FF000000FF0000FFFF000084FF000000FFFF00
    214       FF00FF00FF00FF00FF00FF00FF00FF00FF00000000FF0000FFFF0000FFFF0000
    215       FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF000084FF0000
    216       00FFFF00FF00FF00FF00FF00FF00FF00FF00000000FF0000FFFF0000FFFF0000
    217       FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000
    218       84FF000000FFFF00FF00FF00FF00FF00FF00000000FF0000FFFF0000FFFF0000
    219       FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000
    220       FFFF000084FF000000FFFF00FF00FF00FF00000000FF0000FFFF0000FFFF0000
    221       FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000
    222       84FF000000FFFF00FF00FF00FF00FF00FF00000000FF0000FFFF0000FFFF0000
    223       FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF000084FF0000
    224       00FFFF00FF00FF00FF00FF00FF00FF00FF00000000FF000000FF000000FF0000
    225       00FF000000FF000000FF000000FF000000FF0000FFFF000084FF000000FFFF00
    226       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    227       FF00FF00FF00FF00FF00FF00FF00000000FF000084FF000000FFFF00FF00FF00
    228       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    229       FF00FF00FF00FF00FF00FF00FF00000000FF000000FFFF00FF00FF00FF00FF00
    230       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    231       FF00FF00FF00FF00FF00FF00FF00000000FFFF00FF00FF00FF00FF00FF00FF00
    232       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    233       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    234       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    235       FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
    236       FF00FF00FF00FF00FF00FF00FF00
     166      4C7A0200000010000000100000006A0000000000000078DAE593490E00100C45
     167      7B78F72E5684A63A1142C382BE4F0708F89C955117F4B016BE67B5FC6E96DB97
     168      B0D4B9F4CD949F36DED1DF922B0F1BD11FAB5AFC68DE5C44D40220A9FA779EC8
     169      6A349FD5A435E43CADA1E3678D73F773F1DBF3EFADFFEEFEBBF97F6696BE9D36
    237170    }
    238171  end
     
    241174    Interval = 100
    242175    OnTimer = TimerUpdateTimer
    243     left = 320
    244     top = 8
     176    Left = 384
     177    Top = 10
    245178  end
    246179end
  • trunk/Packages/Common/UJobProgressView.pas

    r55 r86  
    11unit UJobProgressView;
    2 
    3 {$MODE Delphi}
    42
    53interface
     
    75uses
    86  SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs,
    9   Dialogs, ComCtrls, StdCtrls, ExtCtrls, Contnrs, UThreading, Math,
     7  Dialogs, ComCtrls, StdCtrls, ExtCtrls, Generics.Collections, UThreading, Math,
    108  DateUtils;
    119
     
    7169  end;
    7270
    73   TJobs = class(TObjectList)
     71  TJobs = class(TObjectList<TJob>)
    7472  end;
    7573
     
    105103    procedure ReloadJobList;
    106104    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    107     procedure FormDestroy(Sender: TObject);
    108105    procedure ListViewJobsData(Sender: TObject; Item: TListItem);
    109106    procedure TimerUpdateTimer(Sender: TObject);
     
    165162  SExecuted = 'Executed';
    166163
     164
    167165implementation
    168166
     
    286284end;
    287285
    288 procedure TFormJobProgressView.FormDestroy(Sender:TObject);
    289 begin
    290 end;
    291 
    292286procedure TFormJobProgressView.ListViewJobsData(Sender: TObject; Item: TListItem);
    293287begin
    294288  if (Item.Index >= 0) and (Item.Index < JobProgressView.Jobs.Count) then
    295   with TJob(JobProgressView.Jobs[Item.Index]) do begin
     289  with JobProgressView.Jobs[Item.Index] do begin
    296290    Item.Caption := Title;
    297291    if Item.Index = JobProgressView.CurrentJobIndex then Item.ImageIndex := 1
     
    405399    I := 0;
    406400    while I < Jobs.Count do
    407     with TJob(Jobs[I]) do begin
     401    with Jobs[I] do begin
    408402      CurrentJobIndex := I;
    409       CurrentJob := TJob(Jobs[I]);
     403      CurrentJob := Jobs[I];
    410404      JobProgressChange(Self);
    411405      StartTime := Now;
     
    420414        Method(CurrentJob);
    421415      end else begin
     416        Thread := TJobThread.Create(True);
    422417        try
    423           Thread := TJobThread.Create(True);
    424418          with Thread do begin
    425419            FreeOnTerminate := False;
     
    494488  if AValue = FTerminate then Exit;
    495489  for I := 0 to Jobs.Count - 1 do
    496     TJob(Jobs[I]).Terminate := AValue;
     490    Jobs[I].Terminate := AValue;
    497491  FTerminate := AValue;
    498492end;
     
    620614procedure TProgress.Increment;
    621615begin
    622   try
    623     FLock.Acquire;
     616  FLock.Acquire;
     617  try
    624618    Value := Value + 1;
    625619  finally
     
    630624procedure TProgress.Reset;
    631625begin
    632   try
    633     FLock.Acquire;
     626  FLock.Acquire;
     627  try
    634628    FValue := 0;
    635629  finally
     
    678672destructor TJob.Destroy;
    679673begin
    680   Progress.Free;
     674  FreeAndNil(Progress);
    681675  inherited;
    682676end;
  • trunk/Packages/Common/ULanguages.pas

    r83 r86  
    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);
  • trunk/Packages/Common/ULastOpenedList.pas

    r55 r86  
    11unit ULastOpenedList;
    2 
    3 {$mode delphi}
    42
    53interface
     
    8482destructor TLastOpenedList.Destroy;
    8583begin
    86   Items.Free;
     84  FreeAndNil(Items);
    8785  inherited;
    8886end;
     
    9492begin
    9593  if Assigned(MenuItem) then begin
    96     MenuItem.Clear;
     94    while MenuItem.Count > Items.Count do
     95      MenuItem.Delete(MenuItem.Count - 1);
     96    while MenuItem.Count < Items.Count do begin
     97      NewMenuItem := TMenuItem.Create(MenuItem);
     98      MenuItem.Add(NewMenuItem);
     99    end;
    97100    for I := 0 to Items.Count - 1 do begin
    98       NewMenuItem := TMenuItem.Create(MenuItem);
    99       NewMenuItem.Caption := Items[I];
    100       NewMenuItem.OnClick := ClickAction;
    101       MenuItem.Add(NewMenuItem);
     101      MenuItem.Items[I].Caption := Items[I];
     102      MenuItem.Items[I].OnClick := ClickAction;
    102103    end;
    103104  end;
  • trunk/Packages/Common/UListViewSort.pas

    r83 r86  
    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;
  • trunk/Packages/Common/UMemory.pas

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

    r83 r86  
    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
     
    142140    procedure RoundRect(const Rect: TRect; RX,RY: Integer); overload;
    143141    procedure TextOut(X,Y: Integer; const Text: String); override;
    144     procedure Polygon(Points: PPoint; NumPts: Integer; Winding: boolean = False); override;
     142    procedure Polygon(Points: PPoint; NumPts: Integer; Winding: Boolean = False); override;
    145143    procedure Ellipse(x1, y1, x2, y2: Integer); override;
    146144    procedure StretchDraw(const DestRect: TRect; SrcGraphic: TGraphic); override;
     
    502500end;
    503501
    504 procedure TMetaCanvas.Polygon(Points: PPoint; NumPts: Integer; Winding: boolean
     502procedure TMetaCanvas.Polygon(Points: PPoint; NumPts: Integer; Winding: Boolean
    505503  );
    506504var
     
    508506  I: Integer;
    509507begin
     508  APoints := nil;
    510509  SetLength(APoints, NumPts);
    511510  for I := 0 to High(APoints) do
  • trunk/Packages/Common/UPersistentForm.pas

    r69 r86  
    11unit UPersistentForm;
    2 
    3 {$mode delphi}
    42
    53// Date: 2020-11-26
     
    318316      Form.RestoredHeight);
    319317    FormWindowState := Form.WindowState;
     318    Form.WindowState := wsNormal;
    320319    ShowWindow(Form.Handle, SW_SHOWFULLSCREEN);
    321320    {$IFDEF WINDOWS}
  • trunk/Packages/Common/UPixelPointer.pas

    r83 r86  
    5959  function Color32ToColor(Color: TColor32): TColor;
    6060  function ColorToColor32(Color: TColor): TColor32;
     61
    6162
    6263implementation
  • trunk/Packages/Common/UPool.pas

    r55 r86  
    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;
  • trunk/Packages/Common/UPrefixMultiplier.pas

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

    r58 r86  
    11unit URegistry;
    2 
    3 {$MODE delphi}
    42
    53interface
     
    4846    HKEY_CURRENT_CONFIG, HKEY_DYN_DATA);
    4947
     48
    5049implementation
    51 
    5250
    5351{ TRegistryContext }
     
    132130function TRegistryEx.OpenKey(const Key: string; CanCreate: Boolean): Boolean;
    133131begin
    134   {$IFDEF Linux}
     132  {$IFDEF UNIX}
    135133  //CloseKey;
    136134  {$ENDIF}
     
    140138function TRegistryEx.GetCurrentContext: TRegistryContext;
    141139begin
    142   Result.Key := CurrentPath;
     140  Result.Key := String(CurrentPath);
    143141  Result.RootKey := RootKey;
    144142end;
  • trunk/Packages/Common/UResetableThread.pas

    r55 r86  
    11unit UResetableThread;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
  • trunk/Packages/Common/UScaleDPI.pas

    r83 r86  
    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, StdCtrls,
    11   Contnrs;
     8  Classes, Forms, Graphics, Controls, ComCtrls, LCLType, SysUtils,
     9  Generics.Collections;
    1210
    1311type
     12  TControlDimensions = class;
    1413
    1514  { TControlDimension }
     
    1817    BoundsRect: TRect;
    1918    FontHeight: Integer;
    20     Controls: TObjectList; // TList<TControlDimension>
     19    Controls: TControlDimensions;
    2120    // Class specifics
    2221    ButtonSize: TPoint; // TToolBar
     
    2625    constructor Create;
    2726    destructor Destroy; override;
     27  end;
     28
     29  TControlDimensions = class(TObjectList<TControlDimension>)
    2830  end;
    2931
     
    7375constructor TControlDimension.Create;
    7476begin
    75   Controls := TObjectList.Create;
     77  Controls := TControlDimensions.Create;
    7678end;
    7779
     
    7981begin
    8082  FreeAndNil(Controls);
    81   inherited Destroy;
     83  inherited;
    8284end;
    8385
     
    212214  TempBmp: TBitmap;
    213215  Temp: array of TBitmap;
    214   NewWidth, NewHeight: integer;
     216  NewWidth: Integer;
     217  NewHeight: Integer;
    215218  I: Integer;
    216219begin
    217220  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;
     221  try
     222    NewWidth := ScaleX(ImgList.Width, FromDPI.X);
     223    NewHeight := ScaleY(ImgList.Height, FromDPI.Y);
     224
     225    Temp := nil;
     226    SetLength(Temp, ImgList.Count);
     227    for I := 0 to ImgList.Count - 1 do
     228    begin
     229      TempBmp := TBitmap.Create;
     230      try
     231        TempBmp.PixelFormat := pf32bit;
     232        ImgList.GetBitmap(I, TempBmp);
     233        Temp[I] := TBitmap.Create;
     234        Temp[I].SetSize(NewWidth, NewHeight);
     235        {$IFDEF UNIX}
     236        Temp[I].PixelFormat := pf24bit;
     237        {$ELSE}
     238        Temp[I].PixelFormat := pf32bit;
     239        {$ENDIF}
     240        Temp[I].TransparentColor := TempBmp.TransparentColor;
     241        //Temp[I].TransparentMode := TempBmp.TransparentMode;
     242        Temp[I].Transparent := True;
     243        Temp[I].Canvas.Brush.Style := bsSolid;
     244        Temp[I].Canvas.Brush.Color := Temp[I].TransparentColor;
     245        Temp[I].Canvas.FillRect(0, 0, Temp[I].Width, Temp[I].Height);
     246
     247        if (Temp[I].Width = 0) or (Temp[I].Height = 0) then Continue;
     248        Temp[I].Canvas.StretchDraw(Rect(0, 0, Temp[I].Width, Temp[I].Height), TempBmp);
     249      finally
     250        TempBmp.Free;
     251      end;
     252    end;
     253
     254    ImgList.Clear;
     255    ImgList.Width := NewWidth;
     256    ImgList.Height := NewHeight;
     257
     258    for I := 0 to High(Temp) do
     259    begin
     260      ImgList.Add(Temp[I], nil);
     261      Temp[i].Free;
     262    end;
     263  finally
     264    ImgList.EndUpdate;
     265  end;
    256266end;
    257267
     
    331341  with TCoolBar(Control) do begin
    332342    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;
     343    try
     344      for I := 0 to Bands.Count - 1 do
     345        with Bands[I] do begin
     346          MinWidth := ScaleX(MinWidth, FromDPI.X);
     347          MinHeight := ScaleY(MinHeight, FromDPI.Y);
     348          // Workaround to bad band width auto sizing
     349          //Width := ScaleX(Width, FromDPI.X);
     350          Width := ScaleX(Control.Width + 28, FromDPI.X);
     351          //Control.Invalidate;
     352        end;
     353      // Workaround for bad autosizing of coolbar
     354      if AutoSize then begin
     355        AutoSize := False;
     356        Height := ScaleY(Height, FromDPI.Y);
     357        AutoSize := True;
    341358      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;
     359    finally
     360      EndUpdate;
     361    end;
    349362  end;
    350363
  • trunk/Packages/Common/UStringTable.pas

    r55 r86  
    11unit UStringTable;
    2 
    3 {$mode objfpc}{$H+}
    42
    53interface
  • trunk/Packages/Common/USyncCounter.pas

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

    r83 r86  
    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;
  • trunk/Packages/Common/UThreading.pas

    r83 r86  
    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
  • trunk/Packages/Common/UTranslator.pas

    r83 r86  
    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
  • trunk/Packages/Common/UURI.pas

    r55 r86  
    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
  • trunk/Packages/Common/UXMLUtils.pas

    r55 r86  
    11unit UXMLUtils;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/UControls.pas

    r77 r86  
    11unit UControls;
    2 
    3 {$mode delphi}
    42
    53interface
     
    4240    procedure Paint; override;
    4341  end;
     42
    4443
    4544implementation
  • trunk/UEngine.pas

    r84 r86  
    11unit UEngine;
    22
    3 {$mode delphi}
    43{$IFDEF DARWIN}{$modeswitch Objectivec1}{$ENDIF}
    54
     
    76
    87uses
    9   {$IFDEF Darwin}MacOSAll, CocoaAll, CocoaUtils,{$ENDIF}
     8  {$IFDEF DARWIN}MacOSAll, CocoaAll, CocoaUtils,{$ENDIF}
    109  Classes, SysUtils, Graphics, Controls, ExtCtrls, Math, DateUtils,
    11   UMetaCanvas, fgl, UMenu, UControls;
     10  UMetaCanvas, Generics.Collections, Generics.Defaults, UMenu, UControls;
    1211
    1312type
     
    5756  { TMapStations }
    5857
    59   TMapStations = class(TFPGObjectList<TMapStation>)
     58  TMapStations = class(TObjectList<TMapStation>)
    6059    Engine: TEngine;
    6160    function GetRect: TRect;
     
    7170  { TLineStations }
    7271
    73   TLineStations = class(TFPGObjectList<TLineStation>)
     72  TLineStations = class(TObjectList<TLineStation>)
    7473    Line: TMetroLine;
    7574    function SearchMapStation(Station: TMapStation): TLineStation;
     
    105104  { TTrackPoints }
    106105
    107   TTrackPoints = class(TFPGObjectList<TTrackPoint>)
     106  TTrackPoints = class(TObjectList<TTrackPoint>)
    108107    Track: TTrack;
    109108    function AddNew: TTrackPoint;
     
    122121  { TTrackLinks }
    123122
    124   TTrackLinks = class(TFPGObjectList<TTrackLink>)
     123  TTrackLinks = class(TObjectList<TTrackLink>)
    125124    Track: TTrack;
    126125    function SearchPoints(Point1, Point2: TTrackPoint): TTrackLink;
     
    140139  { TTracks }
    141140
    142   TTracks = class(TFPGObjectList<TTrackLink>)
     141  TTracks = class(TObjectList<TTrackLink>)
    143142    function SearchPointUp(TrackPoint: TTrackPoint; Skip: TTrackLink): TTrackLink;
    144143    function SearchPointDown(TrackPoint: TTrackPoint; Skip: TTrackLink): TTrackLink;
     
    156155  { TTrackPointsAngleGroup }
    157156
    158   TTrackPointsAngleGroup = class(TFPGObjectList<TTrackPointsAngle>)
     157  TTrackPointsAngleGroup = class(TObjectList<TTrackPointsAngle>)
    159158    function SearchAngle(Angle: Double): TTrackPointsAngle;
    160159  end;
     
    164163  TMetroLine = class
    165164  private
     165    procedure UpdateEndingLine(EndIndex, Direction: Integer);
    166166    procedure UpdateEndingLines;
    167167  public
     
    182182  { TMetroLines }
    183183
    184   TMetroLines = class(TFPGObjectList<TMetroLine>)
     184  TMetroLines = class(TObjectList<TMetroLine>)
    185185    Engine: TEngine;
    186186    function AddNew: TMetroLine;
     
    194194  end;
    195195
    196   TMetroCarriages = class(TFPGObjectList<TMetroCarriage>)
     196  TMetroCarriages = class(TObjectList<TMetroCarriage>)
    197197  end;
    198198
     
    224224  { TMetroTrains }
    225225
    226   TMetroTrains = class(TFPGObjectList<TMetroTrain>)
     226  TMetroTrains = class(TObjectList<TMetroTrain>)
    227227    function GetUnusedTrain: TMetroTrain;
    228228    function GetUnusedCount: Integer;
     
    239239  { TMetroPassengers }
    240240
    241   TMetroPassengers = class(TFPGObjectList<TMetroPassenger>)
     241  TMetroPassengers = class(TObjectList<TMetroPassenger>)
    242242    Engine: TEngine;
    243243    function AddNew: TMetroPassenger;
     
    251251  end;
    252252
    253   TRivers = class(TFPGObjectList<TRiver>)
     253  TRivers = class(TObjectList<TRiver>)
    254254  end;
    255255
     
    499499begin
    500500  Points := TTrackPoints.Create;
    501   Points.FreeObjects := False;
     501  Points.OwnsObjects := False;
    502502end;
    503503
     
    627627begin
    628628  TrackLinks := TTrackLinks.Create;
    629   TrackLinks.FreeObjects := False;
     629  TrackLinks.OwnsObjects := False;
    630630end;
    631631
     
    751751begin
    752752  NeighPoints := TTrackPoints.Create;
    753   NeighPoints.FreeObjects := False;
     753  NeighPoints.OwnsObjects := False;
    754754  NeighLinks := TTrackLinks.Create;
    755   NeighLinks.FreeObjects := False;
     755  NeighLinks.OwnsObjects := False;
    756756end;
    757757
     
    888888{ TMetroLine }
    889889
    890 procedure TMetroLine.UpdateEndingLines;
     890procedure TMetroLine.UpdateEndingLine(EndIndex, Direction: Integer);
    891891var
    892892  Index: Integer;
     
    894894  Angle: Double;
    895895  EndPoint: TPoint;
     896begin
     897{  if Direction = 1 then Index := Track.Points.IndexOf(LineStations.Last.TrackPoint)
     898    else if Direction = -1 then Index := Track.Points.IndexOf(LineStations.Last.TrackPoint);
     899  if Index = EndIndex then begin
     900    NewTrackPoint := Track.Points.AddNew;
     901    if Direction = 1 then Track.Points.Insert(EndIndex, NewTrackPoint)
     902    else if Direction = -1 then begin
     903      Inc(EndIndex);
     904      Track.Points.Insert(EndIndex, NewTrackPoint);
     905    end;
     906  end;
     907 }
     908  Angle := ArcTan2((Track.Points[EndIndex + 2 * Direction].PositionDesigned.Y -
     909    Track.Points[EndIndex + Direction].PositionDesigned.Y),
     910    (Track.Points[EndIndex + 2 * Direction].PositionDesigned.X -
     911    Track.Points[EndIndex + Direction].PositionDesigned.X));
     912  EndPoint := Point(Round(Track.Points[EndIndex + Direction].PositionDesigned.X - EndStationLength * Cos(Angle)),
     913    Round(Track.Points[EndIndex + Direction].PositionDesigned.Y - EndStationLength * Sin(Angle)));
     914  Track.Points[EndIndex].PositionDesigned := EndPoint;
     915  Track.Points[EndIndex].Position := EndPoint;
     916end;
     917
     918procedure TMetroLine.UpdateEndingLines;
     919var
     920  Index: Integer;
     921  NewTrackPoint: TTrackPoint;
    896922begin
    897923  if LineStations.Count >= 2 then begin
     
    906932      Track.Points.Insert(Track.Points.Count, NewTrackPoint);
    907933    end;
    908 
    909     Angle := ArcTan2((Track.Points[2].PositionDesigned.Y - Track.Points[1].PositionDesigned.Y),
    910       (Track.Points[2].PositionDesigned.X - Track.Points[1].PositionDesigned.X));
    911     EndPoint := Point(Round(Track.Points[1].PositionDesigned.X - EndStationLength * Cos(Angle)),
    912       Round(Track.Points[1].PositionDesigned.Y - EndStationLength * Sin(Angle)));
    913     Track.Points.First.PositionDesigned := EndPoint;
    914     Track.Points.First.Position := EndPoint;
    915 
    916     Angle := ArcTan2((Track.Points[Track.Points.Count - 2].PositionDesigned.Y - Track.Points[Track.Points.Count - 3].PositionDesigned.Y),
    917       (Track.Points[Track.Points.Count - 2].PositionDesigned.X - Track.Points[Track.Points.Count - 3].PositionDesigned.X));
    918     EndPoint := Point(Round(Track.Points[Track.Points.Count - 2].PositionDesigned.X + EndStationLength * Cos(Angle)),
    919       Round(Track.Points[Track.Points.Count - 2].PositionDesigned.Y + EndStationLength * Sin(Angle)));
    920     Track.Points.Last.PositionDesigned := EndPoint;
    921     Track.Points.Last.Position := EndPoint;
     934    UpdateEndingLine(0, 1);
     935    UpdateEndingLine(Track.Points.Count - 1, -1);
    922936  end;
    923937end;
     
    11001114begin
    11011115  LineStations := TLineStations.Create;
    1102   LineStations.FreeObjects := True;
     1116  LineStations.OwnsObjects := True;
    11031117  Trains := TMetroTrains.Create;
    1104   Trains.FreeObjects := False;
     1118  Trains.OwnsObjects := False;
    11051119  Track := TTrack.Create;
    11061120  Track.Line := Self;
     
    11971211begin
    11981212  Passengers := TMetroPassengers.Create;
    1199   Passengers.FreeObjects := False;
     1213  Passengers.OwnsObjects := False;
    12001214  Carriages := TMetroCarriages.Create;
    12011215  Direction := 1;
     
    12301244begin
    12311245  TrackLinks := TTrackLinks.Create;
    1232   TrackLinks.FreeObjects := False;
     1246  TrackLinks.OwnsObjects := False;
    12331247
    12341248  // Collect all near track points as track links
     
    12901304      with TrackLinks[J] do begin
    12911305        // Get orthogonal angle
    1292         HAngle := Angle + Pi / 2;
    1293         if HAngle > Pi then HAngle := HAngle - Pi;
     1306        HAngle := (Angle + Pi / 2) mod Pi;
    12941307        NewShift.X := Trunc(MetroLineThickness * Cos(HAngle) * (J - (TrackLinks.Count - 1) / 2));
    12951308        NewShift.Y := Trunc(MetroLineThickness * Sin(HAngle) * (J - (TrackLinks.Count - 1) / 2));
     
    13021315end;
    13031316
    1304 function MapStationCompareLine(const Item1, Item2: TMetroLine): Integer;
     1317function MapStationCompareLine(constref Item1, Item2: TMetroLine): Integer;
    13051318begin
    13061319  if Item1.Index > Item2.Index then Result := 1
     
    13111324procedure TMapStation.SortLines;
    13121325begin
    1313   Lines.Sort(MapStationCompareLine);
     1326  Lines.Sort(TComparer<TMetroLine>.Construct(MapStationCompareLine));
    13141327end;
    13151328
     
    13761389begin
    13771390  Passengers := TMetroPassengers.Create;
    1378   Passengers.FreeObjects := False;
     1391  Passengers.OwnsObjects := False;
    13791392  Lines := TMetroLines.Create;
    1380   Lines.FreeObjects := False;
     1393  Lines.OwnsObjects := False;
    13811394end;
    13821395
     
    19411954          Track.Points[I].PositionDesigned + Track.Points[I].LinkDown.Shift,
    19421955          Track.Points[I].PositionDesigned + Track.Points[I].LinkUp.Shift,
    1943           Track.Points[I + 1].PositionDesigned + Track.Points[I].LinkUp.Shift, NewPoint) then
    1944           Track.Points[I].Position := NewPoint
    1945           else begin
     1956          Track.Points[I + 1].PositionDesigned + Track.Points[I].LinkUp.Shift, NewPoint) then begin
     1957            Track.Points[I].Position := NewPoint;
     1958          end else begin
    19461959            // Parallel lines
    19471960            NewPoint := Track.Points[I].PositionDesigned + Track.Points[I].LinkDown.Shift;
     
    19491962          end;
    19501963//      end;
     1964
     1965      // Update ending
     1966      if Track.Points.Count > 1 then begin
     1967        Track.Points[Track.Points.Count - 1].Position := Track.Points[Track.Points.Count - 1].PositionDesigned -
     1968          Track.Points[Track.Points.Count - 1].LinkDown.Shift;
     1969      end;
    19511970    end;
    19521971
     
    23332352{      if (S = TrackPoints.Count - 1) then begin
    23342353        Canvas.Pen.EndCap := pecSquare;
    2335         Angle := arctan2(((TrackPoints[S].Position.Y - TrackPoints[S - 1].Position.Y),
     2354        Angle := arctan2D(((TrackPoints[S].Position.Y - TrackPoints[S - 1].Position.Y),
    23362355          (TrackPoints[S].Position.X - TrackPoints[S - 1].Position.X));
    23372356        EndPoint := Point(Round(TrackPoints[S].Position.X + EndStationLength * Cos(Angle)),
  • trunk/UMenu.pas

    r77 r86  
    11unit UMenu;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, Graphics, Controls, fgl, UControls;
     6  Classes, SysUtils, Graphics, Controls, Generics.Collections, UControls;
    97
    108type
     
    6058  { TMenuItems }
    6159
    62   TMenuItems = class(TFPGObjectList<TMenuItem>)
     60  TMenuItems = class(TObjectList<TMenuItem>)
    6361    function AddButton(Text: string; OnClick: TNotifyEvent): TMenuItemButton;
    6462    function AddCheckBox(Text: string; OnChanged: TNotifyEvent): TMenuItemCheckBox;
  • trunk/UTrack.pas

    r59 r86  
    11unit UTrack;
    2 
    3 {$mode delphi}
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl;
     6  Classes, SysUtils, Generics.Collections;
    97
    108type
     
    2826  { TTrackPoints }
    2927
    30   TTrackPoints = class(TFPGObjectList<TTrackPoint>)
     28  TTrackPoints = class(TObjectList<TTrackPoint>)
    3129  end;
    3230
     
    4240  { TTrackLinks }
    4341
    44   TTrackLinks = class(TFPGObjectList<TTrackLink>)
     42  TTrackLinks = class(TObjectList<TTrackLink>)
    4543    function SearchPoints(Point1, Point2: TTrackPoint): TTrackLink;
    4644  end;
Note: See TracChangeset for help on using the changeset viewer.