Changeset 36 for trunk/Forms/UMainForm.pas
- Timestamp:
- Feb 19, 2012, 9:44:58 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UMainForm.pas
r35 r36 120 120 procedure AProgramPauseExecute(Sender: TObject); 121 121 procedure AProgramRunToCursorExecute(Sender: TObject); 122 procedure AProgramRunExecute(Sender: TObject); 122 123 procedure AProgramShowExecutionPointExecute(Sender: TObject); 123 124 procedure AProgramStepIntoExecute(Sender: TObject); … … 130 131 procedure AProjectSaveAsExecute(Sender: TObject); 131 132 procedure AProjectSaveExecute(Sender: TObject); 132 procedure AProgramRunExecute(Sender: TObject);133 133 procedure AShowSourcePositionExecute(Sender: TObject); 134 134 procedure AShowTargetPositionExecute(Sender: TObject); … … 155 155 procedure ProjectOpen(FileName: string); 156 156 procedure SetCurrentTarget(AValue: TTarget); 157 procedure UpdateToolBarHints; 157 158 public 158 159 Modified: Boolean; 159 160 ProjectFileName: string; 160 BreakPoints: TListInteger;161 161 Targets: TTargetList; 162 162 LastOpenedList: TLastOpenedList; … … 195 195 else AProjectNew.Execute; 196 196 UpdateInterface; 197 UpdateToolBarHints; 198 UpdateTargetList; 197 199 end; 198 200 … … 266 268 FCurrentTarget.OnChangeState := TargetStateChanged; 267 269 UpdateInterface; 270 end; 271 272 procedure TMainForm.UpdateToolBarHints; 273 var 274 I: Integer; 275 begin 276 for I := 0 to ToolBar1.ControlCount - 1 do 277 ToolBar1.Controls[I].Hint := ToolBar1.Controls[I].Caption; 268 278 end; 269 279 … … 327 337 AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities); 328 338 AProgramStepInto.Enabled := (tcStepInto in CurrentTarget.Capabilities) and 329 (ProjectFileName <> '') and ( CurrentTarget.State = rsPaused);339 (ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 330 340 AProgramStepOut.Enabled := (tcStepOut in CurrentTarget.Capabilities) and 331 341 (ProjectFileName <> '') and (CurrentTarget.State = rsPaused); 332 342 AProgramRunToCursor.Enabled := (tcRunToCursor in CurrentTarget.Capabilities) and 333 (ProjectFileName <> '') and ( CurrentTarget.State = rsPaused);343 (ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 334 344 AProgramStepOver.Enabled := (tcStepOver in CurrentTarget.Capabilities) and 335 (ProjectFileName <> '') and ( CurrentTarget.State = rsPaused);345 (ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 336 346 AProgramShowExecutionPoint.Enabled := (tcPause in CurrentTarget.Capabilities) and 337 347 (ProjectFileName <> '') and (CurrentTarget.State = rsPaused); … … 339 349 AShowTargetPosition.Enabled := CurrentTarget.Compiled; 340 350 UpdateStatusBar; 341 UpdateTargetList;342 351 end; 343 352 … … 364 373 procedure TMainForm.FormCreate(Sender: TObject); 365 374 begin 366 BreakPoints := TListInteger.Create;367 375 Targets := TTargetList.Create; 368 376 Targets.Add(TTargetInterpretter.Create); … … 382 390 LastOpenedList.Free; 383 391 Targets.Free; 384 BreakPoints.Free;385 392 end; 386 393 … … 391 398 if CurrentTarget is TTargetInterpretter then 392 399 TTargetInterpretter(CurrentTarget).Input := InterpreterForm.MemoInput.Lines.Text; 393 CurrentTarget.SourceCode := MemoSource.Text;394 400 if not CurrentTarget.Compiled then AProgramCompile.Execute; 395 401 CurrentTarget.Run; … … 521 527 522 528 procedure TMainForm.ABreakpointToggleExecute(Sender: TObject); 523 begin 524 //BreakPoints.Add(); 529 var 530 DebugStep: TDebugStep; 531 BreakPoint: TBreakPoint; 532 begin 533 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart); 534 if Assigned(DebugStep) then begin 535 BreakPoint := CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition); 536 if Assigned(BreakPoint) then 537 CurrentTarget.BreakPoints.Delete(CurrentTarget.BreakPoints.IndexOf(BreakPoint)) 538 else CurrentTarget.BreakPoints.AddItem(DebugStep.TargetPosition); 539 end; 525 540 end; 526 541 527 542 procedure TMainForm.AProgramPauseExecute(Sender: TObject); 528 543 begin 529 CurrentTarget.Pause 544 CurrentTarget.Pause; 530 545 end; 531 546 … … 535 550 begin 536 551 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(MemoSource.SelStart); 537 CurrentTarget.RunToCursor(DebugStep.TargetPosition); 552 if CurrentTarget.State = rsStopped then begin 553 if not CurrentTarget.Compiled then AProgramCompile.Execute; 554 CurrentTarget.BreakPoints.SetSystem(DebugStep.TargetPosition); 555 AProgramRun.Execute; 556 end else CurrentTarget.RunToCursor(DebugStep.TargetPosition); 538 557 end; 539 558 … … 545 564 MemoSource.SelStart := DebugStep.SourcePosition; 546 565 MemoTarget.SelStart := DebugStep.TargetPosition; 566 if PageControl1.TabIndex = 0 then MemoSource.SetFocus; 567 if PageControl1.TabIndex = 1 then MemoTarget.SetFocus; 547 568 end; 548 569 549 570 procedure TMainForm.AProgramStepIntoExecute(Sender: TObject); 550 571 begin 551 CurrentTarget.StepInto; 572 if CurrentTarget.State = rsStopped then begin 573 if not CurrentTarget.Compiled then AProgramCompile.Execute; 574 CurrentTarget.BreakPoints.SetSystem(TDebugStep(CurrentTarget.DebugSteps.First).TargetPosition); 575 AProgramRun.Execute; 576 end else CurrentTarget.StepInto; 552 577 end; 553 578 … … 559 584 procedure TMainForm.AProgramStepOverExecute(Sender: TObject); 560 585 begin 561 CurrentTarget.StepOver; 586 if CurrentTarget.State = rsStopped then begin 587 if not CurrentTarget.Compiled then AProgramCompile.Execute; 588 CurrentTarget.BreakPoints.SetSystem(TDebugStep(CurrentTarget.DebugSteps.First).TargetPosition); 589 AProgramRun.Execute; 590 end else CurrentTarget.StepOver; 562 591 end; 563 592
Note:
See TracChangeset
for help on using the changeset viewer.