📄 uhtmlhelpdoc.pas
字号:
GetInheritedList(Ident, AllList, MemberKindClasses[Kind]);
Result := not AllList.IsEmpty;
if Result then //some members?
begin
//create file for documentation of member
CreateFile(F,
GetFileName(Ident) + '.' + KindLegend[Kind],
Localize(KindTitles[Kind]) +
Localize(dtDocumentationClassInheritedInMiddle2) +
RecordKindNames[Ident.Kind] + ' ' + Ident.Name,
Ident.Name + ', ' + Localize(KindTitles[Kind]));
try
//write header of the members
WriteLn(F, '<h1 class=member>',
Localize(KindTitles[Kind]),
Localize(dtDocumentationClassInheritedInMiddle2),
RecordKindNames[Ident.Kind], ' ', Ident.Name, ':</h1>');
WriteLn(F, GetIdentNameLink(Ident),
' <a href="', GetFileName(Ident, nil, True) +
'.' + KindLegend[Kind], '.Alpha.html">',
Localize(dtDocumentationClassesLinkMemberListAlphabetically),
'</a>');
WriteLn(F, '<hr>'); //end the header
WriteLn(F, '<ul>'); //start list
AllList.SortTo(Ident); //sort the list
LastRec := nil;
for i := 0 to AllList.Count - 1 do //for each inherited member
begin
Member := AllList[i]; //get it
if LastRec <> Member.MemberOf then //in a new class?
begin
if assigned(LastRec) then //not the first one?
begin
WriteLn(F, ' </ul>'); //end last list
WriteLn(F, ' </li>'); //end last entry
end;
LastRec := Member.MemberOf; //save this class
//write header for the new class
WriteLn(F, ' <li>', Localize(KindTitles[Kind]),
Localize(dtDocumentationClassInheritedInMiddle),
LastRec.Name, ':');
WriteLn(F, ' <ul>');
end;
WriteInheritedMember(Member, False); //write the member
end; //for i := 0 to AllList.Count - 1
WriteLn(F, ' </ul>');
WriteLn(F, ' </li>'); //end last entry
WriteLn(F, '</ul>'); //end whole list
finally
EndFile(F); //close the file
end;
//create file for documentation of member
CreateFile(F, GetFileName(Ident) + '.' + KindLegend[Kind] + '.Alpha',
Localize(KindTitles[Kind]) +
Localize(dtDocumentationClassInheritedInMiddle2) +
RecordKindNames[Ident.Kind] + ' ' + Ident.Name,
Ident.Name + ', ' + Localize(KindTitles[Kind]));
try
//write header of the members
WriteLn(F, '<h1 class=member>',
Localize(KindTitles[Kind]),
Localize(dtDocumentationClassInheritedInMiddle2),
RecordKindNames[Ident.Kind], ' ', Ident.Name,
Localize(dtDocumentationClassMembersByNamePostfix),
':</h1>');
WriteLn(F, GetIdentNameLink(Ident),
' <a href="', GetFileName(Ident, nil, True) +
'.' + KindLegend[Kind], '.html">',
Localize(dtDocumentationClassesLinkMemberListByClass),
'</a>');
WriteLn(F, '<hr>'); //end the header
AllList.Sort; //sort only by the name
WriteLn(F, '<ul>'); //start list
for i := 0 to AllList.Count - 1 do //for each inherited member
begin
Member := AllList[i]; //get it
WriteInheritedMember(Member, True); //write the member
end;
WriteLn(F, '</ul>'); //end list
finally
EndFile(F); //close the file
end;
end; //if Result
finally
AllList.RemoveAll(False); //don't free the members
AllList.Free; //free list of inherited member
end;
end;
begin
if WriteInheritedList then //has members of that kind?
begin
//get link to list of members of the kind
Result := '<a href="' + GetFileName(Ident, nil, True) + '.' +
KindLegend[Kind] + '.html">' + Localize(KindTitles[Kind]) + '</a>';
WriteDocumentation; //write documentation of all members
end
else
Result := ''; //don't return link
end;
{Writes the documentation of the record-like type.
~param Ident the record-like type whose data should be written }
procedure THTMLHelpDoc.WriteClassDocumentation(Ident: TRecordType);
var F :TextFile; //the file of the documentation
begin
StartContentList(Ident.Name);
AddContentEntry(Ident.Name, GetFileName(Ident) + '.html');
//create the file for the documentation
CreateFile(F, GetFileName(Ident),
DescFilePreFix[Ident.Kind] + ' ' + Ident.Name, Ident.Name);
try
//write type and name of the record-like type
WriteLn(F, '<h1 class=class>', DescFilePreFix[Ident.Kind], ' ', Ident.Name,
'</h1>');
SetCommentIdent(Ident, Ident.InFile); //set record-like type for comment
//write documentation about all fields, properties and methods
WriteLn(F, WriteMembers(mkField, Ident), ' ',
WriteMembers(mkProperty, Ident), ' ',
WriteMembers(mkMethod, Ident));
EndContentList;
WriteLn(F, '<hr>');
CurrentHelpContext := 0; //no help context defined so far
SetCommentIdent(Ident, Ident.InFile); //set record-like type for comment
//write the general documentation about the record-like type
WritePartOfClassDocumentation(Ident, F);
finally
EndFile(F); //close the file
end;
//check, if a help context was defined for this record-like type
CheckHelpContext(GetFileName(Ident) + '.html');
end;
{Writes the current page of the user documentation. Will be called by
~[link CreateUserDocumentation] for each page. }
procedure THTMLHelpDoc.CreateUserDocPage;
var Title :String; //the title of the page
Content :String; //and its content
begin
//get title and content of the page of user documentation
Content := GetUserDocumentationPage(CurrentUserDocPage, Title);
AddContentEntry(ParseCommentText(Title), GetPageURI(CurrentUserDocPage));
inherited CreateUserDocPage; //create documentation
end;
{Writes a file of documentation as help for a GUI.
~param Data the data to generate the help about
~result a linked text to the created file }
function THTMLHelpDoc.GenerateGUIHelpOnData(Data: TOldGUIHelpData): String;
begin
AddContentEntry(HandleRawText(Data.TitleOrBaseName), Data.BaseName + '.html');
Result := inherited GenerateGUIHelpOnData(Data); //generate the documentation
end;
{$IFNDEF LINUX}
{Searches the help compiler and returns its path. If the path is given with the
expert option ~[em HelpCompilerPath] it is used. if this is not the case or
the given file does not exist, it is seached. For this purpose it is checked
if it is installed with Delphi, if the file of the help project is associated
or if it can be found in the search path.
~result the path to the help compiler }
function THTMLHelpDoc.SearchHelpCompiler: String;
var Registry :TRegistry; //to read the path out of the registry
(*
{Checks whether the help compiler is installed with Delphi and, if that is the
case, set its path. }
procedure CheckDelphiInstallation;
var List :TStringList; //list of keys in the registry
i :Integer; //counter through the list
S :String; //a general string
begin
Registry.RootKey := HKEY_LOCAL_MACHINE; //open the delphi main key
if Registry.OpenKeyReadOnly('\Software\Borland\Delphi\') then
begin
List := TStringList.Create; //create list for all sub keys
try
Registry.GetKeyNames(List); //get all sub keys
i := List.Count - 1; //for each entry
while (i >= 0) and (Result = '') do //while entries left and not found
begin
S := List[i]; //get entry
if (length(S) > 1) and (S[1] in ['0'..'9']) then //begins with a digit?
begin
Delete(S, 1, 1 + ord(S[2] in ['0'..'9'])); //delete main version
if (S = '') or ((length(S) = 2) and //is a valid version text?
(S[1] = '.') and (S[2] in ['0'..'9'])) then
begin
Delete(S, 1, 2); //delete sub-version
while (S <> '') and (S[1] in ['0'..'9']) do //delete sub-version
Delete(S, 1, 1);
if (S = '') and //valid version?
Registry.OpenKeyReadOnly('\Software\Borland\Delphi\' +
List[i]) then
begin
//read path to which Delphi has been installed
S := Registry.ReadString('RootDir');
if S <> '' then //could be read?
begin
//set default path of help compiler
S := S + '\Help\Tools\hhc.exe';
if FileExists(S) then //compiler exists?
Result := S; //set it
end; //if path of Delphi read
end; //if "is a valid version text"?
end; //if "is a valid version text"?
end; //if (length(S) > 1) and (S[1] in ['0'..'9'])
dec(i); //next entry
end; //while (i >= 0) and (Result = '')
finally
List.Free; //free list of sub keys
end;
end; //if Registry.OpenKeyReadOnly('\Software\Borland\Delphi\')
end;
*)
{Checks whether the help project files are associated, if this is the case and
the associated progrem exists, set its path. }
procedure CheckFileAssociation;
var S :String; //general string
i :Integer; //end of the path of the program
begin
S := '';
Registry.RootKey := HKEY_CLASSES_ROOT;
if Registry.OpenKeyReadOnly('\.hhc') then //file extension is registered?
begin
S := Registry.ReadString(''); //read type of file
if (S <> '') and //file correctly registered?
Registry.OpenKeyReadOnly('\' + S + '\shell\open\command') then
begin
S := Registry.ReadString(''); //read command to execute
if S <> '' then //command could be read?
begin
if S[1] = '"' then //program is '"'-enclosed?
begin
Delete(S, 1, 1); //delete first '"'
i := pos('"', S); //get position of last '"'
end
else //get end of first command
i := pos(' ', S);
if i <> 0 then //defined?
S := copy(S, 1, i - 1); //use only the first command
if (S <> '') and FileExists(S) and //program is valid?
//and is the help compiler work shop
(UpperCase(copy(S, length(S) - 7, 8)) = '\HHW.EXE') then
begin
//use directly the help compiler
S := copy(S, 1, length(S) - 7) + 'HHC.exe';
if FileExists(S) then //compiler available?
Result := S; //use it
end;
end; //if "associated program could be read"
end; //if "file extension correctly registered"
end; //if Registry.OpenKeyReadOnly('\.hpj')
end;
var S :String; //the path of the help compiler
Dummy :PChar; //not used pointer
begin
Result := FHelpCompilerPath; //path of help compiler specified?
//not found at specific position or is a direc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -