FDXPFPCOptions.pas 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. unit FDXPFPCOptions;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls, ComCtrls, ExtCtrls;
  6. type
  7. TDXPFPCOptions = class(TForm)
  8. Panel1: TPanel;
  9. BUOk: TButton;
  10. BUCancel: TButton;
  11. PageControl: TPageControl;
  12. TSCompiler: TTabSheet;
  13. TSCompilerMessages: TTabSheet;
  14. GroupBox1: TGroupBox;
  15. GroupBox2: TGroupBox;
  16. GroupBox3: TGroupBox;
  17. CheckBox1: TCheckBox;
  18. GroupBox4: TGroupBox;
  19. CheckBox2: TCheckBox;
  20. CheckBox3: TCheckBox;
  21. CheckBox4: TCheckBox;
  22. CheckBox5: TCheckBox;
  23. Panel2: TPanel;
  24. RadioButton1: TRadioButton;
  25. RadioButton2: TRadioButton;
  26. RadioButton3: TRadioButton;
  27. Label1: TLabel;
  28. Panel3: TPanel;
  29. Label2: TLabel;
  30. RadioButton4: TRadioButton;
  31. RadioButton5: TRadioButton;
  32. CheckBox6: TCheckBox;
  33. Panel4: TPanel;
  34. Label3: TLabel;
  35. RadioButton6: TRadioButton;
  36. RadioButton7: TRadioButton;
  37. RadioButton8: TRadioButton;
  38. CheckBox7: TCheckBox;
  39. CheckBox8: TCheckBox;
  40. CheckBox9: TCheckBox;
  41. CheckBox10: TCheckBox;
  42. CheckBox11: TCheckBox;
  43. CheckBox12: TCheckBox;
  44. GroupBox5: TGroupBox;
  45. CBShowWarnings: TCheckBox;
  46. CBShowNotes: TCheckBox;
  47. CBShowHints: TCheckBox;
  48. TabSheet1: TTabSheet;
  49. GroupBox6: TGroupBox;
  50. RadioButton9: TRadioButton;
  51. CheckBox16: TCheckBox;
  52. RadioButton10: TRadioButton;
  53. RadioButton11: TRadioButton;
  54. private
  55. { Déclarations privées }
  56. procedure LoadOptions(options : TStrings);
  57. procedure SaveOptions(options : TStrings);
  58. public
  59. { Déclarations publiques }
  60. function Execute(options : TStrings) : Boolean;
  61. end;
  62. implementation
  63. {$R *.dfm}
  64. // Execute
  65. //
  66. function TDXPFPCOptions.Execute(options : TStrings) : Boolean;
  67. begin
  68. PageControl.ActivePage:=TSCompiler;
  69. LoadOptions(options);
  70. Result:=(ShowModal=mrOk);
  71. if Result then
  72. SaveOptions(options);
  73. end;
  74. // LoadOptions
  75. //
  76. procedure TDXPFPCOptions.LoadOptions(options : TStrings);
  77. var
  78. i : Integer;
  79. comp : TComponent;
  80. msg : String;
  81. begin
  82. for i:=0 to ComponentCount-1 do begin
  83. comp:=Components[i];
  84. if comp is TRadioButton then
  85. TRadioButton(comp).Checked:=(options.IndexOf(TRadioButton(comp).Hint)>=0)
  86. else if comp is TCheckBox then
  87. TCheckBox(comp).Checked:=(options.IndexOf(TCheckBox(comp).Hint)>=0);
  88. end;
  89. msg:='';
  90. for i:=0 to options.Count-1 do if Copy(options[i], 1, 2)='-v' then begin
  91. msg:=Copy(options[i], 3, MaxInt);
  92. Break;
  93. end;
  94. CBShowWarnings.Checked:=(Pos('w', msg)>0);
  95. CBShowNotes.Checked:=(Pos('n', msg)>0);
  96. CBShowHints.Checked:=(Pos('h', msg)>0);
  97. end;
  98. // SaveOptions
  99. //
  100. procedure TDXPFPCOptions.SaveOptions(options : TStrings);
  101. var
  102. i : Integer;
  103. comp : TComponent;
  104. msg : String;
  105. begin
  106. options.Clear;
  107. for i:=0 to ComponentCount-1 do begin
  108. comp:=Components[i];
  109. if comp is TRadioButton then begin
  110. if TRadioButton(comp).Checked then
  111. options.Add(TRadioButton(comp).Hint);
  112. end else if comp is TCheckBox then begin
  113. if TCheckBox(comp).Checked then
  114. options.Add(TCheckBox(comp).Hint);
  115. end;
  116. end;
  117. msg:='-ve';
  118. if CBShowWarnings.Checked then msg:=msg+'w';
  119. if CBShowNotes.Checked then msg:=msg+'n';
  120. if CBShowHints.Checked then msg:=msg+'h';
  121. options.Add(msg);
  122. end;
  123. end.