Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/~mperrin/software/sources/win.pro
Дата изменения: Thu Dec 11 02:05:51 2008
Дата индексирования: Sat Mar 1 11:26:01 2014
Кодировка:
pro win, num, szsz, title=title, $
xsize=xs, ysize=ys, sz=sz, $
xpos = xp, ypos = yp, $
small = small, land = land,keep=keep,$
max=max, _extra=_extra, external=external

;+
; PURPOSE:
; create IDL plot windows displayed in rows in a nice tiled fashion.
; NOTES:
; default size is 256 x 256
;
; program is optimized for my workstation & monitor!
;
; INPUTS
; num window number to open
;
; OPTIONAL KEYWORD INPUTS
; title title string for the window
; xsize xsize
; ysize ysize
; xpos,ypos position of the window.
; sz edge size for a square window
; /small adjusted for 17" monitor (20" is default)
; /land Landscape mode
; /keep If a window with this number is already open,
; just use it rather than opening a new one.
; /max open up a really large window
; /external open the really large window on the external monitor, and
; make it even larger
;
; USES
; strc
;
; Written by M. Liu (UCB): 1995?
; 12/22/99 MCL: added /land (nice size for plots)
; 04/16/00 MCL: can now pass 'sz' as parameter also
; 10/11/02 MDP: Added /keep parameter
; 2003-12-13 MDP: Don't do a retall if called incorrectly, goddamit!
; 2006-08-22 MDP: added /MAX
;
;-


; this won't work on postscript devices!
if !d.name eq "PS" then begin
message,/info,"Can't open new window - current device is postscript!"
return
endif

if not(keyword_set(xs)) then xs = 350
if not(keyword_set(ys)) then ys = 350
if keyword_set(land) then begin
xs = 600
ys = 500
endif
if n_params() lt 1 then begin
message, 'pro win,num,[title=],[xs=', strc(xs), '],[ys=', strc(ys), '],[sz=],[xp=],[yp=]'
endif
if keyword_set(title) eq 0 then title='IDL '+strc(num)
if n_params() eq 2 then sz = szsz
if keyword_set(sz) then begin
xs = sz
ys = sz
endif

if keyword_set(max) then begin
if keyword_set(external) then begin
xs=1600&ys=1000&xp=1500& yp=50
endif else begin
xs=1200 & ys=900 & xp = 1300 & yp = 100
endelse
endif


if keyword_set(keep) then begin ; if the window already exists, then just
; select it and bring to front
Device, Window_State=theseWindows
if (theseWindows[num] eq 1) then begin
wset,num
wshow
return
endif
endif

;spawn, 'echo $HOST', host
hflag = 1
;if (host(0) eq 'notebook') then hflag = 1

; default starting positions
if (hflag) then begin
x0 = 30 ; 17" monitor
y0 = 500
nn = floor(1100./xs)
endif else if keyword_set(small) then begin
x0 = 30 ; 17" monitor
y0 = 640
nn = floor(1100./xs)
endif else begin
x0 = 40 ; 20" monitor
y0 = 750
nn = floor(1220./xs)
endelse


if not(keyword_set(xp)) then $
xpos=x0+((xs+10)*(num mod nn)) $
else $
xpos = xp

if not(keyword_set(yp)) then $
ypos=y0-(ys-256)-(num/nn)*(ys+30) $
else $
ypos = yp

;print,xpos,ypos

window,fix(num),xs=xs,ys=ys, $
title=title, $
xpos = xpos, ypos = ypos,_extra=_extra
; xpos=30+((xs+10)*(num mod 4)), $
; ypos=640-(ys-256)-(num/4)*(ys+30),title=title


;print, xpos, ypos

end