source: trunk/ToBeReviewed/COULEURS/lct.pro @ 69

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

upgrade of COULEURS according to cerbere.lodyc.jussieu.fr: /usr/home/smasson/SAXO_RD/ : files

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME:lct
6;
7; PURPOSE:plus court que de taper loadct,file='palette.tbl'
8;
9; CATEGORY:flemme
10;
11; CALLING SEQUENCE:lct[,numerp_couleur]
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
18;            palette to be abble to adjust according to the printer we use,
19;            the media (paper or slide)...
20;               lightness < 1 to get lighter colors
21;                         > 1 to get darker colors
22;
23; rq: si le mot cle file n''est pas specifie, on cherche un fichier
24; contenant les palette du nom de palette.tbl.
25; Ce fichier peut etre dans n''importe quel repertoire du !path
26;
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
32;-
33;------------------------------------------------------------
34;------------------------------------------------------------
35;------------------------------------------------------------
36PRO lct, numero, GET_NAME = get_name, LIGHTNESS = Lightness, _EXTRA = ex
37@common
38; le mot cle file est passe par l''intermediere de EXTRA?
39; definition du mon du fichier qui contient les palettes de couleur
40   if n_elements(ex) NE 0 then BEGIN
41      if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then nompal=ex.FILE ELSE nompal='palette.tbl'
42   ENDIF ELSE nompal = 'palette.tbl'
43; quelle est l''adresse complete de nompal?
44   thisOS = strupcase(strmid(!version.os_family, 0, 3))
45   CASE thisOS of
46   'MAC':BEGIN & sep = ':' & pathsep = ',' & end
47   'WIN':BEGIN & sep = '\' & pathsep = ';' & end
48   ELSE: BEGIN & sep = '/' & pathsep = ':' & end
49   ENDCASE
50   cd, current = current
51   if strpos(nompal,sep) lt 0 then BEGIN
52      if rstrpos(current,sep) NE strlen(current)-1 then current = current+sep
53      multipath = str_sep(!path,pathsep)
54      for i = 0, n_elements(multipath)-1 do $
55       if rstrpos(multipath[i],sep) NE strlen(multipath[i])-1 then $
56       multipath[i] = multipath[i] +sep
57      nompal = [current, multipath]+ nompal
58   ENDIF
59; on test tous les noms possibles pour trouver ou est le fichier
60   nfile=n_elements(nompal)
61   n = 0
62   repeat begin
63      res = findfile(nompal[n])
64      n = n+1
65   endrep until res[0] NE '' OR n EQ n_elements(nompal)
66   if res[0] NE '' then BEGIN
67      nompal = nompal[n-1]
68      if n_elements(ex) NE 0 then $
69       if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nompal
70; si on est en mode POSTSCRIPT, il faut repasser en mode X pour
71; changer la palette de couleur
72      oldname = !d.name
73      if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN
74         thisOS = !VERSION.OS_FAMILY
75         thisOS = STRMID(thisOS, 0, 3)
76         thisOS = STRUPCASE(thisOS)
77         CASE thisOS of
78            'MAC': SET_PLOT, thisOS
79            'WIN': SET_PLOT, thisOS
80            ELSE: SET_PLOT, 'X'
81         ENDCASE
82         !p.BACKGROUND=(!d.n_colors-1) < 255
83         !p.color=0
84         if !d.n_colors gt 256 then !p.background='ffffff'x
85      ENDIF
86;
87      if arg_present(get_name) then begin
88         if n_elements(numero) EQ 0 then loadct, file=nompal, GET_NAME = get_name, _EXTRA = ex $
89         ELSE loadct,numero, file=nompal, /silent, GET_NAME = get_name,_EXTRA = ex
90      ENDIF ELSE BEGIN
91         if n_elements(numero) EQ 0 then loadct, file=nompal, _EXTRA = ex $
92         ELSE loadct,numero, file=nompal, /silent, _EXTRA = ex
93      ENDELSE
94;
95      if oldname EQ 'PS' AND keyword_set(lightness) then palit, lightness
96;
97      set_plot, oldname
98      IF oldname EQ 'X' OR oldname EQ 'MAC' OR oldname EQ 'WIN' then BEGIN
99         !p.BACKGROUND=(!d.n_colors-1) < 255
100         !p.color=0
101         if !d.n_colors gt 256 then !p.background='ffffff'x
102      ENDIF
103
104   ENDIF ELSE ras = report('le fichier de palettes demande n''existe pas...')
105
106   return
107end
Note: See TracBrowser for help on using the repository browser.