fpmcomp.inc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {
  2. This file is part of the Free Pascal Integrated Development Environment
  3. Copyright (c) 1998 by Berczi Gabor
  4. Compiler menu entries
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. procedure TIDEApp.Target;
  12. var R,R2: TRect;
  13. D: PCenterDialog;
  14. RB: PRadioButtons;
  15. TargetCount,I: integer;
  16. LastItem: PSItem;
  17. L: longint;
  18. begin
  19. TargetCount:=TargetSwitches^.ItemCount;
  20. R.Assign(0,0,60,4+TargetCount);
  21. New(D, Init(R, dialog_target));
  22. with D^ do
  23. begin
  24. HelpCtx:=hcTarget;
  25. GetExtent(R); R.Grow(-3,-1); Inc(R.A.Y);
  26. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+TargetCount;
  27. LastItem:=nil;
  28. for I:=TargetCount-1 downto 0 do
  29. LastItem:=NewSItem(TargetSwitches^.ItemName(I), LastItem);
  30. New(RB, Init(R2, LastItem));
  31. L:=ord(TargetSwitches^.GetCurrSel);
  32. RB^.SetData(L);
  33. Insert(RB);
  34. R2.Copy(R);
  35. R2.B.Y:=R2.A.Y+1;
  36. Insert(New(PLabel, Init(R2, label_target_platform, RB)));
  37. end;
  38. InsertButtons(D);
  39. RB^.Select;
  40. if Desktop^.ExecView(D)=cmOK then
  41. begin
  42. TargetSwitches^.SetCurrSel(RB^.Value);
  43. { we allways need to recompile if we change
  44. the target OS PM }
  45. if L<>RB^.Value then
  46. PrevMainFile:='';
  47. UpdateTarget;
  48. end;
  49. Dispose(D, Done);
  50. end;
  51. procedure TIDEApp.UpdateTarget;
  52. var TargetMenu : PMenuItem;
  53. begin
  54. TargetMenu:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(cmTarget);
  55. if assigned(TargetMenu) then
  56. begin
  57. If assigned(TargetMenu^.Param) then
  58. DisposeStr(TargetMenu^.Param);
  59. TargetMenu^.Param:=NewStr(KillTilde(TargetSwitches^.ItemName(TargetSwitches^.GetCurrSel)));
  60. end;
  61. end;
  62. procedure TIDEApp.UpdateMode;
  63. var ModeMenu : PMenuItem;
  64. begin
  65. ModeMenu:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(cmSwitchesMode);
  66. if assigned(ModeMenu) then
  67. begin
  68. If assigned(ModeMenu^.Param) then
  69. DisposeStr(ModeMenu^.Param);
  70. ModeMenu^.Param:=NewStr(KillTilde(SwitchesModeName[SwitchesMode]));
  71. end;
  72. end;
  73. procedure TIDEApp.DoPrimaryFile;
  74. var
  75. D : PFileDialog;
  76. FileName : string;
  77. begin
  78. New(D, Init('*.pri;*.pas',label_primaryfile_primaryfile,'*.pri;*.pas',fdOpenButton,hidPrimaryFile));
  79. D^.HelpCtx:=hcPrimaryFile;
  80. if Desktop^.ExecView(D)<>cmCancel then
  81. begin
  82. D^.GetFileName(FileName);
  83. SetPrimaryFile(FileName);
  84. UpdatePrimaryFile;
  85. end;
  86. end;
  87. procedure TIDEApp.DoClearPrimary;
  88. begin
  89. PrimaryFile:='';
  90. PrimaryFileMain:='';
  91. PrimaryFileSwitches:='';
  92. PrimaryFilePara:='';
  93. UpdatePrimaryFile;
  94. end;
  95. procedure TIDEApp.DoCompilerMessages;
  96. begin
  97. if not CompilerMessageWindow^.GetState(sfVisible) then
  98. CompilerMessageWindow^.Show;
  99. CompilerMessageWindow^.MakeFirst;
  100. end;