PageRenderTime 16ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
  5The Original Code is frClarify.pas, released April 2000.
  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 frClarify;
 27
 28{$I JcfGlobal.inc}
 29
 30interface
 31
 32uses
 33  Classes, StdCtrls, ExtCtrls,
 34  IDEOptionsIntf;
 35
 36type
 37
 38  { TfClarify }
 39
 40  TfClarify = class(TAbstractIDEOptionsEditor)
 41    rgRunOnceOffs: TRadioGroup;
 42    mFileExtensions: TMemo;
 43    Label1: TLabel;
 44  public
 45    constructor Create(AOwner: TComponent); override;
 46
 47    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;
 51    class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
 52    class function DefaultCollapseChildNodes: Boolean; override;
 53  end;
 54
 55implementation
 56
 57{$R *.lfm}
 58
 59uses
 60  JcfSettings, SetClarify, jcfuiconsts;
 61
 62constructor TfClarify.Create(AOwner: TComponent);
 63begin
 64  inherited;
 65  //fiHelpContext := HELP_CLARIFY;
 66end;
 67
 68function TfClarify.GetTitle: String;
 69begin
 70  Result := lisClarifyClarify;
 71end;
 72
 73procedure TfClarify.Setup(ADialog: TAbstractOptionsEditorDialog);
 74begin
 75  Label1.Caption := lisClarifyFileExtensionsToFormat;
 76  rgRunOnceOffs.Caption := lisClarifyRunOnceOffs;
 77  rgRunOnceOffs.Items[0] := lisClarifyDoNotRun;
 78  rgRunOnceOffs.Items[1] := lisClarifyDoRun;
 79  rgRunOnceOffs.Items[2] := lisClarifyRunOnlyThese;
 80end;
 81
 82
 83{-------------------------------------------------------------------------------
 84  worker procs }
 85
 86procedure TfClarify.ReadSettings(AOptions: TAbstractIDEOptions);
 87begin
 88  with FormatSettings.Clarify do
 89  begin
 90    rgRunOnceOffs.ItemIndex := Ord(OnceOffs);
 91
 92    mFileExtensions.Lines.Assign(FileExtensions);
 93  end;
 94end;
 95
 96procedure TfClarify.WriteSettings(AOptions: TAbstractIDEOptions);
 97begin
 98  with FormatSettings.Clarify do
 99  begin
100    OnceOffs := TOnceOffsOption(rgRunOnceOffs.ItemIndex);
101
102    FileExtensions.Assign(mFileExtensions.Lines);
103    FileExtensions.Sort;
104  end;
105end;
106
107class function TfClarify.SupportedOptionsClass: TAbstractIDEOptionsClass;
108begin
109  Result := TFormatSettings;
110end;
111
112class function TfClarify.DefaultCollapseChildNodes: Boolean;
113begin
114  Result := True;
115end;
116
117{-------------------------------------------------------------------------------
118  event handlers }
119initialization
120  RegisterIDEOptionsEditor(JCFOptionsGroup, TfClarify, JCFOptionClarify);
121end.