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

📄 uoptionswizard.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 PAS
📖 第 1 页 / 共 4 页
字号:
{  JADD - Just Another DelphiDoc: Documentation from Delphi Source Code

Copyright (C) 2005-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 UOptionsWizard;

{Contains the classes for the pages of a sub-thread for the simple wizard for
 ~[em DelphiDoc]. Within this sub-thread the options of a generator of
 documentation can be edited, these are specific to the generators using
 comments. The class of the first page of the sub-thread is the only public
 class, ~[link TGeneratorOptionsWizard].
}


interface

uses Windows,
{$IFNDEF LINUX}
     Controls, StdCtrls, Forms,
{$ELSE}
     QControls, QStdCtrls, QForms,
{$ENDIF}
     UWizard;


type

   { * * *  ***  * * *  ***  TGeneratorOptionsWizard  ***  * * *  ***  * * *  }


  {The first page for the wizard for ~[em DelphiDoc] in the sub-thread to edit
   the options of the generator pertaining comments. On the page can be
   selected if comments should be used. }
  TGeneratorOptionsWizard = class(TWizardPage)
  private
    //selects whether the comments of files are used
    FCheckBoxFileComment: TCheckBox;
    //selects whether the comments of identifiers are used
    FCheckBoxIdentifierComment: TCheckBox;

    //Called when the state of one of the checkboxes is changed.
    procedure CheckBoxClicked(Sender: TObject);
  protected
    //Returns the next page to be shown.
    function GetNextPage: TWizardPage; override;
  public
    //Creates the page and initializes its attributes.
    constructor Create(Form: TForm; Parent: TWinControl;
                       Data: TObject; PreviousPage: TWizardPage); override;

    //Called when the page should be shown.
    procedure ShowPage(PreviousPage: TWizardPage); override;
    //Called when the page should no longer be shown.
    procedure HidePage(NewPage: TWizardPage); override;
  end;





implementation

uses SysUtils,
{$IFNDEF LINUX}
     ExtCtrls, Dialogs,
{$ELSE}
     QExtCtrls, QDialogs,
{$ENDIF}
     General,
     UCommandParameters, 
     UGenerate,
     UOptions,
     UMakeDoc, UCommentDoc;




//Gets the value of a boolean option.
function GetBooleanOption(Options: TOptionWrapper; OptionName: String;
                          var Value: Boolean): Boolean; forward;
//Sets the value of a boolean option.
function SetBooleanOption(Options: TOptionWrapper; OptionName: String;
                          Value: Boolean): Boolean; forward;

//Gets the value of a string option.
function GetStringOption(Options: TOptionWrapper; OptionName: String;
                         var Value: String): Boolean; forward;
//Sets the value of a string option.
function SetStringOption(Options: TOptionWrapper; OptionName: String;
                         Value: String): Boolean; forward;

//Checks whether the generator generates documentation in HTML format.
function CheckHTMLFormat(Generator: TMakeDoc): Boolean; forward;





type

   { * * *  ***  * * *  ***  TCommentPositionsWizard  ***  * * *  ***  * * *  }


  {The second page for the wizard for ~[em DelphiDoc] in the sub-thread to edit
   the options of the generator pertaining comments. On the page can be
   selected where the comments should be searched. }
  TCommentPositionsWizard = class(TWizardPage)
  private
    //selects whether the comments of files should be searched after the
    //first token
    FCheckBoxFileCommentAfterFirstStatement: TCheckBox;
    //selects whether the comments of identifiers should be searched at the
    //first declaration instead of the final one
    FCheckBoxIdentifierCommentAtForward: TCheckBox;
    //selects whether the comments of identifiers should be searched at the
    //other declaration if none is found
    FCheckBoxIdentifierCommentFallBack: TCheckBox;
  protected
    //Returns the next page to be shown.
    function GetNextPage: TWizardPage; override;
  public
    //Creates the page and initializes its attributes.
    constructor Create(Form: TForm; Parent: TWinControl;
                       Data: TObject; PreviousPage: TWizardPage); override;

    //Called when the page should be shown.
    procedure ShowPage(PreviousPage: TWizardPage); override;
    //Called when the page should no longer be shown.
    procedure HidePage(NewPage: TWizardPage); override;
  end;



   { * * *  ***  * * *  ***   TCommentFilterWizard   ***  * * *  ***  * * *  }

  {The third page for the wizard for ~[em DelphiDoc] in the sub-thread to edit
   the options of the generator pertaining comments. On the page can be
   selected if comments are marked by stars. }
  TCommentFilterWizard = class(TWizardPage)
  private
    //selects whether only comments with a leading star should be used
    FCheckBoxOnlyStaredComments: TCheckBox;
    //selects whether leading and trailing stars should be removed
    FCheckBoxRemoveStars: TCheckBox;        //from comments

    //Called when the state of the checkbox about using only comments with
    //leading stars is changed.
    procedure CheckBoxOnlyStaredComments(Sender: TObject);
  protected
    //Returns the next page to be shown.
    function GetNextPage: TWizardPage; override;
  public
    //Creates the page and initializes its attributes.
    constructor Create(Form: TForm; Parent: TWinControl;
                       Data: TObject; PreviousPage: TWizardPage); override;

    //Called when the page should be shown.
    procedure ShowPage(PreviousPage: TWizardPage); override;
    //Called when the page should no longer be shown.
    procedure HidePage(NewPage: TWizardPage); override;
  end;



   { * * *  ***  * * *  ***   TParseCommentWizard   ***  * * *  ***  * * *  }

  {The fourth page for the wizard for ~[em DelphiDoc] in the sub-thread to edit
   the options of the generator pertaining comments. On the page can be
   selected if comments should be parsed. }
  TParseCommentWizard = class(TWizardPage)
  private
    //selects whether comments should be parsed
    FCheckBoxParseComments: TCheckBox;
    //selects whether to keep line breaks
    FCheckBoxKeepLineBreaks: TCheckBox;

{$IFNDEF LINUX}
    //Called when the button to show the documentation is clicked.
    procedure ButtonShowDocumentation(Sender: TObject);
{$ENDIF}
    //Called when the state of the checkbox is changed.
    procedure CheckBoxParseCommentsClicked(Sender: TObject);
  protected
    //Returns the next page to be shown.
    function GetNextPage: TWizardPage; override;
  public
    //Creates the page and initializes its attributes.
    constructor Create(Form: TForm; Parent: TWinControl;
                       Data: TObject; PreviousPage: TWizardPage); override;

    //Called when the page should be shown.
    procedure ShowPage(PreviousPage: TWizardPage); override;
    //Called when the page should no longer be shown.
    procedure HidePage(NewPage: TWizardPage); override;
  end;



   { * * *  ***  * * *  ***   TCommentOptionsWizard   ***  * * *  ***  * * *  }

  {The fifth page for the wizard for ~[em DelphiDoc] in the sub-thread to edit
   the options of the generator pertaining comments. On the page can be
   selected how the comments should be handled. }
  TCommentOptionsWizard = class(TWizardPage)
  private
    //selects whether a limited JavaDoc-compatibility should be used
    FCheckBoxJavaDoc: TCheckBox;
    //selects whether the "exception" section should still be named so
    FCheckBoxException: TCheckBox;
    //selects whether the names of parameters can be used as sections to
    FCheckBoxParamNamesSections: TCheckBox;          //document them

    //Called when the check box for JavaDoc-compatibility is changed.
    procedure CheckBoxJavaDoc(Sender: TObject);
  protected
    //Returns the next page to be shown.
    function GetNextPage: TWizardPage; override;
  public
    //Creates the page and initializes its attributes.
    constructor Create(Form: TForm; Parent: TWinControl;
                       Data: TObject; PreviousPage: TWizardPage); override;

    //Called when the page should be shown.
    procedure ShowPage(PreviousPage: TWizardPage); override;
    //Called when the page should no longer be shown.
    procedure HidePage(NewPage: TWizardPage); override;
  end;


  {The sixth page for the wizard for ~[em DelphiDoc] in the sub-thread to edit
   the options of the generator pertaining comments. On the page can be
   selected whether raw HTML code should be copied unencoded from the comments
   to the documentation. }
  TUseRawHTMLWizard = class(TWizardPage)
  private
    //selects whether raw HTML code should be copied unencoded from the
    //comments to the documentation
    FCheckBoxUseRawHTML: TCheckBox;
  public
    //Creates the page and initializes its attributes.
    constructor Create(Form: TForm; Parent: TWinControl;
                       Data: TObject; PreviousPage: TWizardPage); override;

    //Called when the page should be shown.
    procedure ShowPage(PreviousPage: TWizardPage); override;
    //Called when the page should no longer be shown.
    procedure HidePage(NewPage: TWizardPage); override;
  end;

















{Gets the value of a boolean option.
~param Options    the list of options to get the option from
~param OptionName the name of the option to get
~param Value      out: the value of the option
~result if the generator has a boolean option of the name }
function GetBooleanOption(Options: TOptionWrapper; OptionName: String;
                          var Value: Boolean): Boolean;
var      Index           :Cardinal;             //index of the option
begin
 //search the option
 Result := Options.GetOptionIndex(OptionName, otBoolean, Index);
 if Result then                                 //option found?
  Value := Options.Option[Index].BoolData;        //return its value
end;


{Sets the value of a boolean option.
~param Options    the list of options to set the option in
~param OptionName the name of the option to set
~param Value      the value to set for the option
~result if the generator has a boolean option of the name }
function SetBooleanOption(Options: TOptionWrapper; OptionName: String;
                          Value: Boolean): Boolean;
var      Index           :Cardinal;                 //index of the option
         OptionValue     :TOptionValue;             //to set the option
begin
 //search the option
 Result := Options.GetOptionIndex(OptionName, otBoolean, Index);
 if Result then                                     //option found?
  begin
   OptionValue.BoolData := Value;
   Options.Option[Index] := OptionValue;              //set the new value
  end;
end;



{Gets the value of a string option.
~param Options    the list of options to get the option from
~param OptionName the name of the option to get

⌨️ 快捷键说明

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