;+ ; ; NAME: ; HXISGETWINDOW ; ; PURPOSE: ; Depending on the status of reuse create a new window or reuse the ; current hxis window ; ; CATEGORY: ; HXIS display ; ; CALLING SEQUENCE: ; HXISGETWINDOW [,ERROR=ERROR] ; ; CALLED BY: ; HXISCPLOT, HXISLIFE, HXISSURF, HXISTPLOT, HXISTSPEC, HXISXPLOT ; ; CALLS TO: ; none ; ; INPUTS: ; none explicit, only through commons ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; none ; ; OPTIONAL OUTPUTS: ; ERROR: Set to 1 if current_window (from common hxiswindow) ; was no longer present. Will create a window anyway. ; ; COMMON BLOCKS: ; hxisdata_info.common ; hxiswindow.common ; hxiswidget.common ; ; SIDE EFFECTS: ; May create an IDL window. ; ; ; RESTRICTIONS: ; Requires X windows device. ; ; PROCEDURE: ; Verify that the last created window is still there. If it is then ; it is erased else a new window is created. ; ; MODIFICATION HISTORY: ; OCT-1990, Paul Hick (ARC) ; DEC-1992, Elaine Einfalt (HSTX) - converted to widgets ;- pro hxisgetwindow, error=error @hxisdata_info.common @hxiswindow.common @hxiswidget.common error = 0 ; success until failure save_usage = reuse ; ; Is the CURRENT_WINDOW still in existance. User may have deleted it. ; if n_elements(current_window) ne 0 then begin ; there once was a window device, window=w ; get all existing windows if w(current_window) eq 0 then begin ; ; will go make a new window, but flag error ; reuse=0 ; window is not there anymore, temporarily reset error = 1 endif endif ; ; Get a new window or reuse old one ; set_plot,'X' ; output to screen if reuse and not(first_pass) then begin ; reuse windows if not(new_file) then begin ; same files wshow, current_window erase, current_window endif else begin ; new file needs new banner device, get_window = winpos ; but keep window in same place wdelete, current_window winup, /free, retain=2, xsize=info.yxrat*640, ysiz=640, $ xpos=winpos(0), title='HXIS ' + info.fname, ypos=winpos(1) current_window = !d.window ; get new window's index endelse endif else begin ; make new windows for each display lastmark = 1 - lastmark ; alternate window position first_pass = 0 ; now have at least one HXIS win winup, /free, retain=2, xsize=info.yxrat*640, ysiz=640, $ xpos=hxis_sc(0)-10, title='HXIS ' + info.fname, $ ypos=hxis_sc(1) * lastmark + (lastmark * (-20) + 10) current_window = !d.window ; get new window's index endelse erase reuse = save_usage new_file = 0 return end