Ignore:
Timestamp:
May 6, 2019, 11:03:00 AM (6 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.