Ignore:
Timestamp:
Aug 10, 2010, 7:57:46 AM (14 years ago)
Author:
george
Message:

Visual TreeView reprezentation moved into target code producer set.

File:
1 edited

Legend:

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

    r51 r52  
    77uses
    88  SysUtils, Variants, Classes, Graphics, Controls, Forms,
    9   Dialogs, StdCtrls, USourceCode, UCompiler, UAssemblerSource,
    10   UProducerC, ComCtrls, SynEdit, SynHighlighterPas, USourceTree,
     9  Dialogs, StdCtrls, USourceCode, UCompiler, UProducerAsm8051,
     10  UProducerC, ComCtrls, ExtCtrls, SynEdit, SynHighlighterPas, UProducerTreeView,
    1111  UProducerPascal, Contnrs;
    1212
     
    2121    ComboBox1: TComboBox;
    2222    ListBox1: TListBox;
    23     Memo2: TMemo;
     23    Panel1: TPanel;
    2424    SynEdit1: TSynEdit;
    2525    SynPasSyn1: TSynPasSyn;
    26     TreeView1: TTreeView;
    2726    procedure ComboBox1Change(Sender: TObject);
    2827    procedure FormShow(Sender: TObject);
     
    3534  private
    3635  public
     36    ProducerControl: TControl;
    3737    Compiler: TCompiler;
    38     SourceTree: TSourceTree;
     38    SourceTree: TProducerTreeView;
    3939  end;
    4040
     
    5555  Compiler.SourceCode.Assign(SynEdit1.Lines);
    5656
    57   Memo2.Clear;
     57  ProducerControl.Free;
    5858  if ComboBox1.ItemIndex = 0 then begin
    5959    Compiler.Producer.Free;
     
    6161    Compiler.Producer.ProgramCode := Compiler.ProgramCode;
    6262    Compiler.Compile;
     63    ProducerControl := TMemo.Create(Self);
     64    ProducerControl.Parent := Panel1;
     65    ProducerControl.Align := alClient;
    6366    with TProducerPascal(Compiler.Producer) do
    64       Memo2.Lines.Assign(TextSource);
     67      TMemo(ProducerControl).Lines.Assign(TextSource);
    6568  end else
    6669  if ComboBox1.ItemIndex = 1 then begin
    6770    Compiler.Producer.Free;
    68     Compiler.Producer := TCProducer.Create;
     71    Compiler.Producer := TProducerC.Create;
    6972    Compiler.Producer.ProgramCode := Compiler.ProgramCode;
    7073    Compiler.Compile;
    71     with TCProducer(Compiler.Producer) do
    72       Memo2.Lines.Assign(TextSource);
     74    ProducerControl := TMemo.Create(Self);
     75    ProducerControl.Parent := Panel1;
     76    ProducerControl.Align := alClient;
     77    with TProducerC(Compiler.Producer) do
     78      TMemo(ProducerControl).Lines.Assign(TextSource);
    7379  end else
    7480  if ComboBox1.ItemIndex = 2 then begin
    7581    Compiler.Producer.Free;
    76     Compiler.Producer := TAssemblerProducer.Create;
     82    Compiler.Producer := TProducerAsm8051.Create;
    7783    Compiler.Producer.ProgramCode := Compiler.ProgramCode;
    7884    Compiler.Compile;
    79     with TAssemblerProducer(Compiler.Producer) do
     85    ProducerControl := TMemo.Create(Self);
     86    ProducerControl.Parent := Panel1;
     87    ProducerControl.Align := alClient;
     88    with TProducerAsm8051(Compiler.Producer) do
    8089    for I := 0 to AssemblyCode.Count - 1 do
    81       Memo2.Lines.Add(TAssemblerLine(AssemblyCode[I]).AsString);
     90      TMemo(ProducerControl).Lines.Add(TAssemblerLine(AssemblyCode[I]).AsString);
     91  end;
     92  if ComboBox1.ItemIndex = 3 then begin
     93    Compiler.Producer.Free;
     94    Compiler.Producer := TProducerTreeView.Create;
     95    Compiler.Producer.ProgramCode := Compiler.ProgramCode;
     96    ProducerControl := TTreeView.Create(Self);
     97    ProducerControl.Parent := Panel1;
     98    ProducerControl.Align := alClient;
     99    TProducerTreeView(Compiler.Producer).TreeView := TTreeView(ProducerControl);
     100    Compiler.Compile;
    82101  end;
    83102  LoadErrorMessages;
    84 
    85   SourceTree.TreeView := TreeView1;
    86   SourceTree.Code := Compiler.ProgramCode;
    87   SourceTree.Fill;
    88103end;
    89104
     
    115130begin
    116131  Compiler := TCompiler.Create;
    117   SourceTree := TSourceTree.Create;
     132  SourceTree := TProducerTreeView.Create;
    118133end;
    119134
Note: See TracChangeset for help on using the changeset viewer.