pro cont_event, ev @pltdat.h ; widget_control,ev.id,get_uvalue=uval case uval of "DONE": begin widget_control,/destroy,ev.top ; cont.nlev = 12 ; cont.cmin = 0. & cont.cmax = 0. & cont.cint = 0. cont.prntcon = 0 return end "HELP": begin uval = '' widget_control,helpbase,show=1,get_uvalue=uval,bad_id=badid if badid eq 0 and uval eq 'CONT' then begin print,'>>> there is already a help window (custom contour) on your screen' return endif print,'help (cont)' popup_help,!srcdir+'/cont.hlp','CONT' return end "PRINT": begin if cont.prntcon eq 0 then begin print,'Will print contour information to stdout for each frame' cont.prntcon = 1 endif else begin print,'Will NOT print contour information to stdout for each frame' cont.prntcon = 0 endelse return end "IMAPPLY": begin if cont.imapply le 0 then begin print,'Will apply cmin,cmax to color image' cont.imapply = 1 endif else begin print,'Will NOT apply cmin,cmax to color image' cont.imapply = 0 endelse return end "BGP_CONCLR": begin case ev.value of 0: begin cont.conclr = black print,'Will make BLACK contour lines' return end 1: begin cont.conclr = white print,'Will make WHITE contour line' return end else: endcase end "TXT_CSPEC": begin widget_control,ev.id,get_value=value rvals = [0.,0.,0.] istat = readstr(value(0),rvals,'cmin,cmax,cint (contour specs)') if istat lt 0 then begin widget_control,ev.id,set_value=string(format=$ "(f5.1,',',f5.1,',',f5.1)",cont.cmin,cont.cmax,cont.cint) return endif cmin = rvals(0) & cmax = rvals(1) & cint = rvals(2) if cmin ge cmax or cint le 0. then begin if cmin ge cmax then begin print,'cmin ge cmax ==> will use min,max of field being plotted' cont.cmin = 0. & cont.cmax = 0. endif else begin cont.cmin = cmin & cont.cmax = cmax print,'Using cmin,cmax=',cont.cmin,cont.cmax endelse if cint le 0. then begin print,'cint le 0. ==> will use ',cont.nlev,' contour levels' cont.cint = 0. endif else begin cont.cint = cint print,'Using cint=',cont.cint endelse widget_control,ev.id,set_value=$ string(format="(f6.1,', ',f6.1,', ',f6.1)",$ cont.cmin,cont.cmax,cont.cint) endif else begin cont.cmin = cmin & cont.cmax = cmax & cont.cint = cint print,'Will use cmin=',cmin,' cmax=',cmax,' cint=',cint endelse return end "SL_NLEV": begin cont.nlev = ev.value print,format="('Will use ',i2,' contour levels')",cont.nlev return end "SL_NTHLAB": begin cont.nthlab = ev.value case cont.nthlab of 0: print,'Will NOT label contour lines' 1: print,'Will label every contour level' 2: print,'Will label every other contour level' 3: print,'Will label every 3rd contour level' else: print,cont.nthlab,format=$ "('Will label every ',i1,'th contour level')" endcase return end else: print,'cont_event: unknown uvalue=',uvalue endcase return end ; ;------------------------------------------------------------------- ; pro popup_cont, top @pltdat.h ; contbase = widget_base(title='CUSTOM CONTOURING',/column) ; ; Min,max,int dialog: ; base = widget_base(contbase,/frame,row=3) lab0 = 'Enter contour min,max,interval:' wlab_cspec = widget_label(base,value=lab0,ysize=15) if cont.cmin ne 0. and cont.cmax ne 0. and cont.cint ne 0. then $ wtxt_cspec = widget_text(base,/editable,/no_newline,ysize=1,$ value=strcompress(string(cont.cmin),/remove_all) + ',' + $ strcompress(string(cont.cmax),/remove_all) + ',' + $ strcompress(string(cont.cint),/remove_all),uvalue="TXT_CSPEC") $ else $ wtxt_cspec = widget_text(base,/editable,/no_newline,ysize=1,$ value=strcompress(string(cont.cmin,format="(f2.0)"),/remove_all) + ',' + $ strcompress(string(cont.cmax,format="(f2.0)"),/remove_all) + ',' + $ strcompress(string(cont.cint,format="(f2.0)"),/remove_all),$ uvalue="TXT_CSPEC") ; ; Slider for number of contour levels: ; base = widget_base(contbase,/frame,/column) wsl_nlev = widget_slider(base,title='Number of Contour Levels',$ minimum=2,maximum=30,value=cont.nlev,uvalue="SL_NLEV") ; ; Slider for labelling every nth contour level: ; base = widget_base(contbase,/frame,/column) wsl_nthlab = widget_slider(base,$ title="Set n to label every n'th contour level",$ minimum=0,maximum=6,value=cont.nthlab,uvalue="SL_NTHLAB") ; ; Contour line color (black or white): ; ;if imcon eq 1 or map.vec eq 1 then cont.conclr = white else $ ; cont.conclr = black if imcon eq 1 then cont.conclr = white else cont.conclr = black base = widget_base(contbase,/frame) ival = 0 & if cont.conclr eq white then ival = 1 wbgp_conclr = cw_bgroup(base,/row,/exclusive,set_value=ival,$ uvalue="BGP_CONCLR",["BLACK CONTOUR LINES","WHITE CONTOUR LINES"]) ; ; Print info button (this defaults to 0 at setdef, but when ; custom contouring is requested the default changes to 1) ; base = widget_base(contbase,/frame,/column,/nonexclusive) cont.prntcon = 1 wbut_prnt = widget_button(base,value="PRINT CONTOUR INFO",uvalue="PRINT") widget_control,wbut_prnt,set_button=cont.prntcon ; base = widget_base(contbase,/frame,/column,/nonexclusive) wbut_imapply = widget_button(base,value="APPLY MIN,MAX TO COLOR IMAGE",$ uvalue="IMAPPLY") widget_control,wbut_imapply,set_button=cont.imapply ; ; Done button: ; base = widget_base(contbase,/frame,/row) done = widget_button(base,value="DONE",uvalue="DONE") help = widget_button(base,value="HELP",uvalue="HELP") ; ; Realize custom contour window at left bottom of main control ; window, instead of the usual left top, so as not to cover any ; existing windows that are already at left top of main: ; widget_control,contbase,/realize widget_control,top,tlb_get_offset=main_offset widget_control,top,tlb_get_size=main_size widget_control,contbase,tlb_get_size=cont_size xoff = main_offset(0)-cont_size(0)-10 yoff = main_offset(1)+main_size(1)-cont_size(1) widget_control,contbase,tlb_set_xoffset=xoff,tlb_set_yoffset=yoff xmanager,'cont',contbase return end