diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-10-02 17:10:45 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-10-02 17:10:45 +0200 |
commit | 4fd85f930a7de6d9f099552be750f06932078cb2 (patch) | |
tree | 72d1d235f191a9067efc35af07170a1300880006 /src | |
parent | 52a056f0dc469303190f1f91ec417b8b1f5f083f (diff) | |
download | fpGUI-4fd85f930a7de6d9f099552be750f06932078cb2.tar.xz |
This goes with previous commit. Forgot to check it in.
* Additionally there is some code formatting fixes.
Signed-off-by: Graeme Geldenhuys <graeme@mastermaths.co.za>
Diffstat (limited to 'src')
-rw-r--r-- | src/HelpTopic.pas | 54 |
1 files changed, 15 insertions, 39 deletions
diff --git a/src/HelpTopic.pas b/src/HelpTopic.pas index a7dabb76..a03b46fa 100644 --- a/src/HelpTopic.pas +++ b/src/HelpTopic.pas @@ -94,12 +94,12 @@ Type // should be highlighted // ShowCodes: indicates debugging: hex output of escape // codes will be included - // Text: The output is written to here. + // AText: The output is written to here. // ImageOffsets: For each image that occurs in the text, // the help file offset will be written to this list. procedure GetText( HighLightWords: Int32ArrayPointer; ShowCodes: boolean; - Var Text: PChar; + var AText: string; ImageOffsets: TList ); function SearchForWord( DictIndex: integer; StopAtFirstOccurrence: boolean ): longint; @@ -667,67 +667,44 @@ end; // Main translation function. Turns the IPF data into // a text string. Translates formatting codes into tags // as for Rich Text Viewer. -// Uses TAString for speed without length limits -// - string is too short -// - PChar is slow to concatenate (unless you keep track of the insert point) -// - AnsiString is slow -procedure TTopic.GetText( HighLightWords: Int32ArrayPointer; - ShowCodes: boolean; - Var Text: PChar; - ImageOffsets: TList ); +procedure TTopic.GetText(HighLightWords: Int32ArrayPointer; ShowCodes: boolean; + var AText: string; ImageOffsets: TList); var SlotIndex: integer; Slot: THelpTopicSlot; pData: pInt8; pSlotEnd: pInt8; - S: string; Word: string; - GlobalDictIndex: int32; - Spacing: boolean; InFixedFont: boolean; - WordsOnLine: longint; - StringToAdd: string; LocalDictIndex: int8; DebugString: string; EscapeDebugString: string; - LinkIndex: longint; begin if Links = nil then - Links:= TList.Create; - + Links := TList.Create; S := ''; -{ Text:= StrNew( S.AsPChar ); - S.Destroy; - exit;} - + LinkIndex := 0; + InFixedFont := false; // ? Not sure... this could be reset at start of slot + WordsOnLine := 0; ImageOffsets.Clear; - LinkIndex:= 0; - - InFixedFont:= false; // ? Not sure... this could be reset at start of slot - - WordsOnLine:= 0; - for SlotIndex := 0 to _NumSlots - 1 do begin -ProfileEvent('Processing SlotIndex ' + IntToStr(SlotIndex)); - Spacing:= true; + ProfileEvent('Processing SlotIndex ' + IntToStr(SlotIndex)); + Spacing := true; Slot := THelpTopicSlot(_Slots[ SlotIndex ]); - pData := Slot.pData; - pSlotEnd := pData + Slot.Size; while pData < pSlotEnd do begin LocalDictIndex := pData^; - StringToAdd := ''; if LocalDictIndex < Slot.LocalDictSize then @@ -743,11 +720,10 @@ ProfileEvent('Normal word lookup'); Word := ''; Word:= SubstituteAngleBrackets( Word ); - if HighlightWords^[ GlobalDictIndex ] > 0 then -// graemeg: temp change -// StringToAdd := '<red>' + Word + '<black>' - StringToAdd := Word - else + { TODO -ograemeg : Temp change disabling highlight words } + //if HighlightWords^[ GlobalDictIndex ] > 0 then + // StringToAdd := '<red>' + Word + '<black>' + //else StringToAdd := Word; if Spacing then @@ -835,7 +811,7 @@ ProfileEvent('Special code'); end; ProfileEvent(S); - Text := PChar(S); + AText := S; end; function TTopic.SearchForWord( DictIndex: integer; |