pro Graff_save, pdefs, auto=auto ;+ ; GRAFF_SAVE ; Save a graffer dataset to a file ; ; Usage: ; graff_save, pdefs ; ; Argument: ; pdefs struct input The graffer data structure. ; ; Keyword: ; auto input If set & non-zero, then this is an ; autosave. ; ; History: ; Original: 16/8/95; SJT ; Remove file argument (use pdefs.name): 17/8/95; SJT ; Add facilities for string-type data: 18/8/95; SJT ; Add auto-save: 22/9/95; SJT ;- if (keyword_set(auto)) then begin file = pdefs.dir+'#'+pdefs.name+'#' graff_msg, pdefs.ids.message, 'Autosaving' endif else file = pdefs.dir+pdefs.name on_ioerror, no_open openw, ilu, /get, file on_ioerror, null ; Header & title information printf, ilu, pdefs.version, pdefs.dir, pdefs.name, systime(), $ format = "('Graffer V',I2,'.',I2.2,': ',2A,' : @ ',A)" printf, ilu, pdefs.title printf, ilu, pdefs.subtitle printf, ilu, pdefs.charsize, pdefs.axthick printf, ilu, pdefs.xrange, pdefs.xtype, pdefs.xsty ; X axis properties printf, ilu, pdefs.xtitle printf, ilu, pdefs.yrange, pdefs.ytype, pdefs.ysty ; Y axis properties printf, ilu, pdefs.ytitle printf, ilu, pdefs.nsets, pdefs.cset ; Number of data sets. handle_value, pdefs.data, data, /no_copy for j = 0, (pdefs.nsets-1) > 0 do begin printf, ilu, data(j).psym, data(j).symsize, data(j).line, $ data(j).colour, data(j).thick, data(j).sort, data(j).ndata printf, ilu, data(j).descript printf, ilu, data(j).type handle_value, data(j).xydata, xydata, /no_copy if (data(j).type lt 0) then begin ; Function printf, ilu, xydata.range printf, ilu, xydata.funct, format = "(A)" ; Make 2 lines for ; parametric case endif else begin ; Ordinary data printf, ilu, xydata endelse handle_value, data(j).xydata, xydata, /set, /no_copy endfor handle_value, pdefs.data, data, /no_copy, /set ; Note: don't save the widget ids. printf, ilu, pdefs.ntext ; Number of text items handle_value, pdefs.text, text, /no_copy for j = 0, (pdefs.ntext-1) > 0 do begin printf, ilu, text(j).colour, text(j).size, text(j).orient, $ text(j).align, text(j).font, text(j).thick, text(j).x, $ text(j).y, text(j).norm printf, ilu, text(j).text endfor handle_value, pdefs.text, text, /no_copy, /set ; The hardcopy options printf, ilu, pdefs.hardset.colour, pdefs.hardset.eps, $ pdefs.hardset.orient, pdefs.hardset.timestamp, pdefs.hardset.size printf, ilu, pdefs.hardset.action(0) printf, ilu, pdefs.hardset.action(1) free_lun, ilu pdefs.chflag = 0b ; Clear change flag pdefs.transient.changes = 0 return No_open: graff_msg, pdefs.ids.message, ["Failed to open save file:"+file, $ !Err_string] end