home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
text
/
editors
/
uedit-stuff
/
paging
< prev
next >
Wrap
Text File
|
1991-01-10
|
10KB
|
228 lines
These here are new versions of the paging commands lAmiga-v (insert numbered
page break at cursor), lAmiga-d (delete page break), lAmiga-r (insert
numbered page breaks from cursor to end of file), and lAmiga-y (delete next
page number, leaving formfeed).
L-r has two significant changes. One is that you can put formfeeds into the
file with L-f before running it, and it will put numbered page breaks at
those points, padding out the short pages above them with blank lines. It
will refuse to work if it finds a numbered page break, or any formfeed which
is not at the beginning of a line. The other change is that it puts a top
margin at the top of the first page (the page the cursor is on when you use
it). It also no longer has a tendency to add an extra entirely blank page
at the end.
L-d is different in that it leaves a blank line where the page break was, if
the page before it has any blank lines at the bottom above the bottom margin.
It also runs backwards now; it deletes the previous page break instead of the
next one. Why, you ask? The reason for this is that we have to keep the
sform of the page we're de-numbering in the right place for the logic to
work. Otherwise repeated L-d commands can leave big chunks of blank lines
lying around. Running it backwards makes it much more likely that L-r
followed by multiple L-d's will pretty much restore the original file. (It
will not delete the margin at the top of the first page.) This also makes it
easy to undo a L-v immediately after using it.
L-v mostly works the same, except that if it is used on the first line of a
page, it creates only a top margin, instead of inserting a page break and
thereby creating an entirely blank page. (L-r uses this property to put a
top margin at the beginning of the page it starts on.) This will also be the
case when bottomMargin is zero, which the old version did not handle well.
In making a top margin, it notices existing blank lines and inserts only
enough new ones to create a margin of the correct size. And there are
commented out lines to make it put dashes around the page number.
I've set it so that if the "middle" of a bottom margin is between two lines,
it rounds toward the lower one instead of the upper one. If you want to
remove this change, take out the decNum(n53) in L-v and restore the commented
out decNum(n53) in L-d. The page number is also centered more accurately.
Remember to set your lineLength to reflect the actual paper being printed on
for this to be accurate.
L-y has one change: if it finds a page number in front of the next formfeed
(or any footer text on that line) it deletes that text. Then whether there
was any text in front of the formfeed or not, it deletes all blank lines
immediately above the formfeed. Also it no longer uses alt-kp7 to do the
delete, so it does not clobber your undo buffer.
There are several lines in L-v and L-d that should be removed if you have
your printer set up to do an automatic perforation skip. These lines are
marked with @@@@ in a comment. If you remove them, the effect will be that
page numbers appear in the last line of the bottom margin instead of in the
middle. Restore the commented out decNum(n53) in L-d if you do this. To use
auto perf skip, set your lines/page to the length of the paper in lines minus
the number of lines skipped at the perforation. Assuming that the skip is
equally balanced above and below the perforation (say 3 lines at the top and
bottom of the paper, with a one inch skip), then you would set topMargin and
bottomMargin to be three less than the actual size of margin you want to
appear on the page. For instance, my printer is set up to do a one inch perf
skip on eleven inch paper, with the top of form set half an inch below the
actual perforation, and generally prints six lines per inch. To get one inch
margins at both ends, I set both topMargin and bottomMargin to 3 and lines/
page to 60. If I were to turn off the perforation skip, I would set
bottomMargin and lines/page larger, adding an equal amount to each. I would
not necessarily increase them by six, since that might put the page number
lower than I want it. As long as the difference puts the end of the text in
the right place, the numbers do not have to reflect reality.
=============================================================================
.. if you want page headers and footers, modify this command:
Insert page-division at cursor
<lAmiga-v:
getLocal(curFile,n54,pageLines) .. don't clobber n49!
if (gtNum(2,n54)) {
putMsg("Must set lines/page > 1 first")
returnFalse
}
if (not is(curFile,sLine)) moveCursor(curFile,sLine)
if (not is(curFile,sForm)) {
if (is(curFile,formFeed)) clearChar(curFile) .. will be replaced
getPageRowCol(n50,n51,n52)
getLocal(curFile,n53,bottomMargin)
.. COMMENT OUT lines marked with @@@@ if using auto perforation skip:
decNum(n53) .. @@@@ put number a bit lower when bottomMargin even
div(n53,n53,2) .. @@@@
add(n51,n51,n53) .. @@@@
while (gtNum(n54,n51)) { incNum(n51) insertChar(curFile,eLine) }
if (gtNum(n53,0)) {
getLocal(curFile,n54,lineLength)
div(n54,n54,2)
decNum(n54) .. these two lines make centering more exact
if (geNum(n50,100)) decNum(n54)
while (decNum(n54))
insertChar(curFile," ")
toWord(curFile,n50)
...... if one wants dashes around the number, un-comment-out these lines:
.. insertchar(curfile, " ")
.. insertchar(curfile, "-")
insertChar(curFile,12) .. formfeed
.. movecursor(curfile, sword)
.. movecursor(curfile, schar)
.. movecursor(curfile, schar)
.. swapchar(curfile, "-")
.. movecursor(curfile, eline)
.. movecursor(curfile, echar)
}
}
if (not is(curFile,eFile)) {
getLocal(curFile, n54, topMargin)
while (is(curFile, blankLine)) {
moveCursor(curFile, downLine)
if (not decNum(n54)) return
}
while (decNum(n54))
insertChar(curFile, eLine)
}
>
this key inserts only a page header (top margin) if at sForm. the new
lAmiga-r makes use of that fact.
Delete PREVIOUS page-division
<lAmiga-d:
while (not is(curFile,formFeed)) {
if (not is(curFile,sForm)) moveCursor(curFile,sForm) .. else
if (not is(curFile,sLine)) moveCursor(curFile, sLine)
moveCursor(curFile, sChar)
if (is(curFile,sFile))
returnFalse .. maybe here delete top margin
}
if (not is(curFile,sLine)) moveCursor(curFile,sLine)
getPageRowCol(n54,n50,n51) .. don't clobber n49
getLocal(curFile,n54,topMargin)
getLocal(curFile,n53,bottomMargin)
.. decNum(n53) .. RESTORE this if the decNum(n53) in lAmiga-v is not used
div(n53, n53, 2) .. @@@@ COMMENT THIS OUT if using auto perf skip
equateLoc(curFile,locA,atCursor) .. start of ff line
moveCursor(curFile,downLine)
while (decNum(n54) & is(curFile,blankLine)) .. del topmargin lines
moveCursor(curFile,downLine)
equateLoc(curFile, mouseLoc, locB) .. don't clobber locB
equateLoc(curFile,locB,atCursor)
equateLoc(curFile,atCursor,locA)
moveCursor(curFile,upLine)
while (decNum(n50)) {
if (not is(curFile,blankLine)) {
moveCursor(curFile,downLine)
goto label (3)
}
decNum(n53)
moveCursor(curFile,upLine)
}
label (3)
if (gtNum(0,n53) & !eqLoc(curFile,locB,eFile))
moveCursor(curFile,downLine)
equateLoc(curFile,locA,atCursor)
clearRgn(curFile,loc)
equateLoc(curFile,locB,mouseLoc)
.. if (geLoc(curFile,sPage,atCursor)) .. vscroll when at top corner
vScroll(atCursor) .. ^^ that test can return incorrect result
>
Auto-insert page-divisions and page-numbers in document
<lAmiga-r:
putMsg("Scanning")
equateLoc(curFile,locA,atCursor)
freeBuf(buf54)
getSearch(buf49) .. don't clobber search string
insertChar(buf54,12)
setSearch(buf54)
while (search(curFile,sInvert,eInvert,1))
if (not is(curFile, sLine)) {
putMsg("Delete numbered paging divisions first using lAmiga-d")
setSearch(buf49)
returnFalse
}
putMsg(" ")
.. when there's no final eol/formfeed, eForm is never eFile, so:
moveCursor(curFile, eFile)
if (not is(curFile, sLine)) insertChar(curFile, eLine)
equateLoc(curFile, atCursor, locA)
if (not is(curFile,sForm)) moveCursor(curFile,sForm)
.... if (is(curFile, sFile))
runKey(lAmiga-v) .. first page gets header
while (nothing) {
moveCursor(curFile,eForm)
getLocal(curFile,n53,bottomMargin) .. inside loop cuz L-v trashes
getPageRowCol(n50,n51,n52)
getLocal(curFile,n52,pageLines)
if (gtNum(2,n52)) {
putMsg("Must set lines/page > 1 first")
getSearch(buf49)
returnFalse
}
sub(n50, n52, n51) .. number of lines page is short
incNum(n50)
if (not is(curFile, formFeed))
moveCursor(curFile, downLine) .. cuz at start of last line
if (geNum(n53, n50)) .. why make DO always run once?
do (n54,n50,n53)
moveCursor(curFile,upLine) .. shave margin if any
runKey(lAmiga-v)
if (not moveCursor(curFile,downLine)) returnTrue
updateDisplay
}
>
Erase next page footer (number), leaving formfeed
<lAmiga-y:
if (not is(curFile,eForm)) movecursor(curFile,eForm)
if (not is(curFile,12)) {
if (not is(curFile,eLine)) moveCursor(curFile,eLine)
if (is(curFile,12)) {
moveCursor(curFile, sLine)
clearRgn(curFile, line)
}
}
moveCursor(curFile, upLine)
while (is(curFile, blankLine)) {
clearRgn(curFile, line)
clearChar(curFile)
moveCursor(curFile, upLine)
}
moveCursor(curFile, downLine)
>