Changeset 25 for trunk/Forms
- Timestamp:
- Feb 13, 2012, 9:47:18 AM (13 years ago)
- Location:
- trunk/Forms
- Files:
-
- 4 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UCompiledForm.lfm
r23 r25 10 10 object MemoCompiled: TMemo 11 11 Left = 8 12 Height = 42112 Height = 384 13 13 Top = 8 14 14 Width = 540 … … 20 20 TabOrder = 0 21 21 end 22 object Button1: TButton 23 Left = 7 24 Height = 25 25 Top = 404 26 Width = 113 27 Action = MainForm.ACompileAndRun 28 Anchors = [akLeft, akBottom] 29 TabOrder = 1 30 end 22 31 end -
trunk/Forms/UCompiledForm.pas
r23 r25 13 13 14 14 TCompiledForm = class(TForm) 15 Button1: TButton; 15 16 MemoCompiled: TMemo; 16 17 private -
trunk/Forms/UMainForm.lfm
r24 r25 82 82 Top = 2 83 83 Width = 10 84 Caption = 'ToolButton5'85 84 Style = tbsSeparator 86 85 end … … 412 411 0000000000000000000000000000000000000000000000000000 413 412 } 413 end 414 object MenuItem31: TMenuItem 415 Action = ACompileAndRun 414 416 end 415 417 object MenuItemTarget: TMenuItem … … 590 592 } 591 593 end 594 object MenuItem30: TMenuItem 595 Action = AViewCompilers 596 end 592 597 object MenuItem19: TMenuItem 593 598 Action = AViewInterpretter … … 648 653 top = 96 649 654 object AProjectOpen: TAction 655 Category = 'Project' 650 656 Caption = 'Open' 651 657 ImageIndex = 7 … … 654 660 end 655 661 object AProjectSave: TAction 662 Category = 'Project' 656 663 Caption = 'Save' 657 664 ImageIndex = 0 … … 660 667 end 661 668 object AProjectClose: TAction 669 Category = 'Project' 662 670 Caption = 'Close' 663 671 ImageIndex = 4 … … 666 674 end 667 675 object AProjectSaveAs: TAction 676 Category = 'Project' 668 677 Caption = 'Save as...' 669 678 ImageIndex = 0 … … 672 681 end 673 682 object AProjectNew: TAction 683 Category = 'Project' 674 684 Caption = 'New' 675 685 ImageIndex = 9 … … 688 698 OnExecute = ACompileExecute 689 699 end 700 object ACompileAndRun: TAction 701 Caption = 'Compile and run' 702 OnExecute = ACompileAndRunExecute 703 end 690 704 object AProgramRun: TAction 691 705 Caption = 'Run' … … 711 725 end 712 726 object AViewInterpretter: TAction 727 Category = 'View' 713 728 Caption = 'Interpretter' 714 729 OnExecute = AViewInterpretterExecute 715 730 end 716 731 object AViewCompiled: TAction 732 Category = 'View' 717 733 Caption = 'Compiled' 718 734 OnExecute = AViewCompiledExecute … … 736 752 end 737 753 object AOptions: TAction 754 Category = 'View' 738 755 Caption = 'Options' 739 756 ImageIndex = 2 … … 741 758 end 742 759 object AFormatSource: TAction 760 Category = 'Tool' 743 761 Caption = 'Format source' 744 762 OnExecute = AFormatSourceExecute 745 763 end 746 764 object AShrinkSource: TAction 765 Category = 'Tool' 747 766 Caption = 'Shrink source' 748 767 OnExecute = AShrinkSourceExecute 749 768 end 750 769 object AGenerateNumber: TAction 770 Category = 'Tool' 751 771 Caption = 'Generate code for number' 752 772 ImageIndex = 13 753 773 OnExecute = AGenerateNumberExecute 774 end 775 object AViewCompilers: TAction 776 Category = 'View' 777 Caption = 'Compilers' 778 OnExecute = AViewCompilersExecute 754 779 end 755 780 end -
trunk/Forms/UMainForm.lrt
r24 r25 1 1 TMAINFORM.CAPTION=LazFuck 2 TMAINFORM.TOOLBUTTON5.CAPTION=ToolButton53 2 TMAINFORM.MENUITEM1.CAPTION=Project 4 3 TMAINFORM.MENUITEMOPENRECENT.CAPTION=Open recent … … 17 16 TMAINFORM.AEXIT.CAPTION=Exit 18 17 TMAINFORM.ACOMPILE.CAPTION=Compile 18 TMAINFORM.ACOMPILEANDRUN.CAPTION=Compile and run 19 19 TMAINFORM.APROGRAMRUN.CAPTION=Run 20 20 TMAINFORM.AABOUT.CAPTION=About … … 33 33 TMAINFORM.ASHRINKSOURCE.CAPTION=Shrink source 34 34 TMAINFORM.AGENERATENUMBER.CAPTION=Generate code for number 35 TMAINFORM.AVIEWCOMPILERS.CAPTION=Compilers -
trunk/Forms/UMainForm.pas
r24 r25 8 8 Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs, 9 9 Menus, ActnList, StdCtrls, ComCtrls, UBrainFuck, UCoolTranslator, StrUtils, 10 SpecializedList, UCompiler, Registry, URegistry, ULastOpenedList ;10 SpecializedList, UCompiler, Registry, URegistry, ULastOpenedList, Process; 11 11 12 12 const … … 21 21 AAbout: TAction; 22 22 ABreakpointToggle: TAction; 23 ACompileAndRun: TAction; 24 AViewCompilers: TAction; 23 25 AGenerateNumber: TAction; 24 26 AShrinkSource: TAction; … … 68 70 MenuItem28: TMenuItem; 69 71 MenuItem29: TMenuItem; 72 MenuItem30: TMenuItem; 73 MenuItem31: TMenuItem; 70 74 MenuItemOpenRecent: TMenuItem; 71 75 MenuItemTarget: TMenuItem; … … 95 99 ToolButton9: TToolButton; 96 100 procedure ABreakpointToggleExecute(Sender: TObject); 101 procedure ACompileAndRunExecute(Sender: TObject); 97 102 procedure ACompileExecute(Sender: TObject); 98 103 procedure AExitExecute(Sender: TObject); … … 110 115 procedure AShrinkSourceExecute(Sender: TObject); 111 116 procedure AViewCompiledExecute(Sender: TObject); 117 procedure AViewCompilersExecute(Sender: TObject); 112 118 procedure AViewInterpretterExecute(Sender: TObject); 113 119 procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); … … 135 141 BrainFuckInterpreter: TBrainFuckInterpretter; 136 142 BreakPoints: TListInteger; 137 Compilers: T ListObject; // TListObject<TCompiler>143 Compilers: TCompilerList; 138 144 LastOpenedList: TLastOpenedList; 139 145 OpenProjectOnStart: Boolean; … … 142 148 procedure UpdateInterface; 143 149 procedure UpdateStatusBar; 144 procedure UpdateT ergetList;150 procedure UpdateTargetList; 145 151 end; 146 152 … … 154 160 uses 155 161 UInterpretterForm, UApplicationInfo, UCompiledForm, UOptionsForm, 156 UCompilerDelphi, UCompilerPHP ;162 UCompilerDelphi, UCompilerPHP, UCompilersForm; 157 163 158 164 resourcestring 159 165 SEnterNumber = 'Enter number'; 160 166 SNumberGeneration = 'Number generation'; 167 SProgramExited = 'Program exited'; 168 SCompilerNotFound = 'Compiler "%s" not found'; 169 SCompiledFileNotFound = 'Program compiled file "%s" not found'; 161 170 162 171 { TMainForm } … … 167 176 ProjectOpen(LastOpenedList[0]) 168 177 else AProjectNew.Execute; 178 UpdateInterface; 169 179 end; 170 180 … … 234 244 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')) 235 245 else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(''); 246 CompilerIndex := ReadIntegerWithDefault('SelectedCompiler', 0); 236 247 finally 237 248 Free; 238 249 end; 239 250 LastOpenedList.LoadFromRegistry(Root, Key); 251 Compilers.LoadFromRegistry(Root, Key); 240 252 end; 241 253 242 254 procedure TMainForm.SaveToRegistry(Root: HKEY; Key: string); 243 255 begin 256 Compilers.SaveToRegistry(Root, Key); 244 257 LastOpenedList.SaveToRegistry(Root, Key); 245 258 with TRegistryEx.Create do … … 253 266 WriteString('LanguageCode', CoolTranslator1.Language.Code) 254 267 else DeleteValue('LanguageCode'); 268 WriteInteger('SelectedCompiler', CompilerIndex); 255 269 finally 256 270 Free; … … 274 288 ACompile.Enabled := ProjectFileName <> ''; 275 289 UpdateStatusBar; 290 UpdateTargetList; 276 291 end; 277 292 … … 281 296 end; 282 297 283 procedure TMainForm.UpdateT ergetList;298 procedure TMainForm.UpdateTargetList; 284 299 var 285 300 I: Integer; … … 302 317 BrainFuckInterpreter.OnChangeState := BrainFuckInterpreterChangeState; 303 318 BrainFuckCompiler := TBrainFuckCompiler.Create; 304 Compilers := T ListObject.Create;319 Compilers := TCompilerList.Create; 305 320 Compilers.Add(TBrainFuckCompilerDelphi.Create); 306 321 Compilers.Add(TBrainFuckCompilerPHP.Create); 307 UpdateT ergetList;322 UpdateTargetList; 308 323 LastOpenedList := TLastOpenedList.Create; 309 324 LastOpenedList.MenuItem := MenuItemOpenRecent; … … 352 367 begin 353 368 CompiledForm.Show; 369 end; 370 371 procedure TMainForm.AViewCompilersExecute(Sender: TObject); 372 begin 373 FormCompilers.Show; 354 374 end; 355 375 … … 437 457 end; 438 458 459 procedure TMainForm.ACompileAndRunExecute(Sender: TObject); 460 var 461 Process: TProcess; 462 CompiledFile: string; 463 begin 464 with TBrainFuckCompiler(Compilers[CompilerIndex]) do begin 465 Optimization := coNormal; 466 Source := MemoSource.Text; 467 ProgramName := ExtractFileNameOnly(ProjectFileName); 468 Compile; 469 CompiledFile := ExtractFilePath(ProjectFileName) + 470 'compiled' + DirectorySeparator + Name + DirectorySeparator + 471 ExtractFileNameOnly(ProjectFileName) + SourceExtension; 472 ForceDirectoriesUTF8(ExtractFilePath(CompiledFile)); 473 with TStringList.Create do 474 try 475 Text := Output; 476 SaveToFile(CompiledFile); 477 finally 478 Free; 479 end; 480 if FileExistsUTF8(CompilerPath) then 481 try 482 Process := TProcess.Create(nil); 483 Process.CommandLine := '"' + CompilerPath + '" "' + CompiledFile + '"'; 484 Process.Options := [poWaitOnExit]; 485 Process.Execute; 486 finally 487 Process.Free; 488 end else raise Exception.Create(Format(SCompilerNotFound, [CompilerPath])); 489 490 if CompiledExtension <> '' then begin 491 CompiledFile := ExtractFilePath(CompiledFile) + ExtractFileNameOnly(CompiledFile) + CompiledExtension; 492 if FileExistsUTF8(CompiledFile) then 493 try 494 Process := TProcess.Create(nil); 495 Process.CommandLine := '"' + CompiledFile + '"'; 496 Process.Options := [poWaitOnExit]; 497 Process.Execute; 498 finally 499 Process.Free; 500 end else raise Exception.Create(Format(SCompiledFileNotFound, [CompiledFile])); 501 end; 502 end; 503 end; 504 439 505 procedure TMainForm.AProgramPauseExecute(Sender: TObject); 440 506 begin -
trunk/Forms/UOptionsForm.lfm
r23 r25 10 10 LCLVersion = '0.9.31' 11 11 object ButtonOk: TButton 12 Left = 38 012 Left = 389 13 13 Height = 25 14 14 Top = 247 … … 21 21 end 22 22 object ButtonCancel: TButton 23 Left = 29223 Left = 304 24 24 Height = 25 25 25 Top = 247 … … 30 30 TabOrder = 1 31 31 end 32 object Label1: TLabel 33 Left = 8 34 Height = 18 35 Top = 8 36 Width = 88 37 Caption = 'Memory size:' 38 ParentColor = False 39 end 40 object SpinEditMemorySize: TSpinEdit 32 object SpinEditCellSize: TSpinEdit 41 33 Left = 136 42 Height = 2 743 Top = 634 Height = 21 35 Top = 40 44 36 Width = 130 45 37 MaxValue = 2000000000 46 38 TabOrder = 2 47 39 end 48 object Label2: TLabel 49 Left = 8 50 Height = 18 51 Top = 40 52 Width = 60 53 Caption = 'Cell size:' 54 ParentColor = False 55 end 56 object SpinEditCellSize: TSpinEdit 40 object SpinEditMemorySize: TSpinEdit 57 41 Left = 136 58 Height = 2 759 Top = 4042 Height = 21 43 Top = 6 60 44 Width = 130 61 45 MaxValue = 2000000000 62 46 TabOrder = 3 63 47 end 48 object Label1: TLabel 49 Left = 8 50 Height = 14 51 Top = 8 52 Width = 64 53 Caption = 'Memory size:' 54 ParentColor = False 55 end 56 object Label2: TLabel 57 Left = 8 58 Height = 14 59 Top = 40 60 Width = 43 61 Caption = 'Cell size:' 62 ParentColor = False 63 end 64 64 object Label3: TLabel 65 65 Left = 8 66 Height = 1 866 Height = 14 67 67 Top = 95 68 Width = 12768 Width = 97 69 69 Caption = 'Interface language:' 70 70 ParentColor = False 71 71 end 72 object CheckBox1: TCheckBox 73 Left = 8 74 Height = 17 75 Top = 120 76 Width = 159 77 Caption = 'Reopend last opened project' 78 TabOrder = 4 79 end 72 80 object ComboBoxLanguage: TComboBox 73 81 Left = 162 74 Height = 2 782 Height = 21 75 83 Top = 86 76 84 Width = 188 77 ItemHeight = 085 ItemHeight = 13 78 86 Style = csDropDownList 79 TabOrder = 480 end81 object CheckBox1: TCheckBox82 Left = 883 Height = 1984 Top = 12085 Width = 20586 Caption = 'Reopend last opened project'87 87 TabOrder = 5 88 88 end -
trunk/Forms/UOptionsForm.pas
r23 r25 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Spin, UBrainFuck;9 Spin, ComCtrls, UBrainFuck; 10 10 11 11 type
Note:
See TracChangeset
for help on using the changeset viewer.