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

📄 uicwinhelpdoc.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 PAS
📖 第 1 页 / 共 5 页
字号:
                                 FGenerator.ExtraWinHelpFilesFor) or
                                (FGenerator.InNamedPart and
                                 (FGenerator.CurrentPart in
                                  FGenerator.ExtraWinHelpFilesFor))));
 FRTFFile.WriteCharacter('}');
 FLastBreak := lbText;

 Localize(dtUnitUsedByAliasPre);                 //add information of alias
 PascalCode(Alias, icpcIdentifier);
 Localize(dtUnitUsedByAliasPost);
end;


{Called for each link whose target could not be found.
~param Node          the node with the invalid/unknown link target
~param VisitChildren out: whether the children of the node (the link text)
                     should also be visited; default is True }
procedure TICWinHelpVisitor.InvalidLink(Node: TICNInvalidLink;
                                        var VisitChildren: Boolean);
begin
 VisitChildren := False;                 //will be visited manually
 Node.VisitChildren(Self);               //visit the text

 WriteText(' @ ');                       //write separator
 WriteText(Node.LinkText);               //write text of the unknown target
end;

{Called for each link to a target outside of the generated documentation
 (either in the internet or in the local file system).
~param Node          the node of a link to an external target
~param VisitChildren out: whether the children of the node (the link text)
                     should also be visited; default is True }
procedure TICWinHelpVisitor.LinkExtern(Node: TICNLinkExtern;
                                       var VisitChildren: Boolean);
begin
 FRTFFile.WriteString('{\cf2{\uldb ');      //start the link in a special color
 FLastBreak := lbText;                      //normal text is written

 VisitChildren := False;                    //will be visited manually
 if Node.NoChildren then                    //no text of the link specified?
  WriteText(Node.LinkText)                    //write the text of the target
 else
  Node.VisitChildren(Self);                   //write the text

 //write the makro to open the external resource
 FRTFFile.WriteString('}{\v *!ExecFile("');
 FRTFFile.WriteString(Node.URI);
 FRTFFile.WriteString('","",SW_SHOW,"HTTPLinkError")}}');

 FLastBreak := lbText;                      //normal text has been written
end;


{Called for each link to a page of the additional user documentation.
~param Node          the node of a link to a page of user documentation
~param VisitChildren out: whether the children of the node (the link text)
                     should also be visited; default is True }
procedure TICWinHelpVisitor.LinkPage(Node: TICNLinkPage;
                                     var VisitChildren: Boolean);
begin
 FRTFFile.WriteString('{\uldb ');           //start the link
 FLastBreak := lbText;                      //normal text is written

 VisitChildren := False;                    //will be visited manually
 if Node.NoChildren then                    //no text of the link specified?
  WriteText(Node.LinkText)                    //write the text of the target
 else
  Node.VisitChildren(Self);                   //write the text

 FRTFFile.WriteString('}{\v ');             //end the link and write the target
 FRTFFile.WriteString(FGenerator.GetPageURI(Node.PageIndex));
 FRTFFile.WriteCharacter('>');
 FRTFFile.WriteString(HelpWindowNames[hwMain]);
 if Node.PageIndex = -1 then                //index of documentation?
  FGenerator.WriteMainHLPFileLinkIf(FGenerator.InNamedPart and
                                    (FGenerator.CurrentPart in
                                     FGenerator.ExtraWinHelpFilesFor))
 else
  FGenerator.WriteHLPFileLinkIf(ewhfUserDoc,
                                (not FGenerator.InNamedPart or
                                 (FGenerator.CurrentPart <> ewhfUserDoc)) and
                                ((ewhfUserDoc in
                                  FGenerator.ExtraWinHelpFilesFor) or
                                 (FGenerator.InNamedPart and
                                  (FGenerator.CurrentPart in
                                   FGenerator.ExtraWinHelpFilesFor))));
 FRTFFile.WriteCharacter('}');

 FLastBreak := lbText;                      //normal text has been written
end;


{Called for each link to a help topic in the documentation as a help on a GUI.
~param Node          the node of a link to a help topic
~param VisitChildren out: whether the children of the node (the link text)
                     should also be visited; default is True }
procedure TICWinHelpVisitor.LinkGUI(Node: TICNLinkGUI;
                                    var VisitChildren: Boolean);
