;+ ; ; NAME: ; ; ; PURPOSE: ; ; ; CATEGORY: ; ; ; CALLING SEQUENCE: ; ; ; CALLED BY: ; ; ; CALLS TO: ; none ; ; INPUTS: ; none explicit, only through commons; ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; none explicit, only through commons; ; ; OPTIONAL OUTPUTS: ; none ; ; COMMON BLOCKS: ; none ; ; SIDE EFFECTS: ; none ; ; RESTRICTIONS: ; none ; ; PROCEDURE: ; none ; ; MODIFICATION HISTORY: ; ;- pro cpcat_event, event common cpcatstruc, cp ; the "parameter" structure common passers, yield ; pass to event handler common myfont, myfont common cat_bases, $ base, man_start_id, man_end_id, $ roll_id, rollslide, condoy_id, conmon_id, $ labroll_id, sect_id, filt_id, polar_id, cal_id widget_control, event.id, get_uvalue=input widget_control, event.top, get_uvalue=cat_widg if n_elements(input) eq 0 then input='' type = strmid(tag_names(event, /structure_name),7,4) case type of 'BUTT': case input of 'QUIT' : widget_control, event.top, /destroy 'HELP' : CP_CATHELP, group = event.top 'FONT' : myfont = xfont() 'CANCEL' : widget_control, event.top, /destroy 'ARRAY' : if event.select then yield = yield or 1 $ else yield = yield - 1 'SCREEN' : if event.select then yield = yield or 2 $ else yield = yield - 2 'DISK' : if event.select then yield = yield or 8 $ else yield = yield - 8 'PRINTER' : if event.select then yield = yield or 4 $ else yield = yield - 4 'SEARCH' : begin widget_control, base, sensitive=0 widget_control, base, /hourglass ; Read the start time in window, ; just incase user didn't press return. widget_control, man_start_id, get_value=time ; Check and re-write the time in case it was bad cp_cattime, time=time(0), cp=cp, cas=0 ; Read the end time in window, ; just incase user didn't press return. widget_control, man_end_id, get_value=time ; Check and re-write the time in case it was bad cp_cattime, time=time(0), cp=cp, cas=1 ; ; Check time order, switch order if needed ; if anytim(cp.stime, /utime) gt $ anytim(cp.etime, /utime) then begin temp = cp.stime cp.stime = cp.etime cp.etime = temp endif widget_control, man_start_id, set_value=cp.stime widget_control, man_end_id, set_value=cp.etime ; ; Now may go off and do the search ; cat_widg.group = event.id cp_catread, cp=cp, yield=yield, font=myfont, $ cat_widg=cat_widg ; Re_write in case of expanded time range widget_control, man_start_id, set_value=cp.stime widget_control, man_end_id, set_value=cp.etime widget_control, base, sensitive=1 end ; ; The reset parameter value buttons ; 'RES_ALL' : begin CP_CATRESET, cp=cp widget_control, man_start_id, set_value=cp.stime widget_control, man_end_id, set_value=cp.etime for i = 0, 7 do widget_control, sect_id(i), /set_button for i = 0, 7 do widget_control, filt_id(i), /set_button for i = 0, 3 do widget_control, polar_id(i), /set_button for i = 0, 1 do widget_control, cal_id(i), /set_button widget_control, roll_id(0), set_button=1 widget_control, roll_id(1), set_button=0 widget_control, labroll_id, $ set_value='Roll(s)= -180 to +180' widget_control, rollslide, sensitive=0 end 'RES_TIME' : begin CP_CATRESET, cp=cp, input='TIME' widget_control, man_start_id, set_value=cp.stime widget_control, man_end_id, set_value=cp.etime end 'RES_SEC' : begin CP_CATRESET, cp=cp, input='SECT' for i = 0, 7 do widget_control, sect_id(i), /set_button end 'RES_FIL' : begin CP_CATRESET, cp=cp, input='FILT' for i = 0, 7 do widget_control, filt_id(i), /set_button end 'RES_POL' : begin CP_CATRESET, cp=cp, input='POLAR' for i = 0, 3 do widget_control, polar_id(i), /set_button end 'RES_CAL' : begin CP_CATRESET, cp=cp, input='CALMIR' for i = 0, 1 do widget_control, cal_id(i), /set_button end 'RES_ROLL' : begin CP_CATRESET, cp=cp, input='ROLL' widget_control, roll_id(0), set_button=1 widget_control, roll_id(1), set_button=0 widget_control, labroll_id, $ set_value='Roll(s)= -180 to +180' widget_control, rollslide, sensitive=0 end 'STARTBUT' : begin month = ['', 'Jan', 'Feb', 'Mar', 'Apr', $ 'May', 'Jun', 'Jul', 'Aug', $ 'Sep', 'Oct', 'Nov', 'Dec'] twidget, /init, $ hour=0, min=0 , $ year=fix(strmid(cp.stime, 7, 2))+1900 , $ mon=(where(month eq strmid(cp.stime,3,3)))(0),$ day=fix(strmid(cp.stime, 0, 2)) twidget, rdate, /nowild, year=[1980,1989], $ mon=[1,12], /day, /hour, /min, error=error if error then return newtime = $ string(rdate.day,'(i2.2)') + '-' + $ month(rdate.month) + '-' + $ strtrim(rdate.year-1900,2) + ' ' + $ string(rdate.hour, '(i2.2)') + ':' + $ string(rdate.minute, '(i2.2)') cp_cattime, time=newtime, cp=cp, cas=0 widget_control, man_start_id, set_value=cp.stime end 'ENDBUT' : begin month = ['', 'Jan', 'Feb', 'Mar', 'Apr', $ 'May', 'Jun', 'Jul', 'Aug', $ 'Sep', 'Oct', 'Nov', 'Dec'] twidget, /init, $ hour=23, min=59, $ year=fix(strmid(cp.stime, 7, 2))+1900 , $ mon=(where(strupcase(month) eq $ strupcase(strmid(cp.stime,3,3))))(0),$ day=fix(strmid(cp.stime, 0, 2)) twidget, rdate, /nowild,year=[1980,1989], $ mon=[1,12], /day, /hour, /min, error=error if error then return newtime = $ string(rdate.day,'(i2.2)') + '-' + $ month(rdate.month) + '-' + $ strtrim(rdate.year-1900,2) + ' ' + $ string(rdate.hour, '(i2.2)') + ':' + $ string(rdate.minute, '(i2.2)') cp_cattime, time=newtime, cp=cp, cas=1 widget_control, man_end_id, set_value=cp.etime end ; ; The set parameter value buttons ; 'SW' : if event.select then cp.sect(0) = 1 $ else cp.sect(0) = 0 'S' : if event.select then cp.sect(1) = 1 $ else cp.sect(1) = 0 'SE' : if event.select then cp.sect(2) = 1 $ else cp.sect(2) = 0 'E' : if event.select then cp.sect(3) = 1 $ else cp.sect(3) = 0 'NE' : if event.select then cp.sect(4) = 1 $ else cp.sect(4) = 0 'N' : if event.select then cp.sect(5) = 1 $ else cp.sect(5) = 0 'NW' : if event.select then cp.sect(6) = 1 $ else cp.sect(6) = 0 'W' : if event.select then cp.sect(7) = 1 $ else cp.sect(7) = 0 'R' : if event.select then cp.filt(0) = 1 $ else cp.filt(0) = 0 'Ha' : if event.select then cp.filt(1) = 1 $ else cp.filt(1) = 0 'OP' : if event.select then cp.filt(2) = 1 $ else cp.filt(2) = 0 'GC' : if event.select then cp.filt(3) = 1 $ else cp.filt(3) = 0 'GL' : if event.select then cp.filt(4) = 1 $ else cp.filt(4) = 0 'B' : if event.select then cp.filt(5) = 1 $ else cp.filt(5) = 0 'WB' : if event.select then cp.filt(6) = 1 $ else cp.filt(6) = 0 'G' : if event.select then cp.filt(7) = 1 $ else cp.filt(7) = 0 'CLR' : if event.select then cp.polar(0) = 1 $ else cp.polar(0) = 0 'P60' : if event.select then cp.polar(1) = 1 $ else cp.polar(1) = 0 'DG0' : if event.select then cp.polar(2) = 1 $ else cp.polar(2) = 0 'N60' : if event.select then cp.polar(3) = 1 $ else cp.polar(3) = 0 'CALIN' : if event.select then cp.calmir(0) = 1 $ else cp.calmir(0) = 0 'CALOUT' : if event.select then cp.calmir(1) = 1 $ else cp.calmir(1) = 0 'ALLROLL' : begin if event.select ne 0 then $ widget_control, rollslide, sensitive=0 cp.roll = bytarr(361) + 1b widget_control, labroll_id, $ set_value='Roll(s)= -180 to +180' end 'ONEROLL' : begin if event.select ne 0 then $ widget_control, rollslide, sensitive=1 cp.roll = bytarr(361) ; clear rolls widget_control, rollslide, get_value=value cp.roll(value+180) = 1b ; set current roll rolls = where(cp.roll eq 1b, count) - 180 widget_control, labroll_id, $ set_value='Roll(s)= ' + strtrim(rolls(0), 2) end else: print,'Error - no such button ',input endcase 'TEXT' : begin widget_control, event.id, get_value=value, set_value='' if value(0) eq '' then return ; no input provided case input of 'DOYCON' : begin value = strcompress(value(0),/remove_all) colon = strpos(value, ':') if colon eq -1 then return yr = fix(strmid(value, 0, colon)) doy = fix(strmid(value, colon+1, 3)) parse_atime, atime(yydoy_2_ut([yr,doy])), $ mon=mon, day=day month = ['', 'Jan', 'Feb', 'Mar', 'Apr', $ 'May', 'Jun', 'Jul', 'Aug', $ 'Sep', 'Oct', 'Nov', 'Dec'] widget_control, condoy_id, set_value=value widget_control, conmon_id, set_value=$ strtrim(day,2)+'-'+month(mon)+$ '-'+strtrim(yr,2) end 'MONCON' : begin time = anytim(value(0), /utime) dtime = ut_2_yydoy(time) widget_control, conmon_id, set_value=value(0) widget_control, condoy_id, set_value= $ string(dtime(0),'(i2.2)')+':' $ +string(dtime(1),'(i3.3)') end 'SINTIME' : begin cp_cattime, time=value(0), cp=cp, cas=0 widget_control, man_start_id, set_value=cp.stime end 'EINTIME' : begin cp_cattime, time=value(0), cp=cp, cas=1 widget_control, man_end_id, set_value=cp.etime end else : print,'Error - Invalid text widget ',value(0) endcase end 'SLID' : begin if cp.roll(event.value+180) eq 0b $ then cp.roll(event.value+180) = 1b $ else cp.roll(event.value+180) = 0b rolls = where(cp.roll eq 1b, count) - 180 if count eq 0 then begin ; got to have at least 1 roll cp.roll(event.value+180) = 1b rolls = where(cp.roll eq 1b, count) - 180 endif lab = 'Roll(s)= ' + strtrim(rolls(0), 2) for i = 1, count-1 do lab = lab+','+strtrim(rolls(i),2) widget_control, labroll_id, set_value=lab end else: print,'Error - no such type ',type endcase return end ;============================================================================= ; ARRAY is set if call by the CP.PRO code, only the array is return pro cp_catwidget, cp=cp_1, cat_widg=cat_widg common cpcatstruc, cp ; the "parameter" structures common passers, yield ; pass to event handler common myfont, myfont common cat_bases, $ base, man_start_id, man_end_id, $ roll_id, rollslide, condoy_id, conmon_id, $ labroll_id, sect_id, filt_id, polar_id, cal_id if xregistered('cp_catwidget') then return cp = cp_1 yield = 2b ; default is to list widget if cat_widg.group eq '' then $ ; the top most base base = widget_base(title='CP Catalog Program Version 1.0', /column, $ xpad=25, ypad=25) $ else base = widget_base(title='CP Catalog Program Version 1.0', /column, $ xoffset=20, yoffset=50, xpad=25, ypad=25) control_base = widget_base(base, /row) col2 = widget_base(control_base, /column) col1 = widget_button(col2, value='QUIT',uvalue='QUIT', font=myfont) xpdmenu, ['"RESET" {', $ '"all" RES_ALL', $ '"TIME" RES_TIME', $ '"SECTOR" RES_SEC', $ '"FILTER" RES_FIL', $ '"POLAROID" RES_POL', $ '"CAL MIRROR" RES_CAL', $ '"ROLL " RES_ROLL', $ '}' ], col2, font=myfont help = widget_button(col2, value='HELP', uvalue='HELP', font=myfont) font = widget_button(col2, value='FONT', uvalue='FONT', font=myfont) col5 = widget_base(control_base, /nonexclusive, /column, /frame) arry= widget_button(col5, value='Array', uvalue='ARRAY', font=myfont) scrn= widget_button(col5, value='Screen', uvalue='SCREEN', font=myfont) disk= widget_button(col5, value='Disk File', uvalue='DISK', font=myfont) prin= widget_button(col5, value='Printer', uvalue='PRINTER', font=myfont) col6 = widget_button(control_base,value='SEARCH',uvalue='SEARCH',font=myfont) col7 = widget_base(control_base, /frame, /column) lab = widget_label(col7, value='Date Conversion:', font=myfont) lab = widget_label(col7, value='Enter one to get the other.', font=myfont) convert = widget_base(col7, /row) conlab = widget_base(convert, /column) lab = widget_label(conlab, value='YY:DOY', font=myfont) lab = widget_label(conlab, value='or', font=myfont) lab = widget_label(conlab, value='DD-mon-YY', font=myfont) conval = widget_base(convert, /column) condoy_id = widget_text(conval, /editable, font=myfont, $ xsize=10, uvalue='DOYCON') conmon_id = widget_text(conval, /editable, font=myfont, $ xsize=10, uvalue='MONCON') time = widget_base(base, /row, /frame) pick = widget_base(time, /column, space=13) start_id = widget_button(pick, font=myfont, value='Start Time', $ uvalue='STARTBUT') end_id = widget_button(pick, font=myfont, value='End Time', $ uvalue='ENDBUT') inst = widget_base(time, /column) label = widget_label(inst, font=myfont, value='Select time range with the') label = widget_label(inst, font=myfont, value='buttons to the left or ') label = widget_label(inst, font=myfont, value='manually input to the right.') ttime = widget_base(time, /column) man_start_id = widget_text(ttime, /editable, xsize=15, font=myfont, $ value=cp.stime, uvalue='SINTIME') man_end_id = widget_text(ttime, /editable, xsize=15, font=myfont, $ value=cp.etime, uvalue='EINTIME') select = widget_base(base, /row) sect = widget_base(select, /nonexclusive, /column, /frame) sect_id = lonarr(8) sect_id(0) = widget_button(sect, value='SW sector', uvalue='SW', $ font=myfont) sect_id(1) = widget_button(sect, value='S sector', uvalue='S', $ font=myfont) sect_id(2) = widget_button(sect, value='SE sector', uvalue='SE', $ font=myfont) sect_id(3) = widget_button(sect, value='E sector', uvalue='E', $ font=myfont) sect_id(4) = widget_button(sect, value='NE sector', uvalue='NE', $ font=myfont) sect_id(5) = widget_button(sect, value='N sector', uvalue='N', $ font=myfont) sect_id(6) = widget_button(sect, value='NW sector', uvalue='NW', $ font=myfont) sect_id(7) = widget_button(sect, value='W sector', uvalue='W', $ font=myfont) filt = widget_base(select, /nonexclusive, /column, /frame) filt_id = lonarr(8) filt_id(0) = widget_button(filt, value='Red broadband filter', $ uvalue='R', font=myfont) filt_id(1) = widget_button(filt, value='Ha filter', uvalue='Ha', $ font=myfont) filt_id(2) = widget_button(filt, value='Open filter', uvalue='OP', $ font=myfont) filt_id(3) = widget_button(filt, value='Green Continuum filter', $ uvalue='GC', font=myfont) filt_id(4) = widget_button(filt, value='Green Line filter', uvalue='GL', $ font=myfont) filt_id(5) = widget_button(filt, value='Blue broadband filter', $ uvalue='B', font=myfont) filt_id(6) = widget_button(filt, value='Wideband filter', uvalue='WB', $ font=myfont) filt_id(7) = widget_button(filt, value='Green broadband filter', $ uvalue='G', font=myfont) band = widget_base(select, /column) polar = widget_base(band, /nonexclusive, /column, /frame) polar_id = lonarr(4) polar_id(0) = widget_button(polar, value='Clear polaroid', $ font=myfont, uvalue='CLR') polar_id(1) = widget_button(polar, value='+60 dg polaroid', $ font=myfont, uvalue='P60') polar_id(2) = widget_button(polar, value='0 dg polaroid', $ font=myfont, uvalue='DG0') polar_id(3) = widget_button(polar, value='-60 dg polaroid', $ font=myfont, uvalue='N60') cal = widget_base(band, /nonexclusive, /column, /frame) cal_id = lonarr(2) cal_id(0) = widget_button(cal, value='Cal. mirror IN', font=myfont, $ uvalue='CALIN') cal_id(1) = widget_button(cal, value='Cal. mirror OUT', font=myfont, $ uvalue='CALOUT') rollsel = widget_base(band, /column, /exclusive, /frame) roll_id = lonarr(2) roll_id(0) = widget_button(rollsel, value='All rolls', font=myfont, $ /no_release, uvalue='ALLROLL') roll_id(1) = widget_button(rollsel, value='Select rolls', font=myfont, $ /no_release, uvalue='ONEROLL') rollin = widget_base(base, /column, space=0) rollslide = widget_slider(rollin, font=myfont, $ value=0, minimum=-180, maximum=180) labroll_id = widget_label(rollin, value='Roll(s)= -180 to +180',$ font=myfont) widget_control, base, /realize widget_control, scrn, /set_button for i = 0, 7 do widget_control, sect_id(i), /set_button for i = 0, 7 do widget_control, filt_id(i), /set_button for i = 0, 3 do widget_control, polar_id(i), /set_button for i = 0, 1 do widget_control, cal_id(i), /set_button widget_control, roll_id(0), set_button=1 widget_control, roll_id(1), set_button=0 widget_control, rollslide, sensitive=0 widget_control, base, set_uvalue=cat_widg ; the CATDISPLAY structure if cat_widg.handler eq '' then $ xmanager, 'cp_catwidget', base, event_handler='cpcat_event' $ else xmanager, 'cp_catwidget', base, event_handler='cpcat_event', $ group_leader=cat_widg.group return end