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