Ignore:
Timestamp:
Aug 2, 2018, 3:33:02 PM (6 years ago)
Author:
chronos
Message:
  • Added: Syntax highlighting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r96 r97  
    202202    DockInit;
    203203    Core.PersistentForm1.Load(Self, True);
    204     Core.ThemeManager.UseTheme(Self)
     204    Core.ThemeManager.UseTheme(Self);
     205    FormSourceCode.UpdateTheme;
    205206  end;
    206207end;
     
    249250  if Core.Project.Openned then
    250251    raise Exception.Create(SCloseProjectFirst);
    251   FormSourceCode.MemoSource.Lines.LoadFromFile(FileName);
     252  FormSourceCode.SynEdit1.Lines.LoadFromFile(FileName);
    252253  Core.LastOpenedList.AddItem(FileName);
    253254  Core.Project.FileName := FileName;
     
    343344  Caption := Title;
    344345  AProjectSave.Enabled := Core.Project.Modified;
    345   FormSourceCode.MemoSource.Enabled := Core.Project.Openned;
     346  FormSourceCode.SynEdit1.Enabled := Core.Project.Openned;
    346347  AProjectClose.Enabled := Core.Project.Openned;
    347348  AProjectSaveAs.Enabled := Core.Project.Openned;
     
    371372procedure TFormMain.UpdateStatusBar;
    372373begin
    373   StatusBarMain.Panels[0].Text := IntToStr(FormSourceCode.MemoSource.CaretPos.X) +
    374     ', ' + IntToStr(FormSourceCode.MemoSource.CaretPos.Y);
     374  StatusBarMain.Panels[0].Text := IntToStr(FormSourceCode.SynEdit1.CaretXY.X) +
     375    ', ' + IntToStr(FormSourceCode.SynEdit1.CaretXY.Y);
    375376end;
    376377
     
    418419  DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.MemoTarget.SelStart);
    419420  if Assigned(DebugStep) then begin
    420     FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition;
     421    FormSourceCode.SynEdit1.SelStart := DebugStep.SourcePosition;
    421422    PageControlMain.TabIndex := 0;
    422423  end;
     
    427428  DebugStep: TDebugStep;
    428429begin
    429   DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
     430  DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEdit1.SelStart);
    430431  if Assigned(DebugStep) then begin
    431432    FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition;
     
    484485      end;
    485486      Core.ThemeManager.UseTheme(Self);
     487      FormSourceCode.UpdateTheme;
    486488    end;
    487489  finally
     
    495497  try
    496498    AProgramStop.Execute;
    497     SourceCode := FormSourceCode.MemoSource.Text;
     499    SourceCode := FormSourceCode.SynEdit1.Text;
    498500    ProjectFileName := Core.Project.FileName;
    499501    ProgramName := ExtractFileNameOnly(Core.Project.FileName);
     
    517519  BreakPoint: TBreakPoint;
    518520begin
    519   DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
     521  DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEdit1.SelStart);
    520522  if Assigned(DebugStep) then begin
    521523    BreakPoint := Core.CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition);
     
    550552  if Core.CurrentTarget.State = rsStopped then begin
    551553    if not Core.CurrentTarget.Compiled then AProgramCompile.Execute;
    552     DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
     554    DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEdit1.SelStart);
    553555    Core.CurrentTarget.BreakPoints.SetSystem(DebugStep.TargetPosition);
    554556    AProgramRun.Execute;
    555557  end else begin
    556     DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
     558    DebugStep := Core.CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.SynEdit1.SelStart);
    557559    Core.CurrentTarget.RunToCursor(DebugStep.TargetPosition);
    558560  end;
     
    564566begin
    565567  DebugStep := Core.CurrentTarget.DebugSteps.SearchByTargetPos(Core.CurrentTarget.ExecutionPosition);
    566   FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition;
     568  FormSourceCode.SynEdit1.SelStart := DebugStep.SourcePosition;
    567569  FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition;
    568   if PageControlMain.TabIndex = 0 then FormSourceCode.MemoSource.SetFocus;
     570  if PageControlMain.TabIndex = 0 then FormSourceCode.SynEdit1.SetFocus;
    569571  if PageControlMain.TabIndex = 1 then FormTargetCode.MemoTarget.SetFocus;
    570572end;
     
    612614    AProgramStop.Execute;
    613615    Core.Project.Openned := False;
    614     FormSourceCode.MemoSource.Clear;
     616    FormSourceCode.SynEdit1.Clear;
    615617    UpdateInterface;
    616618  end;
     
    622624  if Core.Project.Openned then Exit;
    623625  Core.Project.FileName := 'Examples' + DirectorySeparator + SNewProject + '.b';
    624   FormSourceCode.MemoSource.Clear;
     626  FormSourceCode.SynEdit1.Clear;
    625627  Core.Project.Openned := True;
    626628  Core.CurrentTarget.Compiled := False;
     
    652654  SaveDialog1.FileName := Core.Project.FileName;
    653655  if SaveDialog1.Execute then begin
    654     FormSourceCode.MemoSource.Lines.SaveToFile(SaveDialog1.FileName);
     656    FormSourceCode.SynEdit1.Lines.SaveToFile(SaveDialog1.FileName);
    655657    Core.Project.FileName := SaveDialog1.FileName;
    656658    Core.LastOpenedList.AddItem(SaveDialog1.FileName);
     
    663665begin
    664666  if Core.Project.Modified and FileExistsUTF8(Core.Project.FileName) then begin
    665     FormSourceCode.MemoSource.Lines.SaveToFile(Core.Project.FileName);
     667    FormSourceCode.SynEdit1.Lines.SaveToFile(Core.Project.FileName);
    666668    Core.Project.Modified := False;
    667669    UpdateInterface;
Note: See TracChangeset for help on using the changeset viewer.