From 79d9e448d8880386c5ae5ccbac5f3382bcb2d780 Mon Sep 17 00:00:00 2001 From: Michael van Canneyt Date: Mon, 26 Nov 2012 15:08:29 +0000 Subject: More richtext color tag improvements. Attached is another patch I made for the richtext edit. Now the red/green/blue/black tags can/must be closed by a correct red/green/blue/black closing tag. That means that except for the margin tags, all tags can/must now be closed with a matching tag. --- docview/components/richtext/RichTextDocumentUnit.pas | 7 ++++++- docview/components/richtext/RichTextStyleUnit.pas | 10 +++++++--- docview/components/richtext/testapp/sample01.txt | 10 +++++----- 3 files changed, 18 insertions(+), 9 deletions(-) (limited to 'docview/components/richtext') diff --git a/docview/components/richtext/RichTextDocumentUnit.pas b/docview/components/richtext/RichTextDocumentUnit.pas index 89f0bf46..50098d8b 100644 --- a/docview/components/richtext/RichTextDocumentUnit.pas +++ b/docview/components/richtext/RichTextDocumentUnit.pas @@ -23,7 +23,8 @@ type ttColor, ttColorOff, ttBackgroundColor, ttBackgroundColorOff, ttRed, ttBlue, ttGreen, ttBlack, - ttnoWrap,ttnoWrapOff, + ttRedOff, ttBlueOff, ttGreenOff, ttBlackOff, + ttNoWrap,ttNoWrapOff, ttAlign, ttBeginLink, ttEndLink, ttSetLeftMargin, ttSetRightMargin, @@ -84,6 +85,10 @@ const 'blue', 'green', 'black', + '/red', + '/blue', + '/green', + '/black', 'nowrap', '/nowrap', 'align', diff --git a/docview/components/richtext/RichTextStyleUnit.pas b/docview/components/richtext/RichTextStyleUnit.pas index 98f5adfa..57f904df 100644 --- a/docview/components/richtext/RichTextStyleUnit.pas +++ b/docview/components/richtext/RichTextStyleUnit.pas @@ -247,7 +247,11 @@ ProfileEvent('DEBUG: ApplyStyleTag >>>'); ttColor: GetTagColor( Tag.Arguments, Style.Color ); - ttColorOff: + ttColorOff, + ttRedOff, + ttGreenOff, + ttBlackOff, + ttBlueOff: Style.Color := ASettings.FDefaultColor; ttBackgroundColor: @@ -271,10 +275,10 @@ ProfileEvent('DEBUG: ApplyStyleTag >>>'); ttAlign: Style.Alignment := GetTagTextAlignment( Tag.Arguments, ASettings.FDefaultAlignment ); - ttnoWrap: + ttNoWrap: Style.Wrap := False; - ttnoWrapOff: + ttNoWrapOff: Style.Wrap := True; ttSetLeftMargin, diff --git a/docview/components/richtext/testapp/sample01.txt b/docview/components/richtext/testapp/sample01.txt index a8653ac8..f283e939 100644 --- a/docview/components/richtext/testapp/sample01.txt +++ b/docview/components/richtext/testapp/sample01.txt @@ -8,7 +8,7 @@ The following text has a left margin of 10 spaces and a right margin of 5 spaces 1 2 3 4 5 6 12345678901234567890123456789012345678901234567890123456789012345 - + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam tincidunt lacinia diam, a egestas arcu bibendum sit amet. Proin erat mauris, vehicula id auctor aliquam, semper id turpis. Etiam iaculis lectus sit amet velit molestie euismod. Proin vel fermentum sem. Vivamus ut odio ligula, et egestas purus. Pellentesque eu turpis vitae ante adipiscing lacinia. Nulla dignissim, ligula id eleifend accumsan, sapien lacus condimentum nulla, eu pulvinar risus magna quis turpis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In vel semper nunc. Nulla eget justo at dolor vestibulum aliquam. Aenean commodo egestas odio, a rutrum sapien fringilla et. @@ -30,13 +30,13 @@ This is normal text This is fixed font text

Text Color

-We can also specify text colors like green, blue, or some RRGGBB specified color. We can also specific a text background color. +We can also specify text colors like green, blue, or some RRGGBB specified color. We can also specific a text background color.

Alternative Fonts

-This sentence is in Courier New 8 font. +This sentence is in Courier New 8 font. -This sentence is in 'Times New Roman' 12 font. +This sentence is in 'Times New Roman' 12 font. This sentence is in Helvetica 18 font. @@ -68,7 +68,7 @@ Using the << is handy to create text art. If your FixedFont supports

HyperLinks

-RichTextView also supports hyperlinks. Simply use the < syntax, where "xyz" is the link text that will be sent to the OnClickLink() and OnOverLink() events. +RichTextView also supports hyperlinks. Simply use the < syntax, where "xyz" is the link text that will be sent to the OnClickLink() and OnOverLink() events. By default the link text will appear in the same color and styling as the surrounding text. If you want to make it more visible, use the < tags. -- cgit v1.2.3-70-g09d2