pro output_eh,event ; output_eh.pro - handle events related to the skirt ; of the surface widget_control, event.top, get_uvalue=state widget_control, event.id, get_uvalue=uval @catch_error case uval of ; Property Sheet Event Handling 'PrintSetup' : begin ; a = dialog_printersetup(state.obj.oPrinter) end 'PrintGo' : begin ; a = dialog_printersetup(state.obj.oPrinter) ; if a ne 0 then begin ; print,'printer' ; state.obj.oPrinter -> draw, state.obj.oView ; state.obj.oPrinter -> NewDocument ; endif end 'ClipboardGo' : begin print,'clipboard' state.obj.oClipboard -> draw, state.obj.oView end 'fileformat' : begin state.output.format = state.output.outputtypes[event.index] widget_control, state.output.fileText, get_value = temp filename = strtrim(temp[0],2) lpos=rstrpos(filename,'.') filename = strmid(filename,0,lpos+1) filename=filename + strlowcase(strtrim(state.output.format,2)) widget_control, state.output.fileText,set_value = filename end 'gofile' : begin ; grab the file name from the text widget widget_control, state.output.fileText, get_value = temp filename = strtrim(temp[0],2) widget_control,state.lasttext,set_value=filename ; create a buffer object to render the image in true color oBuffer = obj_new('IDLgrBuffer', $ palette=state.obj.oPalette, $ ; dim=[640,480]) dim=[1000,500]) ; render the graphics to the buffer object oBuffer -> draw, state.obj.oView ; get a screen shot from the buffer object oScreenImage = oBuffer -> read() ; grab the data from the image object oScreenImage -> getproperty, data=img inf = size(img) ; destroy the buffer object obj_destroy, oBuffer ; check the desired output type and write out ; an image of that type case state.output.format of 'PS' : begin orig_device = !d.name set_plot,'ps' device, /color,/landscape,filename=filename tv,img,true=1 ; xyouts,0.9,0.95,systime(0),alignment=1.0,/normal device,/close set_plot,orig_device end 'GIF' : begin if inf[0] eq 2 then begin write_gif, filename, img endif else if inf[0] eq 3 then begin img = color_quan(img,1,r,g,b,color=256) write_gif, filename, img, r,g,b endif end 'JPG' : begin if inf[0] eq 2 then begin write_jpeg, filename, img endif else if inf[0] eq 3 then begin write_jpeg, filename, img, true=1 endif end 'BMP' : begin if inf[0] eq 2 then begin write_bmp, filename, img endif else if inf[0] eq 3 then begin img = color_quan(img,1,r,g,b,color=256) write_bmp, filename, img, r,g,b endif end 'TIF' : write_tiff, filename,img 'PICT' : begin if inf[0] eq 2 then begin write_pict, filename, img endif else if inf[0] eq 3 then begin img = color_quan(img,1,r,g,b,color=256) write_pict, filename, img, r,g,b endif end 'VRML' : begin oVRML = obj_new('IDLgrVRML', filename=filename) oVRML -> draw, state.obj.oView end endcase end ; from 'gofile' endcase if widget_info(event.top,/valid_id) then $ widget_control, event.top, set_uvalue = state return end