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

📄 uwinhelpdoc.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 PAS
📖 第 1 页 / 共 5 页
字号:
   //return the format for including the image
   Result := Result + '\{bmct ' + IdentPortabilityFileName[p] + '.bmp\}';
end;




















{Gets the links to the generated files by ~[link WriteFileTreeFiles].
~result a text including links to the generated files }
function TWinHelpDoc.GetFileListFileLinks: String;
begin
 if GenerateXFigFiles then            //Xfig files have been generated?
  //generate a link to the Xfig file
  Result := '\par\qc{\uldb ' + Localize(dtDocumentationLinkXFigFiles) +
            '}{\v !ExecFile("http://www.xfig.org/","",SW_SHOW,"HTTPLinkError")}: {\uldb ' +
            FFileTreeFileBaseName + '.fig}{\v !ExecFile("' +
            FFileTreeFileBaseName + '.fig","",SW_SHOW,"XFigLinkError")}\ql'
 else
  Result := '';

 if GenerateWMFFiles then             //WMF files have been generated?
  //generate a link to the WMF file
  Result := Result + '\line\qc ' + Localize(dtDocumentationLinkWMFFiles) +
                     ': {\uldb ' + FFileTreeFileBaseName +
                     '.wmf}{\v !ExecFile("' + FFileTreeFileBaseName +
                     '.wmf","",SW_SHOW,"WMFLinkError")}\ql';
end;

{Writes the list of files.
~param Text the text (by ~[link GetFileListText]) of the list of files }
procedure TWinHelpDoc.WriteFileList(const Text: String);
var       rk         :TRecordKind;   //counter through all kinds of record-likes
begin
 WriteLn(FContentFile, '2 ', DocumentationTexts[dtDocumentationLinkFiles].T,
                       '=FileList');

 //create the page for the list of the files; start its header
 WritePageHeader(Localize(dtDocumentationFilesListTopic), 'FileList',
                 Localize(dtKeyWordListFiles));
 //generate lists of all kinds of record-like types
 for rk := Low(rk) to High(rk) do
  WriteLn(FRTFFile, '{\uldb ', Localize(Plurals[rk]), '}{\v ',
                    DescFilePreFix[rk], 'List}   ');
 WriteLn(FRTFFile, '{\uldb ' + Localize(dtDocumentationLinkFiles) +
                   '}{\v FileList}');             //and this page itself
 WritePageHeaderEnd;                              //end the header

 WriteLn(FRTFFile, Text);                         //write the list of the files

 WritePageFooter;                                 //end the page
end;

















{Writes a linked list of the given kind of identifiers in the file.
~param AFile     the file whose identifiers to write
~param FileTopic the internal name of the documentation of the file; also the
                 base name of all created lists
~param WriteType the kind of identifiers to write
~result a link to the list of the identifiers if it is not empty }
function TWinHelpDoc.WriteVarConstFuncTypesList(AFile: TPascalFile;
                                                const FileTopic: String;
                                                WriteType: TWriteKind): String;

          //header titles of the lists of different kinds of identifiers in
          //files
const     DeclName: array[TWriteKind] of TDocumentationTexts =
                    (dtDocumentationFileDeclarationsHeaderVar,
                     dtDocumentationFileDeclarationsHeaderThreadVar,
                     dtDocumentationFileDeclarationsHeaderConst,
                     dtDocumentationFileDeclarationsHeaderResourceString,
                     dtDocumentationFileDeclarationsHeaderFunctions,
                     dtDocumentationFileDeclarationsHeaderSimpleTypes);
          //the classes of the lists of different kinds of identifiers in files
          DeclTypeClass: array[TWriteKind] of TIdentifierClass =
             (TVariable,       TVariable, TConstant,
              TResourceString, TFunction, TType);
          //the prefixes of the internal name of the pages of the lists of
          //the different kinds of identifiers in files
          TopicDeclName: array[TWriteKind] of String =
             ('Variables',       'ThreadVariables', 'Constants',
              'ResourceStrings', 'Functions',       'Types');


