Changeset 74


Ignore:
Timestamp:
Dec 17, 2016, 6:33:13 PM (8 years ago)
Author:
chronos
Message:
  • Added: Main application icon.
  • Modified: Updated Command and CoolTranslator packages.
  • Added: About dialog.
Location:
trunk
Files:
5 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r73 r74  
    55  Width = 860
    66  Caption = 'LazFuck'
    7   ClientHeight = 561
     7  ClientHeight = 554
    88  ClientWidth = 860
    99  Menu = MainMenu1
     
    1818    Left = 0
    1919    Height = 28
    20     Top = 533
     20    Top = 526
    2121    Width = 860
    2222    Panels = <   
     
    131131  object PageControlRight: TPageControl
    132132    Left = 467
    133     Height = 507
     133    Height = 500
    134134    Top = 26
    135135    Width = 393
     
    141141    object TabSheetDebug: TTabSheet
    142142      Caption = 'Debug'
    143       ClientHeight = 499
    144       ClientWidth = 359
     143      ClientHeight = 494
     144      ClientWidth = 319
    145145      object PanelInput: TPanel
    146146        Left = 0
    147147        Height = 64
    148148        Top = 0
    149         Width = 359
     149        Width = 319
    150150        Align = alTop
    151151        BevelOuter = bvNone
     
    157157        Height = 5
    158158        Top = 64
    159         Width = 359
     159        Width = 319
    160160        Align = alTop
    161161        ResizeAnchor = akTop
     
    165165        Height = 259
    166166        Top = 69
    167         Width = 359
     167        Width = 319
    168168        Align = alTop
    169169        BevelOuter = bvNone
     
    175175        Height = 5
    176176        Top = 328
    177         Width = 359
     177        Width = 319
    178178        Align = alTop
    179179        ResizeAnchor = akTop
     
    183183        Height = 86
    184184        Top = 333
    185         Width = 359
     185        Width = 319
    186186        Align = alTop
    187187        BevelOuter = bvNone
     
    193193        Height = 5
    194194        Top = 419
    195         Width = 359
     195        Width = 319
    196196        Align = alTop
    197197        ResizeAnchor = akTop
     
    199199      object PanelMemory: TPanel
    200200        Left = 0
    201         Height = 75
     201        Height = 70
    202202        Top = 424
    203         Width = 359
     203        Width = 319
    204204        Align = alClient
    205205        BevelOuter = bvNone
     
    210210  object Splitter1: TSplitter
    211211    Left = 462
    212     Height = 507
     212    Height = 500
    213213    Top = 26
    214214    Width = 5
     
    218218  object PanelLeft: TPanel
    219219    Left = 0
    220     Height = 507
     220    Height = 500
    221221    Top = 26
    222222    Width = 462
    223223    Align = alClient
    224224    BevelOuter = bvNone
    225     ClientHeight = 507
     225    ClientHeight = 500
    226226    ClientWidth = 462
    227227    TabOrder = 4
    228228    object PageControlMain: TPageControl
    229229      Left = 0
    230       Height = 384
     230      Height = 377
    231231      Top = 0
    232232      Width = 462
     
    246246      Left = 0
    247247      Height = 118
    248       Top = 389
     248      Top = 382
    249249      Width = 462
    250250      ActivePage = TabSheetMessages
     
    261261      Left = 0
    262262      Height = 5
    263       Top = 384
     263      Top = 377
    264264      Width = 462
    265265      Align = alBottom
     
    10051005    object AAbout: TAction
    10061006      Caption = 'About'
     1007      OnExecute = AAboutExecute
    10071008    end
    10081009    object AHelp: TAction
  • trunk/Forms/UFormMain.pas

    r73 r74  
    113113    ToolButton8: TToolButton;
    114114    ToolButton9: TToolButton;
     115    procedure AAboutExecute(Sender: TObject);
    115116    procedure ABreakpointToggleExecute(Sender: TObject);
    116117    procedure AExitExecute(Sender: TObject);
     
    170171  UCore, UFormCPU, UFormOptions, UFormMessages, UFormTargets, UFormOutput, UFormInput,
    171172  UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter, UFormLog,
    172   UBFTarget;
     173  UBFTarget, UFormAbout;
    173174
    174175resourcestring
     
    187188procedure TFormMain.FormShow(Sender: TObject);
    188189begin
     190  // TODO: Transparent image scaling not working properly under linux Gtk2
     191  // Also screen DPI is not correctly detected under linux Gtk2
     192  {$IFDEF WINDOWS}
    189193  with Core.ScaleDPI do begin
    190194    ApplyToAll(DesignDPI);
    191195    ScaleImageList(ImageListMain, DesignDPI);
    192196  end;
     197  {$ENDIF}
     198
    193199  Core.CoolTranslator1.Translate;
    194200  LoadFromRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey);
     
    503509end;
    504510
     511procedure TFormMain.AAboutExecute(Sender: TObject);
     512begin
     513  FormAbout := TFormAbout.Create(nil);
     514  try
     515    FormAbout.ApplicationInfo := Core.ApplicationInfo;
     516    FormAbout.CoolTranslator := Core.CoolTranslator1;
     517    FormAbout.ShowModal;
     518  finally
     519    FreeAndNil(FormAbout);
     520  end;
     521end;
     522
    505523procedure TFormMain.AProgramPauseExecute(Sender: TObject);
    506524begin
  • trunk/Languages/LazFuckIDE.cs.po

    r72 r74  
    2828msgstr "Form3"
    2929
     30#: tformabout.buttonclose.caption
     31#, fuzzy
     32msgctxt "tformabout.buttonclose.caption"
     33msgid "Close"
     34msgstr "Zavřít"
     35
     36#: tformabout.buttonhomepage.caption
     37msgid "Home page"
     38msgstr ""
     39
     40#: tformabout.caption
     41#, fuzzy
     42msgctxt "tformabout.caption"
     43msgid "About"
     44msgstr "O programu"
     45
     46#: tformabout.labelappname.caption
     47#, fuzzy
     48msgctxt "tformabout.labelappname.caption"
     49msgid "LazFuck"
     50msgstr "LazFuck"
     51
     52#: tformabout.labelcontent.caption
     53#, fuzzy
     54msgctxt "tformabout.labelcontent.caption"
     55msgid "   "
     56msgstr "   "
     57
     58#: tformabout.labeldescription.caption
     59msgid "Simple BrainFuck IDE written in Lazarus/FPC."
     60msgstr ""
     61
    3062#: tformcompilers.caption
    3163msgctxt "tformcompilers.caption"
     
    826858msgstr "Cesta překladače"
    827859
     860#: uformabout.slicense
     861msgid "License"
     862msgstr ""
     863
     864#: uformabout.sreleasedate
     865msgid "Release date"
     866msgstr ""
     867
     868#: uformabout.sversion
     869msgid "Version"
     870msgstr ""
     871
    828872#: uformcpu.sstepspersecond
    829873msgctxt "uformcpu.sstepspersecond"
  • trunk/Languages/LazFuckIDE.po

    r72 r74  
    1818msgstr ""
    1919
     20#: tformabout.buttonclose.caption
     21msgctxt "TFORMABOUT.BUTTONCLOSE.CAPTION"
     22msgid "Close"
     23msgstr ""
     24
     25#: tformabout.buttonhomepage.caption
     26msgid "Home page"
     27msgstr ""
     28
     29#: tformabout.caption
     30msgctxt "TFORMABOUT.CAPTION"
     31msgid "About"
     32msgstr ""
     33
     34#: tformabout.labelappname.caption
     35msgctxt "TFORMABOUT.LABELAPPNAME.CAPTION"
     36msgid "LazFuck"
     37msgstr ""
     38
     39#: tformabout.labelcontent.caption
     40msgctxt "TFORMABOUT.LABELCONTENT.CAPTION"
     41msgid "   "
     42msgstr ""
     43
     44#: tformabout.labeldescription.caption
     45msgid "Simple BrainFuck IDE written in Lazarus/FPC."
     46msgstr ""
     47
    2048#: tformcompilers.caption
    2149msgctxt "tformcompilers.caption"
     
    813841msgstr ""
    814842
     843#: uformabout.slicense
     844msgid "License"
     845msgstr ""
     846
     847#: uformabout.sreleasedate
     848msgid "Release date"
     849msgstr ""
     850
     851#: uformabout.sversion
     852msgid "Version"
     853msgstr ""
     854
    815855#: uformcpu.sstepspersecond
    816856msgctxt "uformcpu.sstepspersecond"
  • trunk/LazFuckIDE.lpi

    r72 r74  
    9797      </Item6>
    9898    </RequiredPackages>
    99     <Units Count="23">
     99    <Units Count="24">
    100100      <Unit0>
    101101        <Filename Value="LazFuckIDE.lpr"/>
     
    228228        <IsPartOfProject Value="True"/>
    229229      </Unit22>
     230      <Unit23>
     231        <Filename Value="Forms\UFormAbout.pas"/>
     232        <IsPartOfProject Value="True"/>
     233        <ComponentName Value="FormAbout"/>
     234        <HasResources Value="True"/>
     235        <ResourceBaseClass Value="Form"/>
     236      </Unit23>
    230237    </Units>
    231238  </ProjectOptions>
  • trunk/LazFuckIDE.lpr

    r67 r74  
    55uses
    66  {$IFDEF UNIX}//{$IFDEF UseCThreads}
    7   cthreads,
     7  cthreads, clocale,
    88  //{$ENDIF}
    99  {$ENDIF}
  • trunk/Packages/Common/UCommon.pas

    r73 r74  
    66
    77uses
    8   {$IFDEF Windows}Windows,{$ENDIF}
     8  {$ifdef Windows}Windows,{$endif}
     9  {$ifdef Linux}baseunix,{$endif}
    910  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf,
    1011  FileUtil; //, ShFolder, ShellAPI;
     
    6970function GetDirCount(Dir: string): Integer;
    7071function MergeArray(A, B: array of string): TArrayOfString;
     72function LoadFileToStr(const FileName: TFileName): AnsiString;
    7173
    7274
     
    305307  end;
    306308end;
     309{$endif}
    307310
    308311function ComputerName: string;
     
    324327{$endif}
    325328{$ifdef unix}
    326 begin
    327   Result := GetHostName;
     329var
     330  Name: UtsName;
     331begin
     332  fpuname(Name);
     333  Result := Name.Nodename;
    328334end;
    329335{$endif}
    330336
     337{$ifdef windows}
    331338function LoggedOnUserNameEx(Format: TUserNameFormat): string;
    332339const
     
    443450
    444451procedure OpenWebPage(URL: string);
    445 var
    446   Process: TProcess;
    447   Browser, Params: string;
    448452begin
    449453  OpenURL(URL);
    450   {try
    451     Process := TProcess.Create(nil);
    452     Browser := '';
    453     //FindDefaultBrowser(Browser, Params);
    454     //Process.Executable := Browser;
    455     //Process.Parameters.Add(Format(Params, [ApplicationInfo.HomePage]);
    456     Process.CommandLine := 'cmd.exe /c start ' + URL;
    457     Process.Options := [poNoConsole];
    458     Process.Execute;
    459   finally
    460     Process.Free;
    461   end;}
    462454end;
    463455
     
    501493end;
    502494
     495function LoadFileToStr(const FileName: TFileName): AnsiString;
     496var
     497  FileStream: TFileStream;
     498  Read: Integer;
     499begin
     500  Result := '';
     501  FileStream := TFileStream.Create(FileName, fmOpenRead);
     502  try
     503    if FileStream.Size > 0 then begin
     504      SetLength(Result, FileStream.Size);
     505      Read := FileStream.Read(Pointer(Result)^, FileStream.Size);
     506      SetLength(Result, Read);
     507    end;
     508  finally
     509    FileStream.Free;
     510  end;
     511end;
     512
    503513
    504514
  • trunk/Packages/Common/UPersistentForm.pas

    r73 r74  
    88
    99uses
    10   Classes, SysUtils, Forms, URegistry, LCLIntf, Registry;
     10  Classes, SysUtils, Forms, URegistry, LCLIntf, Registry, Controls, ComCtrls;
    1111
    1212type
     
    1919    FMinVisiblePart: Integer;
    2020    FRegistryContext: TRegistryContext;
     21    procedure LoadControl(Control: TControl);
     22    procedure SaveControl(Control: TControl);
    2123  public
    2224    FormNormalSize: TRect;
     
    4951
    5052{ TPersistentForm }
     53
     54procedure TPersistentForm.LoadControl(Control: TControl);
     55var
     56  I: Integer;
     57  WinControl: TWinControl;
     58  Count: Integer;
     59begin
     60  if Control is TListView then begin
     61    with Form, TRegistryEx.Create do
     62    try
     63      RootKey := RegistryContext.RootKey;
     64      OpenKey(RegistryContext.Key + '\Forms\' + Form.Name + '\' + Control.Name, True);
     65      for I := 0 to TListView(Control).Columns.Count - 1 do begin
     66        if ValueExists('ColWidth' + IntToStr(I)) then
     67          TListView(Control).Columns[I].Width := ReadInteger('ColWidth' + IntToStr(I));
     68      end;
     69    finally
     70      Free;
     71    end;
     72  end;
     73
     74  if Control is TWinControl then begin
     75    WinControl := TWinControl(Control);
     76    if WinControl.ControlCount > 0 then begin
     77      for I := 0 to WinControl.ControlCount - 1 do begin
     78        if WinControl.Controls[I] is TControl then begin
     79          LoadControl(WinControl.Controls[I]);
     80        end;
     81      end;
     82    end;
     83  end;
     84end;
     85
     86procedure TPersistentForm.SaveControl(Control: TControl);
     87var
     88  I: Integer;
     89  WinControl: TWinControl;
     90begin
     91  if Control is TListView then begin
     92    with Form, TRegistryEx.Create do
     93    try
     94      RootKey := RegistryContext.RootKey;
     95      OpenKey(RegistryContext.Key + '\Forms\' + Form.Name + '\' + Control.Name, True);
     96      for I := 0 to TListView(Control).Columns.Count - 1 do begin
     97        WriteInteger('ColWidth' + IntToStr(I), TListView(Control).Columns[I].Width);
     98      end;
     99    finally
     100      Free;
     101    end;
     102  end;
     103
     104  if Control is TWinControl then begin
     105      WinControl := TWinControl(Control);
     106      if WinControl.ControlCount > 0 then begin
     107        for I := 0 to WinControl.ControlCount - 1 do begin
     108          if WinControl.Controls[I] is TControl then begin
     109            SaveControl(WinControl.Controls[I]);
     110          end;
     111        end;
     112      end;
     113    end;
     114end;
    51115
    52116procedure TPersistentForm.LoadFromRegistry(RegistryContext: TRegistryContext);
     
    181245      Form.BoundsRect := FormNormalSize;
    182246  end;
     247  LoadControl(Form);
    183248end;
    184249
     
    191256  FormWindowState := Form.WindowState;
    192257  SaveToRegistry(RegistryContext);
     258  SaveControl(Form);
    193259end;
    194260
  • trunk/Packages/Common/UScaleDPI.pas

    r73 r74  
    309309  end;
    310310
     311  if Control is TCoolBar then
     312  with TCoolBar(Control) do begin
     313    BeginUpdate;
     314    for I := 0 to Bands.Count - 1 do
     315      with Bands[I] do begin
     316        MinWidth := ScaleX(MinWidth, FromDPI.X);
     317        MinHeight := ScaleY(MinHeight, FromDPI.Y);
     318        Width := ScaleX(Width, FromDPI.X);
     319        //Control.Invalidate;
     320      end;
     321    EndUpdate;
     322  end;
     323
    311324  if Control is TToolBar then begin
    312325    ToolBarControl := TToolBar(Control);
  • trunk/Packages/CoolTranslator/UCoolTranslator.pas

    r72 r74  
    66
    77uses
    8   Classes, SysUtils, Forms, ExtCtrls, Controls, Contnrs,
    9   Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType,
    10   LazFileUtils, LazUTF8;
     8  Classes, SysUtils, Forms, ExtCtrls, Controls, Contnrs, LazFileUtils, LazUTF8,
     9  Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType;
    1110
    1211type
     
    4746    procedure TranslateProperty(Component: TPersistent; PropInfo: PPropInfo);
    4847    function IsExcluded(Component: TPersistent; PropertyName: string): Boolean;
     48    function GetLangFileDir: string;
    4949  public
    5050    ComponentExcludes: TComponentExcludesList;
    5151    Languages: TLanguageList;
     52    procedure Translate;
    5253    procedure LanguageListToStrings(Strings: TStrings);
    53     procedure Translate;
    5454    procedure TranslateResourceStrings(PoFileName: string);
    5555    procedure TranslateUnitResourceStrings(UnitName: string; PoFileName: string);
     
    151151  I: Integer;
    152152  LocaleShort: string;
     153  SearchMask: string;
    153154begin
    154155  FPOFiles.Clear;
     
    158159    //ShowMessage(ExtractFileDir(Application.ExeName) +
    159160    //  DirectorySeparator + 'Languages' + ' ' + '*.' + LocaleShort + '.po');
    160     FileList := FindAllFiles(ExtractFileDir(UTF8Encode(Application.ExeName)) +
    161       DirectorySeparator + FPOFilesFolder, '*.' + LocaleShort + '.po');
     161    SearchMask := '*';
     162    if LocaleShort <> '' then SearchMask := SearchMask + '.' + LocaleShort;
     163    SearchMask := SearchMask + '.po';
     164    FileList := FindAllFiles(GetLangFileDir, SearchMask);
    162165    for I := 0 to FileList.Count - 1 do begin
    163166      FileName := FileList[I];
    164167      //FileName := FindLocaleFileName('.po');
    165       if FileExistsUTF8(FileName) then FPOFiles.Add(TPOFile.Create(FileName));
     168      if FileExists(FileName) and (
     169      ((LocaleShort = '') and (Pos('.', FileName) = Pos('.po', FileName))) or
     170      (LocaleShort <> '')) then FPOFiles.Add(TPOFile.Create(FileName));
    166171    end;
    167172  finally
     
    175180  FPoFilesFolder := AValue;
    176181  ReloadFiles;
     182  CheckLanguageFiles;
    177183end;
    178184
     
    191197  PropInfo: PPropInfo;
    192198  PropList: PPropList;
     199  Excludes: TComponentExcludes;
    193200begin
    194201  Count := GetTypeData(Component.ClassInfo)^.PropCount;
     
    243250          if (UpperCase(PropType.Name) = 'TTRANSLATESTRING') then
    244251          //if not IsExcluded(Component, PropInfo^.Name) then
    245               SetStrProp(Component, PropInfo, TranslateText(PropInfo^.Name, GetStrProp(Component, PropInfo)));
     252              SetStrProp(Component, PropInfo, TranslateText(PropInfo^.Name, GetWideStrProp(Component, PropInfo)));
    246253        end;
    247254        tkClass: begin
     
    284291end;
    285292
     293function TCoolTranslator.GetLangFileDir: string;
     294begin
     295  Result := FPOFilesFolder;
     296  if Copy(Result, 1, 1) <> DirectorySeparator then
     297    Result := ExtractFileDir(UTF8Encode(Application.ExeName)) +
     298      DirectorySeparator + Result;
     299end;
     300
    286301procedure TCoolTranslator.LanguageListToStrings(Strings: TStrings);
    287302var
     
    316331  I: Integer;
    317332begin
     333  Result := '';
    318334  if Text <> '' then begin
    319335    for I := 0 to FPoFiles.Count - 1 do begin
     
    342358var
    343359  I: Integer;
    344 begin
     360  LangDir: string;
     361begin
     362  LangDir := GetLangFileDir;
    345363  TLanguage(Languages[0]).Available := True; // Automatic
    346364
    347365  for I := 1 to Languages.Count - 1 do
    348366  with TLanguage(Languages[I]) do begin
    349     Available := FileExistsUTF8(POFilesFolder + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
     367    Available := FileExists(LangDir + DirectorySeparator + ExtractFileNameOnly(Application.ExeName) +
    350368      '.' + Code + ExtensionSeparator + 'po') or (Code = 'en');
    351369  end;
     
    381399  T: string;
    382400begin
    383   T := '';
    384 
    385401  // Win32 user may decide to override locale with LANG variable.
    386   Lang := GetEnvironmentVariableUTF8('LANG');
     402  Lang := GetEnvironmentVariable('LANG');
    387403
    388404  // Use user selected language
     
    392408  if Lang = '' then begin
    393409    for i := 1 to Paramcount - 1 do
    394       if (ParamStrUTF8(i) = '--LANG') or (ParamStrUTF8(i) = '-l') or
    395         (ParamStrUTF8(i) = '--lang') then
    396         Lang := ParamStrUTF8(i + 1);
     410      if (ParamStr(i) = '--LANG') or (ParamStr(i) = '-l') or
     411        (ParamStr(i) = '--lang') then
     412        Lang := ParamStr(i + 1);
    397413  end;
    398414  if Lang = '' then
    399     LazGetLanguageIDs(Lang, T);
     415    LCLGetLanguageIDs(Lang, T);
    400416
    401417  if Assigned(Language) and (Language.Code = '') and Assigned(FOnAutomaticLanguage) then begin
     
    403419  end;
    404420
    405   if Lang = 'en' then Lang := ''; // English files are without en code
    406 
    407421  Result := Lang;
    408422end;
     
    415429function TCoolTranslator.FindLocaleFileName(LCExt: string): string;
    416430var
     431  T: string;
    417432  Lang: string;
    418433begin
     
    424439    Exit;
    425440
    426   Result := ChangeFileExt(ParamStrUTF8(0), LCExt);
     441  Result := ChangeFileExt(ParamStr(0), LCExt);
    427442  if FileExistsUTF8(Result) then
    428443    Exit;
  • trunk/UCore.lfm

    r73 r74  
    1919    EmailContact = 'robie@centrum.cz'
    2020    AppName = 'LazFuck'
    21     ReleaseDate = 41116
     21    ReleaseDate = 42721
    2222    RegistryKey = '\Software\Chronosoft\LazFuck'
    2323    RegistryRoot = rrKeyCurrentUser
     24    License = 'CC0'
    2425    left = 72
    2526    top = 16
Note: See TracChangeset for help on using the changeset viewer.