;------------------------------------------------------------------------------- ; Program Name: ViewDcl.lsp - [View Dcl Dialogs R4] ; Created By: Terry Miller (Email: terrycadd@yahoo.com) ; (URL: http://web2.airmail.net/terrycad) ; Date Created: 2-20-00 ; Function: View Dcl Dialogs ; Note: The first line of each dialog description must be in the format ; of the standard convention. i.e. "DialogName : dialog {" ;------------------------------------------------------------------------------- ; Revision History ; Rev By Date Description ;------------------------------------------------------------------------------- ; 1 TM 2-20-00 Initial version ; 2 TM 3-20-00 Revised dialog design to include more lines and options. ; 3 TM 6-20-06 Revised and included the functions NoSpaces and WordList. ; 4 TM 7-20-09 Revised the variable *DclPathFilename$ in the ViewDcl ; function. If the AcadDoc.lsp file is not found the users ; may need to edit the filename as required. ;------------------------------------------------------------------------------- ; c:ViewDcl - Utility to View Dcl Dialogs ;------------------------------------------------------------------------------- (defun c:Dcl ()(c:ViewDcl));Shortcut (defun c:ViewDcl (/ Cnt# Dcl_Id% DialogList@ DialogName$ FileName% Index$ Loop PathFilename$ Return# Text$ Title$) (princ "\nSelect Dialog File to View")(princ) (if (not *DclPathFilename$) (if (findfile "AcadDoc.lsp");Change to current filename (setq *DclPathFilename$ (vl-filename-directory (findfile "AcadDoc.lsp"))) (setq *DclPathFilename$ "C:\\") );if );if (if (setq PathFilename$ (getfiled " Select Dialog File" *DclPathFilename$ "dcl" 20)) (setq *DclPathFilename$ (vl-filename-directory PathFilename$)) (exit) );if (setq Title$ (strcat " View " (vl-filename-base PathFilename$) ".dcl")) (setq FileName% (open PathFilename$ "r")) (princ "\nSelect Dialog to View ")(princ) (setq Cnt# 0 DialogList@ nil) (while (setq Text$ (read-line FileName%)) (if (and (wcmatch Text$ "*:*" )(wcmatch Text$ "*dialog*" )) (progn (setq DialogName$ (nth 0 (WordList (NoSpaces Text$)))) (if (/= (substr DialogName$ 1 2) "//") (setq DialogList@ (append DialogList@ (list DialogName$))) );if );progn );if (setq Cnt# (1+ Cnt#)) );while (close FileName%) (setq Index$ "0" Loop t) (while Loop (setq Dcl_Id% (load_dialog "ViewDcl.dcl")) (new_dialog "ViewDcl" Dcl_Id%) (start_list "DialogList")(mapcar 'add_list DialogList@)(end_list) (set_tile "Title" Title$) (set_tile "DialogList" Index$) (action_tile "DialogList" "(setq Index$ $value)") (setq Return# (start_dialog)) (unload_dialog Dcl_Id%) (cond ((= Return# 1) (progn (setq DialogName$ (nth (atoi Index$) DialogList@)) (setq Dcl_Id% (load_dialog PathFilename$)) (new_dialog DialogName$ Dcl_Id%) (start_dialog) (unload_dialog Dcl_Id%) );progn );case ((= Return# 0)(setq Loop nil)) );cond );while (princ) );defun c:ViewDcl ;------------------------------------------------------------------------------- ; Start of ViewDcl Support Utility Functions ;------------------------------------------------------------------------------- ; NoSpaces - Truncates left and right spaces from a string. ; Arguments: 1 ; Str$ = String ; Returns: String with the left and right spaces truncated. ;------------------------------------------------------------------------------- (defun NoSpaces (Str$) (vl-string-trim " " Str$) );defun NoSpaces ;------------------------------------------------------------------------------- ; WordList - Returns a list of words in a sentence ; Arguments: 1 ; Sentence$ = String to convert into a list strings ; Syntax: (WordList "Words in a sentence") = (list "Words" "in" "a" "sentence") ; Returns: List of words or strings that were seperated by spaces in a sentence ;------------------------------------------------------------------------------- (defun WordList (Str$ / List@ Num#) (while (setq Num# (vl-string-search " " Str$)) (setq List@ (cons (substr Str$ 1 Num#) List@) Str$ (substr Str$ (+ Num# 2)) );setq );while (reverse (cons Str$ List@)) );defun WordList ;------------------------------------------------------------------------------- (princ);End of ViewDcl.lsp