* ChmHelp: comments; harmonize code layout with other units in chmhelp

git-svn-id: trunk@46632 -
This commit is contained in:
reiniero 2014-10-21 12:10:55 +00:00
parent 874f3994ff
commit bb7231832e
4 changed files with 27 additions and 24 deletions

View File

@ -75,10 +75,12 @@ var
begin
if fStop^ then Exit;
txt := AItem.KeyWord;
// Fallback:
if txt = '' then txt := AItem.Text;
txt := Trim(txt);
if not Assigned(fLastNode) or (fLastNode.Text <> txt) then
begin
// Add new child node
fLastNode := AParentNode;
NewNode := TContentTreeNode(fTreeView.Items.AddChild(AParentNode, txt));
NewNode.Url := FixURL('/'+AItem.Local);

View File

@ -31,11 +31,11 @@ type
destructor Destroy; override;
procedure LoadKeywordList(const Path: string);
function GetNodesForKeyword(const HelpKeyword: string;
var ListOfNodes: THelpNodeQueryList; var ErrMsg: string
): TShowHelpResult; override;
var ListOfNodes: THelpNodeQueryList; var ErrMsg: string
): TShowHelpResult; override;
function ShowHelp(Query: THelpQuery; {%H-}BaseNode, NewNode: THelpNode;
{%H-}QueryItem: THelpQueryItem;
var ErrMsg: string): TShowHelpResult; override;
{%H-}QueryItem: THelpQueryItem;
var ErrMsg: string): TShowHelpResult; override;
property CHMSearchPath: string read FCHMSearchPath write FCHMSearchPath;
end;
@ -51,14 +51,14 @@ uses chmreader, chmsitemap;
procedure RegisterLangRefHelpDatabase;
begin
if not Assigned(LangRefHelpDatabase) then
LangRefHelpDatabase := TLangRefHelpDatabase(HelpDatabases.CreateHelpDatabase(sFPCLangRef,
TLangRefHelpDatabase, true));
LangRefHelpDatabase := TLangRefHelpDatabase(HelpDatabases.CreateHelpDatabase(sFPCLangRef, TLangRefHelpDatabase, true));
end;
{ TLangRefHelpDatabase }
procedure TLangRefHelpDatabase.ClearKeywordNodes;
var i: Integer;
var
i: Integer;
begin
for i := 0 to FKeywordNodes.Count - 1 do
TObject(FKeywordNodes[i]).Free;
@ -160,10 +160,10 @@ begin
begin
Result := shrDatabaseNotFound;
ErrMsg := Format('ref.chm not found. Please put ref.chm help file in '+ LineEnding
+ '%s' + LineEnding
+'or set the path to it with "HelpFilesPath" in '
+' Environment Options -> Help -> Help Options ->' + LineEnding
+'under Viewers - CHM Help Viewer', [fCHMSearchPath]);
+ '%s' + LineEnding
+'or set the path to it with "HelpFilesPath" in '
+' Environment Options -> Help -> Help Options ->' + LineEnding
+'under Viewers - CHM Help Viewer', [fCHMSearchPath]);
Exit;
end;
// HelpKeyword starts with KeywordPrefix

View File

@ -40,11 +40,11 @@ begin
// FPDoc nodes for units in the LCL
FPDocNode := THelpNode.CreateURL(LCLHelpDatabase,
'LCL - Lazarus Component Library Units',
'file://index.html');
'LCL - Lazarus Component Library Units',
'file://index.html');
LCLHelpDatabase.TOCNode := THelpNode.Create(LCLHelpDatabase, FPDocNode);
DirItem := THelpDBISourceDirectory.Create(FPDocNode, '$(LazarusDir)/lcl',
'*.pp;*.pas;*.inc', True);// and once as normal page
'*.pp;*.pas;*.inc', True);// and once as normal page
LCLHelpDatabase.RegisterItem(DirItem);
end;

View File

@ -31,8 +31,8 @@ type
var ListOfNodes: THelpNodeQueryList;
var ErrMsg: string): TShowHelpResult; override;
function ShowHelp(Query: THelpQuery; {%H-}BaseNode, NewNode: THelpNode;
{%H-}QueryItem: THelpQueryItem;
var ErrMsg: string): TShowHelpResult; override;
{%H-}QueryItem: THelpQueryItem;
var ErrMsg: string): TShowHelpResult; override;
function GetCHMSearchPath: string;
property CHMSearchPath: string read FCHMSearchPath write FCHMSearchPath;
function FindCHMFile: string;
@ -52,7 +52,7 @@ begin
if not Assigned(FPCDirectivesHelpDatabase) then
FPCDirectivesHelpDatabase :=
TFPCDirectivesHelpDatabase(HelpDatabases.CreateHelpDatabase(
sFPCCompilerDirectives, TFPCDirectivesHelpDatabase, true));
sFPCCompilerDirectives, TFPCDirectivesHelpDatabase, true));
end;
{ TFPCDirectivesHelpDatabase }
@ -143,8 +143,8 @@ var
begin
Result := shrHelpNotFound;
if (csDesigning in ComponentState) then Exit;
if (FPCDirectiveHelpPrefix<>'')
and (LeftStr(HelpDirective, Length(FPCDirectiveHelpPrefix)) = FPCDirectiveHelpPrefix) then
if (FPCDirectiveHelpPrefix<>'') and
(LeftStr(HelpDirective, Length(FPCDirectiveHelpPrefix)) = FPCDirectiveHelpPrefix) then
begin
Filename:=FindCHMFile;
debugln(['TFPCDirectivesHelpDatabase.GetNodesForDirective ',Filename]);
@ -152,10 +152,10 @@ begin
begin
Result := shrDatabaseNotFound;
ErrMsg := Format('prog.chm not found. Please put prog.chm help file in '+ LineEnding
+ '%s' + LineEnding
+'or set the path to it with "HelpFilesPath" in '
+' Environment Options -> Help -> Help Options ->' + LineEnding
+'under Viewers - CHM Help Viewer', [FCHMSearchPath]);
+ '%s' + LineEnding
+'or set the path to it with "HelpFilesPath" in '
+' Environment Options -> Help -> Help Options ->' + LineEnding
+'under Viewers - CHM Help Viewer', [FCHMSearchPath]);
Exit;
end;
// HelpDirective starts with DirectivePrefix
@ -182,7 +182,8 @@ end;
function TFPCDirectivesHelpDatabase.GetCHMSearchPath: string;
begin
Result:=FCHMSearchPath;
if Result='' then begin
if Result='' then
begin
Result := '$(LazarusDir)/docs/html;$(LazarusDir)/docs/chm';
IDEMacros.SubstituteMacros(Result);
Result:=MinimizeSearchPath(SetDirSeparators(Result));