⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umfextractor.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 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 UMFExtractor;

{Contains a page to select the extractor of comments for the generator of
 documentation and to edit its options. It is also the base class of the pages
 to select the evaluator of texts for the generator.
}

interface

uses Windows, Classes, Forms, Controls, StdCtrls, ExtCtrls, ComCtrls,
     UMainFormFrame, UMFGenerator,
     UJADDState,
     UOptions;

type
  {A page to select the extractor of comments for the generator of
   documentation and to edit its options. It is also the base class of the
   pages to select the evaluator of texts for the generator. }
  TMFExtractor = class(TMFGenerator)
  private
  protected
    //Called when the generator changes.
    procedure StateGeneratorChanged(State: TJADDState); override;
    //Called when extractor of comments for the generator changes.
    procedure StateExtractorChanged(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

    //Called sometimes when the frame is to be replaced by another frame.
    procedure SelectNextFrame(var NewFrameClass: TMainFormFrameClass;
                              IsNext: Boolean); override;
  end;


implementation

{$R *.dfm}

uses UMakeDoc, UCommentExtraction,
     UMFLocalization;




{Called when the generator changes.
~param State the state that has been changed }
procedure TMFExtractor.StateGeneratorChanged(State: TJADDState);
var       Enabled     :Boolean;            //whether extractors are used
begin
 //extractors are used?
 Enabled := State.Generate.GeneratorUsesCommentExtractors;
 //don't change selection anymore
 //but set the state of the tree view and of the buttons
 TreeView.Enabled := Enabled;
 ButtonResetOptions.Enabled := Enabled;
 ButtonEditOptionsCategory.Enabled := Enabled;
 ButtonEditOptionsAsList.Enabled := Enabled;
end;

{Called when the extractor changes.
~param State the state that has been changed }
procedure TMFExtractor.StateExtractorChanged(State: TJADDState);
begin                                     //update the shown selected extractor
 SelectByClassName(State.Generate.ExtractorClassName);
end;



{Called sometimes when the frame is to be replaced by another frame. This
 method is ~[em not] always called before the frame is being replaced (and
 freed).
~param NewFrameClass the class of the frame that should replace this one
~param IsNext        if the next frame should be shown (instead of the previous
                     one) in some kind of an order }
procedure TMFExtractor.SelectNextFrame(var NewFrameClass: TMainFormFrameClass;
                                       IsNext: Boolean);
begin
 if IsNext then
  if not State.Generate.GeneratorUsesCommentEvaluators then
   NewFrameClass := TMFLocalization;  //skip directly to generate documentation
end;







{Initializes the tree view. }
procedure TMFExtractor.Init;
var       i           :Integer;              //counter through all nodes
begin
 //fill all classes of the extractors of comments in the tree view
 FillTreeView(ExtractorClasses, TCommentExtractor, nil,
              State.Generate.ExtractorClassName);

 //change the caption of the extractors of comments
 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 extractor use
    Text := TCommentExtractorClass(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 TMFExtractor.IsCurrentClass(AClass: TClass): Boolean;
begin
 Result := AClass.ClassNameIs(State.Generate.ExtractorClassName);
end;

{Called to select the class.
~param AClass the class to select }
procedure TMFExtractor.SetClass(AClass: TClass);
begin
 Assert(ExtractorClasses.IndexOfObject(TObject(AClass)) <> -1);
 State.Generate.ChangeExtractorByName(AClass.ClassName); //set the extractor
 with State.Generate.ExtractorDescription do
  begin
   Memo.Text := '';                                      //show its description
   Memo.Lines.Append('Name: ' + Name);
   Memo.Lines.Append('Identification: ' + Identification);
   Memo.Lines.Append('Class Name: ' + State.Generate.ExtractorClassName);
   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 TMFExtractor.GetOptions: TOptionWrapper;
begin
 Result := State.Generate.ExtractorOptions;
end;

{Resets the current object. }
procedure TMFExtractor.ResetOptions;
begin
 State.Generate.ResetExtractor;
end;



end.


  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -