/components/jcf2/Ui/Settings/frNotIdentifierCapsSettings.pas

http://github.com/graemeg/lazarus · Pascal · 117 lines · 68 code · 21 blank · 28 comment · 0 complexity · 6b28d1f31a8d3327bbca2393cd8fc977 MD5 · raw file

  1. {(*}
  2. (*------------------------------------------------------------------------------
  3. Delphi Code formatter source code
  4. The Original Code is frIdentifierCapsSettings.pas, released June 2005.
  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 frNotIdentifierCapsSettings;
  22. {$I JcfGlobal.inc}
  23. interface
  24. uses
  25. Classes, StdCtrls,
  26. IDEOptionsIntf;
  27. type
  28. { TfNotIdentifierCapsSettings }
  29. TfNotIdentifierCapsSettings = class(TAbstractIDEOptionsEditor)
  30. Label1: TLabel;
  31. cbEnableAnyWords: TCheckBox;
  32. mWords: TMemo;
  33. procedure cbEnableAnyWordsClick(Sender: TObject);
  34. procedure FrameResize(Sender: TObject);
  35. public
  36. constructor Create(AOwner: TComponent); override;
  37. function GetTitle: String; override;
  38. procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
  39. procedure ReadSettings({%H-}AOptions: TAbstractIDEOptions); override;
  40. procedure WriteSettings({%H-}AOptions: TAbstractIDEOptions); override;
  41. class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
  42. end;
  43. implementation
  44. {$R *.lfm}
  45. uses
  46. JcfSettings, jcfuiconsts;
  47. constructor TfNotIdentifierCapsSettings.Create(AOwner: TComponent);
  48. begin
  49. inherited;
  50. //fiHelpContext := HELP_CLARIFY_CAPITALISATION;
  51. end;
  52. function TfNotIdentifierCapsSettings.GetTitle: String;
  53. begin
  54. Result := lisCapsNotIdentifiersNotIdentifiers;
  55. end;
  56. procedure TfNotIdentifierCapsSettings.Setup(ADialog: TAbstractOptionsEditorDialog);
  57. begin
  58. cbEnableAnyWords.Caption := lisCapsAnyWordEnable;
  59. Label1.Caption := lisCapsNotIdentifiersSetCapitalisationOnTheseNonIdentifiers;
  60. end;
  61. procedure TfNotIdentifierCapsSettings.ReadSettings(AOptions: TAbstractIDEOptions);
  62. begin
  63. with FormatSettings.NotIdentifierCaps do
  64. begin
  65. cbEnableAnyWords.Checked := Enabled;
  66. mWords.Lines.Assign(Words);
  67. end;
  68. end;
  69. procedure TfNotIdentifierCapsSettings.WriteSettings(AOptions: TAbstractIDEOptions);
  70. begin
  71. with FormatSettings.NotIdentifierCaps do
  72. begin
  73. Enabled := cbEnableAnyWords.Checked;
  74. Words.Assign(mWords.Lines);
  75. end;
  76. end;
  77. class function TfNotIdentifierCapsSettings.SupportedOptionsClass: TAbstractIDEOptionsClass;
  78. begin
  79. Result := TFormatSettings;
  80. end;
  81. procedure TfNotIdentifierCapsSettings.cbEnableAnyWordsClick(Sender: TObject);
  82. begin
  83. mWords.Enabled := cbEnableAnyWords.Checked;
  84. end;
  85. procedure TfNotIdentifierCapsSettings.FrameResize(Sender: TObject);
  86. begin
  87. mWords.Height := ClientHeight -
  88. (cbEnableAnyWords.Top + cbEnableAnyWords.Height + GUI_PAD);
  89. end;
  90. initialization
  91. RegisterIDEOptionsEditor(JCFOptionsGroup, TfNotIdentifierCapsSettings, JCFOptionNotIdentifiers, JCFOptionObjectPascal);
  92. end.