;;;C:CLG_COLOR sets the CLG (modified) color field of the layer name from a dialog. ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: 6-30-99 ;;;> EDITED: 04-27-2004 ;;; (DEFUN c:clg_color (/) (SETQ clg_dcl_num (LOAD_DIALOG "clg_color")) (NEW_DIALOG "set_color" clg_dcl_num) (ACTION_TILE "001" "(set_color_no 1)") ; (ACTION_TILE "002" "(set_color_no 2)") ; (ACTION_TILE "003" "(set_color_no 3)") ; (ACTION_TILE "004" "(set_color_no 4)") ; (ACTION_TILE "005" "(set_color_no 5)") ; (ACTION_TILE "006" "(set_color_no 6)") ; (ACTION_TILE "007" "(set_color_no 7)") ; (ACTION_TILE "008" "(set_color_no 8)") ; (ACTION_TILE "009" "(set_color_no 9)") ; (ACTION_TILE "010" "(set_color_no 10)") ; (ACTION_TILE "011" "(set_color_no 11)") ; (ACTION_TILE "012" "(set_color_no 12)") ; (ACTION_TILE "013" "(set_color_no 13)") ; (ACTION_TILE "014" "(set_color_no 14)") ; (ACTION_TILE "015" "(set_color_no 15)") ; (ACTION_TILE "016" "(set_color_no 16)") ; (ACTION_TILE "017" "(set_color_no 17)") ; (ACTION_TILE "018" "(set_color_no 18)") ; (ACTION_TILE "019" "(set_color_no 19)") ; (ACTION_TILE "020" "(set_color_no 20)") ; (ACTION_TILE "021" "(set_color_no 21)") ; (ACTION_TILE "022" "(set_color_no 22)") ; (ACTION_TILE "023" "(set_color_no 23)") ; (ACTION_TILE "024" "(set_color_no 24)") ; (ACTION_TILE "025" "(set_color_no 25)") ; (ACTION_TILE "026" "(set_color_no 26)") ; (ACTION_TILE "027" "(set_color_no 27)") ; (ACTION_TILE "028" "(set_color_no 28)") ; (ACTION_TILE "029" "(set_color_no 29)") ; (ACTION_TILE "250" "(set_color_no 250)") ; (ACTION_TILE "251" "(set_color_no 251)") ; (ACTION_TILE "252" "(set_color_no 252)") ; (ACTION_TILE "253" "(set_color_no 253)") ; (ACTION_TILE "254" "(set_color_no 254)") ; (ACTION_TILE "255" "(set_color_no 255)") ; (ACTION_TILE "color_edit" "(get_color_no(get_tile\"color_edit\"))") ;_ end of action_tile (ACTION_TILE "accept" "(set_clg_color sel_color)(setq clg_act \"(c:mklayr)\")(done_dialog 1)" ) ;_ end of action_tile (ACTION_TILE "cancel" "(setq clg_act nil)") (SETQ cur_colr (IF colr (ATOI colr) (IF colra (- (ASCII colra) 55) 1 ) ;_ end of if ) ;_ end of if ) ;_ end of setq (set_color_no cur_colr) (if (AND colr (<(READ colr)10)(>(READ colr)0)) (SET_TILE "color_edit" (citocs (ATOI colr))) ) (START_DIALOG) (IF clg_act (EVAL (READ clg_act)) ) ;_ end of if (UNLOAD_DIALOG clg_dcl_num) (PRINC) ) ;_ end of defun ; (DEFUN set_color_no (int /) (IF (citocs int) (SET_TILE "color_edit" (citocs int)) ) (START_IMAGE "color_image") (FILL_IMAGE 0 0 40 40 int) (END_IMAGE) (SETQ sel_color (cstoci (GET_TILE "color_edit"))) ) ;_ end of defun ;;; ;;; CSTOCI -- Color string to color index ;;; Convert an arbitrary case string into a color index. ;;; Returns nil if string is not a valid color. ;;; (DEFUN cstoci (str) (IF (AND str (EQ (TYPE str) 'str)) (PROGN (SETQ str (STRCASE str)) (COND ((= str "RED") 1) ((= str "YELLOW") 2) ((= str "GREEN") 3) ((= str "CYAN") 4) ((= str "BLUE") 5) ((= str "MAGENTA") 6) ((= str "WHITE") 7) ((= str "DARK GRAY") 8) ((= str "LIGHT GRAY") 9) ((AND (< 0 (ATOI str)) (> 256 (ATOI str))) (ATOI str)) (T nil) ) ;_ end of cond ) ;_ end of PROGN ) ;_ end of IF ) ;_ end of defun ;;; ;;; CITOCS -- Convert color index into standard color name. ;;; Will return the standard and logical color names as text ;;; strings. Returns nil for out-of-range color indicies. ;;; (DEFUN citocs (i) (COND ((= i 1) "red") ((= i 2) "yellow") ((= i 3) "green") ((= i 4) "cyan") ((= i 5) "blue") ((= i 6) "magenta") ((= i 7) "white") ((= i 8) "dark gray") ((= i 9) "light gray") ((AND (< 0 i) (> 256 i)) (ITOA i)) (T nil) ) ;_ end of cond ) ;_ end of defun ;;; (DEFUN set_clg_color (int /) (COND ((< int 10) (SETQ colri nil colra nil colr (ITOA int) ) ;_ end of setq ) ((<= int 29) (SETQ colr nil colri int colra (CHR (+ int 55)) ) ;_ end of setq ) ((> int 249) (SETQ colr nil colri int colra (COND ((= int 250) "U") ((= int 251) "V") ((= int 252) "W") ((= int 253) "X") ((= int 254) "Y") ((= int 255) "Z") ) ) ;_ end of setq ) ) ;_ end of cond ) ;_ end of defun (defun get_color_no (name / ) (IF (cstoci name) (setq colr (itoa(cstoci name))) ) (if (AND colr (<(READ colr)10)(>(READ colr)0)) (PROGN (START_IMAGE "color_image") (FILL_IMAGE 0 0 40 40 (ATOI colr)) (END_IMAGE) (SETQ cur_colr colr) ) ) ) (PRINC) ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 2 1 0 nil T nil T) ;*** DO NOT add text below the comment! ***|;