Changeset 133 for trunk


Ignore:
Timestamp:
Mar 4, 2022, 10:57:08 PM (2 years ago)
Author:
chronos
Message:
  • Added: Compile multiple action for compilation of code with mutliple compilers at once.
Location:
trunk
Files:
4 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r131 r133  
    11object FormMain: TFormMain
    22  Left = 430
    3   Height = 703
     3  Height = 732
    44  Top = 249
    5   Width = 1032
     5  Width = 1075
    66  Caption = 'LazFuck'
    7   ClientHeight = 669
    8   ClientWidth = 1032
    9   DesignTimePPI = 144
     7  ClientHeight = 697
     8  ClientWidth = 1075
     9  DesignTimePPI = 150
    1010  Menu = MainMenu1
    1111  OnClose = FormClose
     
    1818  object StatusBarMain: TStatusBar
    1919    Left = 0
    20     Height = 27
    21     Top = 642
    22     Width = 1032
     20    Height = 28
     21    Top = 669
     22    Width = 1075
    2323    Panels = <   
    2424      item
    25         Width = 84
     25        Width = 88
    2626      end   
    2727      item
    28         Width = 84
     28        Width = 88
    2929      end   
    3030      item
    31         Width = 96
     31        Width = 100
    3232      end>
    3333    ParentFont = False
     
    3636  object ToolBarMain: TToolBar
    3737    Left = 0
    38     Height = 33
     38    Height = 34
    3939    Top = 0
    40     Width = 1032
     40    Width = 1075
    4141    Images = Core.ImageListMain
    4242    ParentFont = False
     
    5050    end
    5151    object ToolButton2: TToolButton
    52       Left = 36
     52      Left = 37
    5353      Top = 2
    5454      Action = AProjectOpen
     
    5757    end
    5858    object ToolButton3: TToolButton
    59       Left = 89
     59      Left = 92
    6060      Top = 2
    6161      Action = AProjectSave
    6262    end
    6363    object ToolButton4: TToolButton
    64       Left = 124
     64      Left = 128
    6565      Top = 2
    6666      Action = AProjectClose
    6767    end
    6868    object ToolButton5: TToolButton
    69       Left = 194
    70       Height = 33
     69      Left = 200
     70      Height = 34
    7171      Top = 2
    7272      Style = tbsSeparator
    7373    end
    7474    object ToolButton6: TToolButton
    75       Left = 237
     75      Left = 244
    7676      Top = 2
    7777      Action = AProgramRun
    7878    end
    7979    object ToolButton7: TToolButton
    80       Left = 202
     80      Left = 208
    8181      Top = 2
    8282      Action = AProgramCompile
    8383    end
    8484    object ToolButton8: TToolButton
    85       Left = 159
     85      Left = 164
    8686      Top = 2
    8787      Action = AOptions
    8888    end
    8989    object ToolButton9: TToolButton
    90       Left = 342
     90      Left = 352
    9191      Top = 2
    9292      Action = ABreakpointToggle
    9393    end
    9494    object ToolButton10: TToolButton
    95       Left = 272
     95      Left = 280
    9696      Top = 2
    9797      Action = AProgramPause
    9898    end
    9999    object ToolButton11: TToolButton
    100       Left = 307
     100      Left = 316
    101101      Top = 2
    102102      Action = AProgramStop
    103103    end
    104104    object ToolButton12: TToolButton
    105       Left = 377
     105      Left = 388
    106106      Top = 2
    107107      Action = AProgramStepOver
    108108    end
    109109    object ToolButton13: TToolButton
    110       Left = 412
     110      Left = 424
    111111      Top = 2
    112112      Action = AProgramStepInto
    113113    end
    114114    object ToolButton14: TToolButton
    115       Left = 447
     115      Left = 460
    116116      Top = 2
    117117      Action = AProgramStepOut
    118118    end
    119119    object ToolButton15: TToolButton
    120       Left = 482
     120      Left = 496
    121121      Top = 2
    122122      Action = AProgramRunToCursor
    123123    end
    124124    object ToolButtonTarget: TToolButton
    125       Left = 517
     125      Left = 532
    126126      Hint = 'Target select'
    127127      Top = 2
     
    132132  end
    133133  object PageControlRight: TPageControl
    134     Left = 560
    135     Height = 609
    136     Top = 33
    137     Width = 472
     134    Left = 583
     135    Height = 635
     136    Top = 34
     137    Width = 492
    138138    ActivePage = TabSheetDebug
    139139    Align = alRight
     
    144144    object TabSheetDebug: TTabSheet
    145145      Caption = 'Debug'
    146       ClientHeight = 605
    147       ClientWidth = 390
     146      ClientHeight = 631
     147      ClientWidth = 405
    148148      ParentFont = False
    149149      object PanelInput: TPanel
    150150        Left = 0
    151         Height = 77
     151        Height = 80
    152152        Top = 0
    153         Width = 390
     153        Width = 405
    154154        Align = alTop
    155155        BevelOuter = bvNone
     
    161161        Left = 0
    162162        Height = 6
    163         Top = 77
    164         Width = 390
     163        Top = 80
     164        Width = 405
    165165        Align = alTop
    166166        ResizeAnchor = akTop
     
    168168      object PanelOutput: TPanel
    169169        Left = 0
    170         Height = 311
    171         Top = 83
    172         Width = 390
     170        Height = 324
     171        Top = 86
     172        Width = 405
    173173        Align = alTop
    174174        BevelOuter = bvNone
     
    180180        Left = 0
    181181        Height = 6
    182         Top = 394
    183         Width = 390
     182        Top = 410
     183        Width = 405
    184184        Align = alTop
    185185        ResizeAnchor = akTop
     
    187187      object PanelCPU: TPanel
    188188        Left = 0
    189         Height = 103
    190         Top = 400
    191         Width = 390
     189        Height = 107
     190        Top = 416
     191        Width = 405
    192192        Align = alTop
    193193        BevelOuter = bvNone
     
    199199        Left = 0
    200200        Height = 6
    201         Top = 503
    202         Width = 390
     201        Top = 523
     202        Width = 405
    203203        Align = alTop
    204204        ResizeAnchor = akTop
     
    206206      object PanelMemory: TPanel
    207207        Left = 0
    208         Height = 96
    209         Top = 509
    210         Width = 390
     208        Height = 102
     209        Top = 529
     210        Width = 405
    211211        Align = alClient
    212212        BevelOuter = bvNone
     
    217217  end
    218218  object Splitter1: TSplitter
    219     Left = 554
    220     Height = 609
    221     Top = 33
     219    Left = 577
     220    Height = 635
     221    Top = 34
    222222    Width = 6
    223223    Align = alRight
     
    226226  object PanelLeft: TPanel
    227227    Left = 0
    228     Height = 609
    229     Top = 33
    230     Width = 554
     228    Height = 635
     229    Top = 34
     230    Width = 577
    231231    Align = alClient
    232232    BevelOuter = bvNone
    233     ClientHeight = 609
    234     ClientWidth = 554
     233    ClientHeight = 635
     234    ClientWidth = 577
    235235    ParentFont = False
    236236    TabOrder = 4
    237237    object PageControlMain: TPageControl
    238238      Left = 0
    239       Height = 461
     239      Height = 481
    240240      Top = 0
    241       Width = 554
     241      Width = 577
    242242      ActivePage = TabSheetSource
    243243      Align = alClient
     
    256256    object PageControlBottom: TPageControl
    257257      Left = 0
    258       Height = 142
    259       Top = 467
    260       Width = 554
     258      Height = 148
     259      Top = 487
     260      Width = 577
    261261      ActivePage = TabSheetMessages
    262262      Align = alBottom
     
    274274      Left = 0
    275275      Height = 6
    276       Top = 461
    277       Width = 554
     276      Top = 481
     277      Width = 577
    278278      Align = alBottom
    279279      ResizeAnchor = akBottom
     
    282282  object MainMenu1: TMainMenu
    283283    Images = Core.ImageListMain
    284     Left = 259
    285     Top = 160
     284    Left = 270
     285    Top = 167
    286286    object MenuItem1: TMenuItem
    287       Caption = 'Project'
     287      Caption = 'File'
    288288      object MenuItem8: TMenuItem
    289289        Action = AProjectNew
     
    311311      end
    312312    end
     313    object MenuItem24: TMenuItem
     314      Caption = 'Edit'
     315      object MenuItem25: TMenuItem
     316        Action = FormSourceCode.AFormatSource
     317      end
     318      object MenuItem27: TMenuItem
     319        Action = FormSourceCode.AShrinkSource
     320      end
     321      object MenuItem28: TMenuItem
     322        Action = FormSourceCode.AGenerateNumber
     323      end
     324    end
    313325    object MenuItem9: TMenuItem
    314       Caption = 'Program'
     326      Caption = 'Run'
    315327      object MenuItem11: TMenuItem
    316328        Action = AProgramCompile
    317329      end
     330      object MenuItem20: TMenuItem
     331        Action = AProgramCompileMultiple
     332      end
    318333      object MenuItemTarget: TMenuItem
    319334        Caption = 'Target'
     
    347362      end
    348363    end
    349     object MenuItem24: TMenuItem
     364    object MenuItem18: TMenuItem
    350365      Caption = 'Tools'
    351       object MenuItem25: TMenuItem
    352         Action = FormSourceCode.AFormatSource
    353       end
    354       object MenuItem27: TMenuItem
    355         Action = FormSourceCode.AShrinkSource
    356       end
    357       object MenuItem28: TMenuItem
    358         Action = FormSourceCode.AGenerateNumber
    359       end
    360     end
    361     object MenuItem18: TMenuItem
    362       Caption = 'View'
    363366      object MenuItem22: TMenuItem
    364367        Action = AOptions
     
    383386  object ActionList1: TActionList
    384387    Images = Core.ImageListMain
    385     Left = 259
    386     Top = 230
     388    Left = 270
     389    Top = 240
    387390    object AProjectOpen: TAction
    388391      Category = 'Project'
     
    525528      OnExecute = AViewLogExecute
    526529    end
     530    object AProgramCompileMultiple: TAction
     531      Category = 'Program'
     532      Caption = 'Compile multiple...'
     533      OnExecute = AProgramCompileMultipleExecute
     534    end
    527535  end
    528536  object OpenDialog1: TOpenDialog
    529537    DefaultExt = '.b'
    530538    Filter = 'BrainFuck (*.b)|*.b|Any file (*.*)|*.*'
    531     Left = 67
    532     Top = 221
     539    Left = 70
     540    Top = 230
    533541  end
    534542  object SaveDialog1: TSaveDialog
    535543    DefaultExt = '.b'
    536544    Filter = 'BrainFuck (*.b)|*.b|Any file (*.*)|*.*'
    537     Left = 67
    538     Top = 288
     545    Left = 70
     546    Top = 300
    539547  end
    540548  object TimerRefresh: TTimer
    541549    OnTimer = TimerRefreshTimer
    542     Left = 67
    543     Top = 355
     550    Left = 70
     551    Top = 370
    544552  end
    545553  object PopupMenuRecentFiles: TPopupMenu
    546     Left = 67
    547     Top = 77
     554    Left = 70
     555    Top = 80
    548556  end
    549557  object PopupMenuTargets: TPopupMenu
    550     Left = 67
    551     Top = 143
     558    Images = Core.ImageListMain
     559    Left = 70
     560    Top = 149
    552561  end
    553562end
  • trunk/Forms/UFormMain.lrj

    r113 r133  
    77{"hash":205270389,"name":"tformmain.tabsheettarget.caption","sourcebytes":[84,97,114,103,101,116,32,99,111,100,101],"value":"Target code"},
    88{"hash":212433139,"name":"tformmain.tabsheetmessages.caption","sourcebytes":[77,101,115,115,97,103,101,115],"value":"Messages"},
    9 {"hash":127273972,"name":"tformmain.menuitem1.caption","sourcebytes":[80,114,111,106,101,99,116],"value":"Project"},
     9{"hash":315429,"name":"tformmain.menuitem1.caption","sourcebytes":[70,105,108,101],"value":"File"},
    1010{"hash":131987540,"name":"tformmain.menuitemopenrecent.caption","sourcebytes":[79,112,101,110,32,114,101,99,101,110,116],"value":"Open recent"},
    11 {"hash":127264813,"name":"tformmain.menuitem9.caption","sourcebytes":[80,114,111,103,114,97,109],"value":"Program"},
     11{"hash":310020,"name":"tformmain.menuitem24.caption","sourcebytes":[69,100,105,116],"value":"Edit"},
     12{"hash":22974,"name":"tformmain.menuitem9.caption","sourcebytes":[82,117,110],"value":"Run"},
    1213{"hash":94932420,"name":"tformmain.menuitemtarget.caption","sourcebytes":[84,97,114,103,101,116],"value":"Target"},
    13 {"hash":5989939,"name":"tformmain.menuitem24.caption","sourcebytes":[84,111,111,108,115],"value":"Tools"},
    14 {"hash":380871,"name":"tformmain.menuitem18.caption","sourcebytes":[86,105,101,119],"value":"View"},
     14{"hash":5989939,"name":"tformmain.menuitem18.caption","sourcebytes":[84,111,111,108,115],"value":"Tools"},
    1515{"hash":322608,"name":"tformmain.menuitem10.caption","sourcebytes":[72,101,108,112],"value":"Help"},
    1616{"hash":353982,"name":"tformmain.aprojectopen.caption","sourcebytes":[79,112,101,110],"value":"Open"},
     
    3636{"hash":248107685,"name":"tformmain.ashowsourceposition.caption","sourcebytes":[83,104,111,119,32,112,111,115,105,116,105,111,110,32,105,110,32,115,111,117,114,99,101],"value":"Show position in source"},
    3737{"hash":78944612,"name":"tformmain.aprogramshowexecutionpoint.caption","sourcebytes":[83,104,111,119,32,101,120,101,99,117,116,105,111,110,32,112,111,105,110,116],"value":"Show execution point"},
    38 {"hash":21335,"name":"tformmain.aviewlog.caption","sourcebytes":[76,111,103],"value":"Log"}
     38{"hash":21335,"name":"tformmain.aviewlog.caption","sourcebytes":[76,111,103],"value":"Log"},
     39{"hash":226669790,"name":"tformmain.aprogramcompilemultiple.caption","sourcebytes":[67,111,109,112,105,108,101,32,109,117,108,116,105,112,108,101,46,46,46],"value":"Compile multiple..."}
    3940]}
  • trunk/Forms/UFormMain.pas

    r128 r133  
    1515
    1616  TFormMain = class(TForm)
     17    AProgramCompileMultiple: TAction;
    1718    AViewLog: TAction;
    1819    AProgramShowExecutionPoint: TAction;
     
    5253    MenuItem19: TMenuItem;
    5354    MenuItem2: TMenuItem;
     55    MenuItem20: TMenuItem;
    5456    MenuItem22: TMenuItem;
    5557    MenuItem24: TMenuItem;
     
    117119    procedure AOptionsExecute(Sender: TObject);
    118120    procedure AProgramCompileExecute(Sender: TObject);
     121    procedure AProgramCompileMultipleExecute(Sender: TObject);
    119122    procedure AProgramPauseExecute(Sender: TObject);
    120123    procedure AProgramRunToCursorExecute(Sender: TObject);
     
    171174  UCore, UFormCPU, UFormOptions, UFormMessages, UFormTargets, UFormOutput, UFormInput,
    172175  UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter, UFormLog,
    173   UBFTarget, UCommon;
     176  UBFTarget, UCommon, UFormCompileMultiple;
    174177
    175178resourcestring
     
    206209    FormSourceCode.UpdateTheme;
    207210  end;
     211  Core.Messages.OnChange := FormMain.MessagesChanged;
    208212end;
    209213
     
    227231    AProgramShowExecutionPoint.Execute;
    228232  if Core.CurrentTarget.State = rsStopped then
    229     Core.CurrentTarget.Messages.AddMessage(SProgramStopped);
     233    Core.Messages.AddMessage(SProgramStopped);
    230234end;
    231235
     
    405409  if not Core.CurrentTarget.Compiled then AProgramCompile.Execute;
    406410  Core.CurrentTarget.Run;
    407   Core.CurrentTarget.Messages.AddMessage(SProgramStarted);
     411  Core.Messages.AddMessage(SProgramStarted);
    408412end;
    409413
     
    432436procedure TFormMain.AViewCompilersExecute(Sender: TObject);
    433437begin
    434   if not Assigned(FormTargets) then FormTargets := TFormTargets.Create(Self);
    435   FormTargets.Show;
     438  with TFormTargets.Create(nil) do
     439  try
     440    ShowModal;
     441  finally
     442    Free;
     443  end;
    436444end;
    437445
     
    493501  with Core.CurrentTarget do
    494502  try
     503    Core.Messages.Clear;
    495504    AProgramStop.Execute;
    496505    SourceCode := FormSourceCode.SynEditSource.Text;
     
    499508    if Core.CurrentTarget is TBFTarget then
    500509      TBFTarget(Core.CurrentTarget).Optimizations := Core.Optimizations;
    501     Core.CurrentTarget.Messages.AddMessage(SCompileStart);
     510    DebugEnabled := Core.DebugEnabled;
     511    Core.Messages.AddMessage(SCompileStart);
    502512    Application.ProcessMessages;
    503513    Compile;
    504     Core.CurrentTarget.Messages.AppendMessage(SDone);
     514    Core.Messages.AppendMessage(SDone);
    505515    FormTargetCode.SynEditTarget.Text := TargetCode;
    506516    FormTargetCode.SetHighlighter(Core.CurrentTarget.SourceExtension);
     
    509519    on E: Exception do
    510520      MessageDlg(SError, E.Message, mtError, [mbOk], 0);
     521  end;
     522end;
     523
     524procedure TFormMain.AProgramCompileMultipleExecute(Sender: TObject);
     525var
     526  I: Integer;
     527begin
     528  AProgramStop.Execute;
     529  with TFormCompileMultiple.Create(nil) do
     530  try
     531    Targets := Core.Targets;
     532    if ShowModal = mrOk then begin
     533      Core.Messages.Clear;
     534      for I := 0 to Targets.Count - 1 do
     535      with Targets[I] do
     536      if Selected then
     537      try
     538        AProgramStop.Execute;
     539        SourceCode := FormSourceCode.SynEditSource.Text;
     540        ProjectFileName := Core.Project.FileName;
     541        ProgramName := ExtractFileNameOnly(Core.Project.FileName);
     542        if Targets[I] is TBFTarget then
     543          TBFTarget(Targets[I]).Optimizations := Core.Optimizations;
     544        DebugEnabled := Core.DebugEnabled;
     545        Core.Messages.AddMessage(Name + ' ' + SCompileStart);
     546        Application.ProcessMessages;
     547        Compile;
     548        Core.Messages.AppendMessage(SDone);
     549        FormTargetCode.SynEditTarget.Text := TargetCode;
     550        FormTargetCode.SetHighlighter(Core.CurrentTarget.SourceExtension);
     551        UpdateInterface;
     552      except
     553        on E: Exception do
     554          MessageDlg(SError, E.Message, mtError, [mbOk], 0);
     555      end;
     556    end;
     557  finally
     558    Free;
    511559  end;
    512560end;
  • trunk/Forms/UFormMessages.pas

    r131 r133  
    3737procedure TFormMessages.ListView1Data(Sender: TObject; Item: TListItem);
    3838begin
    39   with Core.CurrentTarget do
     39  with Core do
    4040  if (Item.Index >= 0) and (Item.Index < Messages.Count) then
    41   with TMessage(Messages[Item.Index]) do begin
     41  with Messages[Item.Index] do begin
    4242    Item.Caption := Text;
    4343    Item.Data := Messages[Item.Index];
     
    5151procedure TFormMessages.Reload;
    5252begin
    53   ListView1.Items.Count := Core.CurrentTarget.Messages.Count;
     53  ListView1.Items.Count := Core.Messages.Count;
    5454  ListView1.Refresh;
    5555end;
  • trunk/Forms/UFormSourceCode.lfm

    r128 r133  
    591591  object ActionList1: TActionList
    592592    Images = Core.ImageListMain
    593     Left = 154
     593    Left = 152
    594594    Top = 67
    595595    object AGenerateNumber: TAction
  • trunk/Forms/UFormTargets.lfm

    r103 r133  
    11object FormTargets: TFormTargets
    2   Left = 292
    3   Height = 413
    4   Top = 138
    5   Width = 689
     2  Left = 294
     3  Height = 430
     4  Top = 172
     5  Width = 718
    66  Caption = 'Compilers'
    7   ClientHeight = 413
    8   ClientWidth = 689
    9   DesignTimePPI = 144
     7  ClientHeight = 430
     8  ClientWidth = 718
     9  DesignTimePPI = 150
     10  OnClose = FormClose
    1011  OnCreate = FormCreate
    1112  OnShow = FormShow
    12   LCLVersion = '2.0.0.4'
     13  LCLVersion = '2.2.0.4'
    1314  object ListView1: TListView
    1415    Left = 10
    15     Height = 393
     16    Height = 410
    1617    Top = 10
    17     Width = 672
     18    Width = 701
    1819    Anchors = [akTop, akLeft, akRight, akBottom]
    1920    Columns = <   
    2021      item
    2122        Caption = 'Name'
    22         Width = 96
     23        Width = 100
    2324      end   
    2425      item
    2526        Caption = 'Execution path'
    26         Width = 240
     27        Width = 250
    2728      end   
    2829      item
    2930        Caption = 'Compiler path'
    30         Width = 313
     31        Width = 336
    3132      end>
    3233    OwnerData = True
  • trunk/Forms/UFormTargets.pas

    r115 r133  
    1414  TFormTargets = class(TForm)
    1515    ListView1: TListView;
     16    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    1617    procedure FormCreate(Sender: TObject);
    1718    procedure FormShow(Sender: TObject);
     
    3940procedure TFormTargets.FormShow(Sender: TObject);
    4041begin
     42  Core.PersistentForm1.Load(Self);
    4143  ReloadList;
    4244end;
     
    4648  Core.Translator.TranslateComponentRecursive(Self);
    4749  Core.ThemeManager.UseTheme(Self);
     50end;
     51
     52procedure TFormTargets.FormClose(Sender: TObject; var CloseAction: TCloseAction
     53  );
     54begin
     55  Core.PersistentForm1.Save(Self);
    4856end;
    4957
  • trunk/Languages/LazFuck.cs.po

    r129 r133  
    1616msgstr "Jednoduché BrainFuck IDE napsané v Lazarus/FPC."
    1717
     18#: tformcompilemultiple.buttoncancel.caption
     19#, fuzzy
     20msgctxt "tformcompilemultiple.buttoncancel.caption"
     21msgid "Cancel"
     22msgstr "ZruÅ¡it"
     23
     24#: tformcompilemultiple.buttoncompile.caption
     25msgctxt "tformcompilemultiple.buttoncompile.caption"
     26msgid "Compile"
     27msgstr "PřeloÅŸit"
     28
     29#: tformcompilemultiple.caption
     30msgctxt "tformcompilemultiple.caption"
     31msgid "Compile multiple"
     32msgstr "PřeloÅŸit více"
     33
     34#: tformcompilemultiple.listviewtargets.columns[0].caption
     35msgctxt "tformcompilemultiple.listviewtargets.columns[0].caption"
     36msgid "Name"
     37msgstr "Jméno"
     38
     39#: tformcompilemultiple.listviewtargets.columns[1].caption
     40msgid "Result"
     41msgstr "VÃœsledek"
     42
    1843#: tformcpu.caption
    1944msgid "CPU"
     
    92117
    93118#: tformmain.aprogramcompile.caption
     119msgctxt "tformmain.aprogramcompile.caption"
    94120msgid "Compile"
    95121msgstr "PřeloÅŸit"
     122
     123#: tformmain.aprogramcompilemultiple.caption
     124msgctxt "tformmain.aprogramcompilemultiple.caption"
     125msgid "Compile multiple..."
     126msgstr "PřeloÅŸit více..."
    96127
    97128#: tformmain.aprogrampause.caption
     
    100131
    101132#: tformmain.aprogramrun.caption
     133msgctxt "tformmain.aprogramrun.caption"
    102134msgid "Run"
    103135msgstr "Spustit"
     
    170202
    171203#: tformmain.menuitem1.caption
    172 msgid "Project"
    173 msgstr "Projekt"
     204msgid "File"
     205msgstr "Soubor"
    174206
    175207#: tformmain.menuitem10.caption
     
    179211
    180212#: tformmain.menuitem18.caption
    181 msgid "View"
    182 msgstr "Zobrazení"
    183 
    184 #: tformmain.menuitem24.caption
     213msgctxt "tformmain.menuitem18.caption"
    185214msgid "Tools"
    186215msgstr "Nástroje"
    187216
     217#: tformmain.menuitem24.caption
     218msgctxt "tformmain.menuitem24.caption"
     219msgid "Edit"
     220msgstr "Úpravy"
     221
    188222#: tformmain.menuitem9.caption
    189 msgid "Program"
    190 msgstr "Program"
     223msgctxt "tformmain.menuitem9.caption"
     224msgid "Run"
     225msgstr "Spustit"
    191226
    192227#: tformmain.menuitemopenrecent.caption
     
    470505
    471506#: tformtargets.listview1.columns[0].caption
     507msgctxt "tformtargets.listview1.columns[0].caption"
    472508msgid "Name"
    473509msgstr "Jméno"
    474510
    475511#: tformtargets.listview1.columns[1].caption
     512msgctxt "tformtargets.listview1.columns[1].caption"
    476513msgid "Execution path"
    477514msgstr "Cesta vykonání"
    478515
    479516#: tformtargets.listview1.columns[2].caption
     517msgctxt "tformtargets.listview1.columns[2].caption"
    480518msgid "Compiler path"
    481519msgstr "Cesta překladače"
  • trunk/Languages/LazFuck.pot

    r128 r133  
    44#: tcore.applicationinfo.description
    55msgid "A simple BrainFuck IDE written in Lazarus/FPC."
     6msgstr ""
     7
     8#: tformcompilemultiple.buttoncancel.caption
     9msgctxt "tformcompilemultiple.buttoncancel.caption"
     10msgid "Cancel"
     11msgstr ""
     12
     13#: tformcompilemultiple.buttoncompile.caption
     14msgctxt "tformcompilemultiple.buttoncompile.caption"
     15msgid "Compile"
     16msgstr ""
     17
     18#: tformcompilemultiple.caption
     19msgctxt "tformcompilemultiple.caption"
     20msgid "Compile multiple"
     21msgstr ""
     22
     23#: tformcompilemultiple.listviewtargets.columns[0].caption
     24msgctxt "tformcompilemultiple.listviewtargets.columns[0].caption"
     25msgid "Name"
     26msgstr ""
     27
     28#: tformcompilemultiple.listviewtargets.columns[1].caption
     29msgid "Result"
    630msgstr ""
    731
     
    82106
    83107#: tformmain.aprogramcompile.caption
     108msgctxt "tformmain.aprogramcompile.caption"
    84109msgid "Compile"
     110msgstr ""
     111
     112#: tformmain.aprogramcompilemultiple.caption
     113msgctxt "tformmain.aprogramcompilemultiple.caption"
     114msgid "Compile multiple..."
    85115msgstr ""
    86116
     
    90120
    91121#: tformmain.aprogramrun.caption
     122msgctxt "tformmain.aprogramrun.caption"
    92123msgid "Run"
    93124msgstr ""
     
    160191
    161192#: tformmain.menuitem1.caption
    162 msgid "Project"
     193msgid "File"
    163194msgstr ""
    164195
     
    169200
    170201#: tformmain.menuitem18.caption
    171 msgid "View"
     202msgctxt "tformmain.menuitem18.caption"
     203msgid "Tools"
    172204msgstr ""
    173205
    174206#: tformmain.menuitem24.caption
    175 msgid "Tools"
     207msgctxt "tformmain.menuitem24.caption"
     208msgid "Edit"
    176209msgstr ""
    177210
    178211#: tformmain.menuitem9.caption
    179 msgid "Program"
     212msgctxt "tformmain.menuitem9.caption"
     213msgid "Run"
    180214msgstr ""
    181215
     
    460494
    461495#: tformtargets.listview1.columns[0].caption
     496msgctxt "tformtargets.listview1.columns[0].caption"
    462497msgid "Name"
    463498msgstr ""
    464499
    465500#: tformtargets.listview1.columns[1].caption
     501msgctxt "tformtargets.listview1.columns[1].caption"
    466502msgid "Execution path"
    467503msgstr ""
    468504
    469505#: tformtargets.listview1.columns[2].caption
     506msgctxt "tformtargets.listview1.columns[2].caption"
    470507msgid "Compiler path"
    471508msgstr ""
  • trunk/LazFuck.lpi

    r128 r133  
    9797      </Item4>
    9898    </RequiredPackages>
    99     <Units Count="27">
     99    <Units Count="28">
    100100      <Unit0>
    101101        <Filename Value="LazFuck.lpr"/>
     
    245245        <IsPartOfProject Value="True"/>
    246246      </Unit26>
     247      <Unit27>
     248        <Filename Value="Forms\UFormCompileMultiple.pas"/>
     249        <IsPartOfProject Value="True"/>
     250        <ComponentName Value="FormCompileMultiple"/>
     251        <HasResources Value="True"/>
     252        <ResourceBaseClass Value="Form"/>
     253      </Unit27>
    247254    </Units>
    248255  </ProjectOptions>
  • trunk/LazFuck.lpr

    r122 r133  
    1313  UFormOutput, UFormInput, UFormMemory, UFormMessages, UFormSourceCode,
    1414  UFormTargetCode, UFormTargetOptions, UCore, Common,
    15   UFormLog, UProject, UBFTarget, SysUtils;
     15  UFormLog, UProject, UBFTarget, SysUtils, UFormCompileMultiple;
    1616
    1717{$R *.res}
  • trunk/Packages/Common/UCommon.pas

    r129 r133  
    88  {$IFDEF WINDOWS}Windows,{$ENDIF}
    99  {$IFDEF UNIX}baseunix,{$ENDIF}
    10   Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf,
     10  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, Graphics,
    1111  FileUtil; //, ShFolder, ShellAPI;
    1212
    1313type
    1414  TArrayOfByte = array of Byte;
    15   TArrayOfString = array of string;
    1615  TExceptionEvent = procedure(Sender: TObject; E: Exception) of object;
    1716
     
    3534  DLLHandle1: HModule;
    3635
     36const
     37  clLightBlue = TColor($FF8080);
     38  clLightGreen = TColor($80FF80);
     39  clLightRed = TColor($8080FF);
     40
    3741{$IFDEF WINDOWS}
    3842  GetUserNameEx: procedure (NameFormat: DWORD;
     
    5155function ComputerName: string;
    5256procedure DeleteFiles(APath, AFileSpec: string);
     57function Explode(Separator: Char; Data: string): TStringArray;
    5358procedure ExecuteProgram(Executable: string; Parameters: array of string);
    5459procedure FileDialogUpdateFilterFileType(FileDialog: TOpenDialog);
     
    6570function LoadFileToStr(const FileName: TFileName): AnsiString;
    6671function LoggedOnUserNameEx(Format: TUserNameFormat): string;
    67 function MergeArray(A, B: array of string): TArrayOfString;
     72function MergeArray(A, B: array of string): TStringArray;
    6873function OccurenceOfChar(What: Char; Where: string): Integer;
    6974procedure OpenWebPage(URL: string);
     75procedure OpenEmail(Email: string);
    7076procedure OpenFileInShell(FileName: string);
    7177function PosFromIndex(SubStr: string; Text: string;
     
    8389function SplitString(var Text: string; Count: Word): string;
    8490function StripTags(const S: string): string;
    85 function TryHexToInt(Data: string; var Value: Integer): Boolean;
    86 function TryBinToInt(Data: string; var Value: Integer): Boolean;
     91function TryHexToInt(Data: string; out Value: Integer): Boolean;
     92function TryBinToInt(Data: string; out Value: Integer): Boolean;
    8793procedure SortStrings(Strings: TStrings);
    8894
     
    246252end;
    247253
    248 function TryHexToInt(Data: string; var Value: Integer): Boolean;
     254function TryHexToInt(Data: string; out Value: Integer): Boolean;
    249255var
    250256  I: Integer;
     
    262268end;
    263269
    264 function TryBinToInt(Data: string; var Value: Integer): Boolean;
     270function TryBinToInt(Data: string; out Value: Integer): Boolean;
    265271var
    266272  I: Integer;
     
    290296end;
    291297
    292 function Explode(Separator: char; Data: string): TArrayOfString;
    293 begin
    294   Result := nil;
    295   SetLength(Result, 0);
    296   while Pos(Separator, Data) > 0 do begin
     298function Explode(Separator: Char; Data: string): TStringArray;
     299var
     300  Index: Integer;
     301begin
     302  Result := Default(TStringArray);
     303  repeat
     304    Index := Pos(Separator, Data);
     305    if Index > 0 then begin
     306      SetLength(Result, Length(Result) + 1);
     307      Result[High(Result)] := Copy(Data, 1, Index - 1);
     308      Delete(Data, 1, Index);
     309    end else Break;
     310  until False;
     311  if Data <> '' then begin
    297312    SetLength(Result, Length(Result) + 1);
    298     Result[High(Result)] := Copy(Data, 1, Pos(Separator, Data) - 1);
    299     Delete(Data, 1, Pos(Separator, Data));
    300   end;
    301   SetLength(Result, Length(Result) + 1);
    302   Result[High(Result)] := Data;
    303 end;
    304 
    305 {$IFDEF Windows}
     313    Result[High(Result)] := Data;
     314  end;
     315end;
     316
     317{$IFDEF WINDOWS}
    306318function GetUserName: string;
    307319const
     
    311323begin
    312324  L := MAX_USERNAME_LENGTH + 2;
     325  Result := Default(string);
    313326  SetLength(Result, L);
    314327  if Windows.GetUserName(PChar(Result), L) and (L > 0) then begin
     
    324337  end;
    325338end;
    326 {$endif}
     339{$ENDIF}
    327340
    328341function ComputerName: string;
    329 {$ifdef mswindows}
     342{$IFDEF WINDOWS}
    330343const
    331344 INFO_BUFFER_SIZE = 32767;
     
    342355  end;
    343356end;
    344 {$endif}
    345 {$ifdef unix}
     357{$ENDIF}
     358{$IFDEF UNIX}
    346359var
    347360  Name: UtsName;
     
    351364  Result := Name.Nodename;
    352365end;
    353 {$endif}
    354 
    355 {$ifdef windows}
     366{$ENDIF}
     367
     368{$IFDEF WINDOWS}
    356369function LoggedOnUserNameEx(Format: TUserNameFormat): string;
    357370const
     
    431444procedure LoadLibraries;
    432445begin
    433   {$IFDEF Windows}
     446  {$IFDEF WINDOWS}
    434447  DLLHandle1 := LoadLibrary('secur32.dll');
    435448  if DLLHandle1 <> 0 then
     
    442455procedure FreeLibraries;
    443456begin
    444   {$IFDEF Windows}
     457  {$IFDEF WINDOWS}
    445458  if DLLHandle1 <> 0 then FreeLibrary(DLLHandle1);
    446459  {$ENDIF}
     
    475488end;
    476489
     490procedure OpenEmail(Email: string);
     491begin
     492  OpenURL('mailto:' + Email);
     493end;
     494
    477495procedure OpenFileInShell(FileName: string);
    478496begin
     
    503521end;
    504522
    505 function MergeArray(A, B: array of string): TArrayOfString;
    506 var
    507   I: Integer;
    508 begin
    509   Result := Default(TArrayOfString);
     523function MergeArray(A, B: array of string): TStringArray;
     524var
     525  I: Integer;
     526begin
     527  Result := Default(TStringArray);
    510528  SetLength(Result, Length(A) + Length(B));
    511529  for I := 0 to Length(A) - 1 do
  • trunk/Packages/Common/ULastOpenedList.pas

    r102 r133  
    8484destructor TLastOpenedList.Destroy;
    8585begin
    86   Items.Free;
     86  FreeAndNil(Items);
    8787  inherited;
    8888end;
     
    9494begin
    9595  if Assigned(MenuItem) then begin
    96     MenuItem.Clear;
     96    while MenuItem.Count > Items.Count do
     97      MenuItem.Delete(MenuItem.Count - 1);
     98    while MenuItem.Count < Items.Count do begin
     99      NewMenuItem := TMenuItem.Create(MenuItem);
     100      MenuItem.Add(NewMenuItem);
     101    end;
    97102    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);
     103      MenuItem.Items[I].Caption := Items[I];
     104      MenuItem.Items[I].OnClick := ClickAction;
    102105    end;
    103106  end;
  • trunk/Packages/Common/UTheme.pas

    r122 r133  
    4141    property Theme: TTheme read FTheme write SetTheme;
    4242  end;
     43
     44const
     45  ThemeNameSystem = 'System';
     46  ThemeNameLight = 'Light';
     47  ThemeNameDark = 'Dark';
    4348
    4449procedure Register;
     
    105110  inherited;
    106111  Themes := TThemes.Create;
    107   with Themes.AddNew('System') do begin
     112  with Themes.AddNew(ThemeNameSystem) do begin
    108113    ColorWindow := clWindow;
    109114    ColorWindowText := clWindowText;
     
    113118  end;
    114119  Theme := TTheme(Themes.First);
    115   with Themes.AddNew('Dark') do begin
     120  with Themes.AddNew(ThemeNameDark) do begin
    116121    ColorWindow := RGBToColor($20, $20, $20);
    117122    ColorWindowText := clWhite;
     
    120125    ColorControlSelected := RGBToColor(96, 125, 155);
    121126  end;
    122   with Themes.AddNew('Light') do begin
     127  with Themes.AddNew(ThemeNameLight) do begin
    123128    ColorWindow := clWhite;
    124129    ColorWindowText := clBlack;
     
    175180procedure TThemeManager.UseTheme(Form: TForm);
    176181begin
    177   if not Used and (FTheme.Name = 'System') then Exit;
     182  if not Used and (FTheme.Name = ThemeNameSystem) then Exit;
    178183  ApplyTheme(Form);
    179184  Used := True;
  • trunk/Target/UTargetC.pas

    r126 r133  
    3131begin
    3232  inherited;
    33   Name := 'C';
    34   SourceExtension := '.c';
    35   ImageIndex := 23;
    36   Capabilities := [tcCompile, tcRun];
     33  FName := 'C';
     34  FSourceExtension := '.c';
     35  FImageIndex := 23;
     36  FCapabilities := [tcCompile, tcRun];
    3737  {$IFDEF WINDOWS}
    3838  CompilerPath := 'c:\Program Files\MinGW\bin\gcc.exe';
     
    4242  {$IFDEF UNIX}
    4343  CompilerPath := '/usr/bin/gcc';
    44   CompiledExtension := '';
    45   RunExtension := '';
     44  FCompiledExtension := '';
     45  FRunExtension := '';
    4646  {$ENDIF}
    4747end;
  • trunk/Target/UTargetCSharp.pas

    r126 r133  
    2929begin
    3030  inherited;
    31   Name := 'C#';
    32   SourceExtension := '.cs';
    33   CompiledExtension := '.exe';
    34   RunExtension := '';
    35   ImageIndex := 27;
    36   Capabilities := [tcCompile, tcRun];
     31  FName := 'C#';
     32  FSourceExtension := '.cs';
     33  FCompiledExtension := '.exe';
     34  FRunExtension := '';
     35  FImageIndex := 27;
     36  FCapabilities := [tcCompile, tcRun];
    3737  {$IFDEF WINDOWS}
    3838  CompilerPath := 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\csc.exe';
  • trunk/Target/UTargetDelphi.pas

    r126 r133  
    2828begin
    2929  inherited;
    30   Name := 'Delphi';
    31   SourceExtension := '.pas';
    32   ImageIndex := 22;
    33   Capabilities := [tcCompile, tcRun];
     30  FName := 'Delphi';
     31  FSourceExtension := '.pas';
     32  FImageIndex := 22;
     33  FCapabilities := [tcCompile, tcRun];
    3434  {$IFDEF Windows}
    3535  CompilerPath := 'c:\Program Files\Embarcadero\RAD Studio\9.0\bin\DCC32.EXE';
  • trunk/Target/UTargetFPC.pas

    r126 r133  
    2828begin
    2929  inherited;
    30   Name := 'FPC';
    31   SourceExtension := '.pas';
    32   ImageIndex := 22;
    33   Capabilities := [tcCompile, tcRun];
     30  FName := 'FPC';
     31  FSourceExtension := '.pas';
     32  FImageIndex := 22;
     33  FCapabilities := [tcCompile, tcRun];
    3434  {$IFDEF WINDOWS}
    3535  CompiledExtension := '.exe';
     
    3838  {$ENDIF}
    3939  {$IFDEF UNIX}
    40   CompiledExtension := '';
     40  FCompiledExtension := '';
    4141  CompilerPath := '/usr/bin/fpc';
    42   RunExtension := '';
     42  FRunExtension := '';
    4343  {$ENDIF}
    4444end;
  • trunk/Target/UTargetInterpretter.pas

    r128 r133  
    448448begin
    449449  inherited;
    450   Name := 'Interpretter';
    451   ImageIndex := 25;
    452   Capabilities := [tcRun, tcPause, tcStop, tcCompile, tcStepOut, tcStepInto,
     450  FName := 'Interpretter';
     451  FImageIndex := 25;
     452  FCapabilities := [tcRun, tcPause, tcStop, tcCompile, tcStepOut, tcStepInto,
    453453    tcStepOver, tcRunToCursor];
    454454  // Base commands
  • trunk/Target/UTargetJava.pas

    r126 r133  
    2929begin
    3030  inherited;
    31   Name := 'Java';
    32   SourceExtension := '.java';
    33   CompiledExtension := '.class';
    34   RunExtension := '';
    35   ImageIndex := 24;
    36   Capabilities := [tcCompile, tcRun];
     31  FName := 'Java';
     32  FSourceExtension := '.java';
     33  FCompiledExtension := '.class';
     34  FRunExtension := '';
     35  FImageIndex := 24;
     36  FCapabilities := [tcCompile, tcRun];
    3737  {$IFDEF WINDOWS}
    3838  CompilerPath := 'c:\Program Files\Java\bin\javac.exe';
  • trunk/Target/UTargetJavascript.pas

    r126 r133  
    3232begin
    3333  inherited;
    34   Name := 'Javascript';
    35   SourceExtension := '.js';
    36   ImageIndex := 28;
    37   Capabilities := [tcCompile, tcRun];
     34  FName := 'Javascript';
     35  FSourceExtension := '.js';
     36  FImageIndex := 28;
     37  FCapabilities := [tcCompile, tcRun];
    3838  CompilerPath := '';
    39   CompiledExtension := '';
    40   RunExtension := '';
     39  FCompiledExtension := '';
     40  FRunExtension := '';
    4141end;
    4242
  • trunk/Target/UTargetPHP.pas

    r126 r133  
    2929begin
    3030  inherited;
    31   Name := 'PHP';
    32   SourceExtension := '.php';
    33   RunExtension := '.php';
    34   CompiledExtension := '.php';
    35   ImageIndex := 21;
    36   Capabilities := [tcCompile, tcRun];
     31  FName := 'PHP';
     32  FSourceExtension := '.php';
     33  FRunExtension := '.php';
     34  FCompiledExtension := '.php';
     35  FImageIndex := 21;
     36  FCapabilities := [tcCompile, tcRun];
    3737  {$IFDEF WINDOWS}
    3838  CompilerPath := '';
  • trunk/Target/UTargetPython.pas

    r126 r133  
    2929begin
    3030  inherited;
    31   Name := 'Python';
    32   SourceExtension := '.py';
    33   RunExtension := '.py';
    34   CompiledExtension := '.py';
    35   ImageIndex := 26;
    36   Capabilities := [tcCompile, tcRun];
     31  FName := 'Python';
     32  FSourceExtension := '.py';
     33  FRunExtension := '.py';
     34  FCompiledExtension := '.py';
     35  FImageIndex := 26;
     36  FCapabilities := [tcCompile, tcRun];
    3737  {$IFDEF WINDOWS}
    3838  CompilerPath := '';
  • trunk/UCore.lfm

    r132 r133  
    33  OnDestroy = DataModuleDestroy
    44  OldCreateOrder = False
    5   Height = 433
    6   HorizontalOffset = 793
    7   VerticalOffset = 444
    8   Width = 509
    9   PPI = 144
     5  Height = 451
     6  HorizontalOffset = 826
     7  VerticalOffset = 463
     8  Width = 530
     9  PPI = 150
    1010  object ApplicationInfo: TApplicationInfo
    1111    Identification = 1
     
    541541      0000000000000000000000000000000000000000000000000000
    542542    }
    543     Left = 108
    544     Top = 24
     543    Left = 113
     544    Top = 25
    545545  end
    546546  object Translator: TTranslator
    547547    POFilesFolder = 'Languages'
    548     Left = 108
    549     Top = 108
     548    Left = 113
     549    Top = 113
    550550  end
    551551  object LastOpenedList: TLastOpenedList
    552552    MaxCount = 10
    553     Left = 108
    554     Top = 192
     553    Left = 113
     554    Top = 200
    555555  end
    556556  object PersistentForm1: TPersistentForm
    557557    MinVisiblePart = 50
    558558    EntireVisible = False
    559     Left = 108
    560     Top = 276
     559    Left = 113
     560    Top = 288
    561561  end
    562562  object ImageListMain: TImageList
    563     Left = 372
    564     Top = 24
     563    Left = 388
     564    Top = 25
    565565    Bitmap = {
    566566      4C7A1D00000010000000100000007B1600000000000078DAED9C07585557B6C7
     
    749749  object ScaleDPI1: TScaleDPI
    750750    AutoDetect = False
    751     Left = 372
    752     Top = 120
     751    Left = 388
     752    Top = 125
    753753  end
    754754  object ThemeManager: TThemeManager
    755     Left = 362
    756     Top = 209
     755    Left = 377
     756    Top = 218
    757757  end
    758758  object AboutDialog: TAboutDialog
     
    760760    ThemeManager = ThemeManager
    761761    ApplicationInfo = ApplicationInfo
    762     Left = 362
    763     Top = 288
     762    Left = 377
     763    Top = 300
    764764  end
    765765end
  • trunk/UCore.pas

    r131 r133  
    2828    FCurrentTarget: TTarget;
    2929    StoredDimension: TControlDimension;
     30    procedure InitTargets;
    3031    procedure SetCurrentTarget(AValue: TTarget);
    3132    procedure ScaleDPI;
     33    procedure TargetMessageExecute(Text: string);
    3234  public
    3335    DataDir: string;
    3436    Project: TProject;
    35     Targets: TTargetList;
     37    Targets: TTargets;
     38    Messages: TMessages;
    3639    OpenProjectOnStart: Boolean;
    3740    OptimizationLevel: TCompilerOptimization;
     
    8285
    8386  Project := TProject.Create;
    84   Targets := TTargetList.Create;
     87  Targets := TTargets.Create;
     88  Messages := TMessages.Create;
     89
    8590  StoredDimension := TControlDimension.Create;
    86 
    87   // Init targets list
    88   Targets.Add(TTargetInterpretter.Create);
    89   Targets.Add(TTargetDelphi.Create);
    90   Targets.Add(TTargetFPC.Create);
    91   Targets.Add(TTargetPHP.Create);
    92   Targets.Add(TTargetC.Create);
    93   Targets.Add(TTargetJava.Create);
    94   Targets.Add(TTargetPython.Create);
    95   Targets.Add(TTargetCSharp.Create);
    96   Targets.Add(TTargetJavascript.Create);
    97 
     91  InitTargets;
    9892  LoadFromRegistry(Core.ApplicationInfo.GetRegistryContext);
    9993end;
     
    10296begin
    10397  SaveToRegistry(Core.ApplicationInfo.GetRegistryContext);
     98  FreeAndNil(Messages);
    10499  FreeAndNil(Targets);
    105100  FreeAndNil(Project);
    106101  FreeAndNil(StoredDimension);
     102end;
     103
     104procedure TCore.InitTargets;
     105var
     106  I: Integer;
     107begin
     108  with Targets do begin
     109    Clear;
     110    Add(TTargetInterpretter.Create);
     111    Add(TTargetDelphi.Create);
     112    Add(TTargetFPC.Create);
     113    Add(TTargetPHP.Create);
     114    Add(TTargetC.Create);
     115    Add(TTargetJava.Create);
     116    Add(TTargetPython.Create);
     117    Add(TTargetCSharp.Create);
     118    Add(TTargetJavascript.Create);
     119    for I := 0 to Count - 1 do
     120      Items[I].OnMessage := TargetMessageExecute;
     121  end;
    107122end;
    108123
     
    170185    FCurrentTarget.OnLog := FormMain.TargetLogExecute;
    171186    FCurrentTarget.OptimizationLevel := OptimizationLevel;
    172     FCurrentTarget.Messages.OnChange := FormMain.MessagesChanged;
    173187    if FCurrentTarget is TBFTarget then begin
    174188      TBFTarget(FCurrentTarget).MemorySize := MemorySize;
     
    199213end;
    200214
     215procedure TCore.TargetMessageExecute(Text: string);
     216begin
     217  Messages.AddMessage(Text);
     218end;
     219
    201220procedure TCore.Init;
    202221begin
  • trunk/UTarget.pas

    r128 r133  
    1616  TTargetCapabilities = set of TTargetCapability;
    1717
    18   TRunState = (rsStopped, rsPaused, rsRunning);
     18  TRunState = (rsStopped, rsPaused, rsRunning, rsCompiling);
    1919
    2020  TStepOperation = (soNormal, soStepIn, soStepOut);
     
    2727  end;
    2828
    29   { TDebugStepList }
    30 
    31   TDebugStepList = class(TFPGObjectList<TDebugStep>)
     29  { TDebugSteps }
     30
     31  TDebugSteps = class(TFPGObjectList<TDebugStep>)
    3232    function SearchBySourcePos(Pos: Integer): TDebugStep;
    3333    function SearchByProgramPos(Pos: Integer): TDebugStep;
     
    4444  end;
    4545
    46   { TBreakPointList }
    47 
    48   TBreakPointList = class(TFPGObjectList<TBreakPoint>)
     46  { TBreakPoints }
     47
     48  TBreakPoints = class(TFPGObjectList<TBreakPoint>)
    4949    procedure AddItem(TargetAddress: Integer);
    5050    procedure SetSystem(TargetAddress: Integer);
     
    5959  end;
    6060
    61   { TMessageList }
    62 
    63   TMessageList = class(TFPGObjectList<TMessage>)
     61  { TMessages }
     62
     63  TMessages = class(TFPGObjectList<TMessage>)
    6464  private
    6565    FOnChange: TNotifyEvent;
     
    7272
    7373  TLogEvent = procedure (Lines: TStrings) of object;
     74  TMessageEvent = procedure (Text: string) of object;
    7475
    7576  { TTarget }
     
    7879  private
    7980    FOnLog: TLogEvent;
     81    FOnMessage: TMessageEvent;
    8082  protected
     83    FCompiledExtension: string;
     84    FRunExtension: string;
     85    FSourceExtension: string;
     86    FName: string;
     87    FImageIndex: Integer;
     88    FCapabilities: TTargetCapabilities;
    8189    FCompiled: Boolean;
    8290    function SourceReadNext: Char;
     
    96104    procedure SetState(AValue: TRunState); virtual;
    97105  public
    98     Name: string;
    99106    ProgramName: string;
    100     ImageIndex: Integer;
    101107    OptimizationLevel: TCompilerOptimization;
    102108    CompilerPath: string;
    103109    ExecutorPath: string;
    104     SourceExtension: string;
    105     RunExtension: string;
    106     CompiledExtension: string;
    107110    ProjectFileName: string;
    108     Capabilities: TTargetCapabilities;
    109     BreakPoints: TBreakPointList;
    110     DebugSteps: TDebugStepList;
     111    BreakPoints: TBreakPoints;
     112    DebugSteps: TDebugSteps;
    111113    DebugEnabled: Boolean;
    112     Messages: TMessageList;
     114    Selected: Boolean;
    113115    constructor Create; virtual;
    114116    destructor Destroy; override;
     
    127129    procedure LoadFromRegistry(Context: TRegistryContext); virtual;
    128130    procedure SaveToRegistry(Context: TRegistryContext); virtual;
     131    property SourceExtension: string read FSourceExtension;
     132    property RunExtension: string read FRunExtension;
     133    property CompiledExtension: string read FCompiledExtension;
     134    property Name: string read FName;
     135    property ImageIndex: Integer read FImageIndex;
    129136    property State: TRunState read FState write SetState;
    130137    property SourceCode: string write SetSourceCode;
     
    132139    property Compiled: Boolean read FCompiled write FCompiled;
    133140    property ExecutionPosition: Integer read GetExecutionPosition;
     141    property Capabilities: TTargetCapabilities read FCapabilities;
    134142    property OnChangeState: TNotifyEvent read FOnChangeState write FOnChangeState;
    135143    property OnLog: TLogEvent read FOnLog write FOnLog;
    136   end;
    137 
    138   { TTargetList }
    139 
    140   TTargetList = class(TFPGObjectList<TTarget>)
     144    property OnMessage: TMessageEvent read FOnMessage write FOnMessage;
     145  end;
     146
     147  { TTargets }
     148
     149  TTargets = class(TFPGObjectList<TTarget>)
    141150    procedure LoadFromRegistry(Context: TRegistryContext);
    142151    procedure SaveToRegistry(Context: TRegistryContext);
     
    146155  end;
    147156
     157const
     158  RunStateText: array[TRunState] of string = ('Stopped', 'Paused', 'Running',
     159    'Compiling');
     160
    148161
    149162resourcestring
     
    155168implementation
    156169
    157 { TMessageList }
    158 
    159 procedure TMessageList.DoChange;
     170{ TMessages }
     171
     172procedure TMessages.DoChange;
    160173begin
    161174  if Assigned(FOnChange) then FOnChange(Self);
    162175end;
    163176
    164 procedure TMessageList.AddMessage(Text: string);
     177procedure TMessages.AddMessage(Text: string);
    165178var
    166179  NewItem: TMessage;
     
    172185end;
    173186
    174 procedure TMessageList.AppendMessage(Text: string);
     187procedure TMessages.AppendMessage(Text: string);
    175188begin
    176189  if Count > 0 then begin
     
    180193end;
    181194
    182 { TBreakPointList }
    183 
    184 procedure TBreakPointList.AddItem(TargetAddress: Integer);
     195{ TBreakPoints }
     196
     197procedure TBreakPoints.AddItem(TargetAddress: Integer);
    185198var
    186199  NewItem: TBreakPoint;
     
    191204end;
    192205
    193 procedure TBreakPointList.SetSystem(TargetAddress: Integer);
     206procedure TBreakPoints.SetSystem(TargetAddress: Integer);
    194207begin
    195208  ClearSystem;
     
    197210end;
    198211
    199 procedure TBreakPointList.AddSystem(TargetAddress: Integer);
     212procedure TBreakPoints.AddSystem(TargetAddress: Integer);
    200213var
    201214  NewItem: TBreakPoint;
     
    207220end;
    208221
    209 procedure TBreakPointList.ClearSystem;
     222procedure TBreakPoints.ClearSystem;
    210223var
    211224  I: Integer;
     
    215228end;
    216229
    217 function TBreakPointList.SearchByTargetPos(Pos: Integer): TBreakPoint;
     230function TBreakPoints.SearchByTargetPos(Pos: Integer): TBreakPoint;
    218231var
    219232  I: Integer;
     
    225238end;
    226239
    227 { TDebugStepList }
    228 
    229 function TDebugStepList.SearchBySourcePos(Pos: Integer
     240{ TDebugSteps }
     241
     242function TDebugSteps.SearchBySourcePos(Pos: Integer
    230243  ): TDebugStep;
    231244var
     
    238251end;
    239252
    240 function TDebugStepList.SearchByProgramPos(Pos: Integer): TDebugStep;
     253function TDebugSteps.SearchByProgramPos(Pos: Integer): TDebugStep;
    241254var
    242255  I: Integer;
     
    248261end;
    249262
    250 function TDebugStepList.SearchByTargetPos(Pos: Integer
     263function TDebugSteps.SearchByTargetPos(Pos: Integer
    251264  ): TDebugStep;
    252265var
     
    259272end;
    260273
    261 function TDebugStepList.SearchIndexByProgramPos(Pos: Integer): Integer;
     274function TDebugSteps.SearchIndexByProgramPos(Pos: Integer): Integer;
    262275var
    263276  I: Integer;
     
    269282end;
    270283
    271 procedure TDebugStepList.AddStep(SourcePos, TargetPos: Integer;
     284procedure TDebugSteps.AddStep(SourcePos, TargetPos: Integer;
    272285  Operation: TStepOperation);
    273286var
     
    282295end;
    283296
    284 procedure TDebugStepList.UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgramFrom,
     297procedure TDebugSteps.UpdateTargetPos(OldProgramFrom, OldProgramTo, NewProgramFrom,
    285298    NewProgramTo: Integer; NewTarget: Integer = 0);
    286299var
     
    311324end;
    312325
    313 { TTargetList }
    314 
    315 procedure TTargetList.LoadFromRegistry(Context: TRegistryContext);
     326{ TTargets }
     327
     328procedure TTargets.LoadFromRegistry(Context: TRegistryContext);
    316329var
    317330  I: Integer;
     
    327340end;
    328341
    329 procedure TTargetList.SaveToRegistry(Context: TRegistryContext);
     342procedure TTargets.SaveToRegistry(Context: TRegistryContext);
    330343var
    331344  I: Integer;
     
    342355end;
    343356
    344 function TTargetList.FindByName(Name: string): TTarget;
     357function TTargets.FindByName(Name: string): TTarget;
    345358var
    346359  I: Integer;
     
    352365end;
    353366
    354 procedure TTargetList.LoadToMenuItem(MenuItem: TMenuItem; Action: TNotifyEvent
     367procedure TTargets.LoadToMenuItem(MenuItem: TMenuItem; Action: TNotifyEvent
    355368  ; CurrentTarget: TTarget);
    356369var
     
    359372begin
    360373  if Assigned(MenuItem) then begin
    361     MenuItem.Clear;
     374    while MenuItem.Count > Count do
     375      MenuItem.Delete(MenuItem.Count - 1);
     376    while MenuItem.Count < Count do begin
     377      NewMenuItem := TMenuItem.Create(MenuItem);
     378      MenuItem.Add(NewMenuItem);
     379    end;
    362380    for I := 0 to Count - 1 do begin
    363       NewMenuItem := TMenuItem.Create(MenuItem);
    364       NewMenuItem.Caption := Items[I].Name;
    365       NewMenuItem.OnClick := Action;
    366       NewMenuItem.ImageIndex := Items[I].ImageIndex;
    367       if Items[I] = CurrentTarget then NewMenuItem.Checked := True;
    368       MenuItem.Add(NewMenuItem);
     381      MenuItem.Items[I].Caption := Items[I].Name;
     382      MenuItem.Items[I].OnClick := Action;
     383      MenuItem.Items[I].ImageIndex := Items[I].ImageIndex;
     384      if Items[I] = CurrentTarget then MenuItem.Items[I].Checked := True;
    369385    end;
    370386  end;
     
    414430  inherited;
    415431  OptimizationLevel := coNormal;
    416   BreakPoints := TBreakPointList.Create;
    417   DebugSteps := TDebugStepList.Create;
    418   Messages := TMessageList.Create;
     432  BreakPoints := TBreakPoints.Create;
     433  DebugSteps := TDebugSteps.Create;
    419434end;
    420435
    421436destructor TTarget.Destroy;
    422437begin
    423   FreeAndNil(Messages);
    424438  FreeAndNil(DebugSteps);
    425439  FreeAndNil(BreakPoints);
     
    429443procedure TTarget.Reset;
    430444begin
    431   Messages.Clear;
    432445end;
    433446
     
    551564    CompilerPath := ReadStringWithDefault('CompilerPath', CompilerPath);
    552565    ExecutorPath := ReadStringWithDefault('ExecutorPath', ExecutorPath);
     566    Selected := ReadBoolWithDefault('Selected', Selected);
    553567  finally
    554568    Free;
     
    561575  try
    562576    CurrentContext := Context;
    563     if CompilerPath <> '' then WriteString('CompilerPath', CompilerPath)
    564       else DeleteValue('CompilerPath');
    565     if ExecutorPath <> '' then WriteString('ExecutorPath', ExecutorPath)
    566       else DeleteValue('ExecutorPath');
     577    WriteString('CompilerPath', CompilerPath);
     578    WriteString('ExecutorPath', ExecutorPath);
     579    WriteBool('Selected', Selected);
    567580  finally
    568581    Free;
Note: See TracChangeset for help on using the changeset viewer.