var      List       :TIdentifierList;     //list of the identifiers in the file

 {Gets the list of the kind of identifiers in the file. }
 procedure GetList;
 var       AClass :TIdentifierClass;      //class the identifiers have to be
           i      :Integer;               //counter through all identifiers
           Ident  :TIdentifier;           //each identifier
 begin
  AClass := DeclTypeClass[WriteType];     //get class of identifiers
  for i := 0 to AFile.Idents.Count - 1 do //for each identifier
   begin
    Ident := AFile.Idents[i];               //get it
    if (((Ident is AClass) and              //is of searched class and kind?
         (not (WriteType in [wkVar, wkThreadVar]) or
          (TVariable(Ident).IsThreadVar = (WriteType = wkThreadVar)))) or
        ((WriteType = wkConst) and (Ident is TEnumTypeItem))) and
       not DoNotDocumentIdentifier(Ident) then //documented?
     List.AddIdent(Ident);                       //add it to the list
   end;
 end;

 {Creates the documentation of all identifiers in the list. }
 procedure CreateDocumentation;
 var       i           :Integer;          //counter through all identifiers
           Ident       :TIdentifier;      //each identifier
           Comment     :String;           //the comment of the identifier
           Header      :String;           //additional header links
 begin
  for i := 0 to List.Count - 1 do         //for each identifier
   begin
    Ident := List[i];                       //get it

    if not (Ident is TRecordType) then      //if not a record-like type
     begin
      CurrentHelpContext := 0;                //no help context defined so far
      SetCommentIdent(Ident, AFile);   //set identifier for comment
      Comment := GetIdentComment(Header);     //get its comment


      WriteLn(FContentFile, '4 ', Ident.Name, '=', GetURIOf(Ident));

      //start new page for the identifier
      WritePageHeader(AFile.InternalFileName + '.' + Ident.Name,
                      GetURIOf(Ident),
                      AFile.InternalFileName + ', ' + Ident.Name + '; ' +
                      Ident.Name);
      //write links to the file and to all identifiers of the kind and
      //additional header links
      WriteLn(FRTFFile, FileTypeNames[AFile.FileType], ' ',
                        GetFileNameLink(AFile),
                        '   {\uldb ', Localize(DeclName[WriteType]), '}{\v ',
                        FileTopic, '.', TopicDeclName[WriteType], '>',
                        HelpWindowNames[hwClassSub], '}   ', Header);
      WritePageHeaderEnd;                     //end the header

      //write declaration of the identifier
      Write(FRTFFile, '\par ');
      Write(FRTFFile, GetScope(Ident.Scope)); //write scope of the identifier
      if (WriteType = wkSimpleType) {and not (Ident is TRecordType)} then
       Write(FRTFFile, Ident.Name, ' = ');
      WriteLn(FRTFFile, Ident.GetDescriptionString(Self, Ident), '\par');

      WriteLn(FRTFFile, Comment);             //write its documentation

      //check, if a help context was defined for this identifier
      CheckHelpContext(GetURIOf(Ident));

      WritePageFooter;                        //and the page
     end; //if not (Ident is TRecordType)
   end; //for i := 0 to List.Count - 1
 end;

 {Creates the linked list of identifiers in the file. }
 procedure CreateList;
 var       i         :Integer;             //counter through the list
           Ident     :TIdentifier;         //each identifier
           Port      :TIdentPortabilities; //its portability issues
 begin
  //start page of the list of identifiers of the kind
  WritePageHeader(Localize(DeclName[WriteType]) +
                  Localize(dtDocumentationFileDeclarationsHeaderMiddle) +
                  FileTypeNames[AFile.FileType] + ' ' + AFile.InternalFileName,
                  FileTopic + '.' + TopicDeclName[WriteType],
                  AFile.InternalFileName + ', ' + TopicDeclName[WriteType],
                  hwClassSub);
  //write link to the file
  Write(FRTFFile, FileTypeNames[AFile.FileType], ' {\uldb ',
                  AFile.InternalFileName, '}{\v ', FileTopic, '>',
                  HelpWindowNames[hwMain], '}');
  WriteLn(FRTFFile, ' {\ul ' + Localize(dtDocumentationLinkLegend) +
                    '}{\v legend.files}');  //and to the legend
  WritePageHeaderEnd;                      //end the header


  WriteLn(FRTFFile, '{\b ', Localize(DeclName[WriteType]),  //write the title
                    Localize(dtDocumentationFileDeclarationsHeaderMiddle) +
                    FileTypeNames[AFile.FileType] + ' ' +
                    AFile.InternalFileName, '}\par\li360');

  for i := 0 to List.Count - 1 do          //for each identifier in the list
   begin
    Ident := List[i];                        //get it

    Write(FRTFFile, GetScope(Ident.Scope));  //write its scope

    Port := Ident.Portability;
    if FDeprecatedList.IsIn(Ident) then
     Include(Port, ipDeprecated);
    Write(FRTFFile, GetPortabilityIssues(Port)); //write its portability issues

