Ignore:
Timestamp:
Oct 14, 2010, 8:41:34 AM (14 years ago)
Author:
george
Message:
  • Added: On parsing uses section load and parse unit files.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Transpascal/Forms/UMainForm.pas

    r55 r59  
    3737    procedure UpdateProjectTree;
    3838    procedure UpdateProjectGroup(Node: TTreeNode; Group: TProjectGroup);
     39    function GetSource(Name: string; Source: TStringList): Boolean;
    3940  public
    4041    Project: TProject;
     
    8081  // Compile all project files
    8182  Compiler.Init;
    82   for I := 0 to Project.Items.Count - 1 do begin
    83     if TProjectNode(Project.Items[I]) is TProjectFile then
    84     with TProjectFile(Project.Items[I]) do begin
    85       Compiler.Compile(Parent.GetDir + Name, Source, ProducedCode);
    86     end;
     83  Compiler.Parser.OnGetSource := GetSource;
     84  with TProjectFile(Project.Items[0]) do begin
     85    Compiler.Compile(Parent.GetDir + Name, Source, ProducedCode);
    8786  end;
    8887
     
    179178end;
    180179
     180function TMainForm.GetSource(Name: string; Source: TStringList): Boolean;
     181var
     182  FileName: string;
     183begin
     184  FileName := Project.GetDir(True) + Name + '.pas';
     185  if FileExists(FileName) then begin
     186    Source.LoadFromFile(FileName);
     187    Result := True;
     188  end else Result := False;
     189end;
     190
    181191procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
    182192begin
Note: See TracChangeset for help on using the changeset viewer.