Changeset 133 for trunk/SRC/Colors/lct.pro
- Timestamp:
- 07/07/06 11:57:27 (18 years ago)
- Location:
- trunk/SRC/Colors
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Colors/lct.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:lct6 5 ; 7 ; PURPOSE:plus court que de taper loadct,file='palette.tbl' 6 ; @file_comments 7 ; Fastest than type loadct,file='palette.tbl' 8 8 ; 9 ; CATEGORY:flemme9 ; @categories graphics, color specification 10 10 ; 11 ; CALLING SEQUENCE:lct[,numerp_couleur]11 ; @param numpal {in}{optional} number of the color palette we want to select in the file palette.tbl 12 12 ; 13 ; INPUTS:optionnel: numero de la couleur que l''on veut ds palette.tbl 14 ; 15 ; KEYWORD PARAMETERS: ceux de loadct 16 ; 17 ; LIGHTNESS: a scalar used to change the Lightness of the color 13 ; @keyword LIGHTNESS a scalar used to change the Lightness of the color 18 14 ; palette to be abble to adjust according to the printer we use, 19 15 ; the media (paper or slide)... … … 21 17 ; > 1 to get darker colors 22 18 ; 23 ; rq: si le mot cle file n''est pas specifie, on cherche un fichier24 ; contenant les palette du nom depalette.tbl.25 ; Ce fichier peut etre dans n''importe quel repertoire du!path19 ; @keyword FILE {default=palette.tbl} is not specified, we are looking a file containing 20 ; palettes named palette.tbl. 21 ; This file can be in any directory of the !path 26 22 ; 27 ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) 28 ; 30/3/1999 ajout de _extra, de la recherche 29 ; du nom complet et pour que ca marche aussi en 30 ; mode PS et Z 31 ; 6/7/1999: compatibilite mac et windows 23 ; @keyword GET_NAME Set this keyword to a named variable in which the names of the color tables 24 ; are reurned as a string array. No changes are made to the color table. 25 ; 26 ; @keyword _EXTRA Used to pass your keywords 27 ; 28 ; @history Sebastien Masson (smasson@lodyc.jussieu.fr) 29 ; 30/3/1999: add extra 30 ; 6/7/1999: mac/windows comptibility 31 ; 32 ; @version $Id$ 33 ; 32 34 ;- 33 35 ;------------------------------------------------------------ 34 36 ;------------------------------------------------------------ 35 37 ;------------------------------------------------------------ 36 PRO lct, num ero, GET_NAME = get_name, LIGHTNESS = Lightness, _EXTRA = ex38 PRO lct, numpal, FILE = file, GET_NAME = get_name, LIGHTNESS = Lightness, _EXTRA = ex 37 39 ; 38 40 compile_opt idl2, strictarrsubs 39 41 ; 40 42 @common 41 ; le mot cle file est passe par l''intermediere de EXTRA? 42 ; definition du mon du fichier qui contient les palettes de couleur 43 if n_elements(ex) NE 0 then BEGIN 44 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then nompal=ex.FILE ELSE nompal='palette.tbl' 45 ENDIF ELSE nompal = 'palette.tbl' 46 ; quelle est l''adresse complete de nompal? 43 ; definition of the name of the file containing colors palettes. 44 if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl' 45 ; What is the full adress of nametbl? 47 46 thisOS = strupcase(strmid(!version.os_family, 0, 3)) 48 47 CASE thisOS of … … 52 51 ENDCASE 53 52 cd, current = current 54 if strpos(n ompal,sep) lt 0 then BEGIN53 if strpos(nametbl,sep) lt 0 then BEGIN 55 54 if rstrpos(current,sep) NE strlen(current)-1 then current = current+sep 56 55 multipath = str_sep(!path,pathsep) … … 58 57 if rstrpos(multipath[i],sep) NE strlen(multipath[i])-1 then $ 59 58 multipath[i] = multipath[i] +sep 60 n ompal = [current, multipath]+ nompal59 nametbl = [current, multipath]+ nametbl 61 60 ENDIF 62 ; on test tous les noms possibles pour trouver ou est le fichier63 nfile=n_elements(n ompal)61 ; we test all possible name in order to find where file is. 62 nfile=n_elements(nametbl) 64 63 n = 0 65 64 repeat begin 66 res = findfile(n ompal[n])65 res = findfile(nametbl[n]) 67 66 n = n+1 68 endrep until res[0] NE '' OR n EQ n_elements(n ompal)67 endrep until res[0] NE '' OR n EQ n_elements(nametbl) 69 68 if res[0] NE '' then BEGIN 70 n ompal = nompal[n-1]69 nametbl = nametbl[n-1] 71 70 if n_elements(ex) NE 0 then $ 72 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nompal 73 ; si on est en mode POSTSCRIPT, il faut repasser en mode X pour 74 ; changer la palette de couleur 71 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl 72 ; if we are in POSTSCRIPT mode, we have to pass in X mode in order to change the color palette 75 73 oldname = !d.name 76 74 if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN … … 89 87 ; 90 88 if arg_present(get_name) then begin 91 if n_elements(num ero) EQ 0 then loadct, file=nompal, GET_NAME = get_name, _EXTRA = ex $92 ELSE loadct,num ero, file=nompal, /silent, GET_NAME = get_name,_EXTRA = ex89 if n_elements(numpal) EQ 0 then loadct, file=nametbl, GET_NAME = get_name, _EXTRA = ex $ 90 ELSE loadct,numpal, file=nametbl, /silent, GET_NAME = get_name,_EXTRA = ex 93 91 ENDIF ELSE BEGIN 94 if n_elements(num ero) EQ 0 then loadct, file=nompal, _EXTRA = ex $95 ELSE loadct,num ero, file=nompal, /silent, _EXTRA = ex92 if n_elements(numpal) EQ 0 then loadct, file=nametbl, _EXTRA = ex $ 93 ELSE loadct,numpal, file=nametbl, /silent, _EXTRA = ex 96 94 ENDELSE 97 95 ;
Note: See TracChangeset
for help on using the changeset viewer.