Changeset 106


Ignore:
Timestamp:
May 6, 2019, 11:03:00 AM (5 years ago)
Author:
chronos
Message:
  • Added: TargetCode form use SynEdit for syntax highlighting.
  • Fixed: Do not show error if specific target doesn't have assigned compiler. Not all targets use compiler. Some of them are just interpreted.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r103 r106  
    55  Width = 860
    66  Caption = 'LazFuck'
    7   ClientHeight = 556
     7  ClientHeight = 561
    88  ClientWidth = 860
    9   DesignTimePPI = 144
     9  DesignTimePPI = 120
    1010  Menu = MainMenu1
    1111  OnClose = FormClose
     
    1414  OnDestroy = FormDestroy
    1515  OnShow = FormShow
    16   LCLVersion = '2.0.0.4'
     16  LCLVersion = '2.0.2.0'
    1717  WindowState = wsMaximized
    1818  object StatusBarMain: TStatusBar
    1919    Left = 0
    20     Height = 36
    21     Top = 520
     20    Height = 28
     21    Top = 533
    2222    Width = 860
    2323    Panels = <   
    2424      item
    25         Width = 84
     25        Width = 70
    2626      end   
    2727      item
    28         Width = 84
     28        Width = 70
    2929      end   
    3030      item
    31         Width = 96
     31        Width = 80
    3232      end>
    3333    ParentFont = False
     
    3636  object ToolBarMain: TToolBar
    3737    Left = 0
    38     Height = 31
     38    Height = 26
    3939    Top = 0
    4040    Width = 860
     
    5050    end
    5151    object ToolButton2: TToolButton
    52       Left = 36
     52      Left = 30
    5353      Top = 2
    5454      Action = AProjectOpen
     
    5757    end
    5858    object ToolButton3: TToolButton
    59       Left = 89
     59      Left = 74
    6060      Top = 2
    6161      Action = AProjectSave
    6262    end
    6363    object ToolButton4: TToolButton
    64       Left = 124
     64      Left = 103
    6565      Top = 2
    6666      Action = AProjectClose
    6767    end
    6868    object ToolButton5: TToolButton
    69       Left = 194
    70       Height = 33
     69      Left = 161
     70      Height = 28
    7171      Top = 2
    7272      Style = tbsSeparator
    7373    end
    7474    object ToolButton6: TToolButton
    75       Left = 239
     75      Left = 197
    7676      Top = 2
    7777      Action = AProgramRun
    7878    end
    7979    object ToolButton7: TToolButton
    80       Left = 204
     80      Left = 168
    8181      Top = 2
    8282      Action = AProgramCompile
    8383    end
    8484    object ToolButton8: TToolButton
    85       Left = 159
     85      Left = 132
    8686      Top = 2
    8787      Action = AOptions
    8888    end
    8989    object ToolButton9: TToolButton
    90       Left = 344
     90      Left = 284
    9191      Top = 2
    9292      Action = ABreakpointToggle
    9393    end
    9494    object ToolButton10: TToolButton
    95       Left = 274
     95      Left = 226
    9696      Top = 2
    9797      Action = AProgramPause
    9898    end
    9999    object ToolButton11: TToolButton
    100       Left = 309
     100      Left = 255
    101101      Top = 2
    102102      Action = AProgramStop
    103103    end
    104104    object ToolButton12: TToolButton
    105       Left = 379
     105      Left = 313
    106106      Top = 2
    107107      Action = AProgramStepOver
    108108    end
    109109    object ToolButton13: TToolButton
    110       Left = 414
     110      Left = 342
    111111      Top = 2
    112112      Action = AProgramStepInto
    113113    end
    114114    object ToolButton14: TToolButton
    115       Left = 449
     115      Left = 371
    116116      Top = 2
    117117      Action = AProgramStepOut
    118118    end
    119119    object ToolButton15: TToolButton
    120       Left = 484
     120      Left = 400
    121121      Top = 2
    122122      Action = AProgramRunToCursor
    123123    end
    124124    object ToolButtonTarget: TToolButton
    125       Left = 519
     125      Left = 429
    126126      Hint = 'Target select'
    127127      Top = 2
     
    132132  end
    133133  object PageControlRight: TPageControl
    134     Left = 388
    135     Height = 489
    136     Top = 31
    137     Width = 472
     134    Left = 467
     135    Height = 507
     136    Top = 26
     137    Width = 393
    138138    ActivePage = TabSheetDebug
    139139    Align = alRight
     
    144144    object TabSheetDebug: TTabSheet
    145145      Caption = 'Debug'
    146       ClientHeight = 481
    147       ClientWidth = 434
     146      ClientHeight = 499
     147      ClientWidth = 359
    148148      ParentFont = False
    149149      object PanelInput: TPanel
    150150        Left = 0
    151         Height = 77
     151        Height = 64
    152152        Top = 0
    153         Width = 434
     153        Width = 359
    154154        Align = alTop
    155155        BevelOuter = bvNone
     
    160160        Cursor = crVSplit
    161161        Left = 0
    162         Height = 6
    163         Top = 77
    164         Width = 434
     162        Height = 5
     163        Top = 64
     164        Width = 359
    165165        Align = alTop
    166166        ResizeAnchor = akTop
     
    168168      object PanelOutput: TPanel
    169169        Left = 0
    170         Height = 311
    171         Top = 83
    172         Width = 434
     170        Height = 259
     171        Top = 69
     172        Width = 359
    173173        Align = alTop
    174174        BevelOuter = bvNone
     
    179179        Cursor = crVSplit
    180180        Left = 0
    181         Height = 6
    182         Top = 394
    183         Width = 434
     181        Height = 5
     182        Top = 328
     183        Width = 359
    184184        Align = alTop
    185185        ResizeAnchor = akTop
     
    187187      object PanelCPU: TPanel
    188188        Left = 0
    189         Height = 103
    190         Top = 400
    191         Width = 434
     189        Height = 86
     190        Top = 333
     191        Width = 359
    192192        Align = alTop
    193193        BevelOuter = bvNone
     
    198198        Cursor = crVSplit
    199199        Left = 0
    200         Height = 6
    201         Top = 481
    202         Width = 434
     200        Height = 5
     201        Top = 419
     202        Width = 359
    203203        Align = alTop
    204204        ResizeAnchor = akTop
     
    206206      object PanelMemory: TPanel
    207207        Left = 0
    208         Height = 0
    209         Top = 481
    210         Width = 434
     208        Height = 75
     209        Top = 424
     210        Width = 359
    211211        Align = alClient
    212212        BevelOuter = bvNone
     
    217217  end
    218218  object Splitter1: TSplitter
    219     Left = 382
    220     Height = 489
    221     Top = 31
    222     Width = 6
     219    Left = 462
     220    Height = 507
     221    Top = 26
     222    Width = 5
    223223    Align = alRight
    224224    ResizeAnchor = akRight
     
    226226  object PanelLeft: TPanel
    227227    Left = 0
    228     Height = 489
    229     Top = 31
    230     Width = 382
     228    Height = 507
     229    Top = 26
     230    Width = 462
    231231    Align = alClient
    232232    BevelOuter = bvNone
    233     ClientHeight = 489
    234     ClientWidth = 382
     233    ClientHeight = 507
     234    ClientWidth = 462
    235235    ParentFont = False
    236236    TabOrder = 4
    237237    object PageControlMain: TPageControl
    238238      Left = 0
    239       Height = 341
     239      Height = 384
    240240      Top = 0
    241       Width = 382
     241      Width = 462
    242242      ActivePage = TabSheetSource
    243243      Align = alClient
     
    256256    object PageControlBottom: TPageControl
    257257      Left = 0
    258       Height = 142
    259       Top = 347
    260       Width = 382
     258      Height = 118
     259      Top = 389
     260      Width = 462
    261261      ActivePage = TabSheetMessages
    262262      Align = alBottom
     
    273273      Cursor = crVSplit
    274274      Left = 0
    275       Height = 6
    276       Top = 341
    277       Width = 382
     275      Height = 5
     276      Top = 384
     277      Width = 462
    278278      Align = alBottom
    279279      ResizeAnchor = akBottom
     
    282282  object MainMenu1: TMainMenu
    283283    Images = Core.ImageListMain
    284     left = 259
    285     top = 163
     284    left = 216
     285    top = 136
    286286    object MenuItem1: TMenuItem
    287287      Caption = 'Project'
     
    383383  object ActionList1: TActionList
    384384    Images = Core.ImageListMain
    385     left = 259
    386     top = 230
     385    left = 216
     386    top = 192
    387387    object AProjectOpen: TAction
    388388      Category = 'Project'
     
    529529    DefaultExt = '.b'
    530530    Filter = 'BrainFuck (*.b)|*.b|Any file (*.*)|*.*'
    531     left = 67
    532     top = 221
     531    left = 56
     532    top = 184
    533533  end
    534534  object SaveDialog1: TSaveDialog
    535535    DefaultExt = '.b'
    536536    Filter = 'BrainFuck (*.b)|*.b|Any file (*.*)|*.*'
    537     left = 67
    538     top = 288
     537    left = 56
     538    top = 240
    539539  end
    540540  object TimerRefresh: TTimer
    541541    OnTimer = TimerRefreshTimer
    542     left = 67
    543     top = 355
     542    left = 56
     543    top = 296
    544544  end
    545545  object PopupMenuRecentFiles: TPopupMenu
    546     left = 67
    547     top = 77
     546    left = 56
     547    top = 64
    548548  end
    549549  object PopupMenuTargets: TPopupMenu
    550550    Images = Core.ImageListMain
    551     left = 67
    552     top = 143
     551    left = 56
     552    top = 119
    553553  end
    554554end
  • trunk/Forms/UFormMain.pas

    r97 r106  
    66
    77uses
    8   Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs,
    9   Menus, ActnList, ComCtrls, ExtCtrls, UTarget, Registry, URegistry,
    10   LazFileUtils;
     8  Classes, SysUtils, FileUtil, Forms, Controls,
     9  Graphics, Dialogs, Menus, ActnList, ComCtrls, ExtCtrls, UTarget, Registry,
     10  URegistry, LazFileUtils;
    1111
    1212type
     
    216216procedure TFormMain.TargetLogExecute(Lines: TStrings);
    217217begin
    218   FormLog.Memo1.Lines.AddStrings(Lines);
     218  if Assigned(FormLog) then
     219    FormLog.Memo1.Lines.AddStrings(Lines);
    219220end;
    220221
     
    250251  if Core.Project.Openned then
    251252    raise Exception.Create(SCloseProjectFirst);
    252   FormSourceCode.SynEdit1.Lines.LoadFromFile(FileName);
     253  FormSourceCode.SynEditSource.Lines.LoadFromFile(FileName);
    253254  Core.LastOpenedList.AddItem(FileName);
    254255  Core.Project.FileName := FileName;
     
    344345  Caption := Title;
    345346  AProjectSave.Enabled := Core.Project.Modified;
    346   FormSourceCode.SynEdit1.Enabled := Core.Project.Openned;
     347  FormSourceCode.SynEditSource.Enabled := Core.Project.Openned;
    347348  AProjectClose.Enabled := Core.Project.Openned;
    348349  AProjectSaveAs.Enabled := Core.Project.Openned;
     
    372373procedure TFormMain.UpdateStatusBar;
    373374begin
    374   StatusBarMain.Panels[0].Text := IntToStr(FormSourceCode.SynEdit1.CaretXY.X) +
    375     ', ' + IntToStr(FormSourceCode.SynEdit1.CaretXY.Y);
     375  StatusBarMain.Panels[0].Text := IntToStr(FormSourceCode.SynEditSource.CaretXY.X) +
     376    ', ' + IntToStr(FormSourceCode.SynEditSource.CaretXY.Y);
    376377end;
    377378
     
    417418  DebugStep: TDebugStep;
    418419begin
    419   DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.MemoTarget.SelStart);
     420  DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.SynEditTarget.SelStart);
    420421  if Assigned(DebugStep) then begin
    421     FormSourceCode.SynEdit1.SelStart := DebugStep.SourcePosition;
     422    FormSourceCode.SynEditSource.SelStart := DebugStep.SourcePosition;
    422423    PageControlMain.TabIndex := 0;
    423424  end;
     
    428429  DebugStep: TDebugStep;
    429430begin
    430   DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEdit1.SelStart);
     431  DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart);
    431432  if Assigned(DebugStep) then begin
    432     FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition;
     433    FormTargetCode.SynEditTarget.SelStart := DebugStep.TargetPosition;
    433434    PageControlMain.TabIndex := 1;
    434435  end;
     
    497498  try
    498499    AProgramStop.Execute;
    499     SourceCode := FormSourceCode.SynEdit1.Text;
     500    SourceCode := FormSourceCode.SynEditSource.Text;
    500501    ProjectFileName := Core.Project.FileName;
    501502    ProgramName := ExtractFileNameOnly(Core.Project.FileName);
     
    506507    Compile;
    507508    Core.CurrentTarget.Messages.AppendMessage(SDone);
    508     FormTargetCode.MemoTarget.Text := TargetCode;
     509    FormTargetCode.SynEditTarget.Text := TargetCode;
     510    FormTargetCode.SetHighlighter(Core.CurrentTarget.SourceExtension);
    509511    UpdateInterface;
    510512  except
     
    519521  BreakPoint: TBreakPoint;
    520522begin
    521   DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEdit1.SelStart);
     523  DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart);
    522524  if Assigned(DebugStep) then begin
    523525    BreakPoint := Core.CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition);
     
    552554  if Core.CurrentTarget.State = rsStopped then begin
    553555    if not Core.CurrentTarget.Compiled then AProgramCompile.Execute;
    554     DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEdit1.SelStart);
     556    DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart);
    555557    Core.CurrentTarget.BreakPoints.SetSystem(DebugStep.TargetPosition);
    556558    AProgramRun.Execute;
    557559  end else begin
    558     DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEdit1.SelStart);
     560    DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEditSource.SelStart);
    559561    Core.CurrentTarget.RunToCursor(DebugStep.TargetPosition);
    560562  end;
     
    566568begin
    567569  DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(Core.CurrentTarget.ExecutionPosition);
    568   FormSourceCode.SynEdit1.SelStart := DebugStep.SourcePosition;
    569   FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition;
    570   if PageControlMain.TabIndex = 0 then FormSourceCode.SynEdit1.SetFocus;
    571   if PageControlMain.TabIndex = 1 then FormTargetCode.MemoTarget.SetFocus;
     570  FormSourceCode.SynEditSource.SelStart := DebugStep.SourcePosition;
     571  FormTargetCode.SynEditTarget.SelStart := DebugStep.TargetPosition;
     572  if PageControlMain.TabIndex = 0 then FormSourceCode.SynEditSource.SetFocus;
     573  if PageControlMain.TabIndex = 1 then FormTargetCode.SynEditTarget.SetFocus;
    572574end;
    573575
     
    614616    AProgramStop.Execute;
    615617    Core.Project.Openned := False;
    616     FormSourceCode.SynEdit1.Clear;
     618    FormSourceCode.SynEditSource.Clear;
    617619    UpdateInterface;
    618620  end;
     
    624626  if Core.Project.Openned then Exit;
    625627  Core.Project.FileName := 'Examples' + DirectorySeparator + SNewProject + '.b';
    626   FormSourceCode.SynEdit1.Clear;
     628  FormSourceCode.SynEditSource.Clear;
    627629  Core.Project.Openned := True;
    628630  Core.CurrentTarget.Compiled := False;
     
    654656  SaveDialog1.FileName := Core.Project.FileName;
    655657  if SaveDialog1.Execute then begin
    656     FormSourceCode.SynEdit1.Lines.SaveToFile(SaveDialog1.FileName);
     658    FormSourceCode.SynEditSource.Lines.SaveToFile(SaveDialog1.FileName);
    657659    Core.Project.FileName := SaveDialog1.FileName;
    658660    Core.LastOpenedList.AddItem(SaveDialog1.FileName);
     
    665667begin
    666668  if Core.Project.Modified and FileExistsUTF8(Core.Project.FileName) then begin
    667     FormSourceCode.SynEdit1.Lines.SaveToFile(Core.Project.FileName);
     669    FormSourceCode.SynEditSource.Lines.SaveToFile(Core.Project.FileName);
    668670    Core.Project.Modified := False;
    669671    UpdateInterface;
  • trunk/Forms/UFormSourceCode.lfm

    r105 r106  
    1010  OnCreate = FormCreate
    1111  LCLVersion = '2.0.2.0'
    12   inline SynEdit1: TSynEdit
     12  inline SynEditSource: TSynEdit
    1313    Left = 0
    14     Height = 589
     14    Height = 491
    1515    Top = 0
    16     Width = 672
     16    Width = 560
    1717    Align = alClient
    1818    Font.Height = -13
  • trunk/Forms/UFormSourceCode.pas

    r105 r106  
    3636    MenuItem6: TMenuItem;
    3737    PopupMenuSource: TPopupMenu;
    38     SynEdit1: TSynEdit;
     38    SynEditSource: TSynEdit;
    3939    SynJavaSyn1: TSynJavaSyn;
    4040    procedure AClearExecute(Sender: TObject);
     
    9191    for I := 0 to Number - 1 do
    9292      NumberText := NumberText + '+';
    93     SynEdit1.SelText := NumberText;
     93    SynEditSource.SelText := NumberText;
    9494  end;
    9595end;
     
    9797procedure TFormSourceCode.APasteFromClipboardExecute(Sender: TObject);
    9898begin
    99   SynEdit1.PasteFromClipboard;
     99  SynEditSource.PasteFromClipboard;
    100100end;
    101101
    102102procedure TFormSourceCode.ASelectAllExecute(Sender: TObject);
    103103begin
    104   SynEdit1.SelectAll;
     104  SynEditSource.SelectAll;
    105105end;
    106106
     
    114114  IndentText = '  ';
    115115begin
    116   Source := SynEdit1.Text;
     116  Source := SynEditSource.Text;
    117117  NewSource := '';
    118118  Indent := 0;
     
    130130      NewSource := NewSource + Source[I];
    131131  end;
    132   SynEdit1.Text := NewSource;
     132  SynEditSource.Text := NewSource;
    133133end;
    134134
    135135procedure TFormSourceCode.ACopyToClipboardExecute(Sender: TObject);
    136136begin
    137   SynEdit1.CopyToClipboard;
     137  SynEditSource.CopyToClipboard;
    138138end;
    139139
    140140procedure TFormSourceCode.ACutToClipboardExecute(Sender: TObject);
    141141begin
    142   SynEdit1.CutToClipboard;
     142  SynEditSource.CutToClipboard;
    143143end;
    144144
    145145procedure TFormSourceCode.AClearExecute(Sender: TObject);
    146146begin
    147   SynEdit1.Clear;
     147  SynEditSource.Clear;
    148148end;
    149149
     
    154154  I: Integer;
    155155begin
    156   Source := SynEdit1.Text;
     156  Source := SynEditSource.Text;
    157157  Pos := 1;
    158158  for I := 1 to Length(Source) do begin
     
    163163  end;
    164164  SetLength(Source, Pos - 1);
    165   SynEdit1.Text := Source;
     165  SynEditSource.Text := Source;
    166166end;
    167167
     
    169169begin
    170170  BFHighlighter := TSynBrainFuckHl.Create(nil);
    171   SynEdit1.Highlighter := BFHighlighter;
     171  SynEditSource.Highlighter := BFHighlighter;
    172172end;
    173173
  • trunk/Forms/UFormTargetCode.lfm

    r103 r106  
    11object FormTargetCode: TFormTargetCode
    2   Left = 682
    3   Height = 288
    4   Top = 485
    5   Width = 384
     2  Left = 555
     3  Height = 435
     4  Top = 379
     5  Width = 612
    66  Caption = 'Target code'
    7   ClientHeight = 288
    8   ClientWidth = 384
    9   DesignTimePPI = 144
    10   LCLVersion = '2.0.0.4'
    11   object MemoTarget: TMemo
     7  ClientHeight = 435
     8  ClientWidth = 612
     9  DesignTimePPI = 120
     10  LCLVersion = '2.0.2.0'
     11  inline SynEditTarget: TSynEdit
    1212    Left = 0
    13     Height = 288
     13    Height = 435
    1414    Top = 0
    15     Width = 384
     15    Width = 612
    1616    Align = alClient
     17    Font.Height = -13
    1718    Font.Name = 'Courier New'
     19    Font.Pitch = fpFixed
     20    Font.Quality = fqNonAntialiased
     21    ParentColor = False
    1822    ParentFont = False
    1923    PopupMenu = PopupMenuTarget
    20     ReadOnly = True
    21     ScrollBars = ssAutoBoth
    2224    TabOrder = 0
     25    Gutter.Width = 68
     26    Gutter.MouseActions = <>
     27    RightGutter.Width = 0
     28    RightGutter.MouseActions = <>
     29    Keystrokes = <   
     30      item
     31        Command = ecUp
     32        ShortCut = 38
     33      end   
     34      item
     35        Command = ecSelUp
     36        ShortCut = 8230
     37      end   
     38      item
     39        Command = ecScrollUp
     40        ShortCut = 16422
     41      end   
     42      item
     43        Command = ecDown
     44        ShortCut = 40
     45      end   
     46      item
     47        Command = ecSelDown
     48        ShortCut = 8232
     49      end   
     50      item
     51        Command = ecScrollDown
     52        ShortCut = 16424
     53      end   
     54      item
     55        Command = ecLeft
     56        ShortCut = 37
     57      end   
     58      item
     59        Command = ecSelLeft
     60        ShortCut = 8229
     61      end   
     62      item
     63        Command = ecWordLeft
     64        ShortCut = 16421
     65      end   
     66      item
     67        Command = ecSelWordLeft
     68        ShortCut = 24613
     69      end   
     70      item
     71        Command = ecRight
     72        ShortCut = 39
     73      end   
     74      item
     75        Command = ecSelRight
     76        ShortCut = 8231
     77      end   
     78      item
     79        Command = ecWordRight
     80        ShortCut = 16423
     81      end   
     82      item
     83        Command = ecSelWordRight
     84        ShortCut = 24615
     85      end   
     86      item
     87        Command = ecPageDown
     88        ShortCut = 34
     89      end   
     90      item
     91        Command = ecSelPageDown
     92        ShortCut = 8226
     93      end   
     94      item
     95        Command = ecPageBottom
     96        ShortCut = 16418
     97      end   
     98      item
     99        Command = ecSelPageBottom
     100        ShortCut = 24610
     101      end   
     102      item
     103        Command = ecPageUp
     104        ShortCut = 33
     105      end   
     106      item
     107        Command = ecSelPageUp
     108        ShortCut = 8225
     109      end   
     110      item
     111        Command = ecPageTop
     112        ShortCut = 16417
     113      end   
     114      item
     115        Command = ecSelPageTop
     116        ShortCut = 24609
     117      end   
     118      item
     119        Command = ecLineStart
     120        ShortCut = 36
     121      end   
     122      item
     123        Command = ecSelLineStart
     124        ShortCut = 8228
     125      end   
     126      item
     127        Command = ecEditorTop
     128        ShortCut = 16420
     129      end   
     130      item
     131        Command = ecSelEditorTop
     132        ShortCut = 24612
     133      end   
     134      item
     135        Command = ecLineEnd
     136        ShortCut = 35
     137      end   
     138      item
     139        Command = ecSelLineEnd
     140        ShortCut = 8227
     141      end   
     142      item
     143        Command = ecEditorBottom
     144        ShortCut = 16419
     145      end   
     146      item
     147        Command = ecSelEditorBottom
     148        ShortCut = 24611
     149      end   
     150      item
     151        Command = ecToggleMode
     152        ShortCut = 45
     153      end   
     154      item
     155        Command = ecCopy
     156        ShortCut = 16429
     157      end   
     158      item
     159        Command = ecPaste
     160        ShortCut = 8237
     161      end   
     162      item
     163        Command = ecDeleteChar
     164        ShortCut = 46
     165      end   
     166      item
     167        Command = ecCut
     168        ShortCut = 8238
     169      end   
     170      item
     171        Command = ecDeleteLastChar
     172        ShortCut = 8
     173      end   
     174      item
     175        Command = ecDeleteLastChar
     176        ShortCut = 8200
     177      end   
     178      item
     179        Command = ecDeleteLastWord
     180        ShortCut = 16392
     181      end   
     182      item
     183        Command = ecUndo
     184        ShortCut = 32776
     185      end   
     186      item
     187        Command = ecRedo
     188        ShortCut = 40968
     189      end   
     190      item
     191        Command = ecLineBreak
     192        ShortCut = 13
     193      end   
     194      item
     195        Command = ecSelectAll
     196        ShortCut = 16449
     197      end   
     198      item
     199        Command = ecCopy
     200        ShortCut = 16451
     201      end   
     202      item
     203        Command = ecBlockIndent
     204        ShortCut = 24649
     205      end   
     206      item
     207        Command = ecLineBreak
     208        ShortCut = 16461
     209      end   
     210      item
     211        Command = ecInsertLine
     212        ShortCut = 16462
     213      end   
     214      item
     215        Command = ecDeleteWord
     216        ShortCut = 16468
     217      end   
     218      item
     219        Command = ecBlockUnindent
     220        ShortCut = 24661
     221      end   
     222      item
     223        Command = ecPaste
     224        ShortCut = 16470
     225      end   
     226      item
     227        Command = ecCut
     228        ShortCut = 16472
     229      end   
     230      item
     231        Command = ecDeleteLine
     232        ShortCut = 16473
     233      end   
     234      item
     235        Command = ecDeleteEOL
     236        ShortCut = 24665
     237      end   
     238      item
     239        Command = ecUndo
     240        ShortCut = 16474
     241      end   
     242      item
     243        Command = ecRedo
     244        ShortCut = 24666
     245      end   
     246      item
     247        Command = ecGotoMarker0
     248        ShortCut = 16432
     249      end   
     250      item
     251        Command = ecGotoMarker1
     252        ShortCut = 16433
     253      end   
     254      item
     255        Command = ecGotoMarker2
     256        ShortCut = 16434
     257      end   
     258      item
     259        Command = ecGotoMarker3
     260        ShortCut = 16435
     261      end   
     262      item
     263        Command = ecGotoMarker4
     264        ShortCut = 16436
     265      end   
     266      item
     267        Command = ecGotoMarker5
     268        ShortCut = 16437
     269      end   
     270      item
     271        Command = ecGotoMarker6
     272        ShortCut = 16438
     273      end   
     274      item
     275        Command = ecGotoMarker7
     276        ShortCut = 16439
     277      end   
     278      item
     279        Command = ecGotoMarker8
     280        ShortCut = 16440
     281      end   
     282      item
     283        Command = ecGotoMarker9
     284        ShortCut = 16441
     285      end   
     286      item
     287        Command = ecSetMarker0
     288        ShortCut = 24624
     289      end   
     290      item
     291        Command = ecSetMarker1
     292        ShortCut = 24625
     293      end   
     294      item
     295        Command = ecSetMarker2
     296        ShortCut = 24626
     297      end   
     298      item
     299        Command = ecSetMarker3
     300        ShortCut = 24627
     301      end   
     302      item
     303        Command = ecSetMarker4
     304        ShortCut = 24628
     305      end   
     306      item
     307        Command = ecSetMarker5
     308        ShortCut = 24629
     309      end   
     310      item
     311        Command = ecSetMarker6
     312        ShortCut = 24630
     313      end   
     314      item
     315        Command = ecSetMarker7
     316        ShortCut = 24631
     317      end   
     318      item
     319        Command = ecSetMarker8
     320        ShortCut = 24632
     321      end   
     322      item
     323        Command = ecSetMarker9
     324        ShortCut = 24633
     325      end   
     326      item
     327        Command = EcFoldLevel1
     328        ShortCut = 41009
     329      end   
     330      item
     331        Command = EcFoldLevel2
     332        ShortCut = 41010
     333      end   
     334      item
     335        Command = EcFoldLevel3
     336        ShortCut = 41011
     337      end   
     338      item
     339        Command = EcFoldLevel4
     340        ShortCut = 41012
     341      end   
     342      item
     343        Command = EcFoldLevel5
     344        ShortCut = 41013
     345      end   
     346      item
     347        Command = EcFoldLevel6
     348        ShortCut = 41014
     349      end   
     350      item
     351        Command = EcFoldLevel7
     352        ShortCut = 41015
     353      end   
     354      item
     355        Command = EcFoldLevel8
     356        ShortCut = 41016
     357      end   
     358      item
     359        Command = EcFoldLevel9
     360        ShortCut = 41017
     361      end   
     362      item
     363        Command = EcFoldLevel0
     364        ShortCut = 41008
     365      end   
     366      item
     367        Command = EcFoldCurrent
     368        ShortCut = 41005
     369      end   
     370      item
     371        Command = EcUnFoldCurrent
     372        ShortCut = 41003
     373      end   
     374      item
     375        Command = EcToggleMarkupWord
     376        ShortCut = 32845
     377      end   
     378      item
     379        Command = ecNormalSelect
     380        ShortCut = 24654
     381      end   
     382      item
     383        Command = ecColumnSelect
     384        ShortCut = 24643
     385      end   
     386      item
     387        Command = ecLineSelect
     388        ShortCut = 24652
     389      end   
     390      item
     391        Command = ecTab
     392        ShortCut = 9
     393      end   
     394      item
     395        Command = ecShiftTab
     396        ShortCut = 8201
     397      end   
     398      item
     399        Command = ecMatchBracket
     400        ShortCut = 24642
     401      end   
     402      item
     403        Command = ecColSelUp
     404        ShortCut = 40998
     405      end   
     406      item
     407        Command = ecColSelDown
     408        ShortCut = 41000
     409      end   
     410      item
     411        Command = ecColSelLeft
     412        ShortCut = 40997
     413      end   
     414      item
     415        Command = ecColSelRight
     416        ShortCut = 40999
     417      end   
     418      item
     419        Command = ecColSelPageDown
     420        ShortCut = 40994
     421      end   
     422      item
     423        Command = ecColSelPageBottom
     424        ShortCut = 57378
     425      end   
     426      item
     427        Command = ecColSelPageUp
     428        ShortCut = 40993
     429      end   
     430      item
     431        Command = ecColSelPageTop
     432        ShortCut = 57377
     433      end   
     434      item
     435        Command = ecColSelLineStart
     436        ShortCut = 40996
     437      end   
     438      item
     439        Command = ecColSelLineEnd
     440        ShortCut = 40995
     441      end   
     442      item
     443        Command = ecColSelEditorTop
     444        ShortCut = 57380
     445      end   
     446      item
     447        Command = ecColSelEditorBottom
     448        ShortCut = 57379
     449      end>
     450    MouseActions = <>
     451    MouseTextActions = <>
     452    MouseSelActions = <>
     453    VisibleSpecialChars = [vscSpace, vscTabAtLast]
     454    SelectedColor.BackPriority = 50
     455    SelectedColor.ForePriority = 50
     456    SelectedColor.FramePriority = 50
     457    SelectedColor.BoldPriority = 50
     458    SelectedColor.ItalicPriority = 50
     459    SelectedColor.UnderlinePriority = 50
     460    SelectedColor.StrikeOutPriority = 50
     461    BracketHighlightStyle = sbhsBoth
     462    BracketMatchColor.Background = clNone
     463    BracketMatchColor.Foreground = clNone
     464    BracketMatchColor.Style = [fsBold]
     465    FoldedCodeColor.Background = clNone
     466    FoldedCodeColor.Foreground = clGray
     467    FoldedCodeColor.FrameColor = clGray
     468    MouseLinkColor.Background = clNone
     469    MouseLinkColor.Foreground = clBlue
     470    LineHighlightColor.Background = clNone
     471    LineHighlightColor.Foreground = clNone
     472    inline SynLeftGutterPartList1: TSynGutterPartList
     473      object SynGutterMarks1: TSynGutterMarks
     474        Width = 30
     475        MouseActions = <>
     476      end
     477      object SynGutterLineNumber1: TSynGutterLineNumber
     478        Width = 17
     479        MouseActions = <>
     480        MarkupInfo.Background = clBtnFace
     481        MarkupInfo.Foreground = clNone
     482        DigitCount = 2
     483        ShowOnlyLineNumbersMultiplesOf = 1
     484        ZeroStart = False
     485        LeadingZeros = False
     486      end
     487      object SynGutterChanges1: TSynGutterChanges
     488        Width = 5
     489        MouseActions = <>
     490        ModifiedColor = 59900
     491        SavedColor = clGreen
     492      end
     493      object SynGutterSeparator1: TSynGutterSeparator
     494        Width = 3
     495        MouseActions = <>
     496        MarkupInfo.Background = clWhite
     497        MarkupInfo.Foreground = clGray
     498      end
     499      object SynGutterCodeFolding1: TSynGutterCodeFolding
     500        Width = 13
     501        MouseActions = <>
     502        MarkupInfo.Background = clNone
     503        MarkupInfo.Foreground = clGray
     504        MouseActionsExpanded = <>
     505        MouseActionsCollapsed = <>
     506      end
     507    end
    23508  end
    24509  object PopupMenuTarget: TPopupMenu
    25510    Images = Core.ImageListMain
    26     left = 101
    27     top = 120
     511    left = 84
     512    top = 100
    28513    object MenuItem20: TMenuItem
    29514      Action = AFormatCode
     
    35520  object ActionList1: TActionList
    36521    Images = Core.ImageListMain
    37     left = 239
    38     top = 47
     522    left = 199
     523    top = 39
    39524    object AFormatCode: TAction
    40525      Caption = 'Format code'
  • trunk/Forms/UFormTargetCode.pas

    r91 r106  
    66
    77uses
    8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   Menus, ActnList, strutils;
     8  Classes, SysUtils, FileUtil, SynEdit, SynHighlighterAny, SynHighlighterPas,
     9  SynHighlighterCpp, SynHighlighterPHP, SynHighlighterJava,
     10  SynHighlighterPython, Forms, Controls, Graphics, Dialogs, StdCtrls, Menus,
     11  ActnList, strutils;
    1012
    1113type
     
    1719    AFormatCode: TAction;
    1820    ActionList1: TActionList;
    19     MemoTarget: TMemo;
    2021    MenuItem1: TMenuItem;
    2122    MenuItem20: TMenuItem;
    2223    PopupMenuTarget: TPopupMenu;
     24    SynEditTarget: TSynEdit;
    2325    procedure AFormatCodeExecute(Sender: TObject);
    2426    procedure AShrinkCodeExecute(Sender: TObject);
     
    2628    { private declarations }
    2729  public
    28     { public declarations }
     30    procedure SetHighlighter(SourceExt: string);
    2931  end;
    3032
     
    4749  IndentText = '  ';
    4850begin
    49   Source := MemoTarget.Text;
     51  Source := SynEditTarget.Text;
    5052  NewSource := '';
    5153  Indent := 0;
     
    6365      NewSource := NewSource + Source[I];
    6466  end;
    65   MemoTarget.Text := NewSource;
     67  SynEditTarget.Text := NewSource;
    6668end;
    6769
     
    7274  I: Integer;
    7375begin
    74   Source := MemoTarget.Text;
     76  Source := SynEditTarget.Text;
    7577  Pos := 1;
    7678  for I := 1 to Length(Source) do begin
     
    8183  end;
    8284  SetLength(Source, Pos - 1);
    83   MemoTarget.Text := Source;
     85  SynEditTarget.Text := Source;
     86end;
     87
     88procedure TFormTargetCode.SetHighlighter(SourceExt: string);
     89begin
     90  if Assigned(SynEditTarget.Highlighter) then
     91    SynEditTarget.Highlighter.Free;
     92  if SourceExt = '.pas' then SynEditTarget.Highlighter := TSynPasSyn.Create(nil)
     93  else if SourceExt = '.c' then SynEditTarget.Highlighter := TSynCppSyn.Create(nil)
     94  else if SourceExt = '.php' then SynEditTarget.Highlighter := TSynPhpSyn.Create(nil)
     95  else if SourceExt = '.java' then SynEditTarget.Highlighter := TSynJavaSyn.Create(nil)
     96  else if SourceExt = '.py' then SynEditTarget.Highlighter := TSynPythonSyn.Create(nil);
    8497end;
    8598
  • trunk/UTarget.pas

    r93 r106  
    419419    Free;
    420420  end;
    421   if FileExistsUTF8(CompilerPath) then
     421  if CompilerPath <> '' then begin;
     422    if FileExistsUTF8(CompilerPath) then
    422423    try
    423424      Process := TProcess.Create(nil);
     
    439440      Process.Free;
    440441    end else raise Exception.Create(Format(SCompilerNotFound, [CompilerPath]));
     442  end;
    441443end;
    442444
Note: See TracChangeset for help on using the changeset viewer.