/components/jcf2/Ui/Settings/frClarify.pas

http://github.com/graemeg/lazarus · Pascal · 121 lines · 66 code · 23 blank · 32 comment · 0 complexity · 331d2875f2b7badb44e7b3793646b679 MD5 · raw file

  1. {(*}
  2. (*------------------------------------------------------------------------------
  3. Delphi Code formatter source code
  4. The Original Code is frClarify.pas, released April 2000.
  5. The Initial Developer of the Original Code is Anthony Steele.
  6. Portions created by Anthony Steele are Copyright (C) 1999-2008 Anthony Steele.
  7. All Rights Reserved.
  8. Contributor(s): Anthony Steele.
  9. The contents of this file are subject to the Mozilla Public License Version 1.1
  10. (the "License"). you may not use this file except in compliance with the License.
  11. You may obtain a copy of the License at http://www.mozilla.org/NPL/
  12. Software distributed under the License is distributed on an "AS IS" basis,
  13. WITHOUT WARRANTY OF ANY KIND, either express or implied.
  14. See the License for the specific language governing rights and limitations
  15. under the License.
  16. Alternatively, the contents of this file may be used under the terms of
  17. the GNU General Public License Version 2 or later (the "GPL")
  18. See http://www.gnu.org/licenses/gpl.html
  19. ------------------------------------------------------------------------------*)
  20. {*)}
  21. unit frClarify;
  22. {$I JcfGlobal.inc}
  23. interface
  24. uses
  25. Classes, StdCtrls, ExtCtrls,
  26. IDEOptionsIntf;
  27. type
  28. { TfClarify }
  29. TfClarify = class(TAbstractIDEOptionsEditor)
  30. rgRunOnceOffs: TRadioGroup;
  31. mFileExtensions: TMemo;
  32. Label1: TLabel;
  33. public
  34. constructor Create(AOwner: TComponent); override;
  35. function GetTitle: String; override;
  36. procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
  37. procedure ReadSettings({%H-}AOptions: TAbstractIDEOptions); override;
  38. procedure WriteSettings({%H-}AOptions: TAbstractIDEOptions); override;
  39. class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
  40. class function DefaultCollapseChildNodes: Boolean; override;
  41. end;
  42. implementation
  43. {$R *.lfm}
  44. uses
  45. JcfSettings, SetClarify, jcfuiconsts;
  46. constructor TfClarify.Create(AOwner: TComponent);
  47. begin
  48. inherited;
  49. //fiHelpContext := HELP_CLARIFY;
  50. end;
  51. function TfClarify.GetTitle: String;
  52. begin
  53. Result := lisClarifyClarify;
  54. end;
  55. procedure TfClarify.Setup(ADialog: TAbstractOptionsEditorDialog);
  56. begin
  57. Label1.Caption := lisClarifyFileExtensionsToFormat;
  58. rgRunOnceOffs.Caption := lisClarifyRunOnceOffs;
  59. rgRunOnceOffs.Items[0] := lisClarifyDoNotRun;
  60. rgRunOnceOffs.Items[1] := lisClarifyDoRun;
  61. rgRunOnceOffs.Items[2] := lisClarifyRunOnlyThese;
  62. end;
  63. {-------------------------------------------------------------------------------
  64. worker procs }
  65. procedure TfClarify.ReadSettings(AOptions: TAbstractIDEOptions);
  66. begin
  67. with FormatSettings.Clarify do
  68. begin
  69. rgRunOnceOffs.ItemIndex := Ord(OnceOffs);
  70. mFileExtensions.Lines.Assign(FileExtensions);
  71. end;
  72. end;
  73. procedure TfClarify.WriteSettings(AOptions: TAbstractIDEOptions);
  74. begin
  75. with FormatSettings.Clarify do
  76. begin
  77. OnceOffs := TOnceOffsOption(rgRunOnceOffs.ItemIndex);
  78. FileExtensions.Assign(mFileExtensions.Lines);
  79. FileExtensions.Sort;
  80. end;
  81. end;
  82. class function TfClarify.SupportedOptionsClass: TAbstractIDEOptionsClass;
  83. begin
  84. Result := TFormatSettings;
  85. end;
  86. class function TfClarify.DefaultCollapseChildNodes: Boolean;
  87. begin
  88. Result := True;
  89. end;
  90. {-------------------------------------------------------------------------------
  91. event handlers }
  92. initialization
  93. RegisterIDEOptionsEditor(JCFOptionsGroup, TfClarify, JCFOptionClarify);
  94. end.