home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
felixcad
/
fcaddata.z
/
FLX_TABM.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1996-09-30
|
9KB
|
240 lines
;;; FLX_TABM.LSP
;;; ===========================================================
;;; (C)opyright: Felix Computer Aided Technologies GmbH 1995-96
;;; Created: May 29, 1996 dn
;;; Modified: Sep 25, 1996 vp
;;; ===========================================================
;;; Command: TABSERVICE
;;; Dialog to modify drawing symbol tables:
;;; Delete, rename, purge table entries
;;; ===========================================================
(defun FLX_TABSERVICE ( / prt_list dlg_id dlg_file ret tables
Dlg_Init_Func SET_DLG SHOW_TABLE_ENTRIES
TABLE_RENAME TABLE_DELETE TABLE_PURGE FILTER_NAME)
(setq prt_list (list
"No item!" ;0
"not referenced" ;1
"Cannot rename this entry in '" ;2
"'!" ;3
"These entries cannot be deleted: " ;4
"Alert" ;5
"No item in this table!" ;6
))
(if FLX_XLANGUAGE (FLX_XLANGUAGE "_tabm" nil))
;;; -------------------------------------------------------------------
(setq tables
(list "BLOCK" "DIMSTYLE" "LAYER" "LTYPE" "STYLE" "UCS" "VIEW")
)
;;;---------------------------------------------------------------------
;;; One or more entries have been selected from the list box...
;;;---------------------------------------------------------------------
(defun SET_DLG ( / sel_ent tmp tname)
(setq tname (Dlg_TileGet "tables"))
(Dlg_ListStart "table_entries" 12)
(while (setq tmp (Dlg_ListGet))
(setq sel_ent (cons (FILTER_NAME (cadr tmp)) sel_ent))
)
(Dlg_ListEnd)
(cond
((= (length sel_ent) 0)
(Dlg_TileSet "edit_name" "")
(Dlg_TileMode "edit_name" 1)
(Dlg_TileMode "rename" 1)
(Dlg_TileMode "delete" 1)
)
((= (length sel_ent) 1)
(if (OR
(AND (= tname "LAYER")(= (car sel_ent) "0"))
(AND (= tname "STYLE")(= (car sel_ent) "STANDARD"))
(AND (= tname "LTYPE")(= (car sel_ent) "CONTINUOUS"))
)
(progn
(Dlg_TileMode "delete" 1)
(Dlg_TileMode "rename" 1)
(Dlg_TileMode "edit_name" 1)
(Dlg_TileSet "edit_name" "")
)
(progn
(Dlg_TileMode "delete" 0)
(Dlg_TileMode "rename" 0)
(Dlg_TileMode "edit_name" 0)
(Dlg_TileSet "edit_name" (car sel_ent))
)
)
)
((> (length sel_ent) 1)
(Dlg_TileMode "rename" 1)
(Dlg_TileMode "delete" 0)
(Dlg_TileMode "edit_name" 1)
(Dlg_TileSet "edit_name" "")
)
)
)
;;;---------------------------------------------------------------------------
;;; Display all entries of a table in list box
;;;---------------------------------------------------------------------------
(defun SHOW_TABLE_ENTRIES (name / el tmp tlst ref)
(setq tlst '())
(Dlg_TileSet "edit_name" "")
(Dlg_TileMode "delete" 1)
(Dlg_TileMode "rename" 1)
(Dlg_TileMode "purge" 6) ;;; invisible
(Dlg_TileMode "edit_name" 1)
(if (not (setq tmp (tblnext name T)))
(progn
(Dlg_TileSet "message" (nth 0 prt_list)) ;;;@No item!
(Dlg_ListStart "table_entries" 3)(Dlg_ListEnd)
(Dlg_TileMode "purge" 6)
)
(progn
(if (AND (/= name "DIMSTYLE")(/= name "UCS")(/= name "VIEW"))
(setq ref
(if (/= (logand 64 (cdr (assoc 70 tmp))) 64)
(strcat "\t*" (nth 1 prt_list) "*") ;;;@\t*not referenced*
"" ; else
)
)
(setq ref "") ; else
)
(setq tlst (cons (strcat (strcase (cdr (assoc 2 tmp))) ref ) tlst))
(Dlg_TileSet "message" "")
(Dlg_TileMode "purge" 5)
(while (setq tmp (tblnext name))
(if (AND (/= name "DIMSTYLE")(/= name "UCS")(/= name "VIEW"))
(setq ref (if (/= (logand 64 (cdr (assoc 70 tmp))) 64)
(strcat "\t*" (nth 1 prt_list) "*") ;;;@\t*not referenced*
""
))
(setq ref "")
)
(setq tlst (cons (strcat (strcase (cdr (assoc 2 tmp))) ref) tlst))
)
(setq tlst (reverse tlst))
(Dlg_ListSetTabstops "table_entries" "15")
(Dlg_ListStart "table_entries")(mapcar 'Dlg_ListAdd tlst)(Dlg_ListEnd)
)
)
)
;;;---------------------------------------------------------------------------
;;; Rename table entry
;;;---------------------------------------------------------------------------
(defun TABLE_RENAME ( / newname oldname tname)
(setq newname (Dlg_TileGet "edit_name"))
(Dlg_ListStart "table_entries" 12)
(setq oldname (filter_name (cadr (Dlg_ListGet))))
(Dlg_ListEnd)
(setq tname (Dlg_TileGet "tables"))
(if (/= newname oldname)
(progn
(if (tblrename tname oldname newname)
(SHOW_TABLE_ENTRIES tname)
(alert
(strcat (nth 2 prt_list) newname (nth 3 prt_list)) ;;;@
(strcat tname ": " oldname)
"STOP"
)
)
)
)
)
;;;---------------------------------------------------------------------------
;;; Delete table entry
;;;---------------------------------------------------------------------------
(defun TABLE_DELETE ( / newname oldname tname tmp delnames delstr el separator)
(setq tname (Dlg_TileGet "tables"))
(Dlg_ListStart "table_entries" 12)
(while (setq tmp (Dlg_ListGet))
(if (not (tbldel tname (filter_name (cadr tmp))))
(setq delnames (append delnames (list (filter_name (cadr tmp)))))
)
)
(Dlg_ListEnd)
(if delnames
(progn
(setq delstr tname separator ":\n")
(foreach el delnames
(setq delstr (strcat delstr separator el))
(setq separator ", ")
)
(alert
(strcat (nth 4 prt_list) "\n" delstr)
(nth 5 prt_list)
"INFORMATION"
)
)
)
(SHOW_TABLE_ENTRIES tname)
)
;;;---------------------------------------------------------------------------
;;; Purge entire table
;;;---------------------------------------------------------------------------
(defun TABLE_PURGE ( / tname tmp)
(setq tname (Dlg_TileGet "tables"))
(tblpurge tname 0)
(SHOW_TABLE_ENTRIES tname)
)
;;;---------------------------------------------------------------------------
;;; Read from string end to tab stop, truncate from tab stop if neccessary
;;;---------------------------------------------------------------------------
(defun FILTER_NAME (name / ret i)
(if (wcmatch name "*\t*")
(progn
(setq i (strlen name))
(while (AND (> i 0)(not ret))
(if (= (substr name i 1) "\t") (setq ret (substr name 1 (- i 1))))
(setq i (- i 1))
)
)
)
(if (not ret) name ret)
)
;;;---------------------------------------------------------------------
;;; Dialog initialization function
;;;---------------------------------------------------------------------
(defun Dlg_Init_Func ( / i n)
(if FLX$WIN95 (foreach n
'("IDOK" "Static1" "message" "tables" "purge" "rename" "delete"
"edit_name" "table_entries" "GroupBox1")
(Dlg_TileSetFont n 2)
))
(Dlg_ListStart "tables")(mapcar 'Dlg_ListAdd tables)(Dlg_ListEnd) ; fill list box
(Dlg_TileSet "tables" "LAYER")
(SHOW_TABLE_ENTRIES "LAYER") ; LAYER table is default table
(Dlg_TileAction "tables" "(SHOW_TABLE_ENTRIES $value)")
(Dlg_TileAction "table_entries" "(SET_DLG)")
(Dlg_TileAction "rename" "(TABLE_RENAME)")
(Dlg_TileAction "delete" "(TABLE_DELETE)")
(Dlg_TileAction "purge" "(TABLE_PURGE)")
)
;;;---------------------------------------------------------------------------
;;; MAIN
;;;---------------------------------------------------------------------------
(FLX_FUNC_INIT) ;;; Global Error Handler
(if (FLX_DLGDSP "flx_dlg" "TablesModify" "(princ)" "(Dlg_Init_Func)") (princ)(exit))
(FLX_FUNC_EXIT) (setq *error* nil)
(princ)
)
(princ)