home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Bila Vrana
/
BILA_VRANA.iso
/
028A
/
AUROR.ZIP
/
FILLNUM.AML
< prev
next >
Wrap
Text File
|
1996-07-17
|
3KB
|
111 lines
//--------------------------------------------------------------------
// FILLNUM.AML
// Fill Block with a numeric sequence, (C) 1993-1996 by nuText Systems
//
// (See Fillnum.dox for user help)
//
// This macro fills a column block with an incrementing or decrementing
// numeric value. Note: this macro will run faster if Undo is turned
// Off on Set menu.
//
// Usage:
//
// Select this macro from the Macro List (on the Macro menu), or run it
// from the macro picklist <shift f12>.
//--------------------------------------------------------------------
include bootpath "define.aml"
variable fillstart, fillstep, justopt
// test for edit windows
if not wintype? "edit" then
msgbox "Edit windows only!"
return
end
// test for mark in current window and column mark
if getcurrbuf <> getmarkbuf or getmarktype <> 'k' then
msgbox "Column block not marked in current window."
return
end
macrofile = arg 1
// called by Lib.x when a key is entered in the dialog box
function ondialog (keycode)
// macro help
if keycode == <f1> then
helpmacro macrofile
end
end
// dialog box
dialog "Fill Block with Numbers" 38 8 'c'
field "&Start: >" 3 2 12 1
field "Ste&p: >" 3 4 12 1
// justify options
groupbox '' 3 6
(menu ''
item " ( ) &Left Justify"
item " ( ) &Right Justify"
end) 20 'r' "lr"
button "O&k" 27 2 8
button "Cancel" 27 4 8
// display dialog box and get user values
if (getdialog ref fillstart ref fillstep ref justopt) <> 'Ok' then
return
end
// check block width
finish = fillstart + ((getmarkrows - 1) * fillstep)
maxwidth = length finish
if maxwidth < length fillstart then
maxwidth = length fillstart
end
markwidth = getmarkcols
if maxwidth > markwidth then
msgbox "Column block must be at least " + maxwidth + " columns wide."
"Error!"
return
end
if pos 'l' justopt then
markwidth = -markwidth
end
// display message
say "Filling block..."
// mark the beginning of an undoable group of operations
undobegin
// stop cursor movement from resizing the mark
stopmark
// save cursor position and goto first line
pushcursor
gotopos (getmarkleft) (getmarktop)
// enter numbers into the block
loop getmarkrows times
ovltext fillstart:markwidth
fillstart = fillstart + fillstep
down
end
breakoff
// mark the end of an undoable group of operations
undoend
// restore cursor
popcursor
// clear the title bar
display