Changeset 332 for trunk


Ignore:
Timestamp:
Aug 27, 2024, 3:48:44 PM (3 months ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
Location:
trunk
Files:
7 added
3 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Languages/xtactics.cs.po

    r330 r332  
    197197"Jednotky lze přesouvat kliknutím na vlastněnou buňku a pak kliknutím na cílovou neutrální nebo nepřátelskou buňku. Přesuny lze nastavit jako opakující se každá tak s určeným počtem jednotek. Opakující se přesuny jednotek lze nastavit v okně Přesun jednotek nebo jednoduše pomocí držení klávesy Control při výběru cílové buňky. Pokud je více přesunů z jedené buňky do více jiných a chcete přesunout všechny dostupné do cílové buňky, tak to můžete provést pomocí držení klávesy Shift a výběru cílové buňky."
    198198
    199 #: formkeyshortcuts.sglobal
    200 msgctxt "formkeyshortcuts.sglobal"
    201 msgid "Global"
    202 msgstr "Globální"
    203 
    204 #: formkeyshortcuts.smainform
    205 msgctxt "formkeyshortcuts.smainform"
    206 msgid "Main window"
    207 msgstr "Hlavní okno"
    208 
    209199#: formlist.snew
    210200msgctxt "formlist.snew"
     
    801791msgstr "Položka"
    802792
    803 #: tformkeyshortcuts.caption
    804 msgctxt "tformkeyshortcuts.caption"
    805 msgid "Key shortcuts"
    806 msgstr "Klávesové zkratky"
    807 
    808 #: tformkeyshortcuts.listview1.columns[0].caption
    809 msgid "Action"
    810 msgstr "Akce"
    811 
    812 #: tformkeyshortcuts.listview1.columns[1].caption
    813 msgid "Window"
    814 msgstr "Okno"
    815 
    816 #: tformkeyshortcuts.listview1.columns[2].caption
    817 msgid "Shortcut"
    818 msgstr "Zkratka"
    819 
    820 #: tformkeyshortcuts.menuitem1.caption
    821 msgid "Execute"
    822 msgstr "Vykonat"
    823 
    824793#: tformlist.aadd.caption
    825794msgctxt "tformlist.aadd.caption"
     
    13611330msgid "View range"
    13621331msgstr "Dohled"
     1332
  • trunk/Languages/xtactics.pot

    r330 r332  
    179179msgstr ""
    180180
    181 #: formkeyshortcuts.sglobal
    182 msgctxt "formkeyshortcuts.sglobal"
    183 msgid "Global"
    184 msgstr ""
    185 
    186 #: formkeyshortcuts.smainform
    187 msgctxt "formkeyshortcuts.smainform"
    188 msgid "Main window"
    189 msgstr ""
    190 
    191181#: formlist.snew
    192182msgctxt "formlist.snew"
     
    777767msgstr ""
    778768
    779 #: tformkeyshortcuts.caption
    780 msgctxt "tformkeyshortcuts.caption"
    781 msgid "Key shortcuts"
    782 msgstr ""
    783 
    784 #: tformkeyshortcuts.listview1.columns[0].caption
    785 msgid "Action"
    786 msgstr ""
    787 
    788 #: tformkeyshortcuts.listview1.columns[1].caption
    789 msgid "Window"
    790 msgstr ""
    791 
    792 #: tformkeyshortcuts.listview1.columns[2].caption
    793 msgid "Shortcut"
    794 msgstr ""
    795 
    796 #: tformkeyshortcuts.menuitem1.caption
    797 msgid "Execute"
    798 msgstr ""
    799 
    800769#: tformlist.aadd.caption
    801770msgctxt "tformlist.aadd.caption"
  • trunk/Packages/Common/Common.lpk

    r315 r332  
    4343    <License Value="Copy left."/>
    4444    <Version Minor="12"/>
    45     <Files Count="36">
     45    <Files Count="37">
    4646      <Item1>
    4747        <Filename Value="StopWatch.pas"/>
     
    201201        <UnitName Value="FormAbout"/>
    202202      </Item36>
     203      <Item37>
     204        <Filename Value="Forms\FormKeyShortcuts.pas"/>
     205        <UnitName Value="FormKeyShortcuts"/>
     206      </Item37>
    203207    </Files>
    204208    <CompatibilityMode Value="True"/>
  • trunk/Packages/Common/Common.pas

    r328 r332  
    5555function EndsWith(Text, What: string): Boolean;
    5656function Explode(Separator: Char; Data: string): TStringArray;
    57 procedure ExecuteProgram(Executable: string; Parameters: array of string);
     57procedure ExecuteProgram(Executable: string; Parameters: array of string;
     58  Environment: array of string; CurrentDirectory: string = '');
     59procedure ExecuteProgramOutput(Executable: string; Parameters: array of string;
     60  Environment: array of string; out Output, Error: string;
     61  out ExitCode: Integer; CurrentDirectory: string = '');
    5862procedure FileDialogUpdateFilterFileType(FileDialog: TOpenDialog);
    5963procedure FreeThenNil(var Obj);
     
    6367function GetBit(Variable: QWord; Index: Byte): Boolean;
    6468function GetStringPart(var Text: string; Separator: string): string;
     69function GetEnvironmentVariables: TStringArray;
    6570function GenerateNewName(OldName: string): string;
    6671function GetFileFilterItemExt(Filter: string; Index: Integer): string;
    6772function IntToBin(Data: Int64; Count: Byte): string;
    68 function Implode(Separator: string; List: TList<string>): string;
    69 function Implode(Separator: string; List: TStringList; Around: string = ''): string;
     73function Implode(Separator: string; List: TList<string>): string; overload;
     74function Implode(Separator: string; List: array of string): string; overload;
     75function Implode(Separator: string; List: TStringList; Around: string = ''): string; overload;
    7076function LastPos(const SubStr: String; const S: String): Integer;
    7177function LoadFileToStr(const FileName: TFileName): AnsiString;
     
    98104implementation
    99105
     106resourcestring
     107  SExecutionError = 'Excution error: %s (exit code: %d)';
     108
    100109function StartsWith(Text, What: string): Boolean;
    101110begin
     
    108117end;
    109118
    110 function BinToInt(BinStr : string) : Int64;
    111 var
    112   i : byte;
    113   RetVar : Int64;
     119function BinToInt(BinStr: string): Int64;
     120var
     121  I: Byte;
     122  RetVar: Int64;
    114123begin
    115124  BinStr := UpperCase(BinStr);
    116   if BinStr[length(BinStr)] = 'B' then Delete(BinStr,length(BinStr),1);
     125  if BinStr[length(BinStr)] = 'B' then Delete(BinStr, Length(BinStr), 1);
    117126  RetVar := 0;
    118   for i := 1 to length(BinStr) do begin
    119     if not (BinStr[i] in ['0','1']) then begin
     127  for I := 1 to Length(BinStr) do begin
     128    if not (BinStr[I] in ['0','1']) then begin
    120129      RetVar := 0;
    121130      Break;
    122131    end;
    123     RetVar := (RetVar shl 1) + (byte(BinStr[i]) and 1) ;
     132    RetVar := (RetVar shl 1) + (Byte(BinStr[I]) and 1);
    124133  end;
    125134
     
    136145  end;
    137146end;
    138 
    139147
    140148procedure DeleteFiles(APath, AFileSpec: string);
     
    154162  FindClose(SearchRec);
    155163end;
    156 
    157164
    158165function GetFileFilterItemExt(Filter: string; Index: Integer): string;
     
    177184  if FileExt <> '.*' then
    178185    FileDialog.FileName := ChangeFileExt(FileDialog.FileName, FileExt)
     186end;
     187
     188function GetEnvironmentVariables: TStringArray;
     189var
     190  I: Integer;
     191begin
     192  Result := Default(TStringArray);
     193  SetLength(Result, GetEnvironmentVariableCount);
     194  for I := 0 to GetEnvironmentVariableCount - 1 do
     195    Result[I] := GetEnvironmentString(I);
    179196end;
    180197
     
    219236end;*)
    220237
     238function Implode(Separator: string; List: array of string): string;
     239var
     240  I: Integer;
     241begin
     242  Result := '';
     243  for I := 0 to Length(List) - 1 do begin
     244    Result := Result + List[I];
     245    if I < Length(List) - 1 then Result := Result + Separator;
     246  end;
     247end;
     248
    221249function Implode(Separator: string; List: TStringList; Around: string = ''): string;
    222250var
     
    494522end;
    495523
    496 procedure ExecuteProgram(Executable: string; Parameters: array of string);
     524procedure ExecuteProgram(Executable: string; Parameters: array of string;
     525  Environment: array of string; CurrentDirectory: string = '');
    497526var
    498527  Process: TProcess;
    499528  I: Integer;
    500529begin
     530  Process := TProcess.Create(nil);
    501531  try
    502     Process := TProcess.Create(nil);
    503532    Process.Executable := Executable;
    504533    for I := 0 to Length(Parameters) - 1 do
    505534      Process.Parameters.Add(Parameters[I]);
     535    for I := 0 to Length(Environment) - 1 do
     536      Process.Environment.Add(Environment[I]);
     537    Process.CurrentDirectory := CurrentDirectory;
     538    Process.ShowWindow := swoHIDE;
    506539    Process.Options := [poNoConsole];
    507540    Process.Execute;
     
    511544end;
    512545
     546procedure ExecuteProgramOutput(Executable: string; Parameters: array of string;
     547  Environment: array of string; out Output, Error: string; out ExitCode: Integer;
     548  CurrentDirectory: string);
     549var
     550  Process: TProcess;
     551  I: Integer;
     552  ReadCount: Integer;
     553  Buffer: string;
     554const
     555  BufferSize = 1000;
     556begin
     557  Process := TProcess.Create(nil);
     558  try
     559    Process.Executable := Executable;
     560    for I := 0 to Length(Parameters) - 1 do
     561      Process.Parameters.Add(Parameters[I]);
     562    for I := 0 to Length(Environment) - 1 do
     563      Process.Environment.Add(Environment[I]);
     564    Process.CurrentDirectory := CurrentDirectory;
     565    Process.ShowWindow := swoHIDE;
     566    Process.Options := [poNoConsole, poUsePipes];
     567    Process.Execute;
     568
     569    Output := '';
     570    Error := '';
     571    Buffer := '';
     572    SetLength(Buffer, BufferSize);
     573    while Process.Running do begin
     574      if Process.Output.NumBytesAvailable > 0 then begin
     575        ReadCount := Process.Output.Read(Buffer[1], Length(Buffer));
     576        Output := Output + Copy(Buffer, 1, ReadCount);
     577      end;
     578
     579      if Process.Stderr.NumBytesAvailable > 0 then begin
     580        ReadCount := Process.Stderr.Read(Buffer[1], Length(Buffer));
     581        Error := Error + Copy(Buffer, 1, ReadCount)
     582      end;
     583
     584      Sleep(10);
     585    end;
     586
     587    if Process.Output.NumBytesAvailable > 0 then begin
     588      ReadCount := Process.Output.Read(Buffer[1], Length(Buffer));
     589      Output := Output + Copy(Buffer, 1, ReadCount);
     590    end;
     591
     592    if Process.Stderr.NumBytesAvailable > 0 then begin
     593      ReadCount := Process.Stderr.Read(Buffer[1], Length(Buffer));
     594      Error := Error + Copy(Buffer, 1, ReadCount);
     595    end;
     596
     597    ExitCode := Process.ExitCode;
     598
     599    if (ExitCode <> 0) or (Error <> '') then
     600      raise Exception.Create(Format(SExecutionError, [Output + Error, ExitCode]));
     601  finally
     602    Process.Free;
     603  end;
     604end;
     605
    513606procedure FreeThenNil(var Obj);
    514607begin
     
    529622procedure OpenFileInShell(FileName: string);
    530623begin
    531   ExecuteProgram('cmd.exe', ['/c', 'start', FileName]);
     624  ExecuteProgram('cmd.exe', ['/c', 'start', FileName], []);
    532625end;
    533626
  • trunk/Packages/Common/CommonPackage.pas

    r315 r332  
    1414  ScaleDPI, Theme, StringTable, MetaCanvas, Geometric, Translator, Languages,
    1515  PixelPointer, DataFile, TestCase, Generics, Table, FormEx, FormTests,
    16   FormTest, FormAbout, LazarusPackageIntf;
     16  FormTest, FormAbout, FormKeyShortcuts, LazarusPackageIntf;
    1717
    1818implementation
  • trunk/Packages/Common/FormEx.pas

    r328 r332  
    8282procedure TFormEx.DoClose(var CloseAction: TCloseAction);
    8383begin
    84   if  (not (csDesigning in ComponentState)) then begin
     84  if (not (csDesigning in ComponentState)) then begin
    8585    PersistentForm.FormFullScreen := FullScreen;
    8686    PersistentForm.Save(Self);
  • trunk/Packages/Common/ListViewSort.pas

    r315 r332  
    358358    List.Clear;
    359359    List.AddRange(Source);
    360   end else List.Clear;
     360  end;
    361361  if ListView.Items.Count <> List.Count then
    362362    ListView.Items.Count := List.Count;
  • trunk/Packages/Common/PersistentForm.pas

    r328 r332  
    336336    end;
    337337    Form.OnWindowStateChange := OldHandler;
     338    FormFullScreen := True;
    338339    {$ENDIF}
    339340  end else begin
  • trunk/Packages/Common/Table.pas

    r315 r332  
    44
    55uses
    6   Classes, SysUtils, Generics.Collections, ComCtrls, XMLRead, XMLWrite, DOM;
     6  Classes, SysUtils, Generics.Collections, ComCtrls, XMLRead, DOM;
    77
    88type
Note: See TracChangeset for help on using the changeset viewer.