Ignore:
Timestamp:
Oct 14, 2010, 1:50:39 PM (14 years ago)
Author:
george
Message:
  • Fixed: Seaching global interunit types and functions.
  • Core files transfered into separate package named TranspascalCompiler.
File:
1 edited

Legend:

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

    r59 r60  
    99  Dialogs, StdCtrls, USourceCode, UCompiler, UProducerAsm8051,
    1010  UProducerC, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, UProducerTreeView,
    11   UProducerPascal, Contnrs, UProject;
     11  UProducerPascal, Contnrs, UProject, FileUtil, Menus, ActnList;
    1212
    1313const
     
    1818
    1919  TMainForm = class(TForm)
     20    AProjectNew: TAction;
     21    AProjectOpen: TAction;
     22    AProjectSave: TAction;
     23    AProjectSaveAs: TAction;
     24    AProjectClose: TAction;
     25    ActionList1: TActionList;
    2026    ButtonCompile: TButton;
    2127    ComboBox1: TComboBox;
    2228    ListBoxMessages: TListBox;
     29    MainMenu1: TMainMenu;
     30    MenuItem1: TMenuItem;
     31    MenuItem2: TMenuItem;
     32    MenuItem3: TMenuItem;
     33    MenuItem4: TMenuItem;
     34    MenuItem5: TMenuItem;
     35    MenuItem6: TMenuItem;
    2336    Panel1: TPanel;
     37    Panel2: TPanel;
     38    Panel3: TPanel;
     39    Splitter1: TSplitter;
     40    Splitter2: TSplitter;
     41    Splitter3: TSplitter;
    2442    SynEditSource: TSynEdit;
    2543    SynPasSyn1: TSynPasSyn;
     
    3250    procedure FormDestroy(Sender: TObject);
    3351    procedure ListBoxMessagesClick(Sender: TObject);
     52    procedure Panel2Click(Sender: TObject);
     53    procedure Splitter2CanResize(Sender: TObject; var NewSize: Integer;
     54      var Accept: Boolean);
    3455    procedure TreeViewProjectChange(Sender: TObject; Node: TTreeNode);
    3556  private
     
    7697    ProducerControl.Parent := Panel1;
    7798    ProducerControl.Align := alClient;
    78     TProducerTreeView(Compiler.Producer).TreeView := TTreeView(ProducerControl);
    79   end;
    80 
    81   // Compile all project files
     99//    TProducerTreeView(Compiler.Producer).TreeView := TTreeView(ProducerControl);
     100  end;
     101
     102  // Compile project file
    82103  Compiler.Init;
    83104  Compiler.Parser.OnGetSource := GetSource;
    84105  with TProjectFile(Project.Items[0]) do begin
    85     Compiler.Compile(Parent.GetDir + Name, Source, ProducedCode);
     106    Compiler.Compile(Parent.GetDir + Name, Source);
    86107  end;
    87108
     
    127148end;
    128149
     150procedure TMainForm.Panel2Click(Sender: TObject);
     151begin
     152
     153end;
     154
     155procedure TMainForm.Splitter2CanResize(Sender: TObject; var NewSize: Integer;
     156  var Accept: Boolean);
     157begin
     158
     159end;
     160
    129161procedure TMainForm.LoadErrorMessages;
    130162var
     
    139171
    140172procedure TMainForm.TreeViewProjectChange(Sender: TObject; Node: TTreeNode);
     173var
     174  FileName: string;
    141175begin
    142176  if Assigned(Node) then begin
    143177    if TProjectNode(Node.Data) is TProjectFile then begin
    144178      SynEditSource.Lines.Assign(TProjectFile(Node.Data).Source);
     179      FileName := Compiler.CompiledFolder + DirectorySeparator +
     180        Compiler.Producer.ClassName + DirectorySeparator + ExtractFileNameOnly(TProjectFile(Node.Data).Name) + Compiler.Producer.FileExtension;
    145181      if ProducerControl is TMemo then
    146         TMemo(ProducerControl).Lines.Assign(TProjectFile(Node.Data).ProducedCode);
     182        if FileExists(FileName) then
     183        TMemo(ProducerControl).Lines.LoadFromFile(FileName) else
     184          TMemo(ProducerControl).Lines.Clear;
     185      //if ProducerControl is TTreeView then
     186      //  TTreeView(ProducerControl).Assign(TProjectFile(Node.Data).ProducedCode);
    147187    end;
    148188  end;
Note: See TracChangeset for help on using the changeset viewer.