From 427e658e52f167e6da0164d0fcc5a8bc73d4d1a8 Mon Sep 17 00:00:00 2001 From: pierre Date: Tue, 30 May 2000 18:51:25 +0000 Subject: [PATCH] * Missing part of Gabor's color addition, CVS problem :( --- ide/text/whtmlhlp.pas | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ide/text/whtmlhlp.pas b/ide/text/whtmlhlp.pas index f312164d5a..82e242313d 100644 --- a/ide/text/whtmlhlp.pas +++ b/ide/text/whtmlhlp.pas @@ -11,6 +11,8 @@ const MaxTopicLinks = 5000; { maximum number of links on a single HTML page } type + THTMLSection = (hsNone,hsHeading1,hsHeading2,hsHeading3,hsHeading4,hsHeading5,hsHeading6); + PTopicLinkCollection = ^TTopicLinkCollection; TTopicLinkCollection = object(TStringCollection) procedure Insert(Item: Pointer); virtual; @@ -58,6 +60,8 @@ type procedure DocTableRow(Entered: boolean); virtual; procedure DocTableItem(Entered: boolean); virtual; procedure DocHorizontalRuler; virtual; + public + function GetSectionColor(Section: THTMLSection; var Color: byte): boolean; virtual; private URL: string; Topic: PTopic; @@ -112,11 +116,23 @@ type IndexFileName: string; end; + THTMLGetSectionColorProc = function(Section: THTMLSection; var Color: byte): boolean; + +function DefHTMLGetSectionColor(Section: THTMLSection; var Color: byte): boolean; + +const HTMLGetSectionColor : THTMLGetSectionColorProc = DefHTMLGetSectionColor; + implementation uses WUtils,WHTMLScn, Dos; +function DefHTMLGetSectionColor(Section: THTMLSection; var Color: byte): boolean; +begin + Color:=0; + DefHTMLGetSectionColor:=false; +end; + function EncodeHTMLCtx(FileID: integer; LinkNo: word): longint; var Ctx: longint; begin @@ -280,6 +296,8 @@ end; procedure THTMLTopicRenderer.DocHeading(Level: integer; Entered: boolean); var Align: string; + C: byte; + SC: THTMLSection; begin if Entered then begin @@ -288,9 +306,21 @@ begin PAlign:=paLeft; if DocGetTagParam('ALIGN',Align) then DecodeAlign(Align,PAlign); + SC:=hsNone; + case Level of + 1: SC:=hsHeading1; + 2: SC:=hsHeading2; + 3: SC:=hsHeading3; + 4: SC:=hsHeading4; + 5: SC:=hsHeading5; + 6: SC:=hsHeading6; + end; + if GetSectionColor(SC,C) then + AddText(hscTextAttr+chr(C)); end else begin + AddChar(hscNormText); CurHeadLevel:=0; DocBreak; end; @@ -484,6 +514,11 @@ begin AddChar(S[I]); end; +function THTMLTopicRenderer.GetSectionColor(Section: THTMLSection; var Color: byte): boolean; +begin + GetSectionColor:=HTMLGetSectionColor(Section,Color); +end; + function THTMLTopicRenderer.BuildTopic(P: PTopic; AURL: string; HTMLFile: PTextFile; ATopicLinks: PTopicLinkCollection): boolean; var OK: boolean;