Changeset 19 for trunk/UMainForm.pas
- Timestamp:
- Feb 11, 2012, 10:18:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMainForm.pas
r18 r19 8 8 Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs, 9 9 Menus, ActnList, StdCtrls, ComCtrls, UBrainFuck, UCoolTranslator, StrUtils, 10 SpecializedList ;10 SpecializedList, UCompiler; 11 11 12 12 type … … 59 59 MenuItem25: TMenuItem; 60 60 MenuItem26: TMenuItem; 61 MenuItem 40: TMenuItem;61 MenuItemTarget: TMenuItem; 62 62 MenuItem21: TMenuItem; 63 63 MenuItem3: TMenuItem; … … 112 112 private 113 113 procedure BrainFuckInterpreterChangeState(Sender: TObject); 114 procedure MenuItemTargetClick(Sender: TObject); 114 115 public 115 116 Modified: Boolean; … … 118 119 BrainFuckInterpreter: TBrainFuckInterpretter; 119 120 BreakPoints: TListInteger; 121 Compilers: TListObject; // TListObject<TCompiler> 120 122 procedure UpdateInterface; 121 123 procedure UpdateStatusBar; 124 procedure UpdateTergetList; 122 125 end; 123 126 … … 130 133 131 134 uses 132 UInterpreterForm, UApplicationInfo, UCompiledForm, UOptionsForm; 135 UInterpreterForm, UApplicationInfo, UCompiledForm, UOptionsForm, 136 UCompilerDelphi, UCompilerPHP; 133 137 134 138 { TMainForm } … … 169 173 begin 170 174 UpdateInterface; 175 end; 176 177 procedure TMainForm.MenuItemTargetClick(Sender: TObject); 178 var 179 I: Integer; 180 begin 181 with TMenuItem(Sender) do begin 182 Checked := True; 183 for I := 0 to Parent.Count - 1 do 184 if Parent.Items[I].MenuIndex <> MenuIndex then Parent.Items[I].Checked := False 185 end; 171 186 end; 172 187 … … 194 209 end; 195 210 211 procedure TMainForm.UpdateTergetList; 212 var 213 I: Integer; 214 NewMenuItem: TMenuItem; 215 begin 216 MenuItemTarget.Clear; 217 for I := 0 to Compilers.Count - 1 do begin 218 NewMenuItem := TMenuItem.Create(MenuItemTarget); 219 NewMenuItem.Caption := TBrainFuckCompiler(Compilers[I]).Name; 220 NewMenuItem.OnClick := MenuItemTargetClick; 221 if I = 0 then NewMenuItem.Checked := True; 222 MenuItemTarget.Add(NewMenuItem); 223 end; 224 end; 225 196 226 procedure TMainForm.FormCreate(Sender: TObject); 197 227 begin … … 201 231 BrainFuckCompiler := TBrainFuckCompiler.Create; 202 232 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode('cs'); 233 Compilers := TListObject.Create; 234 Compilers.Add(TBrainFuckCompilerDelphi.Create); 235 Compilers.Add(TBrainFuckCompilerPHP.Create); 236 UpdateTergetList; 203 237 end; 204 238 205 239 procedure TMainForm.FormDestroy(Sender: TObject); 206 240 begin 241 Compilers.Free; 207 242 BrainFuckCompiler.Free; 208 243 BrainFuckInterpreter.Free; … … 275 310 276 311 procedure TMainForm.ACompileExecute(Sender: TObject); 277 begin 278 BrainFuckCompiler.Source := MemoSource.Text; 279 BrainFuckCompiler.ProgramName := ExtractFileNameOnly(ProjectFileName); 280 BrainFuckCompiler.Compile; 281 CompiledForm.MemoCompiled.Text := BrainFuckCompiler.Output; 282 CompiledForm.Show; 312 var 313 I: Integer; 314 begin 315 I := 0; 316 while (I < MenuItemTarget.Count) and (not MenuItemTarget.Items[I].Checked) do Inc(I); 317 with TBrainFuckCompiler(Compilers[I]) do begin 318 Source := MemoSource.Text; 319 ProgramName := ExtractFileNameOnly(ProjectFileName); 320 Compile; 321 CompiledForm.MemoCompiled.Text := Output; 322 CompiledForm.Show; 323 end; 283 324 end; 284 325
Note:
See TracChangeset
for help on using the changeset viewer.