Changeset 46 for trunk/Forms/UFormMain.pas
- Timestamp:
- Jul 12, 2012, 7:47:58 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r45 r46 49 49 ImageList1: TImageList; 50 50 MainMenu1: TMainMenu; 51 MemoSource: TMemo;52 MemoTarget: TMemo;53 51 MenuItem1: TMenuItem; 54 52 MenuItem10: TMenuItem; … … 62 60 MenuItem18: TMenuItem; 63 61 MenuItem2: TMenuItem; 64 MenuItem20: TMenuItem;65 MenuItem21: TMenuItem;66 62 MenuItem22: TMenuItem; 67 MenuItem23: TMenuItem;68 63 MenuItem24: TMenuItem; 69 64 MenuItem25: TMenuItem; 70 MenuItem26: TMenuItem;71 65 MenuItem27: TMenuItem; 72 66 MenuItem28: TMenuItem; 73 MenuItem29: TMenuItem;74 67 MenuItem30: TMenuItem; 75 68 MenuItem31: TMenuItem; … … 78 71 MenuItem34: TMenuItem; 79 72 MenuItem35: TMenuItem; 80 MenuItem36: TMenuItem;81 73 MenuItemOpenRecent: TMenuItem; 82 74 MenuItemTarget: TMenuItem; … … 97 89 PanelOutput: TPanel; 98 90 PanelInput: TPanel; 99 PopupMenuTarget: TPopupMenu;100 PopupMenuSource: TPopupMenu;101 91 SaveDialog1: TSaveDialog; 102 92 Splitter1: TSplitter; … … 200 190 UFormCPU, UFormOptions, UFormMessages, UTargetJava, 201 191 UTargetDelphi, UTargetPHP, UTargetC, UFormTargets, UFormOutput, UFormInput, 202 UFormMemory ;192 UFormMemory, UFormSourceCode, UFormTargetCode; 203 193 204 194 resourcestring … … 214 204 procedure TMainForm.FormShow(Sender: TObject); 215 205 begin 206 LoadFromRegistry(RegistryRoot, ApplicationInfo.RegistryKey); 216 207 PageControlMain.TabIndex := 0; 217 208 if OpenProjectOnStart and (LastOpenedList.Items.Count > 0) then … … 287 278 begin 288 279 AProjectClose.Execute; 289 MemoSource.Lines.LoadFromFile(UTF8Decode(FileName));280 FormSourceCode.MemoSource.Lines.LoadFromFile(UTF8Decode(FileName)); 290 281 LastOpenedList.AddItem(FileName); 291 282 ProjectFileName := FileName; … … 318 309 procedure TMainForm.DockInit; 319 310 begin 311 FormSourceCode.ManualDock(TabSheetSource, nil, alClient); 312 FormSourceCode.Align := alClient; 313 FormSourceCode.Show; 314 FormTargetCode.ManualDock(TabSheetTarget, nil, alClient); 315 FormTargetCode.Align := alClient; 316 FormTargetCode.Show; 320 317 FormCPU.ManualDock(PanelCPU, nil, alClient); 321 318 FormCPU.Align := alClient; … … 387 384 begin 388 385 AProjectSave.Enabled := Modified; 389 Title := ApplicationInfo. Name;386 Title := ApplicationInfo.AppName; 390 387 if ProjectFileName <> '' then Title := ProjectFileName + ' - ' + Title; 391 388 if Modified then Title := Title + ' *'; 392 389 Caption := Title; 393 MemoSource.Enabled := ProjectFileName <> '';390 FormSourceCode.MemoSource.Enabled := ProjectFileName <> ''; 394 391 AProjectClose.Enabled := ProjectFileName <> ''; 395 392 AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and … … 418 415 procedure TMainForm.UpdateStatusBar; 419 416 begin 420 StatusBarMain.Panels[0].Text := IntToStr(MemoSource.CaretPos.X) + ', ' + IntToStr(MemoSource.CaretPos.Y); 417 StatusBarMain.Panels[0].Text := IntToStr(FormSourceCode.MemoSource.CaretPos.X) + 418 ', ' + IntToStr(FormSourceCode.MemoSource.CaretPos.Y); 421 419 end; 422 420 … … 447 445 LastOpenedList := TLastOpenedList.Create(nil); 448 446 LastOpenedList.OnChange := LastOpenedListChange; 449 LoadFromRegistry(RegistryRoot, ApplicationInfo.RegistryKey);450 447 end; 451 448 … … 470 467 DebugStep: TDebugStep; 471 468 begin 472 DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos( MemoTarget.SelStart);469 DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(FormTargetCode.MemoTarget.SelStart); 473 470 if Assigned(DebugStep) then begin 474 MemoSource.SelStart := DebugStep.SourcePosition;471 FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition; 475 472 PageControlMain.TabIndex := 0; 476 473 end; … … 481 478 DebugStep: TDebugStep; 482 479 begin 483 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos( MemoSource.SelStart);480 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart); 484 481 if Assigned(DebugStep) then begin 485 MemoTarget.SelStart := DebugStep.TargetPosition;482 FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition; 486 483 PageControlMain.TabIndex := 1; 487 484 end; … … 494 491 I: Integer; 495 492 begin 496 Source := MemoSource.Text;493 Source := FormSourceCode.MemoSource.Text; 497 494 Pos := 1; 498 495 for I := 1 to Length(Source) do begin … … 503 500 end; 504 501 SetLength(Source, Pos - 1); 505 MemoSource.Text := Source;502 FormSourceCode.MemoSource.Text := Source; 506 503 end; 507 504 … … 535 532 IndentText = ' '; 536 533 begin 537 Source := MemoSource.Text;534 Source := FormSourceCode.MemoSource.Text; 538 535 NewSource := ''; 539 536 Indent := 0; … … 551 548 NewSource := NewSource + Source[I]; 552 549 end; 553 MemoSource.Text := NewSource;550 FormSourceCode.MemoSource.Text := NewSource; 554 551 end; 555 552 … … 565 562 for I := 0 to Number - 1 do 566 563 NumberText := NumberText + '+'; 567 MemoSource.Text :=MemoSource.Text + NumberText;564 FormSourceCode.MemoSource.Text := FormSourceCode.MemoSource.Text + NumberText; 568 565 end; 569 566 end; … … 582 579 AProgramStop.Execute; 583 580 Optimization := coNormal; 584 SourceCode := MemoSource.Text;581 SourceCode := FormSourceCode.MemoSource.Text; 585 582 ProjectFileName := Self.ProjectFileName; 586 583 ProgramName := ExtractFileNameOnly(Self.ProjectFileName); … … 588 585 Compile; 589 586 CurrentTarget.Messages.AppendMessage('done'); 590 MemoTarget.Text := TargetCode;587 FormTargetCode.MemoTarget.Text := TargetCode; 591 588 UpdateInterface; 592 589 end; … … 598 595 BreakPoint: TBreakPoint; 599 596 begin 600 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos( MemoSource.SelStart);597 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart); 601 598 if Assigned(DebugStep) then begin 602 599 BreakPoint := CurrentTarget.BreakPoints.SearchByTargetPos(DebugStep.TargetPosition); … … 618 615 if CurrentTarget.State = rsStopped then begin 619 616 if not CurrentTarget.Compiled then AProgramCompile.Execute; 620 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos( MemoSource.SelStart);617 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart); 621 618 CurrentTarget.BreakPoints.SetSystem(DebugStep.TargetPosition); 622 619 AProgramRun.Execute; 623 620 end else begin 624 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos( MemoSource.SelStart);621 DebugStep := CurrentTarget.DebugSteps.SearchBySourcePos(FormSourceCode.MemoSource.SelStart); 625 622 CurrentTarget.RunToCursor(DebugStep.TargetPosition); 626 623 end; … … 632 629 begin 633 630 DebugStep := CurrentTarget.DebugSteps.SearchByTargetPos(CurrentTarget.ExecutionPosition); 634 MemoSource.SelStart := DebugStep.SourcePosition;635 MemoTarget.SelStart := DebugStep.TargetPosition;636 if PageControlMain.TabIndex = 0 then MemoSource.SetFocus;637 if PageControlMain.TabIndex = 1 then MemoTarget.SetFocus;631 FormSourceCode.MemoSource.SelStart := DebugStep.SourcePosition; 632 FormTargetCode.MemoTarget.SelStart := DebugStep.TargetPosition; 633 if PageControlMain.TabIndex = 0 then FormSourceCode.MemoSource.SetFocus; 634 if PageControlMain.TabIndex = 1 then FormTargetCode.MemoTarget.SetFocus; 638 635 end; 639 636 … … 671 668 Modified := False; 672 669 ProjectFileName := ''; 673 MemoSource.Clear;670 FormSourceCode.MemoSource.Clear; 674 671 UpdateInterface; 675 672 end; … … 679 676 AProjectClose.Execute; 680 677 ProjectFileName := 'Examples' + DirectorySeparator + SNewProject + '.b'; 681 MemoSource.Clear;678 FormSourceCode.MemoSource.Clear; 682 679 Modified := False; 683 680 CurrentTarget.Compiled := False; … … 702 699 SaveDialog1.FileName := ProjectFileName; 703 700 if SaveDialog1.Execute then begin 704 MemoSource.Lines.SaveToFile(UTF8Decode(SaveDialog1.FileName));701 FormSourceCode.MemoSource.Lines.SaveToFile(UTF8Decode(SaveDialog1.FileName)); 705 702 ProjectFileName := SaveDialog1.FileName; 706 703 LastOpenedList.AddItem(SaveDialog1.FileName);
Note:
See TracChangeset
for help on using the changeset viewer.