PageRenderTime 31ms CodeModel.GetById 27ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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