home *** CD-ROM | disk | FTP | other *** search
- ; ON-SCREEN OUTLINING MACROS
- ; 1/8/89
- ; Written by Tom Streeter (75216.2530). This replaces the versions uploaded
- ; to Compuserve on 11/17/88 and 10/15/1988.
- ;
- ; This is an experimental set of macros to allow for simple onscreen
- ; outlining. Modifications, elaborations, and improvements to this should
- ; be relatively simple, and are encouraged.
-
- ; Sprint's lack of an onscreen outliner, i.e. an outliner that automatically
- ; numbers and letters text on screen in classic outline fashion, is a major
- ; drawback. There's much to be said for a word processor like Sprint that
- ; doesn't jump on the WYSIWYG bandwagon; if you're concerned with the actual
- ; words you write instead of how pretty they look on paper, then WYSIWYG
- ; features can just get in the way. Onscreen outlining, however, is not
- ; necessarily a WYSIWYG feature; many of us use them for organizing our
- ; thoughts, notes, etc. in a convenient way on the screen just to help us
- ; think. We never intend to print the outlines on paper.
- ;
- ; So I created the following set of macros. To load, press Alt-U, M, L,
- ; and select "Outline.SPM." To get the outliner menu, either press
- ; Alt-Shift-X and type "OtlMenu," or assign the menu to a key. (A routine
- ; for assigning the menu to Alt-O is included below, along with one to
- ; add it to Sprint's main menu; just "uncomment" them.) To create
- ; an outline, open a new file with a single, default ruler at the top.
- ; (The outliner assumes the file has a default ruler, and won't work
- ; unless the tabs are set at 5.) Create each outline
- ; entry by indenting the beginning of the entry using the Shift-Tab key
- ; (NOT Sprint's ruler). Indent one tab for main headings, two for
- ; subheadings, and so on, up to four indents. Once you have created one or
- ; more entries, you can call the outliner menu and select "Insert
- ; Numbering." I couldn't figure out a way to generate Roman numerals using
- ; Sprint's macro language, so running the outliner macro inserts numbers
- ; before first level headings, capital letters before second level
- ; headings, numbers again for third level headings, and lower case letters
- ; for fourth level headings. You can add entries by simply starting a new
- ; line, and you can move existing entries around by cutting and pasting
- ; them as you would in a normal Sprint document. Just run the "Insert
- ; Numbering" function to get the numbers and letters back into their proper
- ; order.
- ;
- ; OTHER FUNCTIONS: selecting "New Entry" from the menu creates a new entry
- ; immediately below the one the cursor is currently in, and at the same
- ; level. (It's handy for making lists.) "Promote Entry" moves the current
- ; entry to the left one notch and changes the outline numbering
- ; accordingly, and "Demote Entry" does the reverse. "Hide" is a simple
- ; imitation of the hide function on other outliners. Basically, it sets
- ; the ruler's right margin to 255 characters, which effectively "flattens"
- ; all the entries to one line, allowing you to see all (or most) of your
- ; outline on screen at once. "Show" restores things to normal. "Remove
- ; numbering" does just that, but it also promotes all entries to the first
- ; level. (This is necessary if you want to sort the outline elements.)
- ; Running "Insert Numbering" restores things to the way they were.
-
- #define firstlevel
- #define secondlevel
- #define thirdlevel
- #define fourthlevel
-
- ; Error checking--makes sure this is an outline file, i.e., that it has ^G's
- OtlCheck:
- set themark
- r toruler
- f ('^G' csearch) || {
- to themark
- exitmenus
- error "** Warning: Not an Outline File."
- }
- to themark
-
- ; Central routine--inserts #s based on column placement of ^G's
-
- Outline:
-
- OtlCheck
- set themark
- message "\n Numbering Outline"
-
- 0 -> firstlevel
- 0 -> secondlevel
- 0 -> thirdlevel
- 0 -> fourthlevel
-
- ; Go to top of outline and insert a default ruler.
-
- r toruler
- readruler 5 settab writeruler 0 -> modf
-
- while (search "^G^G") {del} ; delete all extra ^G's (they build up
- r toruler ; sometimes in heavily re-worked outlines).
-
- f while ('^G' csearch) { ; Look for all Shift-Tabs.
-
- if column = 5 { ; If they are indented 5 spaces,
- 0 -> secondlevel ; insert a first level number.
- 0 -> thirdlevel
- 0 -> fourthlevel
- delete tosol
- ++firstlevel
- firstlevel put "%3d"
- insert ".^I"
- toeol
- }
- else if column = 10 { ; If they are indented 10,
- 0 -> thirdlevel ; insert a second level letter.
- 0 -> fourthlevel
- delete tosol
- insert "^I "
- ++secondlevel
- (secondlevel+64) insert
- insert ".^I"
- toeol
- }
- else if column = 15 { ; If indented 15, third level.
- 0 -> fourthlevel
- delete tosol
- insert "^I^I "
- ++thirdlevel
- thirdlevel put "%d"
- insert ")^I"
- toeol
- }
- else if column = 20 { ; If indented 20, fourth level.
- delete tosol
- insert "^I^I^I "
- ++fourthlevel
- (fourthlevel+96) insert
- insert ")^I"
- toeol
- }
- else return
- }
- to themark
-
- NewEntry: ; Create a new entry.
- OtlCheck
- r ('^G' csearch)
- if (column = 5) {
- f to ispara
- insert "^J^I^G"
- }
- if (column = 10) {
- f to ispara
- insert "^J^I^I^G"
- }
- if (column = 15) {
- f to ispara
- insert "^J^I^I^I^G"
- }
- if (column = 20) {
- f to ispara
- insert "^J^I^I^I^I^G"
- }
- outline
-
- Hide:
- set themark
- OtlCheck
- readruler 255 -> rightmargin writeruler
- to themark
-
- Show:
- set themark
- OtlCheck
- readruler 65 -> rightmargin writeruler
- to themark
-
- Flatten:
- OtlCheck
- set themark
- r toruler
- f while ('^G' csearch) {
- delete tosol
- insert "^I"
- toeol
- }
- to themark
-
- Promote:
- OtlCheck
- set themark
- r ('^G' csearch)
- if (column = 5) {
- error "Cannot be promoted."
- }
- if (column = 10) {
- delete tosol
- insert "^I^G"
- }
- if (column = 15) {
- delete tosol
- insert "^I^I^G"
- }
- if (column = 20) {
- delete tosol
- insert "^I^I^I^G"
- }
- to themark
- outline
-
- Demote:
- OtlCheck
- set themark
- r ('^G' csearch)
- if (column = 20) {
- error "Cannot be demoted."
- }
- if (column = 15) {
- delete tosol
- insert "^I^I^I^I^G"
- }
- if (column = 10) {
- delete tosol
- insert "^I^I^I^G"
- }
- if (column = 5) {
- delete tosol
- insert "^I^I^G"
- }
- to themark
- outline
-
- OtlMenu:
- menu "On Screen Outlining" {
- "Insert Numbering" OutLine,
- "New Entry" NewEntry,
- "Promote Entry" Promote,
- "Demote Entry" Demote,
- "Hide" Hide,
- "Show" Show,
- "Remove Numbering" Flatten
- }
-
- ; Uncomment the following to add the outline menu to Sprint's Main Menu.
- ; SprintMenu :
- ; menu "Sprint" {
- ; "File" FilesMenu,
- ; "Edit" EditMenu,
- ; "_",
- ; "Insert" InsertMenu,
- ; "Typestyle" TypeStyleMenu,
- ; "Style" StyleMenu,
- ; "Layout" LayoutMenu,
- ; "Outliner" OtlMenu,
- ; "_",
- ; "Print" PrintMenu,
- ; "Window" WindowsMenu,
- ; "Utilities" UtilitiesMenu,
- ; "Customize" CustomMenu,
- ; "_",
- ; "Quit" ExitEditor
- ; }
-
- ; Uncomment the following to assign the outline menu to the Alt-O key.
- ; ~O : OtlMenu
-
-
-
-
-
-
-
-