Changeset 42 for branches/DelphiToC/UMainForm.pas
- Timestamp:
- Aug 5, 2010, 3:13:03 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DelphiToC/UMainForm.pas
r41 r42 27 27 procedure ErrorMessage(Text: string); 28 28 private 29 procedure FillTreeView;30 29 public 31 30 Compiler: TCompiler; … … 52 51 SourceTree.Code := Compiler.ProgramCode; 53 52 SourceTree.Fill; 54 //FillTreeView;55 53 Memo2.Clear; 56 54 if Compiler.Producer is TAssemblerProducer then begin … … 68 66 begin 69 67 MainForm.Memo3.Lines.Add(Text); 70 end;71 72 procedure TMainForm.FillTreeView;73 var74 NewNode: TTreeNode;75 NewNode2: TTreeNode;76 NewNode3: TTreeNode;77 ModuleNode: TTreeNode;78 I: Integer;79 II: Integer;80 M: Integer;81 begin82 with TreeView1, Items, Compiler do begin83 BeginUpdate;84 Clear;85 AddChild(nil, 'Projekt');86 for M := 0 to ProgramCode.Modules.Count - 1 do87 with TModule(ProgramCode.Modules[M]) do begin88 ModuleNode := AddChild(TopItem, Name);89 NewNode := AddChild(ModuleNode, 'Typy');90 for I := 0 to Types.Count - 1 do91 with TType(Types[I]) do92 NewNode2 := AddChild(NewNode, Name);93 NewNode := AddChild(ModuleNode, 'Funkce');94 for I := 0 to Methods.Count - 1 do95 with TFunction(Methods[I]) do begin96 NewNode2 := AddChild(NewNode, Name);97 with NewNode2 do begin98 NewNode3 := AddChild(NewNode2, 'Parametery');99 for II := 0 to Parameters.Count - 1 do100 AddChild(NewNode3, TParameter(Parameters[II]).Name + ':' + TParameter(Parameters[II]).ValueType.Name);101 end;102 end;103 NewNode := AddChild(ModuleNode, 'Promìnné');104 for I := 0 to Variables.Count - 1 do105 with TVariable(Variables[I]) do106 NewNode2 := AddChild(NewNode, Name + ':' + ValueType.Name);107 NewNode := AddChild(ModuleNode, 'Konstanty');108 for I := 0 to Constants.Count - 1 do109 with TConstant(Constants[I]) do110 NewNode2 := AddChild(NewNode, Name + ':' + ValueType.Name + '=' + Value);111 NewNode := AddChild(ModuleNode, 'Program');112 for I := 0 to Code.Commands.Count - 1 do begin113 if TObject(Code.Commands[I]) is TBeginEnd then begin114 NewNode2 := AddChild(NewNode, 'Begin-End');115 116 end else117 if TObject(Code.Commands[I]) is TWhileDo then begin118 NewNode2 := AddChild(NewNode, 'While-Do');119 NewNode3 := AddChild(NewNode2, 'Podmínka');120 121 NewNode3 := AddChild(NewNode2, 'Povel');122 end else123 if TObject(Code.Commands[I]) is TAssignment then begin124 NewNode2 := AddChild(NewNode, TAssignment(Code.Commands[I]).Target.Name + ' := exp');125 126 end;127 end;128 129 end;130 TopItem.Expand(True);131 EndUpdate;132 end;133 68 end; 134 69 … … 153 88 procedure TMainForm.FormShow(Sender: TObject); 154 89 begin 90 WindowState := wsMaximized; 155 91 Memo1.Lines.LoadFromFile(ExampleFileName); 156 92 Button1Click(Self);
Note:
See TracChangeset
for help on using the changeset viewer.