$WW,1$$FG,5$$TX+CX,"Dollar Sign Cmds"$$FG$

TempleOS supports rich-text type cmds which are bracketed with '$$'.  Use $FG,2$<CTRL-L>$FG$ to experiment with them.  Use $FG,2$<CTRL-T>$FG$ to toggle between plain text and rich text.

The format of '$$' cmds includes a two character code, +/-flags, a comma and args separated by commas.  The flags often determine how many and what args the cmd takes.

See $LK-A,"::/TempleOS/Doc/Widget.TXT"$ and $LK-A,"::/TempleOS/Demo/Doc/DemoDoc.TXT"$.

See $LK,"Doc Type Defines","MN:DOCT_TEXT"$ and $LK,"Doc Type Codes","FF:::/TempleOS/Adam/Doc/Doc.CPP,ST_DOC_CMDS"$
$TR,"TX Text"$
$ID,2$Normally, text is not bracketed with "$$", but if you wish to specify flag attr to center text, you can bracket them with "$$" and enter flags such as "$FG,4$+CX$FG$".  You can't edit them if they are bracketed by "$$" unless you toggle to plain text mode with <CTRL-T>.
$ID,-2$$TR,"CR Hard Carriage Return (New Line)"$
$ID,2$Carriage returns are normally specified without being bracketed with "$$".
$ID,-2$$TR,"SR Soft Carriage Return (New Line)"$
$ID,2$Word wrap uses soft carriage returns which are not saved.  You never place soft carriage returns by yourself.
$ID,-2$$TR,"TB Tab"$
$ID,2$Tabs are normally not bracketed with "$$", but are stored as ASCII#9.
$ID,-2$$TR,"CU Cursor pos"$
$ID,2$The cursor pos is usually stored as a ASCII#5 character and is not bracketed with "$$".  You do not normally enter cursor pos cmds yourself.
$ID,-2$$TR,"ID Indent +/- num"$
$ID,2$This changes the indention deeper if positive or shallower if negative. It effects the behavior of trees.
$ID,-2$$TR,"DA Data"$
$ID,2$primarily used for forms that prompt for data. Use $FG,2$<CTRL-L>$FG$ as a resource editor-type thing to generate the text you'll need in your "$FG,2$fmtstr$FG$" cmd in a $FG,2$class$FG$.  If you add it directly with $LK,"DocPutS","MN:DocPutS"$(), you'll need to fill-in the data addr.  See $LK,"DocFormDo","MN:DocFormDo"$(),$LK-A,"::/TempleOS/Demo/Doc/Form.CPP"$.

If there is a ':', the space after the first ':' in the format string marks the first valid cursor pos.
  
$ID,-2$$TR,"Text Colors"$
$ID,2$You place an expression(usually a color define--see $LK,"color defines","MN:BLACK"$) to indicate which of the 16 colors to use. If you enter no num, color returns to the default.
$FG,5$FD$FG$ Default Foreground Color
$FG,5$BD$FG$ Default Background Color
$FG,5$FG$FG$ Foreground Color
$FG,5$BG$FG$ Background Color
$ID,-2$$TR,"FU,BU User Prompts"$
$ID,2$special color changing cmds.  They are used when the user is prompted for text at the cmd line.  They rst the cursor pos if the cursor is posed before them on the line.  They are also used to indicate the start of a prompted str.
$ID,-2$$TR,"CL clear"$
$ID,2$Clear all previous entries except ones with hold($FG,4$+H$FG$) flags.  You might want $FG,4$+H$FG$ on word wrap entries.  Alternatively, you can use $LK,"DocClear","MN:DocClear"$().
$ID,-2$$TR,"PT User Prompt"$
$ID,2$Start of a user prompt.
$ID,-2$$TR,"WW Word Wrap"$
$ID,2$Include a 1 or 0.
$ID,-2$$TR,"HL Highlighting"$
$ID,2$Include a 1 or 0.
$ID,-2$$TR,"UL Underline"$
$ID,2$Include a 1 or 0.
$ID,-2$$TR,"IV Invert"$
$ID,2$Include a 1 or 0.
$ID,-2$$TR,"BK Blink"$
$ID,2$Include a 1 or 0.
$ID,-2$$TR,"SX Shift X pos"$
$ID,2$* Include a num from -16 to 15.
* Only foreground is shifted.
* Positive right.
$ID,-2$$TR,"SY Shift Y pos"$
$ID,2$* Include a num from -16 to 15.
* Only foreground is shifted.
* Positive down.
$ID,-2$$TR,"CM Cursor Movement"$
$ID,2$See $LK-A,"::/TempleOS/Demo/Doc/CursorMove.CPP"$.
$ID,-2$$TR,"AN Anchor"$
$ID,2$
$ID,-2$$TR,"LK Link"$
$ID,2$By default, links have a separate tag text from link text, but with the $FG,4$-A$FG$ flag you can make the link displayed as in example 3.

