Changeset 133 for trunk/SRC/Colors/newpalette.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/newpalette.pro
r132 r133 3 3 ;------------------------------------------------------------ 4 4 ;+ 5 ; NAME:newpalette6 5 ; 7 ; PURPOSE:permet de stocker la palette qui est a l''ecran dans un 8 ; fichier du meme type que celui fournit par defaut dans IDL: 6 ; @file_comments 7 ; Allows to stock the palette which is on the screen 8 ; in a same type file than the one gave by default in IDL 9 9 ; 'colors1.tbl'. 10 10 ; 11 ; CATEGORY:pour garder ses jolies palettes perso.11 ; @categories graphic, color specification 12 12 ; 13 ; CALLING SEQUENCE:newpalette,nom_de_palette13 ; @param namepal {in}{required} It is a string containing the name of the new palettte we want to write. 14 14 ; 15 ; INPUTS:nom_de_palette: c'est un string qui contient le nom de la16 ; nouvelle palette que l''on veut ecrire.15 ; @keyword OVER It is a whole number which designate the number of the palette 16 ; we want to replace the palette on the screen 17 17 ; 18 ; KEYWORD PARAMETERS: 18 ; @keyword FILE {default=palette.tbl} is not specified, we are looking a file containing 19 ; palettes named palette.tbl. 20 ; This file can be in any directory of the !path 21 ; On the other hand it must be writable 19 22 ; 20 ; OVER: c''est un entier qui designe le numero de la palette que l''on 21 ; veut remplacer par la palette a l''ecran. 22 ; 23 ; + ceux de modifyct 23 ; @keyword _extra Used to pass your keywords 24 24 ; 25 ; rq: si le mot cle file n''est pas specifie, on cherche un fichier 26 ; contenant les palettes du nom de palette.tbl. 27 ; Ce fichier peut etre dans n''importe quel repertoire du !path 28 ; Par contre il doit etre en droit d''ecriture 25 ; @history Guillaume Roulet (gr@lodyc.jussieu.fr) 26 ; 30/3/1999 s.masson, add _extra, research of the full name, OVER 27 ; 5/5/1999 s.masson 29 28 ; 30 ; MODIFICATION HISTORY: Guillaume Roulet (gr@lodyc.jussieu.fr) 31 ; 30/3/1999 s.masson, ajout de _extra, de le 32 ; recherche du nom complet, de OVER et du blabla 33 ; 5/5/1999 s.masson, va copie eventuelle du 34 ; fichier contenant les palettes 29 ; @version $Id$ 30 ; 31 ; @todo seb cleaning + traduction 35 32 ;- 36 33 ;------------------------------------------------------------ 37 34 ;------------------------------------------------------------ 38 35 ;------------------------------------------------------------ 39 pro newpalette,nom, OVER = over, _extra = ex 40 ; le mot cle file est passe par l''intermediere de EXTRA? 41 ; definition du mon du fichier qui contient les palettes de couleur 36 pro newpalette,namepal, FILE = file, OVER = over, _extra = ex 42 37 ; 43 38 compile_opt idl2, strictarrsubs 44 39 ; 45 if n_elements(ex) NE 0 then BEGIN 46 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then nompal=ex.FILE ELSE nompal='palette.tbl' 47 ENDIF ELSE nompal = 'palette.tbl' 48 nomcourt = nompal 49 ; quelle est l''adresse complete de nompal? 50 nompal = find(nompal) 51 if nompal[0] NE 'NOT FOUND' then begin 52 nompal = nompal[0] 53 ; nompal nous appartient??? 40 ; definition of the name of the file containing colors palettes. 41 if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl' 42 nomcourt = nametbl 43 ; What is the full adress of nametbl? 44 nametbl = find(nametbl) 45 if nametbl[0] NE 'NOT FOUND' then begin 46 nametbl = nametbl[0] 47 ; does nametbl is our? 54 48 spawn, 'whoami', login 55 appartient = strpos(n ompal, login[0])49 appartient = strpos(nametbl, login[0]) 56 50 if appartient EQ -1 then begin 57 ouinon = report('Le fichier '+n ompal+' ne vous appartient pas, Voulez-vous copier le fichier '+nomcourt+' dans le repertoire courant: '+current+' ?', /default_no, /question)51 ouinon = report('Le fichier '+nametbl+' ne vous appartient pas, Voulez-vous copier le fichier '+nomcourt+' dans le repertoire courant: '+current+' ?', /default_no, /question) 58 52 if ouinon then return ELSE BEGIN 59 spawn, 'cp '+n ompal+' '+nomcourt ; on copie60 n ompal = nomcourt61 spawn, 'chmod u+w '+n ompal ; on se donne les droits d''ecriture53 spawn, 'cp '+nametbl+' '+nomcourt ; copy 54 nametbl = nomcourt 55 spawn, 'chmod u+w '+nametbl ; give writing rights 62 56 ENDELSE 63 57 endif 64 ENDIF ELSE BEGIN ; aucun fichier nompal a ete trouve65 n ompal = nomcourt ; on recupe le nompal d''origine66 ouinon = report('le fichier de palettes demande '+n ompal+' n''existe pas ds les repertoires !path. Voulez-vous cree un fichier '+nompal+' dans le repertoire courant', /default_no, /question)58 ENDIF ELSE BEGIN ; no file nametbl found 59 nametbl = nomcourt ; we reclaim the nametbl source 60 ouinon = report('le fichier de palettes demande '+nametbl+' n''existe pas ds les repertoires !path. Voulez-vous cree un fichier '+nametbl+' dans le repertoire courant', /default_no, /question) 67 61 if NOT ouinon then return 68 62 nomfichsource = filepath('colors1.tbl', subdir=['resource', 'colors']) 69 spawn,'cp '+nomfichsource+' '+n ompal ; on copie70 spawn, 'chmod u+w '+n ompal ; on se donne les droits d''ecriture63 spawn,'cp '+nomfichsource+' '+nametbl ; copy 64 spawn, 'chmod u+w '+nametbl ; give writing rights 71 65 ENDELSE 72 66 73 67 if n_elements(ex) NE 0 then $ 74 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = n ompal68 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl 75 69 ; 76 70 tvlct,r,g,b,/get … … 79 73 b=congrid(b,256) 80 74 IF n_elements(over) EQ 0 then over = 255 81 modifyct,over,n om,r,g,b,file=nompal, _extra = ex75 modifyct,over,namepal,r,g,b,file=nametbl, _extra = ex 82 76 ; 83 77 return
Note: See TracChangeset
for help on using the changeset viewer.