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
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
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; 'colors1.tbl'.
10;
11; @categories graphic, color specification
12;
13; @param namepal {in}{required}
14; It is a string containing the name of the new palette we want to write.
15;
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
19;
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
24;
25; @keyword _extra
26; Used to pass your keywords
27;
28; @history Guillaume Roulet (gr@lodyc.jussieu.fr)
29; 30/3/1999 s.masson, add _extra, research of the full name, OVER
30;                       5/5/1999 s.masson
31;
32; @version $Id$
33;
34; @todo seb cleaning + traduction
35;-
36;------------------------------------------------------------
37;------------------------------------------------------------
38;------------------------------------------------------------
39pro newpalette,namepal, FILE = file, OVER = over, _extra = ex
40;
41  compile_opt idl2, strictarrsubs
42;
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?
51      spawn, 'whoami', login
52      appartient = strpos(nametbl, login[0])
53      if appartient EQ -1 then begin
54         ouinon = report('Le fichier '+nametbl+' ne vous appartient pas, Voulez-vous copier le fichier '+nomcourt+' dans le repertoire courant: '+current+' ?', /default_no, /question)
55         if ouinon then return ELSE BEGIN
56            spawn, 'cp '+nametbl+' '+nomcourt ; copy
57            nametbl = nomcourt
58            spawn,  'chmod u+w '+nametbl ; give writing rights
59         ENDELSE
60      endif
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)
64      if NOT ouinon then return
65      nomfichsource = filepath('colors1.tbl', subdir=['resource', 'colors'])
66      spawn,'cp '+nomfichsource+' '+nametbl ; copy
67      spawn,  'chmod u+w '+nametbl ; give writing rights
68   ENDELSE
69
70   if n_elements(ex) NE 0 then $
71    if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl
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
78   modifyct,over,namepal,r,g,b,file=nametbl, _extra = ex
79;
80   return
81end
Note: See TracBrowser for help on using the repository browser.