$LK,"Link Types","MN:LK_FILE"$

Examples: <CTRL-T> to see

1)$LK,"File link to HelpIndex.TXT","::/TempleOS/Doc/HelpIndex.TXT"$
2)$LK,"File link to HelpIndex.TXT with link type file","FI:::/TempleOS/Doc/HelpIndex.TXT"$
3)File link without different tag str.$LK-A,"::/TempleOS/Doc/HelpIndex.TXT"$
4)$LK,"File find link searching for 'Admin'","FF:::/TempleOS/Doc/HelpIndex.TXT,Admin"$
5)$LK,"File find link searching for 5th 'CTRL'","FF:::/TempleOS/Kernel/Adam1a.HPP,CTRL:5"$
6)$LK,"Manual page link","MN:PrintF"$
7)$LK,"File line num link","FL:::/TempleOS/Kernel/Adam1a.HPP,200"$
8)$LK,"File anchor link -- <CTRL-T> to see anchor after you click","FA:::/TempleOS/Kernel/Define1a.CPP,OS_DEFINE"$
9)$LK,"Bible Link","BF:Acts,2:3"$ The chapter:verse actually just does a text search.
10) $LK,"Help Index Link","HI:Doc"$.
$ID,-2$$TR,"BT Button"$
$ID,2$See $LK-A,"::/TempleOS/Demo/Doc/MenuButton.CPP"$.
$ID,-2$$TR,"CB Check Box"$
$ID,2$
$ID,-2$$TR,"MA Macro"$
$ID,2$Macro's are usually placed into menu/help areas and they have the '$FG,4$+X$FG$' flag set by default.  Adding '$FG,4$-X$FG$' prevents the usual $FG,2$<ESC>$FG$ from being sent (which exits the macro screen).  Note that when you output a macro to the cmd line, when the user clicks on it, it will go to the bottom and execute it unless you cancel the $FG,2$<ESC>$FG$ with a '$FG,4$-X$FG$'.

