Viewing contents of file '../idllib/contrib/tappin/graffer/gr_ds_create.pro'
;+
; GR_DS_CREATE
; Make the pulldown menu to define &| edit a dataset.
;
; Usage:
; gr_ds_create, base
;
; Argument:
; base long input The ID of the parent base
;
; History:
; Pulled out of GRAFFER: 9/12/96; SJT
; Moved event handling in: 17/1/97; SJT
; Drop CDF support: 10/2/97; SJT
;-
pro Gr_dsc_event, event
base = widget_info(/child, event.top)
widget_control, base, get_uvalue = pdefs, /no_copy
idraw_flag = 1
ichange = 1b
track_flag = strpos(tag_names(event, /struct), 'TRACK') ne -1
nch = 1
if (track_flag) then begin
idraw_flag = 0
ichange = 0b
if (event.enter eq 0) then begin
graff_msg, pdefs.ids.hlptxt, ''
goto, miss_case
endif
endif
case event.value of
'Function': graff_msg, pdefs.ids.hlptxt, 'Enter data in the form ' + $
'of a function'
'Function.y = f(x) ...':if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Function with Y as a function of X' $
else begin
ichange = graff_funct(pdefs)
idraw_flag = ichange
if (ichange) then nch = 21
endelse
'Function.x = f(y) ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Function with X as a function of Y' $
else begin
ichange = graff_funct(pdefs, /y_funct)
idraw_flag = ichange
if (ichange) then nch = 21
endelse
'Function.x = f(t) & y = g(t) ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Function with both X and Y ' + $
'functions of a parameter T' $
else begin
ichange = graff_pfunct(pdefs)
idraw_flag = ichange
if (ichange) then nch = 21
endelse
'Function.z = f(x,y) ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Function with Z as a function of X ' + $
'and Y' $
else begin
ichange = graff_zfunct(pdefs)
idraw_flag = ichange
if (ichange) then nch = 21
endelse
'Function.From file ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Read a function definition from a file' $
else begin
ichange = gr_fun_read(pdefs)
idraw_flag = ichange
if (ichange) then nch = 5
endelse
'Function.Fit Dataset ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Do a linear, power or exponential ' + $
'fit to a specified dataset' $
else begin
ichange = gr_fit_dset(pdefs)
nch = 21
endelse
'XY data': graff_msg, pdefs.ids.hlptxt, 'Enter data for current ' + $
'data set'
'XY data.From file ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Read X, Y, [error] data from an ' + $
'external file' $
else begin
ichange = gr_xy_read(pdefs)
idraw_flag = ichange
if (ichange) then nch = 5
end
'XY data.2D Datasets': graff_msg, pdefs.ids.hlptxt, $
'Create a 2 dimensional dataset'
'XY data.2D Datasets.Top level variables ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Read 2D data from IDL top-level ' + $
'variables' $
else begin
ichange = gr_tlv_z(pdefs)
idraw_flag = ichange
if (ichange) then nch = 21
end
'XY data.2D Datasets.From file ...':if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Read 2D data from an external file' $
else begin
ichange = gr_z_read(pdefs)
idraw_flag = ichange
if (ichange) then nch = 21
end
'XY data.Rescale Current ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Rescale the current dataset' $
else begin
ichange = graff_rescale(pdefs)
idraw_flag = ichange
if (ichange) then nch = 21
end
'XY data.Edit values ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Enter X, Y, [error] data from a ' + $
'widget entry box' $
else begin
ichange = gr_xy_wid(pdefs)
idraw_flag = ichange
if (ichange) then nch = 21
end
'XY data.Top level variables ...': if (track_flag) then $
graff_msg, pdefs.ids.hlptxt, 'Get X, Y, [error] values from IDL ' + $
'top-level variables' $
else begin
ichange = graff_tlv(pdefs)
idraw_flag = ichange
if (ichange) then nch = 21
end
endcase
if (ichange) then begin
handle_value, pdefs.data, data, /no_copy
if (data(pdefs.cset).type eq 9 or $
data(pdefs.cset).type eq -4) then begin
widget_control, pdefs.ids.plopts(0), map = 0
widget_control, pdefs.ids.plopts(1), map = 1
endif else begin
widget_control, pdefs.ids.plopts(1), map = 0
widget_control, pdefs.ids.plopts(0), map = 1
endelse
handle_value, pdefs.data, data, /no_copy, /set
endif
if (idraw_flag and (pdefs.opts.update eq 0)) then gr_plot_object, pdefs
if (ichange) then begin
pdefs.chflag = 1b
pdefs.transient.changes = pdefs.transient.changes+nch
if (pdefs.transient.changes gt 20) then begin
gr_bin_save, pdefs, /auto
if (pdefs.opts.update eq 1) then gr_plot_object, pdefs
endif
endif
widget_control, pdefs.ids.chtick, map = pdefs.chflag
Miss_case:
widget_control, base, set_uvalue = pdefs, /no_copy
end
pro Gr_ds_create, base
datopts = [{cw_pdmenu_s, flags:1, name:'XY data'}, $
{cw_pdmenu_s, 0, 'From file ...'}, $
{cw_pdmenu_s, 0, 'Edit values ...'}, $
{cw_pdmenu_s, 0, 'Top level variables ...'}, $
{cw_pdmenu_s, 1, '2D Datasets'}, $
{cw_pdmenu_s, 0, 'From file ...'}, $
{cw_pdmenu_s, 2, 'Top level variables ...'}, $
{cw_pdmenu_s, 2, 'Rescale Current ...'}, $
{cw_pdmenu_s, 3, 'Function'}, $
{cw_pdmenu_s, 0, 'y = f(x) ...'}, $
{cw_pdmenu_s, 0, 'x = f(y) ...'}, $
{cw_pdmenu_s, 0, 'x = f(t) & y = g(t) ...'}, $
{cw_pdmenu_s, 0, 'z = f(x,y) ...'}, $
{cw_pdmenu_s, 0, 'From file ...'}, $
{cw_pdmenu_s, 2, 'Fit Dataset ...'}]
jb = widget_base(base, /row, space = 1, xpad = 1, ypad = 1, event_pro $
= 'gr_dsc_event')
junk = cw_pdtmenu(jb, datopts, /return_full_name, uvalue = 'EDITOR', $
/track)
end