Changeset 20 for trunk/UMainForm.pas
- Timestamp:
- Feb 11, 2012, 10:56:03 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMainForm.pas
r19 r20 18 18 AAbout: TAction; 19 19 ABreakpointToggle: TAction; 20 AShrinkSource: TAction; 20 21 AFormatSource: TAction; 21 22 AOptions: TAction; … … 54 55 MenuItem2: TMenuItem; 55 56 MenuItem20: TMenuItem; 57 MenuItem21: TMenuItem; 56 58 MenuItem22: TMenuItem; 57 59 MenuItem23: TMenuItem; … … 59 61 MenuItem25: TMenuItem; 60 62 MenuItem26: TMenuItem; 63 MenuItem27: TMenuItem; 61 64 MenuItemTarget: TMenuItem; 62 MenuItem21: TMenuItem;63 65 MenuItem3: TMenuItem; 64 66 MenuItem4: TMenuItem; … … 75 77 ToolBar1: TToolBar; 76 78 ToolButton1: TToolButton; 79 ToolButton10: TToolButton; 80 ToolButton11: TToolButton; 77 81 ToolButton2: TToolButton; 78 82 ToolButton3: TToolButton; … … 96 100 procedure AProjectSaveExecute(Sender: TObject); 97 101 procedure AProgramRunExecute(Sender: TObject); 102 procedure AShrinkSourceExecute(Sender: TObject); 98 103 procedure AViewCompiledExecute(Sender: TObject); 99 104 procedure AViewInterpretterExecute(Sender: TObject); … … 115 120 public 116 121 Modified: Boolean; 122 CompilerIndex: Integer; 117 123 ProjectFileName: string; 118 124 BrainFuckCompiler: TBrainFuckCompiler; … … 180 186 begin 181 187 with TMenuItem(Sender) do begin 188 CompilerIndex := MenuIndex; 182 189 Checked := True; 183 190 for I := 0 to Parent.Count - 1 do … … 219 226 NewMenuItem.Caption := TBrainFuckCompiler(Compilers[I]).Name; 220 227 NewMenuItem.OnClick := MenuItemTargetClick; 221 if I = 0then NewMenuItem.Checked := True;228 if I = CompilerIndex then NewMenuItem.Checked := True; 222 229 MenuItemTarget.Add(NewMenuItem); 223 230 end; … … 251 258 BrainFuckInterpreter.Source := MemoSource.Text; 252 259 BrainFuckInterpreter.Run; 260 end; 261 262 procedure TMainForm.AShrinkSourceExecute(Sender: TObject); 263 var 264 Source: string; 265 Pos: Integer; 266 I: Integer; 267 begin 268 Source := MemoSource.Text; 269 Pos := 1; 270 for I := 1 to Length(Source) do begin 271 if Source[I] > ' ' then begin 272 Source[Pos] := Source[I]; 273 Inc(Pos); 274 end; 275 end; 276 SetLength(Source, Pos - 1); 277 MemoSource.Text := Source; 253 278 end; 254 279 … … 310 335 311 336 procedure TMainForm.ACompileExecute(Sender: TObject); 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 337 begin 338 with TBrainFuckCompiler(Compilers[CompilerIndex]) do begin 339 Optimization := coNormal; 318 340 Source := MemoSource.Text; 319 341 ProgramName := ExtractFileNameOnly(ProjectFileName);
Note:
See TracChangeset
for help on using the changeset viewer.