summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2009-09-30 00:55:15 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2009-09-30 00:55:15 +0200
commit8f407a348cc872e90011df94bfb4dbd99fe28e51 (patch)
treeb0db3862f7d631dbb69084af9938e39f1ebc3b5a
parentf2521c3d72db3fe92c8290ca323f9766ef652095 (diff)
downloadfpGUI-8f407a348cc872e90011df94bfb4dbd99fe28e51.tar.xz
Implement AddChildNodes() but it still needs testing.
Signed-off-by: Graeme Geldenhuys <graemeg@gmail.com>
-rw-r--r--src/frm_main.pas35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/frm_main.pas b/src/frm_main.pas
index 6aa96a9d..7851a5a0 100644
--- a/src/frm_main.pas
+++ b/src/frm_main.pas
@@ -227,10 +227,41 @@ end;
procedure TMainForm.AddChildNodes(AHelpFile: THelpFile; AParentNode: TfpgTreeNode;
ALevel: longint; var ATopicIndex: longint);
+var
+ Topic: TTopic;
+ Node: TfpgTreeNode;
begin
- //
ProfileEvent('SubNode with TopicIndex of ' + IntToStr(ATopicIndex));
- inc( ATopicIndex );
+
+ Node := nil;
+ while ATopicIndex < AHelpFile.TopicCount do
+ begin
+ Topic := AHelpFile.Topics[ ATopicIndex ];
+ if Topic.ShowInContents then
+ begin
+ if Topic.ContentsLevel < ALevel then
+ break;
+
+ if Topic.ContentsLevel = ALevel then
+ begin
+ Node := AParentNode.AppendText(Topic.Title);
+ Node.Data := Topic;
+ inc( ATopicIndex );
+ end
+ else
+ begin
+ AddChildNodes( AHelpFile,
+ Node,
+ Topic.ContentsLevel,
+ ATopicIndex );
+ Node := nil;
+ end
+ end
+ else
+ begin
+ inc( ATopicIndex );
+ end;
+ end; { while }
end;
constructor TMainForm.Create(AOwner: TComponent);