//  if WriteType = wkFunc then
//   Write(FRTFFile, ReservedWord(FuncNames[TFunction(Ident).FuncKind]), ' ');

    //write linked name of the identifier
    WriteLn(FRTFFile, GetIdentNameLink(Ident), '\line');
   end;

  WriteLn(FRTFFile, '\par\li');            //end the page
  WritePageFooter;
 end;


begin
 List := TIdentifierList.Create;           //create the list of the identifiers
 try
   GetList;                                //search identifiers of that kind

   if not List.IsEmpty then                //some identifiers found?
    begin
     List.Sort;                              //sort the list

     WriteLn(FContentFile, '3 ', DocumentationTexts[DeclName[WriteType]].T);
     CreateDocumentation;          //generate documentation of all identifiers

     CreateList;                             //write list of identifiers

     //include link to the list in the header of the file
     Result := '{\uldb ' + Localize(DeclName[WriteType]) + '}{\v ' +
               FileTopic + '.' + TopicDeclName[WriteType] + '>' +
               HelpWindowNames[hwClassSub] + '}';
    end
   else
    Result := '';
 finally
  List.RemoveAll(False);             //free the list (without the identifiers)
  List.Free;
 end;
end;



{Writes a list of record-like types of that kind in the file.
~param AFile     the file whose identifiers to write
~param FileTopic the internal name of the documentation of the file; also the
                 base name of all created lists
~param Kind      the kind of record-like types to write a list of
~result a link to the list if it is not empty }
function TWinHelpDoc.WriteRecordTypeList(AFile: TPascalFile;
                                         const FileTopic: String;
                                         Kind: TRecordKind): String;

        //the postfixes of the internal name of the pages of the lists of
        //the different kinds of record-like types
const   TopicName: array[TRecordKind] of String =
        ('Records', 'Objects', 'Classes', 'Interfaces', 'DispatchInterfaces');

var      List       :TIdentifierList;      //list of the record-like types
         i          :Integer;              //counter through the identifiers
         Ident      :TIdentifier;          //the identifiers
         Port       :TIdentPortabilities;  //portability issues
begin
 List := TIdentifierList.Create;           //create list of record-like types
 try
   for i := 0 to AFile.Idents.Count - 1 do //for each identifier in the file
    begin
     Ident := AFile.Idents[i];             //get it
     if (Ident is TRecordType) and (TRecordType(Ident).Kind = Kind) and
        not DoNotDocumentIdentifier(Ident) then //documented?
      List.AddIdent(Ident);                       //add it, if a matching type
    end;

   if not List.IsEmpty then                //some identifiers found?
    begin
     //create new page as a list of the identifiers
     WritePageHeader(Localize(Plurals[Kind]) +
                     Localize(dtDocumentationFileDeclarationsHeaderMiddle) +
                     FileTypeNames[AFile.FileType] +
                     ' ' + AFile.InternalFileName,
                     FileTopic + '.' + TopicName[Kind],
                     AFile.InternalFileName + ', ' + Localize(Plurals[Kind]),
                     hwClassSub);
     //add a link to the file and a legend to its header
     Write(FRTFFile, '{\uldb ', FileTypeNames[AFile.FileType] + ' ' +
                     AFile.InternalFileName, '}{\v ', FileTopic, '>',
                     HelpWindowNames[hwMain], '}');
     WriteLn(FRTFFile, ' {\ul ' + Localize(dtDocumentationLinkLegend) +
                       '}{\v legend.recordlike}');
     WritePageHeaderEnd;                     //end header of the page


     //write title of the list
     WriteLn(FRTFFile, '{\b ', Localize(Plurals[Kind]),
                       Localize(dtDocumentationFileDeclarationsHeaderMiddle2),
                       FileTypeNames[AFile.FileType], ' ',
                       AFile.InternalFileName, '}\par\li360');

     List.Sort;                              //sort the list
     for i := 0 to List.Count - 1 do         //for each record-like type
      begin
       Ident := List[i];                       //get it

       Write(FRTFFile, GetScope(Ident.Scope)); //write its scope

       Port := Ident.Portability;
       if FDeprecatedList.IsIn(Ident) then     //write its portability issue
        Include(Port, ipDeprecated);
       Write(FRTFFile, GetPortabilityIssues(Port));

       //write link to the identifier
       WriteLn(FRTFFile, GetIdentNameLink(Ident), '\line');
      end;

     WriteLn(FRTFFile, '\par\li');           //end the list and the page
     WritePageFooter;


     //include a link to this list in the file-header (indirect)
     Result := '{\uldb ' + Localize(Plurals[Kind]) + '}{\v ' + File

⌨️ 快捷键说明

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