source: trunk/SRC/Postscript/closeps.pro @ 104

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

start to modify headers of Postscript *.pro files for better idldoc output + change the title of idldoc output in html to SAXO Documentation

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; @file_comments Close the Postscript mode
6;
7;  when archive_ps ne 0, we add the name and the date
8;  at the bottom left corner of the postcript page. If the
9;  postscript is called idl.ps we change its name to number.ps
10;  (number automatically found to be 1 larger that any of the
11;  existing ps file)
12;
13; @keyword INFOWIDGET A long integer giving the id of the information
14;           widget (created by openps) that we have de destroy at
15;           the end of closeps (when the postscript is done)
16;
17; @uses cm_4ps
18;
19; @history Sebastien Masson (smasson\@lodyc.jussieu.fr)
20;                       21/12/98
21; June 2005: Sebastien Masson, english version with new commons
22;-
23;------------------------------------------------------------
24;------------------------------------------------------------
25;------------------------------------------------------------
26PRO closeps, INFOWIDGET = infowidget
27;
28   IF lmgr(/demo) EQ 1 THEN return
29;------------------------------------------------------------
30; include commons
31@cm_4ps
32  IF NOT keyword_set(key_forgetold) THEN BEGIN
33@updatenew
34  ENDIF
35;
36  IF !d.name NE 'PS' THEN GOTO, last_part
37;------------------------------------------------------------
38; if archive_ps /= 0 we will add its name and the date at the bottom
39; left corner of the page (in case if the postscript will be archived
40; in printps
41;------------------------------------------------------------
42   IF keyword_set(archive_ps) THEN BEGIN
43;------------------------------------------------------------
44; we get the name of the latest created postscript.
45;------------------------------------------------------------
46     psdir = isadirectory(psdir, title = 'Select psdir')
47     nameps = file_search(psdir+'*.ps' $
48                          , /test_regular, /test_write, /nosort)
49     dates = (file_info(nameps)).mtime
50     lastdate = (reverse(sort(temporary(dates))))[0]
51     nameps = nameps[lastdate]
52     nameps = file_basename(nameps, '.ps')
53; If this name is idl.ps then we change it to the number.ps
54     IF nameps EQ 'idl' then BEGIN
55; get the name of all the *.ps or *.ps.gz files available in psdir
56       allps = file_search(psdir+'*[.ps|.ps.gz|.pdf]', /test_regular, /nosort)
57       allps = file_basename(file_basename(allps,'.gz'),'.ps')
58       allps = file_basename(allps,'.pdf')
59; find which of these names corresponds to numbers...
60; get ascii codes of the names
61       testnumb = byte(allps)
62; longest name
63       maxstrlen = (size(testnumb, /dimensions))[0]
64; ascii codes can be 0 or between byte('0') and byte('9')
65       testnumb = testnumb EQ 0 OR $
66                  (testnumb GE (byte('0'))[0] AND testnumb LE (byte('9'))[0])
67       testnumb = where(total(testnumb, 1) EQ maxstrlen, count)
68       IF count NE 0 THEN BEGIN
69; get the largest number
70         psnumber = fix(allps[testnumb])
71         psnumber = (psnumber[reverse(sort(psnumber))])[0] + 1
72       ENDIF ELSE psnumber = 0
73       nameps = strtrim(psnumber, 2)
74     ENDIF
75;------------------------------------------------------------
76; we annote the postscript
77;------------------------------------------------------------
78     date = byte(systime(0))    ; we get the date
79     xyouts, !d.x_px_cm, !d.y_px_cm $
80             , nameps+') '+string(date[4:10])+string(date[20:23]) $
81             , /device, charsize = .75
82   ENDIF
83;------------------------------------------------------------
84; close the postcript mode
85   device, /close
86;
87last_part:
88;
89   thisOS = strupcase(strmid(!version.os_family, 0, 3))
90   CASE thisOS of
91     'MAC': SET_PLOT, thisOS
92     'WIN': SET_PLOT, thisOS
93     ELSE: SET_PLOT, 'X'
94   ENDCASE   
95   def_myuniquetmpdir
96   colorfile = myuniquetmpdir + 'original_colors.dat'
97   IF file_test(colorfile, /regular) THEN BEGIN
98     restore, colorfile
99     file_delete, colorfile, /quiet
100; reload the original colors
101     tvlct, red, green, blue
102   ENDIF
103   !p.font = -1
104; force background color to the last color (white)
105   !p.BACKGROUND=(!d.n_colors-1) < 255
106   !p.color=0
107   if !d.n_colors gt 256 then !p.background='ffffff'x
108;------------------------------------------------------------
109   if keyword_set(infowidget) then $
110    widget_control, long(infowidget), bad_id = toto, /destroy
111;------------------------------------------------------------
112   return
113end
Note: See TracBrowser for help on using the repository browser.