1 {(*}
2 (*------------------------------------------------------------------------------
3  Delphi Code formatter source code
4 
5 The Original Code is frIdentifierCapsSettings.pas, released June 2005.
6 The Initial Developer of the Original Code is Anthony Steele.
7 Portions created by Anthony Steele are Copyright (C) 1999-2008 Anthony Steele.
8 All Rights Reserved.
9 Contributor(s): Anthony Steele.
10 
11 The contents of this file are subject to the Mozilla Public License Version 1.1
12 (the "License"). you may not use this file except in compliance with the License.
13 You may obtain a copy of the License at http://www.mozilla.org/NPL/
14 
15 Software distributed under the License is distributed on an "AS IS" basis,
16 WITHOUT WARRANTY OF ANY KIND, either express or implied.
17 See the License for the specific language governing rights and limitations
18 under the License.
19 
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 or later (the "GPL")
22 See http://www.gnu.org/licenses/gpl.html
23 ------------------------------------------------------------------------------*)
24 {*)}
25 
26 unit frNotIdentifierCapsSettings;
27 
28 {$I JcfGlobal.inc}
29 
30 interface
31 
32 uses
33   Classes, StdCtrls,
34   IDEOptionsIntf, IDEOptEditorIntf;
35 
36 type
37 
38   { TfNotIdentifierCapsSettings }
39 
40   TfNotIdentifierCapsSettings = class(TAbstractIDEOptionsEditor)
41     Label1: TLabel;
42     cbEnableAnyWords: TCheckBox;
43     mWords: TMemo;
44     procedure cbEnableAnyWordsClick(Sender: TObject);
45     procedure FrameResize(Sender: TObject);
46   public
47     constructor Create(AOwner: TComponent); override;
48 
GetTitlenull49     function GetTitle: String; override;
50     procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
51     procedure ReadSettings({%H-}AOptions: TAbstractIDEOptions); override;
52     procedure WriteSettings({%H-}AOptions: TAbstractIDEOptions); override;
SupportedOptionsClassnull53     class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
54   end;
55 
56 implementation
57 
58 {$R *.lfm}
59 
60 uses
61   JcfSettings, JcfUIConsts;
62 
63 constructor TfNotIdentifierCapsSettings.Create(AOwner: TComponent);
64 begin
65   inherited;
66   //fiHelpContext := HELP_CLARIFY_CAPITALISATION;
67 end;
68 
TfNotIdentifierCapsSettings.GetTitlenull69 function TfNotIdentifierCapsSettings.GetTitle: String;
70 begin
71   Result := lisCapsNotIdentifiersNotIdentifiers;
72 end;
73 
74 procedure TfNotIdentifierCapsSettings.Setup(ADialog: TAbstractOptionsEditorDialog);
75 begin
76   cbEnableAnyWords.Caption := lisCapsAnyWordEnable;
77   Label1.Caption := lisCapsNotIdentifiersSetCapitalisationOnTheseNonIdentifiers;
78 end;
79 
80 
81 procedure TfNotIdentifierCapsSettings.ReadSettings(AOptions: TAbstractIDEOptions);
82 begin
83   with FormattingSettings.NotIdentifierCaps do
84   begin
85     cbEnableAnyWords.Checked := Enabled;
86     mWords.Lines.Assign(Words);
87   end;
88 end;
89 
90 procedure TfNotIdentifierCapsSettings.WriteSettings(AOptions: TAbstractIDEOptions);
91 begin
92   with FormattingSettings.NotIdentifierCaps do
93   begin
94     Enabled := cbEnableAnyWords.Checked;
95     Words.Assign(mWords.Lines);
96   end;
97 end;
98 
TfNotIdentifierCapsSettings.SupportedOptionsClassnull99 class function TfNotIdentifierCapsSettings.SupportedOptionsClass: TAbstractIDEOptionsClass;
100 begin
101   Result := TFormattingSettings;
102 end;
103 
104 procedure TfNotIdentifierCapsSettings.cbEnableAnyWordsClick(Sender: TObject);
105 begin
106   mWords.Enabled := cbEnableAnyWords.Checked;
107 end;
108 
109 procedure TfNotIdentifierCapsSettings.FrameResize(Sender: TObject);
110 begin
111   mWords.Height := ClientHeight -
112     (cbEnableAnyWords.Top + cbEnableAnyWords.Height + GUI_PAD);
113 end;
114 
115 initialization
116   RegisterIDEOptionsEditor(JCFOptionsGroup, TfNotIdentifierCapsSettings, JCFOptionNotIdentifiers, JCFOptionObjectPascal);
117 end.
118