From 0d4fe161254db050b06b0a78744acfed2e19fd0a Mon Sep 17 00:00:00 2001 From: juha Date: Sun, 14 Aug 2011 09:10:10 +0000 Subject: [PATCH] lhelp: Show Index correctly in all machines. If it worked before, this change makes no difference. Issue #19450, patch from Anton git-svn-id: trunk@31985 - --- components/chmhelp/lhelp/chmspecialparser.pas | 33 ++++++++++++------- components/chmhelp/lhelp/lhelp.lpi | 1 + 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/components/chmhelp/lhelp/chmspecialparser.pas b/components/chmhelp/lhelp/chmspecialparser.pas index 64f0940cd1..15822dc49e 100644 --- a/components/chmhelp/lhelp/chmspecialparser.pas +++ b/components/chmhelp/lhelp/chmspecialparser.pas @@ -53,6 +53,7 @@ type fChm: TObject; fBranchCount: DWord; fStop: PBoolean; + fLastNode: TTreeNode; procedure AddItem(AItem: TChmSiteMapItem; AParentNode: TTreeNode); public constructor Create(ATreeView: TTreeView; ASitemap: TChmSiteMap; StopBoolean: PBoolean; AChm: TObject); @@ -80,22 +81,32 @@ procedure TContentsFiller.AddItem(AItem: TChmSiteMapItem; AParentNode: TTreeNode var NewNode: TContentTreeNode; X: Integer; + txt: string; begin if fStop^ then Exit; - NewNode := TContentTreeNode(fTreeView.Items.AddChild(AParentNode, AItem.Text)); - NewNode.Url:=FixURL('/'+AItem.Local); - NewNode.Data:=fChm; - if fTreeView.Images <> nil then + txt := AItem.KeyWord; + if txt = '' then txt := AItem.Text; + txt := Trim(txt); + if not Assigned(fLastNode) or (fLastNode.Text <> txt) then begin - NewNode.ImageIndex := 3; - NewNode.SelectedIndex := 3; - - if (AParentNode.ImageIndex < 0) or (AParentNode.ImageIndex > 2) then + fLastNode := AParentNode; + NewNode := TContentTreeNode(fTreeView.Items.AddChild(AParentNode, txt)); + NewNode.Url:=FixURL('/'+AItem.Local); + NewNode.Data:=fChm; + if fTreeView.Images <> nil then begin - AParentNode.ImageIndex := 1; - AParentNode.SelectedIndex := 1; + NewNode.ImageIndex := 3; + NewNode.SelectedIndex := 3; + + if (AParentNode.ImageIndex < 0) or (AParentNode.ImageIndex > 2) then + begin + AParentNode.ImageIndex := 1; + AParentNode.SelectedIndex := 1; + end; end; - end; + end else + NewNode := TContentTreeNode(fLastNode); + Inc(fBranchCount); if fBranchCount mod 200 = 0 then diff --git a/components/chmhelp/lhelp/lhelp.lpi b/components/chmhelp/lhelp/lhelp.lpi index b5f87998c8..b4f863adbb 100644 --- a/components/chmhelp/lhelp/lhelp.lpi +++ b/components/chmhelp/lhelp/lhelp.lpi @@ -59,6 +59,7 @@ +