source: trunk/SRC/Colors/newpalette.pro @ 136

Last change on this file since 136 was 136, checked in by pinsard, 18 years ago

some improvements and corrections in some .pro file according to
aspell and idldoc log file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.0 KB
RevLine 
[2]1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
[133]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
[2]9; 'colors1.tbl'.
10;
[133]11; @categories graphic, color specification
[2]12;
[136]13; @param namepal {in}{required}
14; It is a string containing the name of the new palette we want to write.
[2]15;
[136]16; @keyword OVER
17; It is a whole number which designate the number of the palette
18; we want to replace the palette on the screen
[2]19;
[136]20; @keyword FILE {default=palette.tbl}
21; if not specified, we are looking a file containing palettes named palette.tbl.
22; This file can be in any directory of the !path
23; On the other hand it must be writable
[2]24;
[136]25; @keyword _extra
26; Used to pass your keywords
[2]27;
[133]28; @history Guillaume Roulet (gr@lodyc.jussieu.fr)
[136]29; 30/3/1999 s.masson, add _extra, research of the full name, OVER
[133]30;                       5/5/1999 s.masson
[2]31;
[133]32; @version $Id$
33;
34; @todo seb cleaning + traduction
[2]35;-
36;------------------------------------------------------------
37;------------------------------------------------------------
38;------------------------------------------------------------
[133]39pro newpalette,namepal, FILE = file, OVER = over, _extra = ex
[114]40;
41  compile_opt idl2, strictarrsubs
42;
[133]43; definition of the name of the file containing colors palettes.
44   if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl'
45   nomcourt = nametbl
46; What is the full adress of nametbl?
47   nametbl = find(nametbl)
48   if nametbl[0] NE 'NOT FOUND' then begin
49      nametbl = nametbl[0]
50; does nametbl is our?
[2]51      spawn, 'whoami', login
[133]52      appartient = strpos(nametbl, login[0])
[2]53      if appartient EQ -1 then begin
[133]54         ouinon = report('Le fichier '+nametbl+' ne vous appartient pas, Voulez-vous copier le fichier '+nomcourt+' dans le repertoire courant: '+current+' ?', /default_no, /question)
[2]55         if ouinon then return ELSE BEGIN
[133]56            spawn, 'cp '+nametbl+' '+nomcourt ; copy
57            nametbl = nomcourt
58            spawn,  'chmod u+w '+nametbl ; give writing rights
[2]59         ENDELSE
60      endif
[133]61   ENDIF ELSE BEGIN             ; no file nametbl found
62      nametbl = nomcourt         ; we reclaim the nametbl source
63      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)
[2]64      if NOT ouinon then return
65      nomfichsource = filepath('colors1.tbl', subdir=['resource', 'colors'])
[133]66      spawn,'cp '+nomfichsource+' '+nametbl ; copy
67      spawn,  'chmod u+w '+nametbl ; give writing rights
[2]68   ENDELSE
69
70   if n_elements(ex) NE 0 then $
[133]71    if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl
[2]72;
73   tvlct,r,g,b,/get
74   r=congrid(r,256)
75   g=congrid(g,256)
76   b=congrid(b,256)
77   IF n_elements(over) EQ 0 then over = 255
[133]78   modifyct,over,namepal,r,g,b,file=nametbl, _extra = ex
[2]79;
80   return
81end
Note: See TracBrowser for help on using the repository browser.