source: trunk/SRC/Postscript/openps.pro @ 121

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

correction of some *.pro using aspell list; introduction of default idldoc syntax

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments switch to postcript mode and define it
7;
8; @param namepsin {in}{optional} name of the postscript file. Extension '.ps' is added
9;                if missing. It will be stored in the psdir directory.
10;
11; @keyword FILENAME to define the name of the postcript file through
12;                  a keyword rather than with nameps inut argument
13;                  (in this case the keyword can be pass through
14;                  different routines via _extra keyword).
15;
16; @keyword INFOWIDGET If INFOWIDGET is present, it specifies a named
17;             variable into which the id of the widget giving informations
18;             about the postscript creation is stored as a long integer.
19;             This id is needed by close ps to kill the information widget.
20;
21; @keyword KEEP_PFONT activate to suppress the modification of !p.font
22;            (by default we force  !p.font = 0  to make smaller postscripts)
23; @keyword PORTRAIT
24; @keyword LANDSCAPE
25; @keyword KEEPPFONT same as keep_pfont
26;
27; @keyword LIGHTNESS a scalar used to change the Lightness of the color
28;            palette to be abble to adjust according to the printer we use,
29;            the media (paper or slide)...
30;               lightness < 1 to get lighter colors
31;                         > 1 to get darker colors
32;
33; @keyword _EXTRA used to pass any keyword to device procedure.
34;
35; @uses cm_4ps
36;
37; @history Sebastien Masson (smasson\@lodyc.jussieu.fr)
38; 21/12/98
39; 1/2/98: ajout de nameps en input
40; 1/9/1999: ajout du mot cle FILENAME et du widget
41; June 2005: Sebastien Masson, cleaning, english version with new commons
42;
43; @version $Id$
44;
45;-
46;------------------------------------------------------------
47;------------------------------------------------------------
48;------------------------------------------------------------
49pro openps, namepsin, FILENAME = filename, INFOWIDGET = infowidget $
50            , KEEPPFONT = keeppfont, KEEP_PFONT = keep_pfont $
51            , PORTRAIT = portrait, LANDSCAPE = landscape $
52            , LIGHTNESS = Lightness,_extra = ex
53;
54;
55  compile_opt idl2, strictarrsubs
56;
57   IF lmgr(/demo) EQ 1 THEN BEGIN
58      dummy = report('impossible to create a PS in demo mode')
59      return
60   ENDIF
61;------------------------------------------------------------
62; include commons
63@cm_4ps
64IF NOT keyword_set(key_forgetold) THEN BEGIN
65@updatenew
66ENDIF
67;------------------------------------------------------------
68; close the postcript device if we are already in postcsrit mode
69   IF !d.name EQ 'PS' THEN device, /close
70; switch to postscript mode
71   set_plot,'ps'
72;------------------------------------------------------------
73; if we use  keyword Lightness
74; save the actual color palette in a temporary file
75; (to be restored when calling closeps
76;------------------------------------------------------------
77   IF n_elements(Lightness) NE 0 THEN BEGIN
78     IF Lightness NE 1 THEN BEGIN
79       tvlct, red, green, blue, /get
80       def_myuniquetmpdir
81       save, red, green, blue, filename = myuniquetmpdir + 'original_colors.dat'
82       palit, Lightness, red, green, blue
83     ENDIF
84   ENDIF
85;------------------------------------------------------------
86; we define the name of the file
87;------------------------------------------------------------
88   CASE 1 OF
89     n_params() EQ 1:nameps = namepsin
90     keyword_set(filename): nameps = filename
91     ELSE:nameps = xquestion('Name of the postscript file?', 'idl.ps', /chkwid)
92   ENDCASE
93; make sure that nameps ends with '.ps'
94   nameps = file_dirname(nameps, /mark_directory) + $
95            file_basename(nameps, '.ps') + '.ps'
96; add path (psdir) and check that nameps is ok
97   nameps = isafile(nameps, iodir = psdir, /new)
98;------------------------------------------------------------
99; we define xsize, ysize, xoffset et  yoffset
100;------------------------------------------------------------
101   IF n_elements(portrait) NE 0 OR n_elements(landscape) NE 0 THEN $
102     key_portrait = keyword_set(portrait) * (1 - keyword_set(landscape))
103
104   if key_portrait EQ 1 then begin
105      xs = min(page_size)
106      ys = max(page_size)
107      xoff = 0.
108      yoff = 0.
109   ENDIF ELSE BEGIN
110      xs = max(page_size)
111      ys = min(page_size)
112      xoff = 0.
113      yoff = max(page_size)
114   ENDELSE
115;------------------------------------------------------------
116; We define the device of the postscript mode
117;------------------------------------------------------------
118   device, /color, /palatino, filename = strcompress(nameps, /remove_all) $
119           , LANDSCAPE = 1 - key_portrait, PORTRAIT = key_portrait $
120           , xsize = xs, ysize = ys, xoffset = xoff, yoffset = yoff $
121           , bits_per_pixel = 8, _extra = ex
122; to make smaller postcripts
123   IF NOT (keyword_set(keeppfont) OR keyword_set(keep_pfont)) $
124   THEN !p.font = 0
125; show some informations
126   IF arg_present(infowidget) THEN $
127    infowidget = xnotice('Postcript file is currently processed...')
128;
129   RETURN
130END
131
132
133
134
135
136
137
138
139
140
141
142
Note: See TracBrowser for help on using the repository browser.