Working with Virtual Highlighting Pens
Contents of Article
In the "good old days" when people worked with big printouts, it was often necessary to mark them up with highlighting pens. SPFLite now allows a way to do this to files with "virtual" highlighting pens and with optional highlight requests with FIND and CHANGE commands.
You can mark (Hi-Lite) a section of text in any of 15 different colors. Prior versions of SPFLite only supported RED, BLUE, GREEN or YELLOW but current releases support additional colors.
The name STD is used to 'clear' a color hi-lite. Setting a hi-lite consists of marking the desired area and pressing a key to which a (Pen/colornamei) function has been assigned. e.g. (Pen/BLUE) (Pen/VIOLET). (Pen/STD).
Any of the defined color names can be added as keywords to any Primary command which supports searching (like FIND, CHANGE etc.)
Types of Color Operands
When a colorname (like GREEN) is added to a Primary command like FIND, it requests that the string only be considered "Found" if it is currently hi-lited IN that specified color.
When a -colorname (like -BLACK) is added to a Primary command like FIND, it requests that the located string be in any color other than the specified color (including uncolored).
When a +colorname (like +BLUE) is added to a Primary command like FIND, it requests that the located string (regardless of it's current color) be hi-lited in tthe specified color.
Using RED as an example:
- FIND ABC RED means to look for a string that is entirely Red. Whether the string is found or not, or is entirely Red or not, its current color is not changed.
- FIND ABC +RED means to make the ABC find string Red, and CHANGE ABC DEF +RED will make the DEF change string Red. A string's color is only changed if a color name with a + plus sign is used.
- FIND ABC -RED means to look for a string that is not (entirely) Red. This includes string that might have a mixture of colors. Whether the string is found or not, its current color is not changed.
- FIND ABC SOLID and FIND ABC -SOLID refer to strings that are (or are not) entirely one color (as opposed to being of mixed colors) without limiting the search to any particular solid color. Whether a solid-color string is found or not, its color is not changed. Because SOLID is a "generic" description and not a specific color like RED, you can FIND strings that are, or are not, SOLID, but you can't CHANGE something to a "color" of SOLID, because it isn't any particular color.
Don't forget the other things you can do with your "virtual printout" file. Line labels and line tags are like "paper clips", and NOTE lines can be used to "scribble" on the "printout" like you would with a "sticky note". See Working with Line Labels, Working with Line Tags, and Working with NOTE Lines for more information.
The colors you set are persistent, may be found with LOCATE color options, and may be cleared with RESET color options. As with all persistent attributes of a file, the STATE profile option must be ON to enable persistent colors. If STATE is OFF, you can still put colors on your text, but when you close the file and reopen it, the color information will be discarded.
The exact color palette used for any of the hi-lite colors can be tailored in the Options -> HiLites settings, so you can adjust the colors to maximize readability. When changing these values, the Options dialog will display sample text so you can readily see just what the chosen colors will look like.
Once your text is colored, you can use LOCATE to find lines having any text with a particular color. LOCATE allows the use of STD to indicate lines which have only standard coloring on them. You can also find lines which have any sort of coloring on them at all by saying LOCATE NOT STD.
You can use LOCATE ALL to exclude or unexclude lines based on their 'condition', which includes their color.
See LOCATE - Scroll to a Specific Line for more information.
When you edit a file such as program source code, and you have an automatic colorization file defined for that file type, SPFLite renders your data lines according to the syntax and color choices defined in the .AUTO file.
Suppose one of the lines in your .AUTO file defined the keyword FUNCTION to be displayed in red, like this:
WORD 4 FUNCTION -- where 4 means "red" in an .AUTO file
Now, suppose you have a data line with the keyword FUNCTION on it and it is being displayed in red.
Then you say LOCATE RED to find this line. Will it work? No. One is a function of colorization, the other from specific Hi-Lite actions.
The exact colors displayed by the highlighting pens can be adjusted in the Options -> HiLites dialog to anything you wish. However, if you choose the same colors as SPFLite uses for text selection, for indication of found text during a FIND or CHANGE operation, or the colors displayed as a result of an active Automatic Colorization file (a filetype.AUTO file), it could get very confusing.
It will probably be best to avoid those particular colors. If you really need to apply highlighting pens to a file that has HILITE AUTO enabled, you may wish to temporarily issue a HILITE AUTO OFF so that you don't run into a confusing "color clash" situation. As noted above, you can mix .AUTO colorization and virtual highlighting pens, but you need to be careful not to confuse yourself.
It's easy to highlight text. You will have to establish a mapping for the (Pen*) functions. Here is a suggested mapping you may find useful. As always, you are free to map these any way you wish:
Ctrl-Shift-R = (Pen/Red)
Ctrl-Shift-B = (Pen/Blue)
Ctrl-Shift-G = (Pen/Green)
Ctrl-Shift-Y = (Pen/Yellow)
Ctrl-Shift-S = (Pen/Std)
Here is our data file:
We are going to highlight the word SEVENTEEN, since it is obviously out of place here. By double-clicking on the word, or by using the Shift+arrow keys, highlight (that is,select) the text:
Finally, while this word is highlighted (again, that is, selected), press one of the highlighting-pen keys you mapped above.
Here, we are going to press the Ctrl-Shift-Y key to make the text yellow:
That's all there is to it.
If you want to "uncolor" this word, you can select it again, and use the key mapped to (PenStd), which was mapped to Ctrl-Shift-S in our example. Or, you can use the RESET command, discussed next.
RESET can be used to clear highlighting-pen colors from the entire file, or from a given line range. The color name you specify reverts back to the standard text color. So, if you had some text marked up in BLUE, and you want that text returned to the normal display color, you would say RESET BLUE.
If you want to clear all of the colors back to the default, you can use RESET STD or RESET COLOR, both of which mean the same thing.
If you do a FIND command to find text has been colored with a highlighting pen, the highlighting produced by the HILITE FIND profile option will take precedence. Once you find some other string, or do a RESET command, the HILITE FIND highlighting will go away, and the color from the highlighting pen will be restored.
This of course assumes you have not specified another color on the actual FIND command itself. If so, the new color specified on the FIND command takes effect. Example: FIND ALL ABCD +GREEN would set all ABCD strings to GREEN. A subsequent FIND ALL ABCD +RED would change the coloring of all ABCD strings from GREEN to RED.
If you swap lines using the M/MM and W/WW line commands, and any of the lines involved have been colored with a highlighting pen, the colors will be retained when the lines are moved to their new positions.
Be aware that space characters in a file are ordinary data, and can have a color associated with them. This can affect FIND and CHANGE commands and the < and > Data Shifting line commands. See Shifting Data for more information.
At present, you cannot use the the virtual highlighting pen functions to color the text of NOTE or xNOTE lines.
Created with the Personal Edition of HelpNDoc: Free Kindle producer