home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------------------ */
- /* Macro: DRAWBOX.AML */
- /* Written by: nuText Systems */
- /* */
- /* Description: This macro draws a box around a column mark in the */
- /* current window. The box style can be passed to this */
- /* macro. If nothing is passed, the user is prompted */
- /* for the box style. The following box styles are */
- /* available: */
- /* */
- /* 1 - single line */
- /* 2 - double horizontal line */
- /* 3 - double vertical line */
- /* 4 - double horizontal and vertical line */
- /* 5 - spaces */
- /* 6 - shaded characters */
- /* */
- /* Usage: Select this macro from the Macro List (on the Macro */
- /* menu), or run it from the macro picklist <shift f12> */
- /* ------------------------------------------------------------------ */
-
- // compile time macros and function definitions
- include bootpath "define.aml"
-
- // 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
-
- // get box style based on first argument (arg 2) passed to this
- // macro (arg 1 is the macro filename)
- boxstyle = arg 2
-
- // if nothing is passed, then prompt the user
- if not boxstyle then
-
- // create a boxstyle menu
- menu "boxstyle"
- item " &Single" 1
- item " Double &Horizontal" 2
- item " Double &Vertical" 3
- item " &Double" 4
- item " &Eraser" 5
- item " Shaded &Character" 6
- end
-
- // display the popup menu and get the boxstyle
- boxstyle = popup "boxstyle" "Select the box style:" 35
-
- // destroy the menu
- destroybuf "boxstyle"
-
- // exit macro if no box style is selected
- if not boxstyle then
- return
- end
-
- end
-
- // get the box style character string
- style = "─│┌┐┘└═│╒╕╛╘─║╓╖╜╙═║╔╗╝╚ ▒▒▒▒▒▒" [(boxstyle - 1) * 6 + 1 : 6]
-
- topside = getmarktop
- botside = getmarkbot
- leftside = getmarkleft
- rightside = getmarkright
-
- undobegin
- oldmark = usemark 'T'
-
- // right side
- column = rightside + 1
- markcolumn column column topside botside
- fillblock style [2]
-
- // left side
- if leftside > 1 then
- column = leftside - 1
- markcolumn column column topside botside
- fillblock style [2]
- left_ok = 1
- end
-
- destroymark
- usemark oldmark
-
- // top side
- if topside > 1 then
- topside = topside - 1
- ovltext (copystr style [1] (getmarkcols)) leftside topside
- ovltext style [4] rightside + 1 topside
- if left_ok then
- ovltext style [3] leftside - 1 topside
- end
- end
-
- // bottom side
- if botside < getlines then
- botside = botside + 1
- ovltext (copystr style [1] (getmarkcols)) leftside botside
- ovltext style [5] rightside + 1 botside
- if left_ok then
- ovltext style [6] leftside - 1 botside
- end
- end
-
- undoend
-
-