Ignore:
Timestamp:
Feb 18, 2012, 11:08:44 PM (13 years ago)
Author:
chronos
Message:
  • Modified: CompiledForm replaced by compiled source tab in PageControl on MainForm.
  • Added: Function for switching position between source code and target code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UMainForm.pas

    r32 r33  
    1818
    1919  TMainForm = class(TForm)
     20    AShowSourcePosition: TAction;
     21    AShowTargetPosition: TAction;
    2022    AProgramCompile: TAction;
    2123    AAbout: TAction;
     
    3133    AProgramStepOver: TAction;
    3234    AProgramStepInto: TAction;
    33     AViewCompiled: TAction;
    3435    AViewInterpretter: TAction;
    3536    AProgramPause: TAction;
     
    4748    ImageList1: TImageList;
    4849    MainMenu1: TMainMenu;
     50    MemoTarget: TMemo;
    4951    MemoSource: TMemo;
    5052    MenuItem1: TMenuItem;
     
    7678    MenuItem34: TMenuItem;
    7779    MenuItem35: TMenuItem;
     80    MenuItem36: TMenuItem;
    7881    MenuItemOpenRecent: TMenuItem;
    7982    MenuItemTarget: TMenuItem;
     
    8689    MenuItem9: TMenuItem;
    8790    OpenDialog1: TOpenDialog;
     91    PageControl1: TPageControl;
     92    PopupMenuTarget: TPopupMenu;
    8893    PopupMenuSource: TPopupMenu;
    8994    SaveDialog1: TSaveDialog;
    9095    StatusBar1: TStatusBar;
    91     TabControl1: TTabControl;
     96    TabSheetSource: TTabSheet;
     97    TabSheetTarget: TTabSheet;
    9298    ToolBar1: TToolBar;
    9399    ToolButton1: TToolButton;
     
    121127    procedure AProjectSaveExecute(Sender: TObject);
    122128    procedure AProgramRunExecute(Sender: TObject);
     129    procedure AShowSourcePositionExecute(Sender: TObject);
     130    procedure AShowTargetPositionExecute(Sender: TObject);
    123131    procedure AShrinkSourceExecute(Sender: TObject);
    124     procedure AViewCompiledExecute(Sender: TObject);
    125132    procedure AViewCompilersExecute(Sender: TObject);
    126133    procedure AViewInterpretterExecute(Sender: TObject);
     
    167174
    168175uses
    169   UInterpretterForm, UApplicationInfo, UCompiledForm, UOptionsForm,
     176  UInterpretterForm, UApplicationInfo, UOptionsForm,
    170177  UTargetDelphi, UTargetPHP, UTargetC, UCompilersForm;
    171178
     
    179186procedure TMainForm.FormShow(Sender: TObject);
    180187begin
     188  PageControl1.TabIndex := 0;
    181189  if OpenProjectOnStart and (LastOpenedList.Count > 0) then
    182190    ProjectOpen(LastOpenedList[0])
     
    188196begin
    189197  Modified := True;
     198  CurrentTarget.Compiled := False;
    190199  UpdateInterface;
    191200end;
     
    236245  UpdateInterface;
    237246  Modified := False;
     247  CurrentTarget.Compiled := False;
    238248end;
    239249
     
    247257    TTarget(Targets[I]).OnChangeState := nil;
    248258  FCurrentTarget.OnChangeState := BrainFuckInterpreterChangeState;
     259  UpdateInterface;
    249260end;
    250261
     
    364375  if CurrentTarget is TTargetInterpretter then
    365376    TTargetInterpretter(CurrentTarget).Input := InterpreterForm.MemoInput.Lines.Text;
    366   CurrentTarget.Source := MemoSource.Text;
     377  CurrentTarget.SourceCode := MemoSource.Text;
    367378  CurrentTarget.Run;
     379end;
     380
     381procedure TMainForm.AShowSourcePositionExecute(Sender: TObject);
     382var
     383  DebugStep: TDebugStep;
     384begin
     385  DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(MemoSource.SelStart);
     386  MemoTarget.SelStart := DebugStep.SourcePosition;
     387  PageControl1.TabIndex := 0;
     388end;
     389
     390procedure TMainForm.AShowTargetPositionExecute(Sender: TObject);
     391var
     392  DebugStep: TDebugStep;
     393begin
     394  DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart);
     395  MemoTarget.SelStart := DebugStep.TargetPosition;
     396  PageControl1.TabIndex := 1;
    368397end;
    369398
     
    384413  SetLength(Source, Pos - 1);
    385414  MemoSource.Text := Source;
    386 end;
    387 
    388 procedure TMainForm.AViewCompiledExecute(Sender: TObject);
    389 begin
    390   CompiledForm.Show;
    391415end;
    392416
     
    466490  with CurrentTarget do begin
    467491    Optimization := coNormal;
    468     Source := MemoSource.Text;
     492    SourceCode := MemoSource.Text;
    469493    ProgramName := ExtractFileNameOnly(ProjectFileName);
    470494    Compile;
    471     CompiledForm.MemoCompiled.Text := Output;
    472     CompiledForm.Show;
     495    MemoTarget.Text := TargetCode;
    473496  end;
    474497end;
     
    483506  with CurrentTarget do begin
    484507    Optimization := coNormal;
    485     Source := MemoSource.Text;
     508    SourceCode := MemoSource.Text;
    486509    ProgramName := ExtractFileNameOnly(ProjectFileName);
    487510    ProjectFileName := Self.ProjectFileName;
     
    515538  MemoSource.Clear;
    516539  Modified := False;
     540  CurrentTarget.Compiled := False;
    517541  UpdateInterface;
    518542end;
Note: See TracChangeset for help on using the changeset viewer.