$ID,-2$$TR,"MU Menu Value"$
$ID,2$See $LK,"PopUpRangeI64","MN:PopUpRangeI64"$().
$ID,-2$$TR,"HX Hex Edit"$
$ID,2$See $LK,"DocD","MN:DocD"$().
$ID,-2$$TR,"Hidden Text Widget"$
$ID,2$$FG,5$HS Start of hidden text$FG$
$FG,5$HE End of hidden text$FG$
$FG,5$$FG$Hidden text widgets allow text to be placed in collapsable brackets like this $HS$$FG$This is hidden.$HE$ which can be expanded by clicking them. If you place a '$FG,4$-C$FG$' flag to uncollapse it, it will start expanded like this $HS$$FG$Click to hide$HE$. They can be nestled like this $HS$Click here:$HS$This is nestled.$HE$ okay?$HE$.
$ID,-2$$TR,"TR Tree Widget"$
$ID,2$A tree widget is a branch in a collapsable tree.  The domain of the branch extends from the first +indent until enough -indents bring it back to where it started.  Tree's begin collapsed unless a $FG,4$-C$FG$ flag is present.
$ID,-2$$TR,"SP Sprite"$
$ID,2$You can insert a sprite into text with $FG,2$<CTRL-R>$FG$.  It is critical where the cursor is at the time you enter $FG,2$<CTRL-R>$FG$ because the sprite will be offset from that location.  This is especially important when adding images to programs.  Numbers for sprites are automatically chosen because copying to and from the clipboard requires this.  You can insert another sprite with the same image by hitting $FG,2$<CTRL-T>$FG$ and manually adding a $FG,4$$$SP$$$FG$ entry with the same num.  You can cause the $FG,4$$$SP$$$FG$ cmd to appear with some text associated with it by manually adding text into the $FG,4$$$SP$$$FG$ cmd, as in $FG,4$$$SP,"pic 2",2$$$FG$.
$ID,-2$$TR,"IB Insert Binary"$
$ID,2$This cmd is used to tell the compiler to fetch the binary data stored after the end of text.  There is basically one type of binary data in DOC's at this point--sprites-- created with $FG,2$<CTRL-R>$FG$. They have a number associated with them.  This number is automatically chosen, because copying to the clip-board and back requires renuming. To use a $FG,4$$$IB$$$FG$ cmd, toggle to plain text ($FG,2$<CTRL-T>$FG$) after inserting a sprite and check the number in the $FG,4$$$SP$$$FG$ cmd. Create a $FG,4$$$IB$$$FG$ cmd with the same number and the sprite will be inserted into the compiled stream like a string constant.  You can optionally include tag text to be displayed for the $FG,4$$$IB$$$FG$ cmd.

The main reason for the $FG,4$$$IB$$$FG$ cmd at this point is to pass a arg to the $LK,"SpritePlot3","MN:SpritePlot3"$() function.  See $LK-A,"::/TempleOS/Demo/Graphics/SpritePlot.CPP"$.

