PRO qImage_Save, state

;+
; NAME:
;	qImage_Save
; PURPOSE:
;	Save current image to binary file
; CATEGORY:
;	Widget qImage
; CALLING SEQUENCE:
;	qImage_Save, state
; INPUTS:
;	state		array[1]; type: structure
;					qImage state structure
; OUTPUTS:
;	(to disk file)
; INCLUDE:
	@compile_opt.pro		; On error, return to caller
; CALLS:
;	qSave2File
; SIDE EFFECTS:
; RESTRICTIONS:
; PROCEDURE:
; MODIFICATION HISTORY:
;	APR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu)
;-

widget_control, state.wid_send, sensitive=0

wid_child = widget_info(state.wid_qimage_cw, /child)
widget_control, wid_child, get_uvalue=qimage_cw_state, /no_copy

widget_control, state.wid_info, get_uvalue=info
IF n_elements(info) EQ 5 THEN trailer = info[4]

qSave2File, /block, wid_save=qimage_cw_state.wid_image, /call_by_qimage, trailer=trailer

widget_control, wid_child, set_uvalue=qimage_cw_state, /no_copy
widget_control, state.wid_send, /sensitive

RETURN  &  END
