fpmcomp.inc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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,R3: TRect;
  13. D: PCenterDialog;
  14. RB: PScrollerRadioButtons;
  15. VScrollBar : PScrollBar;
  16. TargetCount,TargetHeight,I: Sw_Integer;
  17. LastItem: PSItem;
  18. L: longint;
  19. begin
  20. TargetCount:=TargetSwitches^.ItemCount;
  21. TargetHeight:=TargetCount;
  22. GetExtent(R);
  23. if (R.B.Y-R.A.Y) < (TargetHeight+9) then TargetHeight:= (R.B.Y-R.A.Y)-9;
  24. if TargetHeight<3 then TargetHeight:=3;
  25. R.Assign(0,0,60,4+TargetHeight);
  26. New(D, Init(R, dialog_target));
  27. with D^ do
  28. begin
  29. HelpCtx:=hcTarget;
  30. GetExtent(R); R.Grow(-3,-1); Inc(R.A.Y);
  31. R2.Copy(R); Inc(R2.A.Y); R2.B.Y:=R2.A.Y+TargetHeight;
  32. {have scroll bar for Targets only if they does not fit in view}
  33. VScrollBar :=nil;
  34. if TargetHeight<>TargetCount then
  35. begin
  36. Dec(R2.B.X);
  37. R3.Copy(R2);R3.A.X:=R3.B.X; R3.B.X:=R3.B.X+1;
  38. R3.B.Y:=R3.B.Y-3; {-3 because of InsertButtons later}
  39. VScrollBar := New(PScrollBar, Init(R3));
  40. Insert(VScrollBar);
  41. end;
  42. LastItem:=nil;
  43. for I:=TargetCount-1 downto 0 do
  44. LastItem:=NewSItem(TargetSwitches^.ItemName(I), LastItem);
  45. New(RB, Init(R2, LastItem, VScrollBar));
  46. L:=ord(TargetSwitches^.GetCurrSel);
  47. RB^.SetData(L);
  48. RB^.CentreSelected;
  49. Insert(RB);
  50. R2.Copy(R);
  51. R2.B.Y:=R2.A.Y+1;
  52. Insert(New(PLabel, Init(R2, label_target_platform, RB)));
  53. end;
  54. InsertButtons(D);
  55. RB^.Select;
  56. if Desktop^.ExecView(D)=cmOK then
  57. begin
  58. TargetSwitches^.SetCurrSel(RB^.Value);
  59. { we allways need to recompile if we change
  60. the target OS PM }
  61. if L<>RB^.Value then
  62. PrevMainFile:='';
  63. UpdateTarget;
  64. UpdateAsmOutputSwitches;
  65. end;
  66. Dispose(D, Done);
  67. end;
  68. procedure TIDEApp.UpdateTarget;
  69. var TargetMenu : PMenuItem;
  70. begin
  71. TargetMenu:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(cmTarget);
  72. if assigned(TargetMenu) then
  73. begin
  74. If assigned(TargetMenu^.Param) then
  75. DisposeStr(TargetMenu^.Param);
  76. TargetMenu^.Param:=NewStr(KillTilde(TargetSwitches^.ItemName(TargetSwitches^.GetCurrSel)));
  77. end;
  78. end;
  79. procedure TIDEApp.UpdateMode;
  80. var ModeMenu : PMenuItem;
  81. begin
  82. ModeMenu:=PAdvancedMenuBar(MenuBar)^.GetMenuItem(cmSwitchesMode);
  83. if assigned(ModeMenu) then
  84. begin
  85. If assigned(ModeMenu^.Param) then
  86. DisposeStr(ModeMenu^.Param);
  87. ModeMenu^.Param:=NewStr(KillTilde(SwitchesModeName[SwitchesMode]));
  88. end;
  89. end;
  90. procedure TIDEApp.DoPrimaryFile;
  91. var
  92. D : PFPFileDialog;
  93. FileName : string;
  94. begin
  95. New(D, Init('*.pri;*.pas',label_primaryfile_primaryfile,'*.pri;*.pas',fdOpenButton,hidPrimaryFile));
  96. D^.HelpCtx:=hcPrimaryFile;
  97. if Desktop^.ExecView(D)<>cmCancel then
  98. begin
  99. D^.GetFileName(FileName);
  100. SetPrimaryFile(FileName);
  101. UpdatePrimaryFile;
  102. end;
  103. end;
  104. procedure TIDEApp.DoClearPrimary;
  105. begin
  106. PrimaryFile:='';
  107. PrimaryFileMain:='';
  108. PrimaryFileSwitches:='';
  109. PrimaryFilePara:='';
  110. UpdatePrimaryFile;
  111. end;
  112. procedure TIDEApp.DoCompilerMessages;
  113. begin
  114. if not CompilerMessageWindow^.GetState(sfVisible) then
  115. CompilerMessageWindow^.Show;
  116. CompilerMessageWindow^.MakeFirst;
  117. end;