Ignore:
Timestamp:
Jul 12, 2012, 7:47:58 AM (12 years ago)
Author:
chronos
Message:
  • Modified: Source code and target code splited to units.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r45 r46  
    4949    ImageList1: TImageList;
    5050    MainMenu1: TMainMenu;
    51     MemoSource: TMemo;
    52     MemoTarget: TMemo;
    5351    MenuItem1: TMenuItem;
    5452    MenuItem10: TMenuItem;
     
    6260    MenuItem18: TMenuItem;
    6361    MenuItem2: TMenuItem;
    64     MenuItem20: TMenuItem;
    65     MenuItem21: TMenuItem;
    6662    MenuItem22: TMenuItem;
    67     MenuItem23: TMenuItem;
    6863    MenuItem24: TMenuItem;
    6964    MenuItem25: TMenuItem;
    70     MenuItem26: TMenuItem;
    7165    MenuItem27: TMenuItem;
    7266    MenuItem28: TMenuItem;
    73     MenuItem29: TMenuItem;
    7467    MenuItem30: TMenuItem;
    7568    MenuItem31: TMenuItem;
     
    7871    MenuItem34: TMenuItem;
    7972    MenuItem35: TMenuItem;
    80     MenuItem36: TMenuItem;
    8173    MenuItemOpenRecent: TMenuItem;
    8274    MenuItemTarget: TMenuItem;
     
    9789    PanelOutput: TPanel;
    9890    PanelInput: TPanel;
    99     PopupMenuTarget: TPopupMenu;
    100     PopupMenuSource: TPopupMenu;
    10191    SaveDialog1: TSaveDialog;
    10292    Splitter1: TSplitter;
     
    200190  UFormCPU, UFormOptions, UFormMessages, UTargetJava,
    201191  UTargetDelphi, UTargetPHP, UTargetC, UFormTargets, UFormOutput, UFormInput,
    202   UFormMemory;
     192  UFormMemory, UFormSourceCode, UFormTargetCode;
    203193
    204194resourcestring
     
    214204procedure TMainForm.FormShow(Sender: TObject);
    215205begin
     206  LoadFromRegistry(RegistryRoot, ApplicationInfo.RegistryKey);
    216207  PageControlMain.TabIndex := 0;
    217208  if OpenProjectOnStart and (LastOpenedList.Items.Count > 0) then
     
    287278begin
    288279  AProjectClose.Execute;
    289   MemoSource.Lines.LoadFromFile(UTF8Decode(FileName));
     280  FormSourceCode.MemoSource.Lines.LoadFromFile(UTF8Decode(FileName));
    290281  LastOpenedList.AddItem(FileName);
    291282  ProjectFileName := FileName;
     
    318309procedure TMainForm.DockInit;
    319310begin
     311  FormSourceCode.ManualDock(TabSheetSource, nil, alClient);
     312  FormSourceCode.Align := alClient;
     313  FormSourceCode.Show;
     314  FormTargetCode.ManualDock(TabSheetTarget, nil, alClient);
     315  FormTargetCode.Align := alClient;
     316  FormTargetCode.Show;
    320317  FormCPU.ManualDock(PanelCPU, nil, alClient);
    321318  FormCPU.Align := alClient;
     
    387384begin
    388385  AProjectSave.Enabled := Modified;
    389   Title := ApplicationInfo.Name;
     386  Title := ApplicationInfo.AppName;
    390387  if ProjectFileName <> '' then Title := ProjectFileName + ' - ' + Title;
    391388  if Modified then Title := Title + ' *';
    392389  Caption := Title;
    393   MemoSource.Enabled := ProjectFileName <> '';
     390  FormSourceCode.MemoSource.Enabled := ProjectFileName <> '';
    394391  AProjectClose.Enabled := ProjectFileName <> '';
    395392  AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and
     
    418415procedure TMainForm.UpdateStatusBar;
    419416begin
    420   StatusBarMain.Panels[0].Text := IntToStr(MemoSource.CaretPos.X) + ', ' + IntToStr(MemoSource.CaretPos.Y);
     417  StatusBarMain.Panels[0].Text := IntToStr(FormSourceCode.MemoSource.CaretPos.X) +
     418    ', ' + IntToStr(FormSourceCode.MemoSource.CaretPos.Y);
    421419end;
    422420
     
    447445  LastOpenedList := TLastOpenedList.Create(nil);
    448446  LastOpenedList.OnChange := LastOpenedListChange;
    449   LoadFromRegistry(RegistryRoot, ApplicationInfo.RegistryKey);
    450447end;
    451448
     
    470467  DebugStep: TDebugStep;
    471468begin
    472   DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(MemoTarget.SelStart);
     469  DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.MemoTarget.SelStart);
    473470  if Assigned(DebugStep) then begin
    474     MemoSource.SelStart := DebugStep.SourcePosition;
     471    FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition;
    475472    PageControlMain.TabIndex := 0;
    476473  end;
     
    481478  DebugStep: TDebugStep;
    482479begin
    483   DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart);
     480  DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
    484481  if Assigned(DebugStep) then begin
    485     MemoTarget.SelStart := DebugStep.TargetPosition;
     482    FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition;
    486483    PageControlMain.TabIndex := 1;
    487484  end;
     
    494491  I: Integer;
    495492begin
    496   Source := MemoSource.Text;
     493  Source := FormSourceCode.MemoSource.Text;
    497494  Pos := 1;
    498495  for I := 1 to Length(Source) do begin
     
    503500  end;
    504501  SetLength(Source, Pos - 1);
    505   MemoSource.Text := Source;
     502  FormSourceCode.MemoSource.Text := Source;
    506503end;
    507504
     
    535532  IndentText = '  ';
    536533begin
    537   Source := MemoSource.Text;
     534  Source := FormSourceCode.MemoSource.Text;
    538535  NewSource := '';
    539536  Indent := 0;
     
    551548      NewSource := NewSource + Source[I];
    552549  end;
    553   MemoSource.Text := NewSource;
     550  FormSourceCode.MemoSource.Text := NewSource;
    554551end;
    555552
     
    565562    for I := 0 to Number - 1 do
    566563      NumberText := NumberText + '+';
    567     MemoSource.Text := MemoSource.Text + NumberText;
     564    FormSourceCode.MemoSource.Text := FormSourceCode.MemoSource.Text + NumberText;
    568565  end;
    569566end;
     
    582579    AProgramStop.Execute;
    583580    Optimization := coNormal;
    584     SourceCode := MemoSource.Text;
     581    SourceCode := FormSourceCode.MemoSource.Text;
    585582    ProjectFileName := Self.ProjectFileName;
    586583    ProgramName := ExtractFileNameOnly(Self.ProjectFileName);
     
    588585    Compile;
    589586    CurrentTarget.Messages.AppendMessage('done');
    590     MemoTarget.Text := TargetCode;
     587    FormTargetCode.MemoTarget.Text := TargetCode;
    591588    UpdateInterface;
    592589  end;
     
    598595  BreakPoint: TBreakPoint;
    599596begin
    600   DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart);
     597  DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
    601598  if Assigned(DebugStep) then begin
    602599    BreakPoint := CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition);
     
    618615  if CurrentTarget.State = rsStopped then begin
    619616    if not CurrentTarget.Compiled then AProgramCompile.Execute;
    620     DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart);
     617    DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
    621618    CurrentTarget.BreakPoints.SetSystem(DebugStep.TargetPosition);
    622619    AProgramRun.Execute;
    623620  end else begin
    624     DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart);
     621    DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart);
    625622    CurrentTarget.RunToCursor(DebugStep.TargetPosition);
    626623  end;
     
    632629begin
    633630  DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(CurrentTarget.ExecutionPosition);
    634   MemoSource.SelStart := DebugStep.SourcePosition;
    635   MemoTarget.SelStart := DebugStep.TargetPosition;
    636   if PageControlMain.TabIndex = 0 then MemoSource.SetFocus;
    637   if PageControlMain.TabIndex = 1 then MemoTarget.SetFocus;
     631  FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition;
     632  FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition;
     633  if PageControlMain.TabIndex = 0 then FormSourceCode.MemoSource.SetFocus;
     634  if PageControlMain.TabIndex = 1 then FormTargetCode.MemoTarget.SetFocus;
    638635end;
    639636
     
    671668  Modified := False;
    672669  ProjectFileName := '';
    673   MemoSource.Clear;
     670  FormSourceCode.MemoSource.Clear;
    674671  UpdateInterface;
    675672end;
     
    679676  AProjectClose.Execute;
    680677  ProjectFileName := 'Examples' + DirectorySeparator + SNewProject + '.b';
    681   MemoSource.Clear;
     678  FormSourceCode.MemoSource.Clear;
    682679  Modified := False;
    683680  CurrentTarget.Compiled := False;
     
    702699  SaveDialog1.FileName := ProjectFileName;
    703700  if SaveDialog1.Execute then begin
    704     MemoSource.Lines.SaveToFile(UTF8Decode(SaveDialog1.FileName));
     701    FormSourceCode.MemoSource.Lines.SaveToFile(UTF8Decode(SaveDialog1.FileName));
    705702    ProjectFileName := SaveDialog1.FileName;
    706703    LastOpenedList.AddItem(SaveDialog1.FileName);
Note: See TracChangeset for help on using the changeset viewer.