Changeset 47 for trunk/Forms/UFormMain.pas
- Timestamp:
- Jul 12, 2012, 8:21:21 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r46 r47 27 27 ABreakpointToggle: TAction; 28 28 AViewCompilers: TAction; 29 AGenerateNumber: TAction;30 AShrinkSource: TAction;31 AFormatSource: TAction;32 29 AOptions: TAction; 33 30 AProgramStepOut: TAction; … … 119 116 procedure ABreakpointToggleExecute(Sender: TObject); 120 117 procedure AExitExecute(Sender: TObject); 121 procedure AFormatSourceExecute(Sender: TObject);122 procedure AGenerateNumberExecute(Sender: TObject);123 118 procedure AOptionsExecute(Sender: TObject); 124 119 procedure AProgramCompileExecute(Sender: TObject); … … 138 133 procedure AShowSourcePositionExecute(Sender: TObject); 139 134 procedure AShowTargetPositionExecute(Sender: TObject); 140 procedure AShrinkSourceExecute(Sender: TObject);141 135 procedure AViewCompilersExecute(Sender: TObject); 142 136 procedure AViewInterpretterExecute(Sender: TObject); … … 145 139 procedure FormDestroy(Sender: TObject); 146 140 procedure FormShow(Sender: TObject); 147 procedure MemoSourceChange(Sender: TObject);148 procedure MemoSourceKeyDown(Sender: TObject; var Key: Word;149 Shift: TShiftState);150 procedure MemoSourceKeyPress(Sender: TObject; var Key: char);151 procedure MemoSourceKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState152 );153 procedure MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;154 Shift: TShiftState; X, Y: Integer);155 141 procedure TimerRefreshTimer(Sender: TObject); 156 142 private … … 193 179 194 180 resourcestring 195 SEnterNumber = 'Enter number';196 SNumberGeneration = 'Number generation';197 181 SProgramExited = 'Program exited'; 198 182 SProgramStarted = 'Program started'; … … 215 199 end; 216 200 217 procedure TMainForm.MemoSourceChange(Sender: TObject);218 begin219 Modified := True;220 CurrentTarget.Compiled := False;221 UpdateInterface;222 end;223 224 procedure TMainForm.MemoSourceKeyDown(Sender: TObject; var Key: Word;225 Shift: TShiftState);226 begin227 end;228 229 procedure TMainForm.MemoSourceKeyPress(Sender: TObject; var Key: char);230 begin231 end;232 233 procedure TMainForm.MemoSourceKeyUp(Sender: TObject; var Key: Word;234 Shift: TShiftState);235 begin236 UpdateStatusBar;237 end;238 239 procedure TMainForm.MemoSourceMouseDown(Sender: TObject; Button: TMouseButton;240 Shift: TShiftState; X, Y: Integer);241 begin242 UpdateStatusBar;243 end;244 245 201 procedure TMainForm.TimerRefreshTimer(Sender: TObject); 246 202 begin … … 281 237 LastOpenedList.AddItem(FileName); 282 238 ProjectFileName := FileName; 283 UpdateInterface;284 239 Modified := False; 285 240 CurrentTarget.Compiled := False; 241 UpdateInterface; 286 242 end; 287 243 … … 485 441 end; 486 442 487 procedure TMainForm.AShrinkSourceExecute(Sender: TObject);488 var489 Source: string;490 Pos: Integer;491 I: Integer;492 begin493 Source := FormSourceCode.MemoSource.Text;494 Pos := 1;495 for I := 1 to Length(Source) do begin496 if Source[I] > ' ' then begin497 Source[Pos] := Source[I];498 Inc(Pos);499 end;500 end;501 SetLength(Source, Pos - 1);502 FormSourceCode.MemoSource.Text := Source;503 end;504 505 443 procedure TMainForm.AViewCompilersExecute(Sender: TObject); 506 444 begin … … 521 459 begin 522 460 Close; 523 end;524 525 procedure TMainForm.AFormatSourceExecute(Sender: TObject);526 var527 Source: string;528 NewSource: string;529 Indent: Integer;530 I: Integer;531 const532 IndentText = ' ';533 begin534 Source := FormSourceCode.MemoSource.Text;535 NewSource := '';536 Indent := 0;537 for I := 1 to Length(Source) do begin538 if Source[I] = '[' then begin539 NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding ;540 Inc(Indent);541 NewSource := NewSource + DupeString(IndentText, Indent);542 end543 else if Source[I] = ']' then begin544 Dec(Indent);545 NewSource := NewSource + LineEnding + DupeString(IndentText, Indent) + Source[I] + LineEnding + DupeString(IndentText, Indent);546 end547 else if Ord(Source[I]) > $20 then548 NewSource := NewSource + Source[I];549 end;550 FormSourceCode.MemoSource.Text := NewSource;551 end;552 553 procedure TMainForm.AGenerateNumberExecute(Sender: TObject);554 var555 NumberText: string;556 Number: Integer;557 I: Integer;558 begin559 NumberText := InputBox(SNumberGeneration, SEnterNumber, '1');560 if TryStrToInt(NumberText, Number) then begin561 NumberText := '';562 for I := 0 to Number - 1 do563 NumberText := NumberText + '+';564 FormSourceCode.MemoSource.Text := FormSourceCode.MemoSource.Text + NumberText;565 end;566 461 end; 567 462 … … 665 560 procedure TMainForm.AProjectCloseExecute(Sender: TObject); 666 561 begin 562 if Modified then AProjectSaveAs.Execute; 667 563 AProgramStop.Execute; 668 Modified := False;669 564 ProjectFileName := ''; 670 565 FormSourceCode.MemoSource.Clear; 566 Modified := False; 671 567 UpdateInterface; 672 568 end; … … 689 585 procedure TMainForm.AProjectOpenExecute(Sender: TObject); 690 586 begin 587 AProjectClose.Execute; 691 588 OpenDialog1.FileName := ProjectFileName; 692 589 if OpenDialog1.Execute then begin
Note:
See TracChangeset
for help on using the changeset viewer.