begin
 FRTFFile.WriteString('{\uldb ');           //start the link
 FLastBreak := lbText;                      //normal text is written

 VisitChildren := False;                    //will be visited manually
 if Node.NoChildren then                    //no text of the link specified?
  WriteText(Node.LinkText)                    //write the text of the target
 else
  Node.VisitChildren(Self);                   //write the text

 FRTFFile.WriteString('}{\v ');             //end the link and write the target
 FRTFFile.WriteString(FGenerator.GetGUIHelpURIByIndex(Node.GUIIndex,
                                                      Node.CommentIndex));
 FRTFFile.WriteCharacter('>');
 FRTFFile.WriteString(HelpWindowNames[hwMain]);
 FGenerator.WriteMainHLPFileLinkIf(FGenerator.InNamedPart and
                                   (FGenerator.CurrentPart in
                                    FGenerator.ExtraWinHelpFilesFor));
 FRTFFile.WriteCharacter('}');

 FLastBreak := lbText;                      //normal text has been written
end;




{Called for each node representing an image.
~param Data the node representing the options to include the image }
procedure TICWinHelpVisitor.Image(Data: TICNImage);
var       Format           :String;    //the format to insert the image
begin
 //prepare image to be shown in the documentation
 Format := FGenerator.WriteImage(Data.CharFormat, Data.JPEGFormat,
                                 Data.Resolution, nil, Data.FileName,
                                 Data.ImageLinks, Data.AlternativeText);

 FRTFFile.WriteString(Format);         //let the image be included

 if Data.CharFormat then               //should be included in the text?
  FLastBreak := lbText                   //was normal text
 else
  FLastBreak := lbParagraph;             //was on its own paragraph
end;


{Called for each node representing a short token of pascal code.
~param Code the text of the code token
~param Kind what kind of code the token is }
procedure TICWinHelpVisitor.PascalCode(const Code: String;
                                       Kind: TICPascalCode);
begin
 case Kind of                        //start the format
   icpcReservedWord: FRTFFile.WriteString('{\b '); 
   icpcString:       FRTFFile.WriteString('{\cf3 ');
   icpcIdentifier:   ;
 else
  assert(False);
 end;
 FLastBreak := lbText;               //text will be written
 WriteText(Code);                    //write the code
 if Kind <> icpcIdentifier then      //if format has been started
  begin
   FRTFFile.WriteCharacter('}');       //end the format
   FLastBreak := lbText;               //text has been written
  end;
end;







{Called for each node representing a list. Each child node is an item in the
 list.
~param Node          the node representing a list
~param VisitChildren out: whether the children of the node (the items)
                     should also be visited; default is True }
procedure TICWinHelpVisitor.List(Node: TICNList; var VisitChildren: Boolean);
var       i                :Integer;    //counter through all items of the list
begin
 if Node.HasChildren then               //list not empty?
  begin
   if Node.ItemIndentation <> iciiNone then  //items are indented?
    AddIndentation(Node.ItemIndentation = iciiSmall,  //add the indentation
                   Node.ItemMarker <> iclimNone);

   VisitChildren := False;                //visit the items manually
   for i := 0 to Node.ChildCount - 1 do   //for each item of the list
    begin
     if i > 0 then                          //not the first item?
      begin
       EndParagraph(True);                    //end the previous item and add
       if Node.ItemSeparation = icisLine then //vertical space between items
        begin
         FRTFFile.WriteString('\line');
         FRTFFile.WriteString(FGenerator.NewLine);
        end
       else
        if Node.ItemSeparation = icisParagraph then
         begin
          FRTFFile.WriteString('\par');
          FRTFFile.WriteString(FGenerator.NewLine);
         end;
      end;

     if Node.ItemMarker <> iclimNone then   //a marker for each item?
      begin
       if Node.ItemMarker = iclimBullet then    //use bullet as the marker?
        FRTFFile.WriteString('{\f2\''B7}')        //write the bullet
       else                                       //or the number of the item
        WriteText(GetEnumerationValue(i + 1, Node.ItemEnumeration));
       if Node.ItemIndentation <> iciiNone then //item is indented?
        begin
         FRTFFile.WriteString('\tab');            //skip marker
         FRTFFile.WriteString(FGenerator.NewLine);
        end
       else
        FRTFFile.WriteCharacter(' ');             //add a space after marker
       FLastBreak := lbText;                    //text has been written
      end;

     Node.Children[i].Visit(Self);          //write the item
    end; //for i := 0 to Node.ChildCount - 1

   if Node.ItemIndentation <> iciiNone then //list is indented?
    EndIndentation(Node.ItemIndentation = iciiSmall,  //end the indentation
                   Node.ItemMarker <> iclimNone);
  end; //if Node.HasChildren
