📄 umfevaluator.pas
字号:
{ JADD - Just Another DelphiDoc: Documentation from Delphi Source Code
Copyright (C) 2002-2008 Gerold Veith
This file is part of JADD - Just Another DelphiDoc.
DelphiDoc is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
DelphiDoc 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
unit UMFEvaluator;
{Contains a page to select the evaluator of texts for the generator of
documentation and to edit its options.
}
interface
uses Windows, Classes, Forms, Controls, StdCtrls, ExtCtrls, ComCtrls,
UMFExtractor,
UJADDState,
UOptions;
type
{A page to select the evaluator of texts for the generator of documentation
and to edit its options. }
TMFEvaluator = class(TMFExtractor)
private
protected
//Called when extractor of comments for the generator changes.
procedure StateExtractorChanged(State: TJADDState); override;
//Called when evaluator of comments for the generator changes.
procedure StateEvaluatorChanged(State: TJADDState); override;
//Initializes the tree view.
procedure Init; override;
//Checks whether an object of the class is curently used.
function IsCurrentClass(AClass: TClass): Boolean; override;
//Called to select the class.
procedure SetClass(AClass: TClass); override;
//Returns an object to edit the options of the current object.
function GetOptions: TOptionWrapper; override;
//Resets the current object.
procedure ResetOptions; override;
public
end;
implementation
{$R *.dfm}
uses UCommentDoc, UInlineCommand;
{Called when the extractor changes.
~param State the state that has been changed }
procedure TMFEvaluator.StateExtractorChanged(State: TJADDState);
begin
//don't change selection anymore
end;
{Called when the extractor changes.
~param State the state that has been changed }
procedure TMFEvaluator.StateEvaluatorChanged(State: TJADDState);
begin //update the shown selected evaluator
SelectByClassName(State.Generate.EvaluatorClassName);
end;
{Initializes the tree view. }
procedure TMFEvaluator.Init;
var i :Integer; //counter through all nodes
begin
//fill all classes of the evaluators of texts in the tree view
FillTreeView(EvaluatorClasses, TCommentEvaluator, nil,
State.Generate.EvaluatorClassName);
//change the caption of the evaluators of texts
for i := 0 to TreeView.Items.Count - 1 do //for each node
with TreeView.Items[i] do
if ImageIndex > 1 then //if it is an evaluator use
Text := TCommentEvaluatorClass(Data).GetDescription.Name; //name instead
end;
{Checks whether an object of the class is curently used.
~param AClass the class to check if it is currently selected
~result if the class is currently selected }
function TMFEvaluator.IsCurrentClass(AClass: TClass): Boolean;
begin
Result := AClass.ClassNameIs(State.Generate.EvaluatorClassName);
end;
{Called to select the class.
~param AClass the class to select }
procedure TMFEvaluator.SetClass(AClass: TClass);
begin
Assert(EvaluatorClasses.IndexOfObject(TObject(AClass)) <> -1);
State.Generate.ChangeEvaluatorByName(AClass.ClassName); //set the evaluator
with State.Generate.EvaluatorDescription do
begin
Memo.Text := ''; //show its description
Memo.Lines.Append('Name: ' + Name);
Memo.Lines.Append('Identification: ' + Identification);
Memo.Lines.Append('Class Name: ' + State.Generate.EvaluatorClassName);
Memo.Lines.Append('');
Memo.Lines.Append(Description);
end;
end;
{Returns an object to edit the options of the current object.
~result an object to edit the options }
function TMFEvaluator.GetOptions: TOptionWrapper;
begin
Result := State.Generate.EvaluatorOptions;
end;
{Resets the current object. }
procedure TMFEvaluator.ResetOptions;
begin
State.Generate.ResetEvaluator;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -