diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-10-12 15:42:13 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2009-10-12 15:42:13 +0200 |
commit | 915913d13f42912405c1ee03a74ce134156cb518 (patch) | |
tree | 71eaf4045cf4b435cd0629660432060a17f164dc /components/richtext/RichTextView.pas | |
parent | 44a2f50f35b357af485d12b55da38e1f1a4bbe9e (diff) | |
download | fpGUI-915913d13f42912405c1ee03a74ce134156cb518.tar.xz |
Shutdown optimization.
When the application shuts down, there is no need to
redraw the RichText View component. These changes are
optimized for that behaviour.
Signed-off-by: Graeme Geldenhuys <graeme@mastermaths.co.za>
Diffstat (limited to 'components/richtext/RichTextView.pas')
-rwxr-xr-x | components/richtext/RichTextView.pas | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/components/richtext/RichTextView.pas b/components/richtext/RichTextView.pas index d6c85c6e..2347d060 100755 --- a/components/richtext/RichTextView.pas +++ b/components/richtext/RichTextView.pas @@ -258,7 +258,7 @@ Type procedure AddText( Text: PChar; ADelay: boolean = False ); procedure AddParagraph( Text: PChar ); procedure AddSelectedParagraph( Text: PChar ); - procedure Clear; + procedure Clear(const ADestroying: boolean = False); procedure InsertText( CharIndexToInsertAt: longword; TextToInsert: PChar ); property Text: PChar read FText; property TextEnd: longint read GetTextEnd; @@ -1607,15 +1607,20 @@ begin StrDispose( NewText ); end; -Procedure TRichTextView.Clear; +Procedure TRichTextView.Clear(const ADestroying: boolean = False); begin ClearSelection; FText[ 0 ] := #0; FTopCharIndex := 0; - Layout; - if FLayout.FNumLines > 1 then - raise Exception.Create('FLayout.FNumLines should have been 0 but it was ' + IntToStr(FLayout.FNumLines)); -// RePaint; + if ADestroying then // component is shutting down + FLayout.Free + else + begin + Layout; + if FLayout.FNumLines > 1 then + raise Exception.Create('FLayout.FNumLines should have been 0 but it was ' + IntToStr(FLayout.FNumLines)); + RePaint; + end; end; //procedure TRichTextView.SetBorder( BorderStyle: TBorderStyle ); |