Viewing contents of file '../idllib/contrib/tappin/graffer/gr_place_winds.pro'
pro Gr_place_winds, pdefs

;+
; GR_PLACE_WINDS
;	Adjust the positioning of the two windows in comapct mode so
;	they are reasonable well separated.
;
; Usage:
;	gr_place_winds, pdefs
;
; Argument:
;	pdefs	struct	input	The GRAFFER master structure.
;
; History:
;	Original: 17/1/97; SJT
;-

if (not (widget_info(pdefs.ids.graffer, /valid) and $
         widget_info(pdefs.ids.graffer2, /valid))) then return

device, get_screen_size = screen

widget_control, pdefs.ids.graffer, tlb_get_offset = off1, tlb_get_size $
  = sz1
widget_control, pdefs.ids.graffer2, tlb_get_offset = off2, tlb_get_size $
  = sz2 


if (min(off1-off2) gt 125) then return ; OK as we are

noff2 = off1 + (125 > (off2-off1))

br = noff2 + sz2
if (br(0) gt screen(0) or br(1) gt screen(1)) then begin
    noff3 = (screen - sz2) < noff2
    noff1 = (off1 - (noff2 - noff3)) > 10
    widget_control, pdefs.ids.graffer, tlb_set_xoffset = noff1(0), $
      tlb_set_yoffset = noff1(1)
    widget_control, pdefs.ids.graffer2, tlb_set_xoffset = noff2(0), $
      tlb_set_yoffset = noff3(1)    
endif else widget_control, pdefs.ids.graffer2, tlb_set_xoffset = $
  noff2(0), tlb_set_yoffset = noff2(1)    

end