home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-07-18 | 57.7 KB | 1,565 lines |
-
- SDI'S SPEED-KITS VOLUME I VERSION 1.5
-
- by Software Designs, Inc.
-
-
- **************************************************************************
- * *
- * *
- * WELCOME TO THE WORLD OF SDI'S SPEED-KITS!!! *
- * *
- * THE FLAGSHIP IN A COMING FLEET OF ULTIMATE LISP PROGRAMMING TOOLS! *
- * *
- * *
- * This package is a demo of the first of many utility routines to *
- * take you into a new realm of LISP programming for AutoCAD Version 11. *
- * Brace yourself as you experience windows (yes, Virginia, WINDOWS!) *
- * as a LISP tool with a few flicks of the wrist. Written in 'C', *
- * SDI'S SPEED-KIT allows very fast screen writes seamlessly integrated *
- * into LISP with no hassle!!! No more clumsy text entry!!!!!!!!!!!! *
- * Fasten your seatbelt before you see the ease in which low-level *
- * functions can be used in conjunction with LISP as well as numerous, *
- * neat drafting utilities to increase your production while *
- * decreasing your frustration level to nil/NULL! *
- * *
- * Get out of the old and into the NEW!!!!! *
- * *
- **************************************************************************
-
- Now that we've got your attention, let's get down to business:
-
- SDI'S SPEED KIT I is the first of many packages to be introduced
- over the next several months. This demonstration will give
- you a taste of the windowing functions that comprise
- SDI'S SPEED KIT I. These routines are written in 'C'
- to provide extremely fast text windows extremely easily.
- All functions are intuitive and therefore very easy to implement.
- When you register, you'll receive a library containing the
- functions listed and explained at the end of this document as
- well as a bunch of other useful window functions.
-
- SDI'S future SPEED-KITS will allow direct, low-level access
- to file functions as well as a number of sorting and data
- manipulation routines. Our designers have programmed in LISP
- for many years and subsequently have had "Gee, I wish that
- could be done EASILY in LISP" pop into our heads VERY frequently.
- Actually, we were really saying "I could do it in C in a second;
- therefore, I wish there was a C/LISP hybrid..." That's the goal of
- SDI'S various SPEED-KITS.
-
- Also in the future SPEED-KITS will be user tools to greatly
- increase drafting and programming productivity. These will
- encompass database manipulation to novel techniques in
- eliminating keystrokes and regen's. Even if you're not
- a draftsman, they'll be instantly useful (we use them everyday
- and we're programming 95% of the time!)
-
- More to come in the future...
-
-
-
- ***************************************************************************
-
-
- Here's all you need to do to run the demo:
-
- 1) Copy the files SDIKIT.EXP and DEMO.LSP into a sub-directory.
- 2) Run AutoCAD and load the file DEMO.LSP by typing (load "demo")
- at the command prompt.
- 3) Type 'demo'
-
- That's all there is to it!
-
- When you're done with the demo, be sure to read the documentation at
- the end of this file...
-
- ****************************************************************************
-
- Now for the (important) miscellaneous stuff...
-
- 1) This product is a fully functioning SHAREWARE Version.
- You are free to copy it as much as you want and we encourage
- you to distribute it to colleagues, friends, local BBSs, etc.
- as long as ALL of the files on this disk comprising
- SDI'S SPEED-KITS I are included. The Registered Version of
- this software contains over 30 functions (much more
- than this shareware version) so it will be worth the money to
- register directly with us. Although $35 a copy is probably
- outrageously low for the amount of hours involved in developing
- these kits, we've purposely kept the price as low as possible
- to attract as many clients as possible. That's the ballgame
- in a nutshell - nothing more, nothing less...
- (P.S. - Please register.)
-
- 2) If you find an error in this software, PLEASE contact us as soon
- as possible so that we may fix the problem quickly. We can
- be found on Compuserve under 76517,2466 or on BIX under
- Sleonardis. Most errors will be repaired within a few days.
- We've beta-tested the software extensively, but...
-
- Well, you know...
-
-
- 3) What you get when you register:
- You will receive the latest registered version
- of the SDI'S SPEED-KITS VOL. I library, including:
- a) an internal window text editor to use in your LISP
- applications,
- b) the ability to include help in your functions (via some
- function key),
- c) audio access,
- d) comprehensive documentation and support (see below for
- the partial documentation),
- e) much more.
-
- As mentioned, the cost for registration is only $35.00.
-
-
-
- *****************************************
- * Software Designs, Inc. *
- * *
- * To receive a registered version *
- * SDI'S SPEED-KITS VOLUME I, please *
- * send a check or money order for *
- * $35.00 to: *
- * *
- * Software Designs, Inc. *
- * 858 Austerlitz Rd. *
- * Paris, Ky. 40361-9055 *
- * *
- * For more information on this or other *
- * products call: *
- * *
- * (606)268-8908 *
- * or (606)987-6129 *
- *****************************************
-
- What's coming:
- AC utilities ... many programs for DWG'S to come!
- Engineering products (All areas)
- VGA Graphics, Animations and walk-throughs!
- Conversion between other CAD systems!
- Lots more SPEED-KITS!
-
- Software Designs, Inc. is a Registered AutoCAD Developer.
-
- AutoCAD is a registered trademark of Autodesk, Inc.
-
-
-
-
- Thanks for taking the time to investigate SDI'S products. Be sure
- to look for our other products, AC11TO10 and PURGE, as well as
- future SPEED-KITS....
-
-
-
-
- ***************************************************************************
-
-
- Revision History:
- -----------------
-
- Version 1.0 - Initial release
-
- Version 1.2 - Fixed minor bugs and added functions
-
- Version 1.5 -
- 1.) When using the function '(message..)' the graphics
- screen became mangled. This was repaired.
-
- 2.) When using the function '(menu) prior to any other function,
- the computer 'locked up'. This was repaired.
-
- 3.) Monochrome cards were incorrectly handled. This was repaired.
-
- 4.) 'SAVE_VIDEO' and 'RESTORE_VIDEO' now require an integer
- from 0 to 3 to be passed into each function. This will
- allow you to save and restore up to four screens. You
- must be in text mode to use these functions.
-
- 5.) TEXTMENU' now requires a list of strings passed into it
- instead of single strings in V1.2.
-
-
-
-
-
- *****************************************************************************
- *****************************************************************************
- *****************************************************************************
-
-
-
- SDI'S SPEED-KITS VOLUME I MANUAL (SHAREWARE VERSION)
-
-
-
- The functions do not return error codes; rather, they print out an error
- message on the screen describing the type of problem you have and set
- the AutoCAD system variable ERRNO to that error.
-
- **************************************************************************
- * *
- * Many functions require text screen coordinate information passed *
- * in the form of row and column. The upper left corner of the screen *
- * is the coordinate 1,1. Reference to columns is shown with an 'x' and *
- * 'y' for rows. *
- * *
- **************************************************************************
-
-
- --------------------------------------------------------------------------
- WINDOW - This function is used to draw windows on the text screen. The
- color of the window's components are set with the function 'SETCOLORS'
- (see below). The speed at which the window opens is set with the
- function 'SETSPEED' (also below).
-
- Use this function with 'DISPLAY' and the cursor routines to make your
- LISP software very professional-looking.
-
- Usage: (window x1 y1 x2 y2 height border_type)
- Where x1 (columns) is left side,
- y1 (rows) is the top,
- x2 is the right side and
- y2 is the bottom.
- Height values of 0, 1 or 2 cast shadows with the light source
- appearing from the upper left corner.
- Border_type is 0, 1 or 2 depending on whether plain, single-line
- or double-line borders (respectively) are desired.
-
- Returns: Nothing of use.
-
- Example:
- (window 5 5 75 20 1 1)
-
- Draws a window from the 5th column to the 75th column and from
- row 5 to row 20. The height for the window is 1 and the
- border is of the double-line type.
-
-
-
-
- --------------------------------------------------------------------------
- DISPLAY - This is a high-speed text display function. The current colors
- take effect on the string displayed (see 'SETCOLORS' below). Currently,
- there is no text formatting in this function.
-
- Usage: (display x y string)
- Where x is the column and
- y is the row.
-
- The string will be displayed at that coordinate.
-
-
- Returns: Nothing of use.
-
-
- Example:
- (display 5 6 "THIS IS A STRING")
-
- Will print out the message "THIS IS A STRING" at the 5th column
- and 6th row.
-
-
-
-
- --------------------------------------------------------------------------
- TEXTMENU - This function is used to allow the user to select one of a
- number of options (23 maximum). A window is automatically created and
- centered on the screen displaying the options that were passed. You may
- specify a default option to cause the highlight bar to fall on a
- specific line.
-
- Usage:
- (textmenu TITLE_OR_INSTRUCTIONS default (list string string string...))
-
- The first parameter to this function will be centered at the top of
- the window (generally used as a label). The default is a number
- assigned for the initial highlight bar to appear on (ie. the 1st
- string, the 2nd string ,the 3rd string...). The last parameter is the
- list of strings to be displayed.
-
- Returns: An integer corresponding to the option chosen, or one of
- the following scan codes:
-
- If the Escape key was hit - 283
- If F10 key was hit - 17408
- If the CANCEL key was hit - 11779
-
- Example:
- (setq number
- (textmenu "Please Select an Automobile" 3
- (list
- "Toyota"
- "Chevrolet"
- "Ford"
- )
- )
- )
- (cond
- ((= number 1)
- (....They've selected "Toyota" )
- )
- ((= number 2)
- (....They've selected "Chevrolet" )
- )
- ((= number 3)
- (....They've selected "Ford" )
- )
- ((= number 283)
- (....They've hit the ESCAPE key )
- )
- ((= number 17408)
- (....They've hit the F10 key )
- )
- ((= number 11779)
- (....They've hit the ESCAPE key )
- )
- (t nil)
- )
-
-
- A window is automatically created and centered with the current
- colors in affect at the current SPEED. Here the default choice
- is "Ford" since it is the 3rd option in the list.
- Textmenu will return the number associated with the item or one
- of three keys: ESCAPE, CANCEL or F10.
-
-
-
-
-
- --------------------------------------------------------------------------
- SETSPEED - This function takes one argument as an integer for the time
- delay while opening windows. Typically around 200. If passed a value
- of 99, the function will NOT set the value but simply returns the
- current value. Negative numbers are not allowed. The size of the
- number will be directly proportional to the speed that the window
- will open; simply, larger numbers will produce slower-opening windows.
- Typically set to somewhere around 200.
-
- Usage: (setspeed integer)
-
- Returns: The current value set.
-
- Example:
- (setq oldspeed (setspeed 99)) ;Gets the current value.
- (setspeed 300) ;Set the speed to 300.
- (window 5 5 10 10 1 2) ;Window opens slowly.
- (setspeed speed) ;Put the old speed back in
-
-
-
-
- --------------------------------------------------------------------------
- MESSAGE - Opens a window centered on the screen and displays the message
- passed using the current colors in effect. The function takes two
- arguments as (message "the message" flag). The last argument is
- a numeric value of 0 or 1. If the value is 0 the function will stop,
- wait for the user to hit a key, close the message window and return
- the scan code for that key. If the flag is nonzero the function will
- wait for a key stroke and return that key stroke to lisp as an integer.
-
- Usage: (message string flag)
-
- Returns: The key stroke entered or nil if no flag set.
-
- Example:
- (message "Print this message in the center of the screen and wait" 1)
-
- This will wait for a key stroke and return it to LISP.
-
-
- (message "Print this message in the center of the screen, don't wait" 1)
-
- This will open a window, center the message within it and return
- to the LISP routine that called it.
-
-
-
-
- --------------------------------------------------------------------------
- NOCURSOR - Simply turns the cursor off.
-
- Usage: (nocursor)
-
- Returns: Nothing of use.
-
- Example:
- (nocursor)
-
- Just turned the cursor off.
-
-
-
-
- --------------------------------------------------------------------------
- ONCURSOR - Simply turns the cursor on.
-
- Usage: (oncursor)
-
- Returns: Nothing of use.
-
- Example:
- (oncursor)
-
- Just turned the cursor on.
-
-
-
-
- --------------------------------------------------------------------------
- GETCURS - This will return the current cursor position as (x y) column
- and row.
-
- Usage: (getcurs)
-
- Returns: The current cursor position as a list.
-
- Example:
- (setq place (getcurs))
-
- Place might now have the value (5 6) for the 5 column and 6th row.
-
-
-
-
- --------------------------------------------------------------------------
- SETCURS - This function takes two arguments as column and row and places
- the cursor at that position.
-
- Usage: (setcurs)
-
- Returns: Nothing of use.
-
- Example:
- (setcurs 5 6)
-
- This sets the cursor to the 5th column and 6th row.
-
-
-
-
-
- --------------------------------------------------------------------------
- CLS - Clears the screen with the current background color in affect.
-
- Usage: (cls)
-
- Returns: Nothing of use.
-
- Example:
- (cls)
-
- It's handy to define (defun c:cls() (cls) (prin1)).
-
-
-
-
- --------------------------------------------------------------------------
- SETCOLORS - This is the routine to set the colors for all of the video
- functions in this package. There are 6 parameters to pass to the
- function within the range of 0-15. This is the order in which they
- are defined:
-
- 1) FORWARD TEXT COLOR
- 2) BACKGROUND COLOR
- 3) BORDER BACKGROUND COLOR
- 4) BORDER TEXT COLOR
- 5) HIGHLIGHTED TEXT COLOR
- 6) HIGHLIGHTED BACKGROUND COLOR
-
- The range for all colors is 0 - 15. When a window is created on
- the screen it will have a border color of BORDER BACKGROUND COLOR
- and border lines of BORDER TEXT COLOR. The center of the window
- will be of color BACKGROUND COLOR. Any text displayed in the
- window will be of color FORWARD TEXT COLOR. For any function with
- slide bars (such as textmenu) the highlighted bar will be of color
- HIGHLIGHT BACKGROUND COLOR and the text within the bar will be of
- color HIGHLIGHT TEXT COLOR.
-
- NOTE: If the background color is set to number greater than 7
- then blinking text appears.
-
-
- Usage: (setcolors first second third fourth fifth sixth)
-
- Returns: Nothing of use.
-
- Example:
- (setcolors
- _WHITE ;FORWARD TEXT COLOR
- _BLUE ;<<--- FOR CLS ;BACKGROUND COLOR
- _RED ;BORDER BACKGROUND COLOR
- _WHITE ;BORDER TEXT COLOR
- _BLACK ;HIGHLIGHTED TEXT COLOR
- _CYAN ;HIGHLIGHTED BACKGROUND COLOR
- )
-
- Where the global variables are set as:
- (setq
- _BLACK 0
- _BLUE 1
- _GREEN 2
- _CYAN 3
- _RED 4
- _MAGENTA 5
- _BROWN 6
- _LIGHTGRAY 7
- _DARKGRAY 8
- _LIGHTBLUE 9
- _LIGHTGREEN 10
- _LIGHTCYAN 11
- _LIGHTRED 12
- _LIGHTMAGENTA 13
- _YELLOW 14
- _WHITE 15
- )
-
-
-
-
- --------------------------------------------------------------------------
- SAVE_VIDEO - Saves the screen into one of four banks (0,1,2 or 3) which
- can be restored with the RESTORE_VIDEO function. The function
- is neseccary for flipping screens into the graphics mode and
- returning by (textscr). This is the only way to retrieve the
- screen.
-
- Usage: (save_video)
-
- Returns: Nothing of use.
-
- Example:
- (save_video 0) ;Saves the text screen in bank 0.
- (command "zoom" "e") ;Causes screen to flip to graphics
- (textscr) ;Be sure to move back to textmode.
- (restore_video 0) ;Restores it to previous state.
-
- You'll receive an error if you try to save the screen while
- in the graphics mode (use 'TEXT_SCR').
-
-
-
-
-
-
- --------------------------------------------------------------------------
- RESTORE_VIDEO - Restores the video screen to the screen saved in the
- the designated bank. See 'SAVE_SCRREEN'.
-
- Usage: (restore_video bank)
-
- Returns: Nothing of use.
-
- Example:
- (save_video)
- (graphscr 2)
- (command "line" deltax deltay "")
- (textscr) ;Must call prior to restoring!
- (restore_video)
-
- As with 'SAVE_SCREEN', you must be in text mode to perform this!...
- (again, use 'TEXT_SCR')
-
-
-
- *****************************************************************************
- *****************************************************************************
- *****************************************************************************
-
-
- REGISTERED PORTION ONLY
-
-
-
- DEBUGGING AND DEVELOPMENT INFORMATION -
-
-
- When writing your applications you should work with the debugger on.
- The debugger is normally off. The debug function will cause messages
- to appear on the screen when an error has occured. The message will be
- displayed in a window and a keystroke will be required before returning.
- If the error occurs while in graphics mode, the text is displayed as
- standard text at the command line and a keystroke will be required before
- returning.
-
- Enabling DEBUG mode opens a tracing file in the current directory. Each
- time an SDI routine is called, the file is appended with the name of
- function called. This helps to trace larger LISP programs to determine
- where the error occured.
-
- With DEBUG off, no messages are displayed and no trace file is opened.
-
-
- VARIABLES -
- ------------
- There are a number of variables in the system which affect
- some of the functions. These are listed below. Variables which accept
- a single numeric value have a special 99 code used exclusively for the
- retrieval of a variable's value.
-
-
-
- FUNCTIONS -
- ------------
-
- SETSTART - This function sets a value signifying where the initial slide
- bar will appear in the function 'SELECT'.
-
-
- Usage: (setstart position)
-
- Returns: The current value of START.
-
- Example:
- (setq oldstart (setstart 99)) ;Get the old value..do not set it!
- (setstart 3) ;Set the third parameter to be default
- (window x1 y1 x2 y2 1 2) ;Pop a window for 'SELECT'
- (setq answer
- (select
- (LIST
- "LINE"
- "POLYLINE"
- "CIRCLE"
- "TEXT"
- "3DFACE"
- )
- )
- )
- (setstart oldstart) ; Puts the variable back to original state.
- __________
- | |
- |LINE |
- |POLYLINE |
- |CIRCLE | <<---highlight bar appears on CIRCLE
- |TEXT |
- |3DFACE |
- |__________|
-
-
-
- --------------------------------------------------------------------------
- SETDENYS - This is a list of keys maintained in the system for use by
- the functions 'EDIT' and 'TEXTMENU'. The initial value of the list upon
- entry is (0 ESCAPE CANCEL F10). This list of keys will not be processed
- by the function ('EDIT' or 'TEXTMENU') but rather cause the function to
- return that key. Please excuse the spelling on this one - 'SETDENIES'
- didn't seem quite right...
-
- Usage: (setdenys (list-of-keys))
-
- Returns: Nothing.
-
- Example:
- (setq
- _F1 15104
- _F2 15360
- _F3 15616
- _CANCEL 11779
- )
- (window 12 10 64 16 1 2)
- (title 0 " F1 - Help F2 - Print F3 - Quit ");
- (setdenys (list F1 F2 F3 CANCEL))
- (setq ret (edit lst) i 0)
- (nocursor)
- (setq key (car ret))
- (cond
- ((= key _F1)
- .... They entered the F1 key in the editor.
- )
- ((= key _F2)
- .... They entered the F2 key in the editor.
- )
- ((= key _F3)
- .... They entered the F2 key in the editor.
- )
- ((= key _CANCEL)
- .... They entered the F3 key in the editor.
- )
- )
-
-
-
- --------------------------------------------------------------------------
- SETSCROLL - This variable is used in the 'SCROLL' function only.
- The scroll function will operate in 3 modes:
- 0 - Scrolls text left/right and up/down.
- 1 - Causes LEFT and RIGHT keys to be 'denied' from processing
- and forces 'SCROLL' to return them. Scroll up/down only.
- 2 - Causes 'SCROLL' to lock into up/down only. Does not
- return on LEFT and RIGHT keys. Uses a scroll bar for
- position only (disable scroll bar by masking the colors).
-
- See 'SCROLL' for more information. Use the magic 99 code to retrieve
- the value without setting it.
-
- Usage: (setscroll scroll-bit)
-
- Returns: The current SCROLL bit value.
-
- Example:
- (setq oldbit (setscroll 99)) ;Save the SCROLL bit value
- (window x1 y1 x2 y2 1 2) ;Pop a window
- (title 0 " USE <-> AND UP/DN ") ;Title top of window
- (title 1 " Escape always exits ") ;Title bottom of window
- (setscroll 2) ;Set the scroll bit for
- ;UP/DOWN only!
- (setq answer
- (scroll
- (list
- "This is an example of the scroll"
- "routine for use in AutoLISP. To"
- "bad we didn't have this kind of"
- "stuff in Version 9 and 10, right?"
- " "
- "I suppose one use of the function"
- "could be for help."
- " "
- "Another use might be for reading"
- "up text files or something to be"
- "displayed with certain menus in"
- "action. Each menu having it's own"
- "text file related to it"
- )
- )
- )
- (setscroll oldbit)
-
-
-
- --------------------------------------------------------------------------
- SET_NUMERIC - This variable is used in the editor only. It causes the
- editor to accept only numeric keystrokes (0,1,2,3... E e + -). This is
- primarily used for numeric field entry only. The values for NUMERIC
- are 0 and 1 only, representing ON and OFF, respectively. Uses the 99
- code value for returning only.
-
- Usage: (setnumeric on-off-flag)
-
- Returns: The current NUMERIC value.
-
- Example:
- (cls) ;Clear the screen
- (setspeed 50) ;Set the window open speed to 50
- (window 10 12 65 14 1 1) ;Pop a window
- (title 1 " Cancel to exit ") ;Label the window bottom
- (title 0 " This is a numeric entry test! ") ;Label the top
- (setnumeric 1) ;Set the editor to numeric only
- (relative 1) ;Make printing relative to window
- (display 1 1 "Enter a number: ") ;print the instructions
- (setupbox 28 13 63 13) ;Set up an edit box...
- ; not a window!
- (setdenys (list _CANCEL _SPACE _ENTER)) ;Set up the return keys
- (cleanup) ;Forces the editor to accept
- ; the box not window..!
- (setq lst (list "")) ;No default value
- (while (/= key _CANCEL) ;Test until they CANCEL
- (setq ret(EDIT lst)) ;Get return list from editor
- (setq value (cdr ret)) ;Strip out the value
- (setq key (car ret)) ;Was it CANCEL/ENTER/SPACE?
- (display 28 13 (rtos (nth 0 value ) ;Evaluate the
- (getvar "LUNITS") (getvar "LUPREC")) ;value
- )
- )
- (setnumeric 0) ;Set the editor to text mode
-
-
-
-
- --------------------------------------------------------------------------
- RELATIVE - When 'RELATIVE' is on 'DISPLAY's coordinates are adjusted to the
- last window. Use the 99 code to retrieve the value without setting.
- Value is 1=ON 0=OFF.
-
-
- Usage: (relative on-off-flag)
-
-
- Returns: The current value of RELATIVE.
-
- Example:
- Using 'RELATIVE' set to 'ON':
- (window 10 12 65 14 1 1) ;Pop a window
- (relative 1) ;Make printing relative to window
- (display 1 1 "Enter a number: ") ;print the instructions
- _____________________
- | |
- | Enter a number: |
- |_____________________|
-
-
-
-
- Using 'RELATIVE' set to 'OFF':
- (window 10 12 65 14 1 1) ;Pop a window
- (relative 0) ;Make printing relative to screen
- (display 1 1 "Hello world ") ;print the instructions
- _____________________________________________________________
- | |
- |Hello world |
- | ___________________ |
- | | | |
- | | | |
- | | | |
- | |___________________| |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- |_____________________________________________________________|
-
-
-
- --------------------------------------------------------------------------
- SETSIDES - This function is for use with 'SELECT' only. It is a single
- key deny for the LEFT and RIGHT keys. The values are 0 = OFF and
- 1 = ON. When ON, the 'SELECT' function will return LEFT or RIGHT
- if either key is struck. If OFF, the 'SELECT' function will do nothing
- if these keys are struck. Use the magic 99 code to retrieve the
- current value without setting it. Default value is 1.
-
- Usage: (setsides on-off-flag)
-
- Returns: The current value of SIDES.
-
- Example:
- (window x1 y1 x2 y2 1 2) ;Pop a window
- (title 0 " Scroll Up/Down ") ;Label the top
- (setsides 0) ;Disable LEFT/RIGHT keys
- (while (< answer 6)
- (setq answer
- (SELECT
- (list
- "LINE" "CIRCLE" "TEXT" "DIMENSION" "ATTRIBUTE DEFINITION"
- )
- ))
- (cond
- ((= answer 0)
- (message "CHOOSE LINE!" 0)
- )
- ((= answer 1)
- (message "CHOOSE CIRCLE!" 0)
- )
- .
- .
- .
-
-
-
-
- --------------------------------------------------------------------------
- SETUPBOX - This is an imaginary window for use with the editor. The
- editor will react to the last window in the system before an imaginary
- box. Therefore in order to make the box work you must call 'CLEANUP'
- to release the window from control. 'SETUPBOX' accepts the four corners
- for an imaginary window as left column, top row, right column and
- bottom row.
-
- Usage: (setupbox x1 y1 x2 y2)
-
- Returns: Nothing.
-
- Example:
- (window 5 5 75 20 1 2) ;Pop a window
- (setupbox 14 10 63 16) ;Create a box within the window to work in
- (cleanup) ;Release the window from control to edit
- (setq lst (list ;Lines of text to be edited.
- "This just a few lines of text to be edited upon. "
- "Note: You don't have to use a window to use the "
- "editor! The lines of text returned to you are the "
- "exact lines of text that appear with the box "
- "defined if no window was used! If a window was "
- "used, then there is no need to set up the box. "
- " F10 ESCAPE OR CANCEL will allow you to exit. "
- ))
- (setdenys editlist) ;Set up the editor's keys
- (setq ret (edit lst) ;Edit the list within the SETUPBOX region
- strings (cdr ret) ;Get the edited strings
- ret (car ret) ;How did they exit?
- )
- (cls) ;Clear the whole screen
- .
- .
- .
-
-
-
-
- --------------------------------------------------------------------------
- CLEANUP - This function takes no arguments. It simply removes
- control of the last window from all functions. For example, if
- 'RELATIVE' printing was on and 'WINDOW' was called once, 'DISPLAY' would
- print text relative to that last window (even if it is no longer on
- screen), but if 'CLEANUP' were called between the 'WINDOW' and 'DISPLAY',
- DISPLAY text would be relative to the entire screen only (Whew!). This
- function is primarily used with 'EDIT' to cause the 'SETUPBOX's imaginary
- box to take control rather than the last window.
-
- Usage: (cleanup)
-
- Returns: Nothing.
-
- Example: See SETUPBOX above.
-
-
-
-
- --------------------------------------------------------------------------
- EDITBOX - This is the text and field editor for the kit. The function
- accepts only a list of strings to be edited and displays them in the
- current window (or setupbox if 'CLEANUP' was called) waiting to be
- edited. The only exit from the routine is in the last DENIAL list setup.
- NOTE: As a safeguard from being trapped in the editor, the key ALT-F1
- will always allow you to exit if DEBUG is ON.
-
- The editor is a simple boundary editor which currently does not support
- new lines, wrapping or scrolling.
-
- The following keys are predefined:
- INSERT: Toggles INSERT/OVERSTRIKE mode.
- HOME: Places the cursor at the beginning of the line.
- END: Places the cursor at the end of the line.
- DELETE: Deletes the character at the cursor position and pulls the
- string left by 1 char.
- PGUP: Places the cursor at the top-most part of the box.
- PGDN: Places the cursor at the bottom-most part of the box.
- BKSPCE: Erases the character to the left of the cursor and moves
- the cursor to the left.
- RIGHT/LEFT: Moves the cursor left and right without erasing text.
- TAB: Move the cursor 5 spaces to the right...No tab charactor
- is inserted.
-
- Note: Most editors will insert a new line of text if the ENTER key
- is struck while in INSERT mode. This editor never creates new
- lines.
-
- Usage: (edit (list-of-strings))
-
-
- Returns: A list of (scan code of exiting key '(list of edited strings)).
-
- Example:
- (setq
- _F10 17408
- _ESCKEY 283
- _ENTER 7181
- _CANCEL 11779
- )
- (setdenys '(ESCAPE CANCEL F10)) ;Set up the editors keys
- (window 5 5 75 20 1 2) ;Pop a window
- (title 0 " F10 Save ESC - Quit ") ;Label the top
- (setupbox 14 10 63 16) ;Create a box within the window to work in
- (cleanup) ;Release the window from control to edit
- (setq lst (list ;Lines of text to be edited.
- "This just a few lines of text to be edited upon. "
- "Note: You don't have to use a window to use the "
- "editor! The lines of text returned to you are the "
- "exact lines of text that appear in with the box "
- "defined if no window was used! If a window was "
- "used, then there is no need to set up the box. "
- " F10 ESCAPE OR CANCEL will allow you to exit. "
- ))
- (setq ret(edit lst) ;Edit the list within the SETUPBOX region
- strings(cdr ret) ;Get the edited strings
- ret (car ret) ;How did they exit?
- )
- (CLS) ;Clear the whole screen
- .
- .
- .
-
-
- SPECIAL NOTE ON EDIT: This editor is sure to change. We are currently
- working on a full-blown editor which allows scrolling, wrapping,
- line insertion and, especially, full control from LISP!
-
-
-
-
- --------------------------------------------------------------------------
- FILLBACK - This function takes one numeric argument, 1 or 0. If passed
- 1, the last window (or full screen if 'CLEANUP' or no window was called)
- will be filled with the extended character ascii 176 and a border of
- double lines. If the value is 0, no border is drawn.
-
- Usage: (fillback border-flag)
-
- Returns: Nothing.
-
- Example:
- (setvar "CMDECHO" 0) ;Kill the comments
- (cleanup) ;Make sure we have a full screen
- (save_video 2) ;Save it before we change it
- (nocursor) ;Kill the cursor
- (setspeed 0) ;Set the speed to FAST
- (fillback 1) ;Fill the screen with background
- (window 5 20 75 22 1 2) ;Pop a window
- (center
- " USE LEFT AND RIGHT KEYS F10 EXITS THE PROGRAM ") ;Show help
- (window 1 1 80 3 1 2) ;Pop a window
- (settop " EDIT " " SELECT " " SCROLL BIT " " READ ") ;Set bar
- .
- .
- .
-
-
-
- --------------------------------------------------------------------------
- SETTOP - This function takes strings to be displayed as arguments which
- will be used by the menuing system. Up to 6 menu pull-down strings
- are allowed. The function will equally space the strings across the
- top of screen. This function should be called only once in a menuing
- system. This function is intrinsically linked with the function
- 'DO_TOP_BAR' and must be set up prior to the 'DO_TOP_BAR' call.
-
- Usage: (settop label-string label-string ...)
-
- Returns: Nothing of interest.
-
- Example:
- (defun c:MENUPULL(/ lst num exitkey)
- (screenblue1) ;A predefined function for color setting.
- (setvar "CMDECHO" 0) ;Kill the comments.
- (cleanup) ;Make sure no active window for FILLBACK
- (save_video 2) ;Save the video in bank number 2 for restoring
- (nocursor) ;Kill the cursor
- (setscroll 1) ;Set the scroller up to return LEFT/RIGHT keys
- (setspeed 0) ;Set the speed to FAST!
- (fillback 1) ;Fill the whole screen with background
- (window 5 20 75 22 1 2);Pop the help window
- (center " USE LEFT AND RIGHT KEYS F10 EXITS THE PROGRAM ");
- (window 1 1 80 3 1 2);Pop the pull down window
- (settop " FILES " " DRAW " " CONVERT " " SETUP ") ;Prints
- ;the top strings and sets up the internal bar slider
- (save_video 0) ;Make a snapshot for interleaf to operate with
- (setq lst (list '(one) '(two) '(four) '(three) ) ;Four corresponding
- ;functions for top
- exitkey _F10 ;Only way to exit the menuing system
- )
- (interlea lst exitkey) ;Set the wheels in motion!
- (oncursor) ;Turn the cursor back on
- (restore_video 2) ;Give it to them like they left it!
- (prin1) ;Be quiet...
- )
- ____________________________________________________________________________
- | |
- | ________________________________________________________________________ |
- | | | |
- | | FILES DRAW CONVERT SETUP | |
- | |________________________________________________________________________| |
- | The second window opened ^^ |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | |
- | __________________________________________________________________ |
- | | | |
- | | USE LEFT AND RIGHT KEYS F10 EXITS THE PROGRAM | |
- | |__________________________________________________________________| |
- | The first window opened ^^ |
- | |
- | |
- | |
- |____________________________________________________________________________|
- Whole screen ^^
-
-
-
-
-
- --------------------------------------------------------------------------
- DOTOP - This function is used within the function interleaf to drive
- the menuing system. Once 'SETTOP' is called (see example above), a call
- to 'DOTOP' will highlight the first option on the top 'MENU BAR' and
- wait for a key stroke. If the keystroke is a LEFT or RIGHT key, the
- function will unhighlight the current option and highlight the
- next chosen option. The function does full wrap around. If the
- function is replied to by an <ENTER> keystroke, it returns an integer
- corresponding to the strings passed into 'SETTOP' (0 is the first string,
- 1 is the second etc.) This function accepts one argument as an integer
- which represents a keystroke. This allows a function (in LISP) to pass
- a RIGHTKEY into 'DOTOP'. 'DOTOP' will process that key as if it were entered
- with the function itself. This is what allows the menuing system to move
- from one pull-down to the next with popped windows!
-
-
- Usage: (dotop key-pushed)
-
- Returns: An integer corresponding to a string on top (function).
-
- Example:
- (defun interleaf(funclist exitkey / flag key r j iloop numfuncs)
- (setq flag 'T key -1 r 0 j 0 iloop 'T ;Force one entry
- numfuncs (length funclist) ;Count how many functions are in system
- )
- (while iloop
- (setq r 0 j 0)
- (while flag
- (if (= key r)
- (progn
- (setq j (eval (nth r funclist) )) ;Each function returns
- ) ;a key stroke.
- (setq r (1+ r)) ;Otherwise not this function
- )
- (if (and (< r numfuncs)(= j 0)) ;Jump back to DOTOP?
- (setq flag 't)
- (setq flag nil)
- )
- )
- (setq flag 't)
- (if (or (= key exitkey)(/= 0 (getvar "ERRNO"))) ;Check status!
- (setq iloop nil)
- (progn
- (restore_video 0) ;Gives the illusion of self maintainance
- (setq key (dotop j)) ;Get the next function or exit key!
- )
- )
- )
- (princ)
- )
-
- Note: Due to the complexity of the menuing system it is advised that
- you simply use the interleaf function as supplied until you
- feel comfortable with it's operation. Use the existing menuing
- system as a template for creating your own system!
-
-
- --------------------------------------------------------------------------
- KEYCHECK - This is a low-level keyboard checking routine. This function
- will read the keyboard buffer and return its results as a scan code.
- (use 'CASTCHAR' to convert to a character if needed). The function
- takes one argument, 1 or 0. If passed a 0, the function will wait
- until a key is struck and return the scan code value for that key.
- If passed a 1, the function will simply test to see if a key has been
- struck and return the scan code value for that key or 0 if no key
- was struck.
-
- Note: This function is sheltered from AutoCAD's flip screen, orthmode,
- snap etc. The function will return the value of those keys rather
- than process them.
-
-
- Usage: (keycheck wait-flag)
-
-
- Returns: The integer code for the key struck or 0 if 1 was passed and
- no key was struck.
-
- Example:
- (while (= (keycheck 1) 0) ;While no key is touched
- (dobeep 5000 500) ;Sound the speeker at 5000Hz for 500 ms
- )
-
- This will cause the speaker to sound until any key is struck.
-
-
-
- (display X Y "ENTER Yes or No: ")
- (setq flat 't)
- (while flag)
- (setq a (keycheck 0)) ;Wait for a key stroke
- (if(or(= (castchar A) "Y")(= (castchar A) "y") ;Test it
- (= (castchar A) "N")(= (castchar A) "n")
- )
- (setq flag nil)
- (dobeep 5000 3000) ;Sound alarm
- )
- )
-
- This will wait until Y or N is given before continuing.
-
-
-
-
-
- --------------------------------------------------------------------------
- CLSWINDOW - This simply clears the last window (whether there or not).
- The function takes two parameters and assumes the current color set.
-
- Usage: (clswindow)
-
- Returns: Nothing.
-
- Example:
- (window 5 5 75 20 1 1) ;Pop a window
- (fillback 1) ;Fill the window with background
- (keycheck 0) ;Wait for a keystroke!
- (clswindow) ;Clear the window back out again.
-
-
-
-
-
- --------------------------------------------------------------------------
- SCROLL - This function accepts a list of strings as one argument.
- The list of strings is processed into the last window (or upper left
- of whole screen if 'CLEANUP' or no window was called) and allows the
- text in that window to be scrolled. <ESCAPE> will exit the scroller.
-
-
- Usage: (scroll (list-of-strings))
-
- Returns: A key stroke to be processed.
-
- Example:
- (setq oldbit (setscroll 99)) ;Save the SCROLL bit value
- (window x1 y1 x2 y2 1 2) ;Pop a window
- (title 0 " USE <-> AND UP/DN ") ;Title top of window
- (title 1 " Escape always exits ") ;Title bottom of window
- (setscroll 0 ) ;Set the scroll bit for UP/DOWN and
- (setq answer ;LEFT/RIGHT scrolling
- (scroll
- (list
- "This is an example of the scroll"
- "routine for use in AutoLISP. Too"
- "bad we didn't have this kind of"
- "stuff in Version 9 and 10 huh! "
- " "
- "I suppose one use of the function"
- "could be for help."
- " "
- "Another use might be for reading"
- "up text files or something to be"
- "displayed with certain menus in"
- "action. Each menu having it's own"
- "text file related to it"
- )
- )
- )
- (setscroll oldbit)
-
- --------------------------------------------------------------------------
- SELECT - The select function is somewhat like the 'TEXTMENU' function
- (above). The function takes one argument as a list of strings. The
- strings are displayed in the last window (or Upper left corner if
- 'CLEANUP' or no window was called). A scroll bar is set at the START
- position in the strings (see 'SETSTART' above) initially. The function
- allows the user to scroll in the list strings with the UP/DOWN
- (HOME/END) keys. When the user hits the <ENTER> key an integer
- corresponding to the member in the list of strings is returned. This
- function will deny (return) a LEFT or RIGHTKEY if SETSIDES is ON
- and a LEFT or RIGHTKEY is struck.
-
-
- Usage: (select (list-of-strings))
-
- Returns: An integer corresponding to the member of the list or LEFTKEY/
- RIGHTKEY code if SETSIDES is OFF.
-
- Example:
- (setq oldstart (setstart 99)) ;Get the old value..do not set it!
- (setstart 3) ;Set the third parameter to be default.
- (window x1 y1 x2 y2 1 2) ;Pop a window for SELECT.
- (setq answer
- (select
- (LIST
- "LINE"
- "POLYLINE"
- "CIRCLE"
- "TEXT"
- "3DFACE"
- )
- )
- )
- (setstart oldstart) ;Puts the variable back to original state.
-
-
-
-
-
- --------------------------------------------------------------------------
- TITLE - This function takes two arguments: a TOP/BOTTOM flag and
- a string. The flag is 0 for the TOP of the window and 1 for the BOTTOM
- of the window. The string will be centered on the border of the
- window at the top or bottom.
-
- Usage: (title top/bottom-flag display-string)
-
- Returns: Nothing.
-
- Example:
- (window 5 5 20 20 1 2)
- (title 0 " Choose an Item ");
- (title 1 " Escape to Quit ");
-
- RESULTS ARE:
-
- |---- Choose an Item -----|
- | |
- | |
- | |
- | |
- | |
- | |
- |---- Escape to Quit -----|
-
-
-
-
- --------------------------------------------------------------------------
- CENTER_TEXT - Centers text horizontally in a window at the current
- cursor position (only y is dependent).
-
- Usage: (center message-string-to-center)
-
- Returns: Nothing.
-
- Example:
- (window 5 5 25 7 1 2) ;Cursor is automatically in window @ 1 1
- (center " Hit Enter to Edit ")
-
- RESULTS ARE:
- ___________________
- | |
- | Hit Enter to Edit |
- |___________________|
-
-
-
-
-
- --------------------------------------------------------------------------
- GETMODE - Gets the current graphics mode as a list in the form of
- (ACGRAPHMODE DOS_MODE). If ACGRAPHMODE is 1, the screen is in graphics
- mode. If ACGRAPHMODE is 0 then the screen is on the text side. The
- DOS_MODE is the actual video mode as follows:
-
- 0 B/W 40X25 CGA,EGA
- 1 16 Colors 40X25 CGA,EGA
- 2 B/W 80X25 CGA,EGA
- 3 16 Colors 80X25 CGA,EGA
- 7 Monochrome
-
- Usage: (getmode)
-
- Returns: A list of ACGRAPHICS MODE and DOS_MODE.
-
- Example:
- (defun screenblue1()
- (textscr) ;Put in textmode.
- (if (/= (cadr (getmode)) 7) ;If not monochome
- (SETCOLORS ;Then set the colors
- (list
- _WHITE ;forward text color
- _BLUE ;background color
- _RED ;border background color
- _WHITE ;border text color
- _BLACK ;highlighted text color
- _CYAN ;highlighted background color
- )
- ))
- (princ)
- )
-
- This was to avoid causing invisible and blinking text!
-
-
-
-
- --------------------------------------------------------------------------
- CASTCHAR - Takes an integer argument as a scan code and converts it
- to a character string.
-
-
- Usage: (castchar scan-code)
-
- Returns: A string representation of the scan code.
-
- Example:
- (setq a (KEYCHECK 0)) ;Wait for a key stroke
- (setq converted (CASTCHAR A))
- (if (or (= converted "Y") ;Is it a Y
- (= converted "y") ;or y
- (= converted "N") ; ...
- (= converted "n") ;
- )
- (setq flag nil)
- (dobeep 5000 3000) ;Sound alarm
- )
-
-
-
-
-
- --------------------------------------------------------------------------
- GETCOLORS - Returns the current color set as a list of integers.
-
- Usage: (getcolors)
-
- Returns: A list of integers.
-
- Example:
- (setq oldcolors (getcolors)) ;save old color set
- (setcolors ;Then set the new colors
- (list
- _WHITE ;forward text color
- _BLUE ;background color
- _RED ;border background color
- _WHITE ;border text color
- _BLACK ;highlighted text color
- _CYAN ;highlighted background color
- )
- ))
-
- .
- .Some code here
- .
-
- (setcolors oldcolors) ;Then reset the colors
-
-
-
-
- --------------------------------------------------------------------------
- DOBEEP - This function sounds the speaker. It takes two arguments:
- a frequency (hertz) and a duration (ms). Both values must be positive
- and nonzero.
-
- Usage: (dobeep frequency-hertz duration-milliseconds)
-
- Returns: Nothing.
-
- Example:
- (dobeep 500 1000) ;500 hz for 1000 milliseconds (1 second).
-
-
-
-
- ***************************************************************************
-
- This is the summary of all of the functions in the registered version:
-
- Usage : (WINDOW x1 y1 x2 y2 height border_type)
- Types : (WINDOW int int int int int int)
-
- Usage : (DISPLAY x y string)
- Tupes : (DISPLAY int int string)
-
- Usage : (TEXTMENU title_or_instructions default (list of strings))
- Types : (TEXTMENU string int (list strings ...))
-
- Usage : (SETSPEED value-of-speed)
- Types : (SETSPEED int)
-
- Usage : (MESSAGE string-to-display wait-flag)
- Types : (MESSAEG string int)
-
- Usage : (NOCURSOR)
- Types : (NOCURSOR)
-
- Usage : (ONCURSOR)
- Types : (ONCURSOR)
-
- Usage : (GETCURS)
- Types : (GETCURS)
-
- Usage : (SETCURS (list x y))
- Types : (SETCURS (list int int))
-
- Usage : (CLS)
- Types : (CLS)
-
- Usage : (SETCOLORS (list-of-colors))
- Types : (SETCOLORS (list int int int int int int))
-
- Usage : (SAVE_VIDEO bank-number)
- Types : (SAVE_VIDEO int)
-
- Usage : (RESTORE_VIDEO bank-number)
- Types : (RESTORE_VIDEO int)
-
- Usage : (SETSTART position)
- Types : (SETSTART int)
-
- Usage : (SETDENYS (list-of-keys))
- Types : (SETDENYS (list int int int ...))
-
- Usage : (SETSCROLL scroll-bit)
- Types : (SETSCROLL int)
-
- Usage : (SETNUMERIC on-off-flag)
- Types : (SETNUMERIC int)
-
- Usage : (RELATIVE on-off-flag)
- Types : (RELATIVE int)
-
- Usage : (SETSIDES on-off-flag)
- Types : (SETSIDES int)
-
- Usage : (SETUPBOX x1 y1 x2 y2)
- Types : (SETUPBOX int int int int)
-
- Usage : (CLEANUP)
- Types : (CLEANUP)
-
- Usage : (EDIT (list-of-strings))
- Types : (EDIT (list string string string ...))
-
- Usage : (FILLBACK border-flag)
- Types : (FILLBACK int)
-
- Usage : (SETTOP label-string label-string ...)
- Types : (SETTOP string string string ...)
-
- Usage : (DOTOP key-pushed)
- Types : (DOTOP int)
-
- Usage : (KEYCHECK wait-flag)
- Types : (KEYCHECK int)
-
- Usage : (CLSWINDOW)
- Types : (CLSWINDOW)
-
- Usage : (SCROLL (list-of-strings))
- Types : (SCROLL (list string string ...))
-
- Usage : (SELECT (list-of-strings))
- Types : (SELECT (list string string ...))
-
- Usage : (TITLE top/bottom-flag display-string)
- Types : (TITLE int string)
-
- Usage : (CENTER message-string-to-center)
- Types : (CENTER string)
-
- Usage : (GETMODE)
- Types : (GETMODE)
-
- Usage : (CASTCHAR scan-code)
- Types : (CASTCHAR int)
-
- Usage : (GETCOLORS)
- Types : (GETCOLORS)
-
- Usage : (DOBEEP frequency-hertz duration-milliseconds)
- Types : (DOBEEP int int)
-
-
-
- And finally...
- (Lawyer's stuff - sorry...)
-
- SOFTWARE DESIGNS, INC. MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AND
- SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR
- FITNESS FOR ANY PARTICULAR PURPOSE. WE FURTHER RESERVE THE RIGHT TO
- MAKE CHANGES TO THE SPECIFICATIONS OF THE PRODUCT WITHOUT OBLIGATION
- TO NOTIFY ANY PERSON OR ORGANIZATION OF SUCH CHANGES.
-
-