lazarus/ide/frames/codeexplorer_figures_options.pas
paul dcc7ce6884 ide: code explorer
- add an option to ignore constants in the list of functions to the options frame
  - don't remove default values on load if there is no "codeexploreroptions.xml" (or defaults will gone on first use)

git-svn-id: trunk@19510 -
2009-04-19 11:23:22 +00:00

140 lines
5.2 KiB
ObjectPascal

{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
}
unit codeexplorer_figures_options;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms,
IDEOptionsIntf, LazarusIDEStrConsts, CodeExplOpts, ExtCtrls, Spin, StdCtrls;
type
{ TCodeExplorerFiguresOptionsFrame }
TCodeExplorerFiguresOptionsFrame = class(TAbstractIDEOptionsEditor)
FigureCharConstCheckBox: TCheckBox;
FigureCategoriesCheckGroup: TCheckGroup;
IgnoreFigureConstantsLabel: TLabel;
IgnoreFigConstInFuncsLabel: TLabel;
LongProcLineCountLabel: TLabel;
LongParamListCountLabel: TLabel;
IgnoreFigureConstantsMemo: TMemo;
IgnoreFigConstInFuncsMemo: TMemo;
NestedProcCountLabel: TLabel;
LongProcLineCountSpinEdit: TSpinEdit;
LongParamListCountSpinEdit: TSpinEdit;
NestedProcCountSpinEdit: TSpinEdit;
FigureLeftPanel: TPanel;
public
function GetTitle: String; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
end;
implementation
{ TCodeExplorerFiguresOptionsFrame }
function TCodeExplorerFiguresOptionsFrame.GetTitle: String;
begin
Result := lisCEFigures;
end;
procedure TCodeExplorerFiguresOptionsFrame.Setup(
ADialog: TAbstractOptionsEditorDialog);
var
c: TCEFigureCategory;
begin
FigureCategoriesCheckGroup.Caption := lisCEShowFigures;
for c := Low(TCEFigureCategory) to High(TCEFigureCategory) do
FigureCategoriesCheckGroup.Items.Add(CodeExplorerLocalizedString(c));
LongProcLineCountLabel.Caption := lisCELongProcLineCount;
LongParamListCountLabel.Caption := lisCELongParamListCount;
NestedProcCountLabel.Caption := lisCENestedProcCount;
FigureCharConstCheckBox.Caption := lisCEFigureCharConst;
IgnoreFigureConstantsLabel.Caption := lisCEIgnoreFigureConstants;
IgnoreFigConstInFuncsLabel.Caption := lisCEIgnoreFigConstInFuncs;
end;
procedure TCodeExplorerFiguresOptionsFrame.ReadSettings(
AOptions: TAbstractIDEOptions);
var
c: TCEFigureCategory;
Tmp: TStrings;
begin
with AOptions as TCodeExplorerOptions do
begin
for c := Low(TCEFigureCategory) to High(TCEFigureCategory) do
FigureCategoriesCheckGroup.Checked[ord(c)] := c in Figures;
LongProcLineCountSpinEdit.Value := LongProcLineCount;
LongParamListCountSpinEdit.Value := LongParamListCount;
NestedProcCountSpinEdit.Value := NestedProcCount;
FigureCharConstCheckBox.Checked := FigureCharConst;
Tmp := CreateListOfIgnoreFigureConstants;
IgnoreFigureConstantsMemo.Lines.Assign(Tmp);
Tmp.Free;
Tmp := CreateListOfIgnoreFigConstInFuncs;
IgnoreFigConstInFuncsMemo.Lines.Assign(Tmp);
Tmp.Free;
end;
end;
procedure TCodeExplorerFiguresOptionsFrame.WriteSettings(
AOptions: TAbstractIDEOptions);
var
NewCategories: TCEFigureCategories;
c: TCEFigureCategory;
begin
NewCategories := [];
for c := Low(TCEFigureCategory) to high(TCEFigureCategory) do
if FigureCategoriesCheckGroup.Checked[ord(c)] then
Include(NewCategories, c);
with AOptions as TCodeExplorerOptions do
begin
Figures := NewCategories;
LongProcLineCount := LongProcLineCountSpinEdit.Value;
LongParamListCount := LongParamListCountSpinEdit.Value;
NestedProcCount := NestedProcCountSpinEdit.Value;
FigureCharConst := FigureCharConstCheckBox.Checked;
SetListOf_IgnoreFigureConstants(IgnoreFigureConstantsMemo.Lines, False);
SetListOf_IgnoreFigConstInFuncs(IgnoreFigConstInFuncsMemo.Lines, False);
end;
end;
class function TCodeExplorerFiguresOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result := TCodeExplorerOptions;
end;
initialization
{$I codeexplorer_figures_options.lrs}
RegisterIDEOptionsEditor(GroupCodeExplorer, TCodeExplorerFiguresOptionsFrame, cdeOptionsFigures);
end.