summaryrefslogtreecommitdiff
path: root/docview/components/richtext
diff options
context:
space:
mode:
authorMichael van Canneyt <michael@freepascal.org>2012-11-26 15:08:29 +0000
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2012-11-26 15:08:29 +0000
commit79d9e448d8880386c5ae5ccbac5f3382bcb2d780 (patch)
tree177071f628ae96835ad40bdf8c5e2b1a7e42e7bb /docview/components/richtext
parent753665acf0314f99ec1e48bff80c090e6bbee578 (diff)
downloadfpGUI-79d9e448d8880386c5ae5ccbac5f3382bcb2d780.tar.xz
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.
Diffstat (limited to 'docview/components/richtext')
-rw-r--r--docview/components/richtext/RichTextDocumentUnit.pas7
-rw-r--r--docview/components/richtext/RichTextStyleUnit.pas10
-rw-r--r--docview/components/richtext/testapp/sample01.txt10
3 files changed, 18 insertions, 9 deletions
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
<tt><nowrap>
1 2 3 4 5 6
12345678901234567890123456789012345678901234567890123456789012345
-</tt></nowrap>
+</nowrap></tt>
<rightmargin 5>
<leftmargin 10>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
<tt>This is fixed font text</tt>
<leftmargin 0><h2>Text Color</h2>
-We can also specify text colors like <green>green</color>, <blue>blue</color>, or <color #969229>some RRGGBB specified color</color>. <backcolor yellow>We can also specific a text background color.</backcolor>
+We can also specify text colors like <green>green</green>, <blue>blue</blue>, or <color #969229>some RRGGBB specified color</color>. <backcolor yellow>We can also specific a text background color.</backcolor>
<h2>Alternative Fonts</h2><image 1>
<leftmargin 55 pixels>
-<font "Courier New-8">This sentence is in Courier New 8 font.
+<font "Courier New-8">This sentence is in Courier New 8 font.</font>
-<font "Times New Roman-12">This sentence is in 'Times New Roman' 12 font.
+<font "Times New Roman-12">This sentence is in 'Times New Roman' 12 font.</font>
<font "Helvetica-18">This sentence is in Helvetica 18 font.</font>
@@ -68,7 +68,7 @@ Using the <<tt><<nowrap> is handy to create text art. If your FixedFont supports
</nowrap></tt>
<h2>HyperLinks</h2>
-RichTextView also supports hyperlinks. Simply use the <<link xyz> syntax, where "xyz" is the link text that will be sent to the <blue><link 1>OnClickLink()</link></color> and <green><link onoverlink>OnOverLink()</link></color> events.
+RichTextView also supports hyperlinks. Simply use the <<link xyz> syntax, where "xyz" is the link text that will be sent to the <blue><link 1>OnClickLink()</link></blue> and <green><link onoverlink>OnOverLink()</link></green> 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 <<color> tags.