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
RevLine 
[2]1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
[104]6; @file_comments switch to postcript mode and define it
[2]7;
[104]8; @param namepsin {in}{optional} name of the postscript file. Extension '.ps' is added
[16]9;                if missing. It will be stored in the psdir directory.
[2]10;
[104]11; @keyword FILENAME to define the name of the postcript file through
[16]12;                  a keyword rather than with nameps inut argument
[118]13;                  (in this case the keyword can be pass through
[16]14;                  different routines via _extra keyword).
15;
[104]16; @keyword INFOWIDGET If INFOWIDGET is present, it specifies a named
[16]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;
[104]21; @keyword KEEP_PFONT activate to suppress the modification of !p.font
[121]22;            (by default we force  !p.font = 0  to make smaller postscripts)
[118]23; @keyword PORTRAIT
24; @keyword LANDSCAPE
[104]25; @keyword KEEPPFONT same as keep_pfont
[16]26;
[104]27; @keyword LIGHTNESS a scalar used to change the Lightness of the color
[16]28;            palette to be abble to adjust according to the printer we use,
[118]29;            the media (paper or slide)...
[16]30;               lightness < 1 to get lighter colors
31;                         > 1 to get darker colors
32;
[118]33; @keyword _EXTRA used to pass any keyword to device procedure.
[16]34;
[118]35; @uses cm_4ps
36;
[104]37; @history Sebastien Masson (smasson\@lodyc.jussieu.fr)
38; 21/12/98
[16]39; 1/2/98: ajout de nameps en input
[2]40; 1/9/1999: ajout du mot cle FILENAME et du widget
[118]41; June 2005: Sebastien Masson, cleaning, english version with new commons
42;
43; @version $Id$
44;
[2]45;-
46;------------------------------------------------------------
47;------------------------------------------------------------
48;------------------------------------------------------------
[16]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;
[114]54;
55  compile_opt idl2, strictarrsubs
56;
[16]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
[2]71   set_plot,'ps'
72;------------------------------------------------------------
[16]73; if we use  keyword Lightness
74; save the actual color palette in a temporary file
75; (to be restored when calling closeps
[2]76;------------------------------------------------------------
[16]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
[2]85;------------------------------------------------------------
[16]86; we define the name of the file
[2]87;------------------------------------------------------------
[16]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)
[2]98;------------------------------------------------------------
[118]99; we define xsize, ysize, xoffset et  yoffset
[2]100;------------------------------------------------------------
[69]101   IF n_elements(portrait) NE 0 OR n_elements(landscape) NE 0 THEN $
[16]102     key_portrait = keyword_set(portrait) * (1 - keyword_set(landscape))
[69]103
[16]104   if key_portrait EQ 1 then begin
105      xs = min(page_size)
106      ys = max(page_size)
107      xoff = 0.
108      yoff = 0.
[118]109   ENDIF ELSE BEGIN
[16]110      xs = max(page_size)
111      ys = min(page_size)
112      xoff = 0.
113      yoff = max(page_size)
[118]114   ENDELSE
[2]115;------------------------------------------------------------
[16]116; We define the device of the postscript mode
[2]117;------------------------------------------------------------
[16]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)) $
[118]124   THEN !p.font = 0
[16]125; show some informations
126   IF arg_present(infowidget) THEN $
127    infowidget = xnotice('Postcript file is currently processed...')
[2]128;
[16]129   RETURN
[2]130END
131
132
133
134
135
136
137
138
139
140
141
142
Note: See TracBrowser for help on using the repository browser.