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

📄 uoldguihelpdata.pas

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

Copyright (C) 2004-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 UOldGUIHelpData;

{Contains the class ~[linkClass TOldGUIHelpData] for all needed data to
 generate help on a GUI - a Graphical User Interface. That input method is used
 in Delphi programs in most cases. }

interface

uses Windows, Classes,
     UGenerationMessages, UMakeDoc,
     UGUIHelpData;


type


   { * * *  ***  * * *  ***   TOldGUIHelpData   ***  * * *  ***  * * *  }

  {Does not only contain the parsed data of the log files for the GUI, but also
   the comments as the documentation of the GUI from the accompanying .txt
   files. The comments are hold as simple texts with formatting commands inside
   them.
  ~deprecated This kind of saving comments as strings is deprecated and will be
              replaced with a ~[linkUnit UICNodes COM] - Comment Object Model.
  }
  TOldGUIHelpData = class(TPureGUIHelpData)
  private
    //title of the page to show (and sort) by
    FTitle: String;


    //contains all defined aliases of components to other components to share
    //their documentation
    FAliases: TStringList;

    //list of the manually defined links on the image of the form;
    //the string is the link, the object is the position (type PRect)
    FManualLinks: TStringList;

    //the default comment for not documented components
    FDefaultComment: String;
    //the topic of the default comment for not documented components
    FDefaultCommentTopic: String;

    //a preface to use when generating the documentation
    FPreface: String;
    //an epilogue to use when generating the documentation
    FEpilogue: String;

    //the names of the documented components
    FCommentNames: TStringList;
    //the documentations of the documented components
    FCommentComments: TStringList;
    //the topics of the documentations of the documented components
    FCommentCommentTopics: TStringList;



    //Returns the title or, if no title is defined, the base name of the file.
    function GetTitleOrBaseName: String;

  public
    //Creates the object and parses the log file.
    constructor Create(const LogFileName: String;
                       MessageLogger: TMakeDoc;
                       MessageID: TMessageID; MessageNumber: TMessageNumber);
    //Frees the parsed data and the object.
    destructor Destroy; override;


    //Adds a manual link to the data.
    function AddManualLink(const Position, Link: String): Boolean;





    property Title: String read FTitle write FTitle;
    property TitleOrBaseName: String read GetTitleOrBaseName;





    property Aliases: TStringList read FAliases;

    property ManualLinks: TStringList read FManualLinks;

    property DefaultComment: String read FDefaultComment write FDefaultComment;
    property DefaultCommentTopic: String read FDefaultCommentTopic
                                         write FDefaultCommentTopic;

    property Preface: String read FPreface write FPreface;
    property Epilogue: String read FEpilogue write FEpilogue;

    property CommentNames: TStringList read FCommentNames;
    property CommentComments: TStringList read FCommentComments;
    property CommentCommentTopics: TStringList read FCommentCommentTopics;
  end;



implementation

uses SysUtils;







   { * * *  ***  * * *  ***   TOldGUIHelpData   ***  * * *  ***  * * *  }


{Creates the object and parses the log file.
~param LogFileName   the name of the log file to parse
~param MessageLogger the generator to log all messages to
~param MessageID     the ID of the messages to use when they are logged
~param MessageNumber the number of the message to use when they are logged }
constructor TOldGUIHelpData.Create(const LogFileName: String;
                                   MessageLogger: TMakeDoc;
                                   MessageID: TMessageID;
                                   MessageNumber: TMessageNumber);
begin
 //create the object and parse the log file
 inherited Create(LogFileName, MessageLogger, MessageID, MessageNumber);

 FAliases := TStringList.Create;                 //create all needed lists
 FManualLinks := TStringList.Create;
 FCommentNames := TStringList.Create;
 FCommentComments := TStringList.Create;
 FCommentCommentTopics := TStringList.Create;
end;


{Frees the parsed data and the object.}
destructor TOldGUIHelpData.Destroy;
var        i              :Integer;              //counter through lists
           Rect           :PRect;                //each position
begin
 FCommentComments.Free;                          //free all lists
 FCommentCommentTopics.Free;
 FCommentNames.Free;

 for i := 0 to FManualLinks.Count - 1 do         //free all positions of links
  begin
   Rect := PRect(FManualLinks.Objects[i]);         //get position
   Dispose(Rect);                                  //free it
  end;
 FManualLinks.Free;

 FAliases.Free;

 inherited Destroy;                              //free the object
end;












{Returns the title or, if no title is defined, the base name of the file.
~result the title or the base name of the data }
function TOldGUIHelpData.GetTitleOrBaseName: String;
begin
 if Title <> '' then                //title not empty?
  Result := FTitle                    //return the title
 else
  Result := BaseName;                 //return the base name
end;







{Adds a manual link to the image.
~param Position the position of the link on the image
~param Link     the link to link to
~result whether the position is valid }
function TOldGUIHelpData.AddManualLink(const Position, Link: String): Boolean;
var      Rect        :TRect;       //position of the link
         Pointer     :PRect;       //new position to save it
begin
 Result := ParseRectString(Position, Rect);   //parse position
 if Result then                               //position valid?
  begin                                         //create position
   New(Pointer);
   try
     Pointer^ := Rect;                          //assign the position
     FManualLinks.AddObject(Link, TObject(Pointer)); //add link and position
   except
     Dispose(Pointer);
     raise;
   end;
  end;
end;


end.

⌨️ 快捷键说明

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