$ID,-2$$TR,"IT Insert Binary Type"$
$ID,2$See $FG,4$$$IB$$$FG$.  This cmd inserts a number into the compiled stream describing the type of binary data associated with a num.  See $LK,"DOCBT_CSPRITE","MN:DOCBT_CSPRITE"$ for the types of binary data in DOC's.
$ID,-2$$TR,"IS Insert Binary Size"$
$ID,2$See $FG,4$$$IB$$$FG$.  This cmd inserts a number into the compiled stream describing the size of binary data associated with a number.
$ID,-2$$TR,"BP Break Point"$
$ID,2$This is used by the debugger to mark a break point.
$ID,-2$$TR,"HC,HI,HV html"$
$ID,2$The $LK,"ToHtml","MN:ToHtml"$() or $LK,"Doc2Html","MN:Doc2Html"$() routines will generate a html version of a document.  You can cause html code to be injected with $FG,5$HC$FG$.  If you happen to have a 640x480 image, you can inject it with $FG,5$HI$FG$.  If you happen to have a 640x480 $FG,2$.wmv$FG$ video, you can inject it with $FG,5$HV$FG$.  Use the $FG,4$+HTML$FG$ flag to inject a html link.
$ID,-2$$TR,"ER Error"$
$ID,2$When errors are detected in dollar cmds, an $FG,5$ER$FG$ entry is generated to hold the garbage so it is not lost.
$ID,-2$
See $LK,"Doc Flag Defines","MN:DOCEf1_AUX_STR"$ and $LK,"Doc Flag Codes","FF:::/TempleOS/Adam/Doc/Doc.CPP,ST_DOC_FLAGS"$
See $LK+S,"dft_flags","FF:::/TempleOS/Adam/Doc/DocPlain.CPP,doc_dft_flags1"$.
$TR,"FLAGS"$
$ID,2$$TR,"+H Hold"$
$ID,2$Tells it to not delete it when cleared with $FG,5$CL$FG$ or when the doc->max_entries is exceeded.  Word wrap is a good one to hold.
$ID,-2$$TR,"+A Auxilliary Str"$
$ID,2$Some cmds need other strs.  A $FG,4$+A$FG$ means an auxiliary str is present.  Links have $FG,4$+A$FG$ by default, so use a $FG,4$-A$FG$ if you wish the tag str and the link str to be the same.
$ID,-2$$TR,"+D Define Str"$
$ID,2$A $FG,4$+D$FG$ means a define str is present.  The tag will be regenerated by substituting the value of a system $FG,2$#define$FG$ or $LK,"DefineLoad","MN:DefineLoad"$() string.  See $LK-A,"::/TempleOS/Demo/Doc/DefineStr.CPP"$.
$ID,-2$$TR,"+TR Tree"$
$ID,2$* Make a tree branch.  Usually, this is placed on a text($FG,5$TX$FG$) entry.  The tree extends from the start until another tree entry or when indentation has been expanded and reduced back to the starting value.
* A $FG,4$+C$FG$ flag on a tree will start it collapsed.
$ID,-2$$TR,"+PU PopUp"$
$ID,2$A PopUp flag on a macro ($FG,5$MA$FG$) will cause the cmds to run in a new task, a pop-up window.
$ID,-2$$TR,"+C Collapsed"$
$ID,2$A collapsed flag on a tree $FG,5$TR$FG$ entry or a hide start $FG,5$HS$FG$ will cause it to start collapsed.  A $FG,4$-C$FG$ flag will make it start open.
$ID,-2$$TR,"+X <ESC> (Exit)"$
$ID,2$* A exit flag will cause a macro to send an $FG,2$<ESC>$FG$ before running(to exit the personal menu screen and return to the cmd prompt).  Actually, the default has an exit flag set so you might add a $FG,4$-X$FG$ to turn-off $FG,2$ESC$FG$.
* If an entry is already at the cmd prompt, the $FG,4$+X$FG$ will cause a movement to the bottom of the window.
$ID,-2$$TR,"+Q <SHIFT-ESC> (Abort Quit)"$
$ID,2$A quit flag is similar to a $FG,4$+X$FG$ except a $FG,2$<SHIFT-ESC>$FG$ instead of an $FG,2$<ESC>$FG$ to exit.
$ID,-2$$TR,"+Z Zero"$
$ID,2$A zero flag on a hex edit($FG,5$HX$FG$) entry will cause the offset from zero.  A $FG,4$-X$FG$ will show the actual memory addr. By default, $FG,5$HX$FG$ has the zero flag set.
$ID,-2$$TR,"+HTML"$
$ID,2$The $LK,"ToHtml","MN:ToHtml"$() or $LK,"Doc2Html","MN:Doc2Html"$() routines will generate a html version of a document.  You can cause html link on an item with $FG,4$+HTML$FG$.
$ID,-2$$TR,"+BP"$
$ID,2$The Bin Ptr Link flags lets you specify a file name and bin num to import a bin$FG$.  $FG,2$$$SP+BP,"<tag>",1,"filename,1"$$$FG$ will import bin num "1" from filename.
$ID,-2$$TR,"+AL Alias"$
$ID,2$An alias flag on a tree entry ($FG,4$+TR$FG$) will cause the text of the current entry the cursor is on to be copied to this entry.  This creates something similar to a drop-down window, but it doesn't work well yet.
$ID,-2$$TR,"+RD Refresh Data"$
$ID,2$The Refresh Data flag on a $FG,5$DA$FG$ or a $FG,5$CB$FG$ makes the value updated continuously.
$ID,-2$$ID,-2$

$FG,5$EXAMPLES:

$FG$<CTRL-T> to see how the following were done.
$UL,1$Underlined$UL,0$ $IV,1$Inverted$IV,0$ $BK,1$Blinking$BK,0$ $SY,-3$super$SY,0$ $SY,0$$SY,3$sub$SY,0$
$TX+SCX,"This is a big long scrolling msg.",10$

$FG,5$Cursor Movements:$FG$
$CM+LX,3,3$Cursor moved 3 rows down and to 3rd column from left.
$CM+RX,-40,3$Note mandatory comma after flags

The following may be changed to modes instead of attr with flags.

$TX+CX,"This is centered"$

$TX+RX,"This is right justified"$
