📄 uicpdfdoc.pas
字号:
//(raises the size by about two third)
FDisablePDFCompression: Boolean;
//the name of the PDF File to be generated
FPDFFileName: String;
//the color of string constants; default: clRed
FStringColor: TColor;
//to which level the sup-topics should be in the table of contents
FTableOfContentsDetailLevel: TTableOfContentsDetailLevel;
//whether images that are included in documentation should be displayed
//interpolated by the PDF viewers
FInterpolateImages: Boolean;
//maximum scale factor of images that are included in documentation
FMaxImageScale: Single;
//whether diagrams should be drawn directly via PDF commands instead of
//rendered as an image
FDiagramsDirectlyAsPDF: Boolean;
//the index of the current image
FImageIndex: Integer;
//absolute unique paths of all images in the PDF file; the objects is the
//internal index; this is just an optimization to not copy an image twice
//into the PDF file
FImagePaths: TStringList;
//the entry of the table of contents in the outline
FTableOfContentsOutlineEntry: POutlineEntry;
//Adds the links of images.
procedure AddImageLinks(const ImageName: String;
ImageLinks: TImageLinkList;
Width, Height, X, Y: TPDFValue);
protected
//Writes the node of the ~[linkUnit UICNodes COM] into the file.
procedure WriteNode(Node: TICNode; EndLine: Boolean = True);
//Writes a link to a file.
procedure WriteFileNameLink(TheFile: TPascalFile);
//Writes a link to an identifier.
procedure WriteIdentNameLink(Ident: TIdentifier;
WriteFile: Boolean = False);
//Writes a link to a member of a record-like type.
procedure WriteRecordFieldNameLink(Ident: TIdentifier;
WriteRecord: Boolean = False);
//Writes the list of files.
procedure WriteFileList(Node: TICNode); override;
//Write the documentation about all identifiers of the given kind in the
//file.
procedure WriteVarConstFuncTypes(AFile: TPascalFile;
const FileTopic: String;
WriteType: TWriteKind);
//Writes the documentation about the file.
procedure WriteFileDocumentation(AFile: TPascalFile); override;
//Writes the hierarchy of the record-like types of the specified kind.
procedure WriteClassTree(Kind: TRecordKind; Node: TICNode); override;
//Writes the documentation of the members of a record-like type.
procedure WriteMembers(Kind: TMemberKind; Ident: TRecordType);
//Writes the documentation of the record-like type.
procedure WriteClassDocumentation(Ident: TRecordType); override;
//Writes the lists of all exported identifiers.
function WriteExportsList: Boolean;
//Write a list of all long functions.
function WriteLongFunctionList: Boolean;
//Writes the splitted up list of identifiers and files into the
//documentation.
function WriteListOfIdentifiersAndFiles(const TopicName: String;
DescriptionText,
KeyWordListText: TDocumentationTexts;
Idents, Classes: TIdentifierList;
Files: TIdentifierFileList): Boolean;
override;
//Generates an index about all identifiers and files.
procedure DoGenerateIndex(List: TIdentifierFileList;
const CharIndices: array of TIndexCharIndex);
override;
//Writes the current page of the user documentation.
procedure CreateUserDocPage; override;
//Generates the help on one data set of a GUI.
procedure GenerateGUIHelpOnData(Data: TICGUIHelpData;
AddContentTo: TICNCompound); override;
//Writes the legend of the special symbols/icons used in the documentation.
procedure WriteLegend;
//Writes the title page of the document.
procedure WriteTitlePage;
//Writes the table of contents.
procedure WriteTableOfContents;
//Begins the documentation.
procedure StartDocumentation;
//Writes the end of the documentation.
procedure EndOfDocumentation;
//Ends the documentation.
procedure EndDocumentation;
//Postprocesses the generated documentation.
procedure PostProcess;
//Generate the help on a GUI.
function DoGenerateGUIHelp: Boolean; override;
//Generate only the user documentation.
function DoGenerateOnlyUserDocumentation: Boolean; override;
//Process parsed data; generate some documentation about it.
function DoGenerateDocumentation: Boolean; override;
public
//Creates the generator object and its helper objects.
constructor Create; override;
//Destroys the generator object and its helper objects.
destructor Destroy; override;
//Returns a description of the documentation of the generator.
class function GetDescription: TGeneratorDescription; override;
//Returns the number of available options in generators of this class.
class function GetOptionCount: Cardinal; override;
//Gets a description of an option.
class procedure GetOptionDescription(Index: Cardinal;
var Desc: TOptionDescription);
override;
//Gets the value of an option.
function GetOption(Index: Cardinal): TOptionValue; override;
//Sets the value of an option.
procedure SetOption(Index: Cardinal; const Value: TOptionValue); override;
//Returns the capabilities of this class of the generators.
class function Capabilities: TGeneratorCapabilities; override;
//Writes the links to the generated files by ~[link WriteFileTreeFiles].
procedure WriteFileListFileLinks;
//Writes the links to the generated files by ~[link WriteClassesTreeFiles].
procedure WriteClassTreeFileLinks(Kind: TRecordKind);
//Adds an icon representing the scope to the current paragraph.
procedure AddScope(Scope: TScope);
//Adds the icons representing the portability issues to the paragraph.
procedure AddPortabilityIssues(Issues: TIdentPortabilities);
//Includes an image in the documentation.
function WriteImage(CharFormat, JPEGFormat: Boolean; Resolution: TPoint;
BMP: TBitmap; const FileName: String;
Links: TImageLinkList;
const AlternativeText: String): String; override;
//Resets the attributes to ready the generator for a new generation.
procedure ResetForNewGeneration; override;
property StringColor: TColor read FStringColor;
property MaxImageScale: Single read FMaxImageScale;
property DiagramsDirectlyAsPDF: Boolean read FDiagramsDirectlyAsPDF;
end;
//some sizes of papers that can be used for the PDF file
const PaperFormats: array[0..66] of record
//name of the paper format
Name: String;
//size of the paper in mm
Height, Width: Integer;
end =
((Name: 'Customized'; Height: 0; Width: 0),
(Name: 'ISO A0'; Height: 1189; Width: 841),
(Name: 'ISO A1'; Height: 841; Width: 594),
(Name: 'ISO A2'; Height: 594; Width: 420),
(Name: 'ISO A3'; Height: 420; Width: 297),
(Name: 'ISO A4'; Height: 297; Width: 210),
(Name: 'ISO A5'; Height: 210; Width: 148),
(Name: 'ISO A6'; Height: 148; Width: 105),
(Name: 'ISO A7'; Height: 105; Width: 74),
(Name: 'ISO A8'; Height: 74; Width: 52),
(Name: 'ISO A9'; Height: 52; Width: 37),
(Name: 'ISO A10'; Height: 37; Width: 26),
(Name: 'ANSI A'; Height: 279; Width: 216),
(Name: 'ANSI B'; Height: 432; Width: 279),
(Name: 'ANSI C'; Height: 559; Width: 432),
(Name: 'ANSI D'; Height: 864; Width: 559),
(Name: 'ANSI E'; Height: 1118; Width: 864),
(Name: 'Invoice'; Height: 216; Width: 140),
(Name: 'Executive'; Height: 267; Width: 184),
(Name: 'Legal'; Height: 356; Width: 216),
(Name: 'Letter'; Height: 279; Width: 216),
(Name: 'Ledger'; Height: 432; Width: 279),
(Name: 'Tabloid'; Height: 432; Width: 279),
(Name: 'Broadsheet'; Height: 559; Width: 432),
(Name: 'ISO B0'; Height: 1414; Width: 1000),
(Name: 'ISO B1'; Height: 1000; Width: 707),
(Name: 'ISO B2'; Height: 707; Width: 500),
(Name: 'ISO B3'; Height: 500; Width: 353),
(Name: 'ISO B4'; Height: 353; Width: 250),
(Name: 'ISO B5'; Height: 250; Width: 176),
(Name: 'ISO B6'; Height: 176; Width: 125),
(Name: 'ISO B7'; Height: 125; Width: 88),
(Name: 'ISO B8'; Height: 88; Width: 62),
(Name: 'ISO B9'; Height: 62; Width: 44),
(Name: 'ISO B10'; Height: 44; Width: 31),
(Name: 'ISO C0'; Height: 1297; Width: 917),
(Name: 'ISO C1'; Height: 917; Width: 648),
(Name: 'ISO C2'; Height: 648; Width: 458),
(Name: 'ISO C3'; Height: 458; Width: 324),
(Name: 'ISO C4'; Height: 324; Width: 229),
(Name: 'ISO C5'; Height: 229; Width: 162),
(Name: 'ISO C6'; Height: 162; Width: 114),
(Name: 'ISO C7'; Height: 114; Width: 81),
(Name: 'ISO C8'; Height: 81; Width: 57),
(Name: 'ISO C9'; Height: 57; Width: 40),
(Name: 'ISO C10'; Height: 40; Width: 28),
(Name: 'JIS B0'; Height: 1456; Width: 1030),
(Name: 'JIS B1'; Height: 1030; Width: 728),
(Name: 'JIS B2'; Height: 728; Width: 515),
(Name: 'JIS B3'; Height: 515; Width: 364),
(Name: 'JIS B4'; Height: 364; Width: 257),
(Name: 'JIS B5'; Height: 257; Width: 182),
(Name: 'JIS B6'; Height: 182; Width: 128),
(Name: 'JIS B7'; Height: 128; Width: 91),
(Name: 'JIS B8'; Height: 91; Width: 64),
(Name: 'JIS B9'; Height: 64; Width: 45),
(Name: 'JIS B10'; Height: 45; Width: 32),
(Name: 'Shiroku 4'; Height: 379; Width: 264),
(Name: 'Shiroku 5'; Height: 262; Width: 189),
(Name: 'Shiroku 6'; Height: 188; Width: 127),
(Name: 'Kiku 4'; Height: 306; Width: 227),
(Name: 'Kiku 5'; Height: 227; Width: 151),
(Name: 'Waido AB'; Height: 257; Width: 210),
(Name: 'Kai 8'; Height: 370; Width: 260),
(Name: 'Kai 16'; Height: 260; Width: 185),
(Name: 'Kai 32'; Height: 185; Width: 130),
(Name: 'Kai 32 big'; Height: 203; Width: 140)
);
implementation
uses SysUtils,
{$IFNDEF NOJPEGSUPPORT}
{$IFNDEF LINUX}
jpeg,
{$ENDIF}
{$ENDIF}
{$IFNDEF NOPNGSUPPORT}
{$IFNDEF LINUX}
pngimage,
{$ENDIF}
{$ENDIF}
{$IFNDEF LINUX}
ShellAPI,
{$ENDIF}
General, UFilePaths,
UExtIdents,
UILComment,
UICDeclarationAssembler;
//format to create names of images from an integer value
const ImageNameFormat = 'Img_%d';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -