Viewing contents of file '../idllib/contrib/tappin/graffer/graff_init.pro'
pro Graff_init, pdefs, file, version=version
;+
; GRAFF_INIT
; Set up a new graffer plot structure
;
; Usage:
; graff_init, pdefs
;
; Argument:
; pdefs struct output The graffer plot structure.
; file string input The filename for the new plot.
;
; Keywords:
; version int input The graffer version 2-elements, major
; & minor version numbers, if pdefs exists,
; then previous version is retained.
;
; Note:
; If pdefs exists, it is assumed to be a pre-existing pdefs
; structure and its associated handles are released.
;
; History:
; Extracted from GRAFFER: 18/8/95; SJT
; Axis style IDS added: 17/1/97; SJT
; Modify for extended symbol definitions: 20/1/97; SJT
; Drop CDF support: 10/2/97; SJT
; Add flag for short colour table: 8/5/97; SJT
; Add flag for "single point" key format: 15/5/97; SJT
; Add REM(arks) field: 23/6/97; SJT
; Several bug fixes to .grafferrc handling: 24/7/97; SJT
; Add mouse-editing default option: 13/8/97; SJT
;-
if (n_elements(pdefs) ne 0) then begin
version = pdefs.version
idblock = pdefs.ids
hblock = pdefs.hardset
topid = pdefs.ids.graffer
dir = pdefs.dir
ds_dir = pdefs.ds_dir
optblock = pdefs.opts
endif else gr_rc_get, optblock
if (n_elements(file) eq 0) then begin
fc = ''
if (n_elements(dir) eq 0) then cd, curr = dir
endif else begin
fc = file
gr_split_dir, fc, dir
dir = gr_get_full_dir(dir)
endelse
if (n_elements(ds_dir) eq 0) then ds_dir = dir
pdefs = {graff_define, $
Version: version, $
Name: fc, $
Dir: dir, $
Title: '', $
Subtitle: '', $
Charsize: 1.0, $
Axthick: 1, $
Position: fltarr(4), $
Aspect: fltarr(2), $
Xrange: findgen(2), $
Xtitle: '', $
Xtype: 0, $
Xsty: {graff_style, $
Idl: 0, $
Extra: 0, $
Grid: 0, $
Time: 0, $
Tzero: 0}, $
Yrange: findgen(2), $
Ytitle: '', $
Ytype: 0, $
Ysty: {graff_style}, $
Ctable: 0, $
Gamma: 1.0, $
Nsets: 1, $
Cset: 0, $ $
Data: handle_create(), $
Ntext: 0, $
Text: handle_create(), $
Text_options: {graff_text, $
Text: '', $
Colour: 1, $
Size: 1.0, $
Orient: 0., $
Align: 0., $
Font: 3, $
Thick: 1, $
X: 0., $
Y: 0., $
Norm: 0b $
}, $
Key: {graff_key, $
X: fltarr(2), $
Y: fltarr(2), $
Norm: 2, $ $
cols: 1, $
List: handle_create(), $
Frame: 0b, $
One_point: 0b, $
Use: 0b, $
title: '' $
}, $
Remarks: handle_create(), $
Ids: { graff_ids, $
Graffer: 0l, $
Graffer2:0l, $
Name: 0l, $
Dir: 0l, $
Title: 0l, $
Subtitle:0l, $
Charsize:0l, $
Axthick: 0l, $
Mode: 0l, $
Xtitle: 0l, $
Xmin: 0l, $
Xmax: 0l, $
Xlog: 0l, $
Xsty: lonarr(8), $
Ytitle: 0l, $
Ymin: 0l, $
Ymax: 0l, $
Ylog: 0l, $
Ysty: lonarr(8), $
Plopts: lonarr(2), $
Cset: 0l, $
Descr: 0l, $
Pline: 0l, $
Psym: 0l, $
Symsize: 0l, $
Colour: 0l, $
Line: 0l, $
Thick: 0l, $
Dsxtra: lonarr(3), $
Clip: 0l, $
Zmode: 0l, $
Xcp: 0l, $
Ycp: 0l, $
Draw: 0l, $
Windex: 0l, $
Message: 0l, $
Hlptxt: 0l, $
Popmsg: 0l, $
Chtick: 0l, $
Update: 0l $
}, $
Hardset: { graff_hard, $
Colour: 0b, $
Eps: 0b, $
Orient: 0b, $
Psize: 0b, $
Timestamp: 0b , $
Font: {graff_hfont, $
Family: 1, $
Wg_sl: 0}, $
Size: [23., 18.], $
Off: [3.35, 1.5], $
Action: ['lp ', ''] $
}, $
Transient: { graff_trans, $
Imove: -1l, $
Showid: 0l, $
Opos: fltarr(2), $
Changes: 0, $
Opflag: 0b $
}, $
Opts: {graff_opts, $
Auto_delay: 300., $
S2d: 0b, $
Update: 0b, $
Mouse: 1b $
}, $
Ds_dir: ds_dir, $
Chflag: 0b, $
Popflag: 0b, $
Short_colour: 0b $
}
if (n_elements(idblock) ne 0) then pdefs.ids = idblock
if (n_elements(hblock) ne 0) then pdefs.hardset = hblock
if (n_elements(optblock) ne 0) then pdefs.opts = optblock
data_str = {graff_data, $
Ndata: 0l, $
Ndata2: 0l, $ ; Only used in 2D Dss
Type: 0, $
Mode: 0, $
Xydata: handle_create(), $
Descript: "", $
Pline: 1, $
Psym: 0, $
Symsize: 1., $
Line: 0, $
Colour: 1, $
Thick: 1, $
zopts: {graff_2d, $
Format: 0, $
N_levels: -6, $
Levels: fltarr(30), $
N_cols: 1, $
Colours: intarr(30)+1, $
N_sty: 1, $
Style: intarr(30), $
N_thick: 1, $
Thick: intarr(30)+1, $
Range: fltarr(2), $
Pxsize: 0.5, $
Label: 0, $
Fill: 0b}, $
Sort: 0b, $
Noclip: 0b, $
Medit: pdefs.opts.mouse $
}
handle_value, data_str.xydata, fltarr(2, 2), /set
handle_value, pdefs.data, data_str, /set, /no_copy
handle_value, pdefs.text, {graff_text, $
Text: '', $
Colour: 1, $
Size: 1.0, $
Orient: 0., $
Align: 0., $
Font: 3, $
Thick: 1, $
X: 0., $
Y: 0., $
Norm: 0b}, /set
end