home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 v2.4 Fix / W95-v2.4fix.iso / ACADWIN / SUPPORT / DDPTYPE.LSP < prev    next >
Encoding:
Lisp/Scheme  |  1995-02-08  |  6.9 KB  |  238 lines

  1. ; Next available MSG number is    11 
  2. ; MODULE_ID DDPTYPE_LSP_
  3. ;;;
  4. ;;;    ddptype.lsp
  5. ;;;
  6. ;;;    Copyright (C) 1992, 1994 by Autodesk, Inc.
  7. ;;;
  8. ;;;    Permission to use, copy, modify, and distribute this software
  9. ;;;    for any purpose and without fee is hereby granted, provided
  10. ;;;    that the above copyright notice appears in all copies and
  11. ;;;    that both that copyright notice and the limited warranty and
  12. ;;;    restricted rights notice below appear in all supporting
  13. ;;;    documentation.
  14. ;;;
  15. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
  16. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
  17. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  18. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
  19. ;;;    UNINTERRUPTED OR ERROR FREE.
  20. ;;;
  21. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to
  22. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
  23. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 
  24. ;;;    (Rights in Technical Data and Computer Software), as applicable.
  25. ;;;
  26. ;;;.
  27. ;;;   C:DDPTYPE - set point style and size dialogue.
  28. ;;;
  29. ;;;               Uses ddptype.dcl for the dialogue definition.  The
  30. ;;;               slide images are in acad.slb.
  31. ;;;
  32. ;;; ===================== load-time error checking ============================
  33. ;;;
  34.  
  35.   (defun ai_abort (app msg)
  36.      (defun *error* (s)
  37.         (if old_error (setq *error* old_error))
  38.         (princ)
  39.      )
  40.      (if msg
  41.        (alert (strcat " Error en la aplicaci≤n: "
  42.                       app
  43.                       " \n\n  "
  44.                       msg
  45.                       "  \n"
  46.               )
  47.        )
  48.      )
  49.      (exit)
  50.   )
  51.  
  52. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,
  53. ;;; and then try to load it.
  54. ;;;
  55. ;;; If it can't be found or it can't be loaded, then abort the
  56. ;;; loading of this file immediately, preserving the (autoload)
  57. ;;; stub function.
  58.  
  59.   (cond
  60.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
  61.  
  62.      (  (not (findfile "ai_utils.lsp"))                     ; find it
  63.         (ai_abort "DDPTYPE"
  64.                   (strcat "Imposible localizar el archivo AI_UTILS.LSP."
  65.                           "\n Compruebe el directorio de soporte.")))
  66.  
  67.      (  (eq ;|MSG0|;"failed" (load ;|MSG0|;"ai_utils" "failed"))            ; load it
  68.         (ai_abort "DDPTYPE" "Imposible cargar el archivo AI_UTILS.LSP"))
  69.   )
  70.  
  71.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
  72.       (ai_abort "DDPTYPE" nil)         ; a Nil <msg> supresses
  73.   )                                    ; ai_abort's alert box dialog.
  74.  
  75. ;;; ==================== end load-time operations ===========================
  76.  
  77. (defun ai_ptype_start ( / pt1 pt2)
  78.   (setq ai_pts_lst '("0" "1" "2" "3" "4" "32" "33" "34" "35" "36"
  79.                      "64" "65" "66" "67" "68" "96" "97" "98" "99" "100")
  80.   )
  81.   (foreach pt0 ai_pts_lst
  82.     (setq pt1 (strcat "pdmode" pt0)
  83.           pt2 (getvar "PDMODE")
  84.     )
  85.     (start_image pt1)
  86.     (slide_image 
  87.       0 0
  88.       (- (dimx_tile pt1) 1) (- (dimy_tile pt1) 1) 
  89.       (strcat "acad(pt" pt0 ")")
  90.     )
  91.     (if (= pt2 (atoi pt0))
  92.       (mode_tile pt1 2)
  93.     )
  94.     (end_image)
  95.   )
  96. )
  97.  
  98. (defun ai_ptype_set ()
  99.   (ai_chk_pts nil)
  100.   (if ai_pts_do
  101.     (progn
  102.       (if ai_pts0
  103.         (setq ai_pts 0.0)
  104.         (if (= (get_tile ;|MSG0|;"pdsize_r") "1")
  105.           (setq ai_pts (- 0.0 ai_pts))
  106.         )
  107.       )
  108.       (setvar "PDSIZE" ai_pts)
  109.       (setvar "PDMODE" (atoi (substr ai_ptmode 7 3)))
  110.       (done_dialog 1)
  111.     )
  112.   )
  113. )
  114.  
  115. (defun ai_chk_pts (pts0)
  116.   (cond ((or (= ai_pts nil)
  117.              (<= ai_pts 0.0)
  118.          )
  119.          (set_tile "error" "Entrada no vßlida.")
  120.          (setq ai_pts_do nil)
  121.          (mode_tile ;|MSG0|;"pdsize_value" 2)
  122.         )
  123.         (T
  124.          (set_tile ;|MSG0|;"error" "")
  125.          (setq ai_pts_do T)
  126.          (if pts0
  127.            (setq ai_pts0 nil)
  128.          )
  129.         )
  130.   )
  131. )
  132.  
  133. (defun ai_pdsize_r ()
  134.   (if ai_pts
  135.     (progn  
  136.       (setq ai_pt_do T ai_pts0 nil ai_ptunt 2)
  137.       (set_tile ;|MSG0|;"pdsize_label" "%")
  138.       (set_tile ;|MSG0|;"pdsize_value" (rtos (setq ai_pts (abs ai_pts)) ai_ptunt))
  139.     )
  140.   )
  141. )
  142.  
  143. (defun ai_pdsize_a ()
  144.   (if ai_pts
  145.     (progn
  146.       (setq ai_pt_do T ai_pts0 nil ai_ptunt (getvar "LUNITS"))
  147.       (if (or (= ai_ptunt 3)
  148.               (= ai_ptunt 4)
  149.           )
  150.         (set_tile ;|MSG0|;"pdsize_label" "")
  151.         (set_tile "pdsize_label" "Unidades")
  152.       )
  153.       (set_tile ;|MSG0|;"pdsize_value" (rtos (setq ai_pts (abs ai_pts)) ai_ptunt))
  154.     )
  155.   )
  156. )
  157.  
  158. (defun ai_ptype_main (/ globals)
  159.   (ai_ptype_start)
  160.   (mode_tile ai_ptmode 4)
  161.   (if (<= ai_pts 0.0)
  162.     (progn
  163.       (set_tile ;|MSG0|;"pdsize_r" "1")
  164.       (set_tile ;|MSG0|;"pdsize_label" "%")
  165.       (setq ai_ptunt 2)
  166.     )
  167.     (progn
  168.       (set_tile ;|MSG0|;"pdsize_a" "1")
  169.       (setq ai_ptunt (getvar "LUNITS"))
  170.       (if (or (= ai_ptunt 3)
  171.               (= ai_ptunt 4)
  172.           )
  173.         (set_tile ;|MSG0|;"pdsize_label" "")
  174.         (set_tile "pdsize_label" "Unidades")
  175.       )
  176.     )
  177.   )
  178.   (set_tile ;|MSG0|;"pdsize_value" (rtos (setq ai_pts (abs ai_pts)) ai_ptunt))
  179.   (foreach pd0 ai_pts_lst
  180.     (action_tile (strcat "pdmode" pd0) 
  181.       ;|MSG0|;"(mode_tile ai_ptmode 4)(setq ai_ptmode $key)(mode_tile ai_ptmode 4)"
  182.     )
  183.   )
  184.   (action_tile ;|MSG0|;"pdsize_value" "(setq ai_pts (distof $value)) (ai_chk_pts T)")
  185.   (action_tile ;|MSG0|;"pdsize_r" "(ai_pdsize_r)")
  186.   (action_tile ;|MSG0|;"pdsize_a" "(ai_pdsize_a)")
  187.   (action_tile ;|MSG0|;"accept" "(ai_ptype_set)")
  188.   (action_tile ;|MSG0|;"help" "(help \"\" \"ddptype\")")
  189.   (start_dialog)
  190. )
  191.  
  192. (defun c:ddptype (/ app dcl_id old_cmd ai_pts_do ai_ptmode ai_pts 
  193.                     ai_pts0 undo_init ai_ptunt)
  194.  
  195.   ;; Set up error function.
  196.   (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
  197.         old_error  *error*            ; save current error function
  198.         *error* ai_error              ; new error function
  199.   )
  200.  
  201.   (setvar "cmdecho" 0)
  202.  
  203.   (cond
  204.      (  (not (ai_trans)))                        ; transparent OK
  205.      (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?
  206.      (  (not (setq dcl_id (ai_dcl ;|MSG0|;"ddptype"))))  ; is .DCL file loaded?
  207.      (T 
  208.         (if (/= 1 (logand (getvar "CMDACTIVE") 1)) (ai_undo_push))
  209.         (ddptype_main)        
  210.         (if (/= 1 (logand (getvar "CMDACTIVE") 1)) (ai_undo_pop))
  211.      )                          ; proceed!
  212.   )
  213.  
  214.   (setq *error* old_error) 
  215.   (setvar "cmdecho" old_cmd)
  216.   (princ)
  217. )
  218.  
  219. (defun ddptype_main()
  220.   (if (not (new_dialog ;|MSG0|;"ddptype" dcl_id))
  221.     (exit)
  222.   )
  223.   
  224.   (setq ai_ptmode (strcat "pdmode" (itoa (getvar "PDMODE"))) 
  225.         ai_pts (getvar "PDSIZE")
  226.   )
  227.   (setvar "CMDECHO" 0)
  228.   (if (= ai_pts 0.0)
  229.     (setq ai_pts -5.0 ai_pts0 T)
  230.   )
  231.   (ai_ptype_main)
  232.  
  233.   (princ)
  234. )
  235.  
  236. (princ "  DDPTYPE cargada.  ")
  237. (princ)
  238.