end;


{Called for each node representing a dictionary. The child nodes are used in
 pairs, the first always specifies the term to be described while the second
 contains the description.
~param Node          the node representing a dictionary
~param VisitChildren out: whether the children of the node (the terms and
                     descriptions) should also be visited; default is True }
procedure TICWinHelpVisitor.Dictionary(Node: TICNDictionary;
                                       var VisitChildren: Boolean);
var       ItemIndent       :TICItemIndentation; //indentation of the items
          DescrIndent      :TICItemIndentation; //indentation of descriptions
          i                :Integer;            //counter through all items
begin
 if Node.HasChildren then                    //dictionary is not empty?
  begin
   assert(not Odd(Node.ChildCount));

   ItemIndent := Node.ItemIndentation;         //get the indentations
   DescrIndent := Node.DescriptionIndentation;

//   if ItemIndent = iciiNone then
//    EndParagraph;

   //same level of indentation for the descriptions as for the items?
   if (ItemIndent = DescrIndent) and (ItemIndent <> iciiNone) then
    begin
     AddIndentation(ItemIndent = iciiSmall);     //add a static indentation
     ItemIndent := iciiNone;                     //and none for the items
     DescrIndent := iciiNone;
    end;

   VisitChildren := False;                     //visit the items manually
   for i := 0 to Node.ChildCount div 2 - 1 do  //visit each item as a pair
    begin
     if i > 0 then                               //not the first item?
      begin
       if DescrIndent <> iciiNone then             //description indented?
        EndIndentation(DescrIndent = iciiSmall)      //end the indentation
       else
        if ItemIndent = iciiNone then                //items not indented?
         NewLineSimple;                                //end the line

       if Node.WholeItemSeparation = icisLine then //add vertical spacing
        NewLineSimple
       else
        if Node.WholeItemSeparation = icisParagraph then
         NewParagraphSimple;
      end;


     if ItemIndent <> iciiNone then              //items are indented?
      AddIndentation(ItemIndent = iciiSmall);      //add the indentation

     Node.Children[i * 2].Visit(Self);           //show term to be described

     if ItemIndent <> iciiNone then              //items are indented?
      EndIndentation(ItemIndent = iciiSmall)       //end the indentation
     else
      if DescrIndent = iciiNone then               //no indentation at all?
       NewLineSimple;                                //end the line


     if Node.ItemDescriptionSeparation = icisLine then //add vertical spacing
      NewLineSimple
     else
      if Node.ItemDescriptionSeparation = icisParagraph then
       NewParagraphSimple;

     if DescrIndent <> iciiNone then             //desription is indented?
      AddIndentation(DescrIndent = iciiSmall);     //add the indentation

     Node.Children[i * 2 + 1].Visit(Self);       //show description of the term
    end; //for i := 0 to Node.ChildCount div 2 - 1

   if DescrIndent <> iciiNone then             //description is indented?
    EndIndentation(DescrIndent = iciiSmall);     //end the indentation

   //same level of indentation for the descriptions as for the items?
   if (Node.ItemIndentation = Node.DescriptionIndentation) and
      (Node.ItemIndentation <> iciiNone) then
    EndIndentation(Node.ItemIndentation = iciiSmall); //end static indentation
  end; //if Node.HasChildren
end;


{Called for each node representing a topic in the documentation of identifiers
 or files as derived from its comment.
~param Node          the node representing a topic
~param VisitChildren out: whether the children of the node (the content)
                     should also be visited; default is True }
procedure TICWinHelpVisitor.TopicComment(Node: TICNTopicForComment;
                                         var VisitChildren: Boolean);
var       i                :Integer;     //counter through child nodes
begin
 case Node.Topic of                 

⌨️ 快捷键说明

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