Changeset 447 for trunk/Packages/Common


Ignore:
Timestamp:
May 19, 2022, 10:39:34 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Use first capital letter in identifiers.
Location:
trunk/Packages/Common
Files:
15 edited

Legend:

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

    r396 r447  
    3737  RegisterPackage('Common', @Register);
    3838end.
     39
  • trunk/Packages/Common/StopWatch.pas

    r424 r447  
    3535implementation
    3636
    37 constructor TStopWatch.Create(const startOnCreate : boolean = false) ;
     37constructor TStopWatch.Create(const startOnCreate : Boolean = False) ;
    3838begin
    3939  inherited Create;
     
    7272begin
    7373  dt := ElapsedMiliseconds / MSecsPerSec / SecsPerDay;
    74   result := Format('%d days, %s', [Trunc(dt), FormatDateTime('hh:nn:ss.z', Frac(dt))]) ;
     74  Result := Format('%d days, %s', [Trunc(dt), FormatDateTime('hh:nn:ss.z', Frac(dt))]) ;
    7575end;
    7676
     
    9393
    9494end.
     95
  • trunk/Packages/Common/UAboutDialog.pas

    r424 r447  
    5151end.
    5252
     53
  • trunk/Packages/Common/UCommon.pas

    r424 r447  
    4242  clLightRed = TColor($8080FF);
    4343
    44 function AddLeadingZeroes(const aNumber, Length : integer) : string;
     44function AddLeadingZeroes(const aNumber, Length : Integer) : string;
    4545function BinToInt(BinStr: string): Int64;
    4646function BinToHexString(Source: AnsiString): string;
     
    9696function BinToInt(BinStr : string) : Int64;
    9797var
    98   i : byte;
     98  I : Byte;
    9999  RetVar : Int64;
    100100begin
    101101  BinStr := UpperCase(BinStr);
    102   if BinStr[length(BinStr)] = 'B' then Delete(BinStr,length(BinStr),1);
     102  if BinStr[Length(BinStr)] = 'B' then Delete(BinStr,Length(BinStr),1);
    103103  RetVar := 0;
    104   for i := 1 to length(BinStr) do begin
    105     if not (BinStr[i] in ['0','1']) then begin
     104  for I := 1 to Length(BinStr) do begin
     105    if not (BinStr[I] in ['0','1']) then begin
    106106      RetVar := 0;
    107107      Break;
    108108    end;
    109     RetVar := (RetVar shl 1) + (byte(BinStr[i]) and 1) ;
     109    RetVar := (RetVar shl 1) + (Byte(BinStr[I]) and 1) ;
    110110  end;
    111111
     
    435435end;
    436436
    437 function AddLeadingZeroes(const aNumber, Length : integer) : string;
     437function AddLeadingZeroes(const aNumber, Length : Integer) : string;
    438438begin
    439439  Result := SysUtils.Format('%.*d', [Length, aNumber]) ;
     
    614614  begin
    615615    for J := ReadFrom to Len do
    616       if (S[j] = C) then
     616      if (S[J] = C) then
    617617      begin
    618618        Result := J;
     
    631631    Inc(I);
    632632    APos := ReadUntil(I, '<');
    633     Result := Result + Copy(S, I, APos - i);
     633    Result := Result + Copy(S, I, APos - I);
    634634    I := ReadUntil(APos + 1, '>');
    635635  end;
  • trunk/Packages/Common/UFindFile.pas

    r424 r447  
    66Tired of using FindFirst, Next and Close?
    77Come see how to encapsulate all those functions
    8 in a single "find-files-recursively" component.
     8in A Single "find-files-recursively" component.
    99It's easy to use, free and with code.
    1010
     
    3434  TFindFile = class(TComponent)
    3535  private
    36     s : TStringList;
    37     fSubFolder : boolean;
     36    S : TStringList;
     37    fSubFolder : Boolean;
    3838    fAttr: TFileAttrib;
    3939    fPath : string;
     
    4747  published
    4848    property FileAttr: TFileAttrib read fAttr write fAttr;
    49     property InSubFolders : boolean read fSubFolder write fSubFolder;
     49    property InSubFolders : Boolean read fSubFolder write fSubFolder;
    5050    property Path : string read fPath write SetPath;
    5151    property FileMask : string read fFileMask write fFileMask ;
     
    7979  FileMask := FilterAll;
    8080  FileAttr := [ffaAnyFile];
    81   s := TStringList.Create;
     81  S := TStringList.Create;
    8282end;
    8383
    8484destructor TFindFile.Destroy;
    8585begin
    86   s.Free;
     86  S.Free;
    8787  inherited Destroy;
    8888end;
     
    101101function TFindFile.SearchForFiles: TStringList;
    102102begin
    103   s.Clear;
     103  S.Clear;
    104104  try
    105105    FileSearch(Path);
    106106  finally
    107     Result := s;
     107    Result := S;
    108108  end;
    109109end;
     
    111111procedure TFindFile.FileSearch(const InPath : string);
    112112var Rec  : TSearchRec;
    113     Attr : integer;
     113    Attr : Integer;
    114114begin
    115115  Attr := 0;
     
    125125  try
    126126    repeat
    127       s.Add(inPath + Rec.Name);
     127      S.Add(inPath + Rec.Name);
    128128    until SysUtils.FindNext(Rec) <> 0;
    129129  finally
  • trunk/Packages/Common/UFormAbout.pas

    r423 r447  
    8383end.
    8484
     85
  • trunk/Packages/Common/UGeometric.pas

    r424 r447  
    5252function PointToLineDistance(const P, V, W: TPoint): Integer;
    5353var
    54   l2, t: Double;
     54  l2, T: Double;
    5555  tt: TPoint;
    5656begin
     
    165165end.
    166166
     167
  • trunk/Packages/Common/UJobProgressView.pas

    r424 r447  
    221221      for I := 0 to ListViewJobs.Items.Count - 1 do
    222222      begin
    223         ItemRect := ListViewJobs.Items[i].DisplayRect(drBounds);
     223        ItemRect := ListViewJobs.Items[I].DisplayRect(drBounds);
    224224        Maxh := Max(Maxh, ItemRect.Top + (ItemRect.Bottom - ItemRect.Top));
    225225      end;
  • trunk/Packages/Common/UMetaCanvas.pas

    r424 r447  
    124124    procedure SetWidth(AValue: Integer); override;
    125125    function GetWidth: Integer; override;
    126     procedure DoLine (x1,y1,x2,y2:integer); override;
     126    procedure DoLine (x1,y1,x2,y2:Integer); override;
    127127    procedure DoTextOut(X, Y: Integer; Text: string); override;
    128128    procedure DoRectangle(const Bounds: TRect); override;
     
    451451end;
    452452
    453 procedure TMetaCanvas.DoLine(x1, y1, x2, y2: integer);
     453procedure TMetaCanvas.DoLine(x1, y1, x2, y2: Integer);
    454454var
    455455  NewObj: TCanvasLine;
     
    665665end.
    666666
     667
  • trunk/Packages/Common/UPrefixMultiplier.pas

    r423 r447  
    3030  BasePrefixMultipliers: TPrefixMultiplierDef =
    3131  (
    32     (ShortText: 'y'; FullText: 'yocto'; Value: 1e-24),
    33           (ShortText: 'z'; FullText: 'zepto'; Value: 1e-21),
    34     (ShortText: 'a'; FullText: 'atto'; Value: 1e-18),
    35     (ShortText: 'f'; FullText: 'femto'; Value: 1e-15),
    36     (ShortText: 'p'; FullText: 'piko'; Value: 1e-12),
    37     (ShortText: 'n'; FullText: 'nano'; Value: 1e-9),
    38     (ShortText: 'u'; FullText: 'mikro'; Value: 1e-6),
    39     (ShortText: 'm'; FullText: 'mili'; Value: 1e-3),
     32    (ShortText: 'y'; FullText: 'yocto'; Value: 1E-24),
     33          (ShortText: 'z'; FullText: 'zepto'; Value: 1E-21),
     34    (ShortText: 'a'; FullText: 'atto'; Value: 1E-18),
     35    (ShortText: 'f'; FullText: 'femto'; Value: 1E-15),
     36    (ShortText: 'p'; FullText: 'piko'; Value: 1E-12),
     37    (ShortText: 'n'; FullText: 'nano'; Value: 1E-9),
     38    (ShortText: 'u'; FullText: 'mikro'; Value: 1E-6),
     39    (ShortText: 'm'; FullText: 'mili'; Value: 1E-3),
    4040    (ShortText: ''; FullText: ''; Value: 1e0),
    4141    (ShortText: 'k'; FullText: 'kilo'; Value: 1e3),
     
    5151  TimePrefixMultipliers: TPrefixMultiplierDef =
    5252  (
    53     (ShortText: 'ys'; FullText: 'yocto'; Value: 1e-24),
    54           (ShortText: 'zs'; FullText: 'zepto'; Value: 1e-21),
    55     (ShortText: 'as'; FullText: 'atto'; Value: 1e-18),
    56     (ShortText: 'fs'; FullText: 'femto'; Value: 1e-15),
    57     (ShortText: 'ps'; FullText: 'piko'; Value: 1e-12),
    58     (ShortText: 'ns'; FullText: 'nano'; Value: 1e-9),
    59     (ShortText: 'us'; FullText: 'mikro'; Value: 1e-6),
    60     (ShortText: 'ms'; FullText: 'mili'; Value: 1e-3),
     53    (ShortText: 'ys'; FullText: 'yocto'; Value: 1E-24),
     54          (ShortText: 'zs'; FullText: 'zepto'; Value: 1E-21),
     55    (ShortText: 'as'; FullText: 'atto'; Value: 1E-18),
     56    (ShortText: 'fs'; FullText: 'femto'; Value: 1E-15),
     57    (ShortText: 'ps'; FullText: 'piko'; Value: 1E-12),
     58    (ShortText: 'ns'; FullText: 'nano'; Value: 1E-9),
     59    (ShortText: 'us'; FullText: 'mikro'; Value: 1E-6),
     60    (ShortText: 'ms'; FullText: 'mili'; Value: 1E-3),
    6161    (ShortText: 's'; FullText: 'sekunda'; Value: 1),
    6262    (ShortText: 'min'; FullText: 'minuta'; Value: 60),
  • trunk/Packages/Common/UResetableThread.pas

    r423 r447  
    296296end.
    297297
     298
  • trunk/Packages/Common/UScaleDPI.pas

    r424 r447  
    259259    begin
    260260      ImgList.Add(Temp[I], nil);
    261       Temp[i].Free;
     261      Temp[I].Free;
    262262    end;
    263263  finally
  • trunk/Packages/Common/UStringTable.pas

    r424 r447  
    3939function TStringTable.GetColCount: Integer;
    4040begin
    41   Result := Size.x;
     41  Result := Size.X;
    4242end;
    4343
  • trunk/Packages/Common/UTheme.pas

    r424 r447  
    188188
    189189end.
     190
  • trunk/Packages/Common/UTranslator.pas

    r424 r447  
    420420
    421421  if Lang = '' then begin
    422     for i := 1 to Paramcount - 1 do
    423       if (ParamStr(i) = '--LANG') or (ParamStr(i) = '-l') or
    424         (ParamStr(i) = '--lang') then
    425         Lang := ParamStr(i + 1);
     422    for I := 1 to Paramcount - 1 do
     423      if (ParamStr(I) = '--LANG') or (ParamStr(I) = '-l') or
     424        (ParamStr(I) = '--lang') then
     425        Lang := ParamStr(I + 1);
    426426  end;
    427427  if Lang = '' then begin
     
    473473      DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    474474    if FileExistsUTF8(Result) then
    475       exit;
     475      Exit;
    476476
    477477    Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator + LangID +
    478478      DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    479479    if FileExistsUTF8(Result) then
    480       exit;
     480      Exit;
    481481
    482482    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator
    483483      + LangID + DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    484484    if FileExistsUTF8(Result) then
    485       exit;
     485      Exit;
    486486
    487487    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator
     
    489489      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    490490    if FileExistsUTF8(Result) then
    491       exit;
     491      Exit;
    492492
    493493    {$IFDEF UNIX}
     
    496496      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    497497    if FileExistsUTF8(Result) then
    498       exit;
     498      Exit;
    499499    {$ENDIF}
    500500    // Let us search for reducted files
    501     LangShortID := copy(LangID, 1, 2);
     501    LangShortID := Copy(LangID, 1, 2);
    502502    // At first, check all was checked
    503503    Result := ExtractFilePath(ParamStrUTF8(0)) + LangShortID +
    504504      DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    505505    if FileExistsUTF8(Result) then
    506       exit;
     506      Exit;
    507507
    508508    Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator +
     
    510510      ExtractFileName(ParamStrUTF8(0)), LCExt);
    511511    if FileExistsUTF8(Result) then
    512       exit;
     512      Exit;
    513513
    514514    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator
     
    516516      ExtractFileName(ParamStrUTF8(0)), LCExt);
    517517    if FileExistsUTF8(Result) then
    518       exit;
     518      Exit;
    519519
    520520    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator
     
    522522      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    523523    if FileExistsUTF8(Result) then
    524       exit;
     524      Exit;
    525525
    526526    // Full language in file name - this will be default for the project
     
    529529      Result := ExtractFilePath(ParamStrUTF8(0)) + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt;
    530530      if FileExistsUTF8(Result) then
    531         exit;
     531        Exit;
    532532      // Common location (like in Lazarus)
    533533      Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator +
    534534        ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt;
    535535      if FileExistsUTF8(Result) then
    536         exit;
     536        Exit;
    537537
    538538      Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' +
    539539        DirectorySeparator + ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangID])) + LCExt;
    540540      if FileExistsUTF8(Result) then
    541         exit;
     541        Exit;
    542542    except
    543543      Result := ''; // Or do something else (useless)
     
    548548      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), LCExt);
    549549    if FileExistsUTF8(Result) then
    550       exit;
     550      Exit;
    551551    {$ENDIF}
    552552    Result := ExtractFilePath(ParamStrUTF8(0)) + ChangeFileExt(
    553553      ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt;
    554554    if FileExistsUTF8(Result) then
    555       exit;
     555      Exit;
    556556
    557557    Result := ExtractFilePath(ParamStrUTF8(0)) + 'locale' + DirectorySeparator +
    558558      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt;
    559559    if FileExistsUTF8(Result) then
    560       exit;
     560      Exit;
    561561
    562562    Result := ExtractFilePath(ParamStrUTF8(0)) + 'languages' + DirectorySeparator +
    563563      ChangeFileExt(ExtractFileName(ParamStrUTF8(0)), Format(FormatLang, [LangShortID])) + LCExt;
    564564    if FileExistsUTF8(Result) then
    565       exit;
     565      Exit;
    566566  end;
    567567
Note: See TracChangeset for help on using the changeset viewer.