📄 uoptionswizard.pas
字号:
end; //if Generator is TCommentDoc
CheckBoxParseCommentsClicked(nil); //update buttons
end;
{Called when the page should no longer be shown, but not when the wizard is
ended.
~param NewPage the page that will be shown instead }
procedure TParseCommentWizard.HidePage(NewPage: TWizardPage);
var Generator :TCommentDoc; //the currently chosen generator
begin
//current generator uses comments and they can be parsed
if TGeneratorManager(Data).TheGenerator is TCommentDoc then
begin
//get the current generator
Generator := TCommentDoc(TGeneratorManager(Data).TheGenerator);
//comments should not be parsed?
if assigned(FCheckBoxParseComments) then
begin
SetBooleanOption(Generator.Evaluator.GetOptions, 'DontParseComments',
not FCheckBoxParseComments.Checked); //set the option
SetBooleanOption(Generator.Extractor.GetOptions, 'DoNotSectionize',
not FCheckBoxParseComments.Checked); //set the option
end;
//line breaks in comments could be kept in the documentation?
if assigned(FCheckBoxKeepLineBreaks) then
SetBooleanOption(Generator.GetOptions, 'KeepLineBreaksInComments',
FCheckBoxKeepLineBreaks.Checked); //set the option
end;
FCheckBoxParseComments := nil; //controls will be removed
FCheckBoxKeepLineBreaks := nil;
inherited HidePage(NewPage); //hide the page
end;
{ * * * *** * * * *** TCommentOptionsWizard *** * * * *** * * * }
{Creates the page and initializes its attributes.
~param Form the form to show the page of the wizard on
~param Parent the parent to show the components of the page on
~param Data custom data for the wizard
~param PreviousPage the previous page of this page (to go back to) }
constructor TCommentOptionsWizard.Create(Form: TForm; Parent: TWinControl;
Data: TObject;
PreviousPage: TWizardPage);
begin
inherited Create(Form, Parent, Data, PreviousPage); //create the object
FCaption := 'Options for comments?';
FHelpContext := 31105;
//generation of documentation not in a HTML format?
if not CheckHTMLFormat(TGeneratorManager(Data).TheGenerator) then
Exclude(FButtonsEnabled, wbNext); //end of options
end;
{Returns the next page to be shown.
~result the next page to be shown }
function TCommentOptionsWizard.GetNextPage: TWizardPage;
begin
//generation of documentation in HTML format?
if CheckHTMLFormat(TGeneratorManager(Data).TheGenerator) then
begin //create the next page
Result := TUseRawHTMLWizard.Create(Form, Parent, Data, Self);
Result.SuperPage := SuperPage;
end
else
Result := nil; //end this sub-thread
end;
{Called when the check box for JavaDoc-compatibility is changed.
~param Sender the sender of the event, ~[link FCheckBoxJavaDoc] }
procedure TCommentOptionsWizard.CheckBoxJavaDoc(Sender: TObject);
begin
assert(assigned(FCheckBoxJavaDoc));
//generator can document exceptions raised in functions
if assigned(FCheckBoxException) then
//enable option of the name of sections to document exceptions only if
//JavaDoc-compatibility is used
FCheckBoxException.Enabled := FCheckBoxJavaDoc.Checked;
end;
{Called when the page should be shown.
~param PreviousPage the previously shown page or nil }
procedure TCommentOptionsWizard.ShowPage(PreviousPage: TWizardPage);
var Generator :TCommentDoc; //the currently chosen generator
Value :Boolean; //value of options
StrValue :String; //name of sections for excpetions
begin
inherited ShowPage(PreviousPage); //start the page
//generator uses comments?
if TGeneratorManager(Data).TheGenerator is TCommentDoc then
begin
//get the current generator
Generator := TCommentDoc(TGeneratorManager(Data).TheGenerator);
//can use commands inside the comments?
if GetStringOption(Generator.Extractor.GetOptions,
'SectionSeparator', StrValue) or
GetStringOption(Generator.Evaluator.GetOptions,
'CommentCommandChar', StrValue) then
begin
//show option to select whether the commands should be used in a more
//JavaDoc-like way
ShowText('If your source code is in a JavaDoc-like style commented, here some options can be changed to allow an easier transition.' + LineDelimiter +
'The command character will be changed from "~" to "@" ("~" isn''t used in Pascal, "@" is, that''s the reason for choosing "~"), and "@result" will be changed to "@return" ("result" was chosen in order to stay with Pascal). ' +
'"@exception may be changed to "@throws", please see below.' + LineDelimiter +
'For passing on HTML tags to the documentation take a look at the next page.');
FCheckBoxJavaDoc := AddCheckBox('Use limited &JavaDoc-compatibility?',
StrValue = '@', CheckBoxJavaDoc);
//can use "exception" to document exceptions to be thrown by functions?
if GetStringOption(Generator.Extractor.GetOptions,
'SectionName_exception', StrValue) then
begin
//show option to select whether "exception" should still be used
ShowText('"@throws" was added as an synonym for "@exception" in Javadoc 1.2, so you can now use both in Javadoc. DelphiDoc can only use one of them, so you can choose here which one to use.');
FCheckBoxException :=
AddCheckBox('Use still "&exception" instead of "throws"?',
LowerCase(StrValue) = 'exception');
FCheckBoxException.Enabled := FCheckBoxJavaDoc.Checked;
end
else
assert(False);
inc(FNewComponentTop, 10);
end
else
assert(False);
//can use the names of parameters as sections to document them?
if GetBooleanOption(Generator.GetOptions, 'ParamNamesAsSections',
Value) then
begin
//show option to select whether the names of parameters should be used
ShowText('If you want to shorten your comments, you can use the names of parameters directly as sections names, saving a "param " for each parameter. This can''t be used for parameters with the name of a valid section.');
FCheckBoxParamNamesSections :=
AddCheckBox('Names of ¶meters can be used as sections?',
Value);
end
else
assert(False);
end; //if Generator is TCommentDoc
end;
{Called when the page should no longer be shown, but not when the wizard is
ended.
~param NewPage the page that will be shown instead }
procedure TCommentOptionsWizard.HidePage(NewPage: TWizardPage);
var Generator :TCommentDoc; //the currently chosen generator
begin
//generator uses comments?
if TGeneratorManager(Data).TheGenerator is TCommentDoc then
begin
//get the current generator
Generator := TCommentDoc(TGeneratorManager(Data).TheGenerator);
//can be made more JavaDoc-compatible?
if assigned(FCheckBoxJavaDoc) then
if FCheckBoxJavaDoc.Checked then //should be made more JavaDoc-compatible?
begin
//set all corresponding options
SetStringOption(Generator.Extractor.GetOptions,
'SectionSeparator', '@');
SetStringOption(Generator.Extractor.GetOptions,
'SectionName_result', 'return');
if assigned(FCheckBoxException) and not FCheckBoxException.Checked then
SetStringOption(Generator.Extractor.GetOptions,
'SectionName_exception', 'throws')
else
SetStringOption(Generator.Extractor.GetOptions,
'SectionName_exception', 'exception');
SetStringOption(Generator.Evaluator.GetOptions,
'CommentCommandChar', '@');
end
else
begin
//set all corresponding options
SetStringOption(Generator.Extractor.GetOptions,
'CommentCommandChar', '~');
SetStringOption(Generator.Extractor.GetOptions,
'SectionName_result', 'result');
SetStringOption(Generator.Extractor.GetOptions,
'SectionName_exception', 'exception');
SetStringOption(Generator.Evaluator.GetOptions,
'CommentCommandChar', '~');
end;
//can use name of parameters to document them directly?
if assigned(FCheckBoxParamNamesSections) then
SetBooleanOption(Generator.GetOptions, 'ParamNamesAsSections',
FCheckBoxParamNamesSections.Checked); //set the option
end; //if Generator is TCommentDoc
FCheckBoxJavaDoc := nil; //controls will be removed
FCheckBoxException := nil;
FCheckBoxParamNamesSections := nil;
inherited HidePage(NewPage); //hide the page
end;
{ * * * *** * * * *** TUseRawHTMLWizard *** * * * *** * * * }
{Creates the page and initializes its attributes.
~param Form the form to show the page of the wizard on
~param Parent the parent to show the components of the page on
~param Data custom data for the wizard
~param PreviousPage the previous page of this page (to go back to) }
constructor TUseRawHTMLWizard.Create(Form: TForm; Parent: TWinControl;
Data: TObject;
PreviousPage: TWizardPage);
begin
inherited Create(Form, Parent, Data, PreviousPage); //create the object
FCaption := 'Comments in raw HTML?';
FHelpContext := 31106;
Exclude(FButtonsEnabled, wbNext); //end of options
end;
{Called when the page should be shown.
~param PreviousPage the previously shown page or nil }
procedure TUseRawHTMLWizard.ShowPage(PreviousPage: TWizardPage);
var Generator :TCommentDoc; //the currently chosen generator
Value :Boolean; //value of option
begin
inherited ShowPage(PreviousPage); //start the page
//generator uses comments and HTML format?
if CheckHTMLFormat(TGeneratorManager(Data).TheGenerator) then
begin
//get the current generator
Generator := TCommentDoc(TGeneratorManager(Data).TheGenerator);
//can copy raw HTML code from the comments in the documentation?
if GetBooleanOption(Generator.GetOptions, 'DontQuoteSpecialCharacters',
Value) then
begin
//show option to select whether the raw HTML codes should not be encoded
ShowText('If your source code is commented with HTML tags and you only want to generate the documentation in one of the HTML output formats, you can select here to just pass the HTML code through to the documentation instead of encoding it.');
FCheckBoxUseRawHTML := AddCheckBox('&Pass comments on as raw HTML code?',
Value);
end
else
assert(False);
end; //if CheckHTMLFormat(..)
end;
{Called when the page should no longer be shown, but not when the wizard is
ended.
~param NewPage the page that will be shown instead }
procedure TUseRawHTMLWizard.HidePage(NewPage: TWizardPage);
var Generator :TCommentDoc; //the currently chosen generator
begin
//generator uses comments and HTML format?
if CheckHTMLFormat(TGeneratorManager(Data).TheGenerator) then
begin
//get the current generator
Generator := TCommentDoc(TGeneratorManager(Data).TheGenerator);
//can copy raw HTML code from the comments in the documentation?
if assigned(FCheckBoxUseRawHTML) then
SetBooleanOption(Generator.GetOptions, 'DontQuoteSpecialCharacters',
FCheckBoxUseRawHTML.Checked); //set the option
end;
FCheckBoxUseRawHTML := nil; //controls will be removed
inherited HidePage(NewPage); //hide the page
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -