Changeset 16 for trunk/UMainForm.pas
- Timestamp:
- Feb 11, 2012, 7:12:30 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMainForm.pas
r15 r16 7 7 uses 8 8 Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs, 9 Menus, ActnList, StdCtrls, ComCtrls, UBrainFuck, UCoolTranslator, 9 Menus, ActnList, StdCtrls, ComCtrls, UBrainFuck, UCoolTranslator, StrUtils, 10 10 SpecializedList; 11 11 … … 17 17 ACompile: TAction; 18 18 AAbout: TAction; 19 ABreakpoint Set: TAction;20 A BreakpointUnset: TAction;19 ABreakpointToggle: TAction; 20 AFormatSource: TAction; 21 21 AOptions: TAction; 22 22 AInterpretterStepOut: TAction; … … 55 55 MenuItem20: TMenuItem; 56 56 MenuItem22: TMenuItem; 57 MenuItem23: TMenuItem; 58 MenuItem24: TMenuItem; 59 MenuItem25: TMenuItem; 57 60 MenuItem40: TMenuItem; 58 61 MenuItem21: TMenuItem; … … 65 68 MenuItem9: TMenuItem; 66 69 OpenDialog1: TOpenDialog; 70 PopupMenuSource: TPopupMenu; 67 71 SaveDialog1: TSaveDialog; 68 72 StatusBar1: TStatusBar; … … 77 81 ToolButton7: TToolButton; 78 82 ToolButton8: TToolButton; 83 ToolButton9: TToolButton; 84 procedure ABreakpointToggleExecute(Sender: TObject); 79 85 procedure ACompileExecute(Sender: TObject); 80 86 procedure AExitExecute(Sender: TObject); 87 procedure AFormatSourceExecute(Sender: TObject); 81 88 procedure AOptionsExecute(Sender: TObject); 82 89 procedure AProgramPauseExecute(Sender: TObject); … … 230 237 end; 231 238 239 procedure TMainForm.AFormatSourceExecute(Sender: TObject); 240 var 241 Source: string; 242 NewSource: string; 243 Indent: Integer; 244 I: Integer; 245 const 246 IndentText = ' '; 247 begin 248 Source := MemoSource.Text; 249 NewSource := ''; 250 Indent := 0; 251 for I := 1 to Length(Source) do begin 252 if Source[I] = '[' then begin 253 NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding ; 254 Inc(Indent); 255 NewSource := NewSource + DupeString(IndentText, Indent); 256 end 257 else if Source[I] = ']' then begin 258 Dec(Indent); 259 NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding + DupeString(IndentText, Indent); 260 end 261 else if Ord(Source[I]) > $20 then 262 NewSource := NewSource + Source[I]; 263 end; 264 MemoSource.Text := NewSource; 265 end; 266 232 267 procedure TMainForm.AOptionsExecute(Sender: TObject); 233 268 begin … … 245 280 CompiledForm.MemoCompiled.Text := BrainFuckCompiler.Output; 246 281 CompiledForm.Show; 282 end; 283 284 procedure TMainForm.ABreakpointToggleExecute(Sender: TObject); 285 begin 286 //BreakPoints.Add(); 247 287 end; 248 288
Note:
See TracChangeset
for help on using the changeset viewer.