;+ ;Event handlers for SXI Image Display and Analysis Client (IDAC) ; ;This file contains the event handlers for the widgets created by ;the procedures in the file IDAC.pro, automatically generated by ;IDL's GUI builder. It is central to the IDAC "project" (IDAC.prj). ; ;Inputs: None (Individual procedures have inputs) ;Outputs: None (Individual procedures may have outputs) ; ;Use of some components can be restricted by use of the ;"restrict" tag in the pinfo structure, as follows ; 0 for SWO usage ; 1 for SEC R&D usage -- SQL DataMiner read only ; 2 for Air Force -- SQL DataBridge read only ; 3 for SSW community -- no SQL ; ;Written: S. Greer, NOAA/SEC -- Version 9.0, April 9, 2003 ; ;-============================================================== ; ; IDL Event Callback Procedures ; IDAC_eventcb ; ; Generated on: 04/20/2001 09:40.12 ; ;----------------------------------------------------------------- ; Notify Realize Callback Procedure. ; Argument: ; wWidget - ID number of specific widget. ; ; ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDAC_init, wWidget, _EXTRA=_VWBExtra_ ; Initialize some variables. Create the info structure pointer, ; "pinfo". Only the pointer is generally passed to other procedures, ; so the overhead is low. IDACBaseID = wWidget idDraw = widget_info(wWidget, find_by_uname='IDACDraw') BrowserID = 0L widget_control,wWidget,get_uvalue=ids if n_elements(ids) gt 0 then begin BrowserID=ids.BrowserID chid = widget_info(BrowserID,/child) widget_control,chid,get_uvalue=binfo (*binfo).IdacID=IDACBaseID endif device,decomposed=0 forward_function DBSInit, DBS_get_g12_BrightRegionsByDateRange ;************************************************ ; SET RESTRICT ; 0 for SWO usage ; 1 for SEC R&D usage -- SQL DataMiner read only ; 2 for Air Force -- SQL DataBridge read only ; 3 for SSW community -- no SQL restrict = 0 ;************************************************ rstr= ['a','b','c','d'] ver = '9.0'+rstr[restrict] ; April 11, 2003 ; Compile DataMiner or DataBridge procedures, according to restrict ; (Dminer2.pro, a DataMiner routine, is handled separately) if restrict lt 2 then begin OdbcSqlx endif else begin dbService,'hi there' configFile = '\Program Files\SEC\DataBridgeServiceClient\seccommon.xml' retval = DBSInit(configFile) ; retval not used IDACDataBridge1 ; File containing several functions endelse ; ssw has the following common as a .pro file. IDLDE complains ; when you try to compile it, giving this error: ; End of file encountered before end of program. ; At: C:\IDAC\utstart_time_com.pro, Line 3 COMMON UTSTART_TIME, PRINT_START_TIME, ATIME_FORMAT if n_elements(atime_format) eq 0 then atime_format='YOHKOH' imgLoc = "\sxi_clients\singleimageclient\image\" ;loadct,0 set_plot,'WIN' img = intarr(512,512) ; Original tvscl'd image img[*] = 0 txt = "" ; Image text from filename idate = intarr(6) & idate(*) = 0 ; Image date ftsData = fltarr(512,512) & ftsData[*] = 0. ftsHdr = strarr(200) & ftsHdr[*] = "" pvxo = fltarr(512) & pvyo = pvxo pvxo[*] = 0. & pvyo = pvxo arcsec = 5. ; Default pixel size in arc seconds ; Allow for a maximum of bright regions (maxnbr) maxnbr = 50 br = replicate({bright,rank:'',x:0,y:0},maxnbr) info = {$ restrict:restrict, $ logscl:1, $ ; Scaling (0=linear, 1=log) arcs:arcsec, $ date:idate, $ idacID:0L, $ ; Widget ID of IDAC Base widget roiID:0L, $ ; Widget ID of ROI Manager Base widget zoomID:0L, $ ; Widget ID of extra zoom base widget Display:0, $ ; Flags (sum), 0,1,2,3,4 for active text display windows tempRoiDispID:0L,$ ;1 Widget ID of temporary ROI statistics text box brDispID:0L, $ ; 2 Widget ID of bright regions text box hdrDispID:0L,$ ; 3 Widget ID of FTS header display text box roiDispID:0L,$ ; 4 Widget ID of ROI display text box (under ROI Manager) dispID:0L, $ ; Widget ID of whatever text display popup box brightR:0, $ ; 1=Bright Reg displayed in IDAC draw window(s); 0=Not br:br, $ ; Array of 50 bright region structures maxnbr:maxnbr, $; Maximum number of bright regions to display doroi:0, $ ; Mouse button in ROI mode (1=yes,0=no) dwin:0, $ ; Draw window # of main widget zwin:0, $ ; Draw window # of zoom widget (if exists) rwin1:-1, $ ; Draw window # of ROI manager (if exists) rwin2:-1, $ ; Draw window # of ROI editor (if exists) file1:"", $ ; File name & path of currently loaded FTS file fname:"", $ ; File name w/o path imgLoc:imgLoc, $; Default image location (path) imgLvl:'-1', $ ; Image level of currently loaded image lvl0Hdr0:ptr_new(), $ ; Level 0 primary header lvl1Hdr0:ptr_new(), $ ; Level 1 primary header lvl0Hdr1:ptr_new(), $ ; Level 0 HASS header extension lvl1HdrX:ptr_new(), $ ; Level 1 other header extensions ftsData:ftsData, $ ftsHdr:ftsHdr, $ hdrDsp:0, $ ; Flag to indicate FTS header display is open or not ; The following 3 tags are used by the coord transformation routines dateObs:"", $ ; a datetime string: YYYY-MM-DDTHH:mm:SS.ccc sunr:0.0, $ b0:0.0, $ helio:1, $ ; Type of coordinates. 0=pixel coords. newimg:0, $ ; Flag set when a new image is loaded into IDAC ;------------------------------------------------------- ; All tags beginning with p have to do with profiles tool pbase:0L, $ ; Profiles base widget id pc1:0, $ ; Color indices (pc1,pc2 and pc3) pc2:150, $ pc3:255, $ pfirst:1, $ ; (Re)draw profile axes? pfl:0, $ ; Profiles widget is active, i.e. exists (or not) pmode:1, $ ; Columns(1) or Rows(0) pvxo:pvxo, $ pvyo:pvyo, $ pwin:0, $ ; Profiles draw window number px:0L, $ pxo:0L, $ py:0L, $ pyo:0L, $ ;------------------------------------------------------ dtStr:'', $ ; Date for DataBridge queries YYYY-MM-DDThh:mm:ss.sss ttl:"", $ txt:txt, $ updTbl:0, $ ; Flag to indicate database tables should be updated zm:1., $ ; Current zoom factor main IDAC draw window zmNew:0., $ ; Current zoom factor new IDAC draw window (0.=no window) newz:0 $ ; Flag for new zoom window exists } pinfo = ptr_new(info) (*pinfo).idacID = wWidget ; Get FTS header templates sxig12_templates Level0Hdr0Template,retval (*pinfo).lvl0Hdr0 = retval Level0Hdr1Template,retval (*pinfo).lvl0Hdr1 = retval Level1Hdr0Template,retval (*pinfo).lvl1Hdr0 = retval Level1Hdr1234Template, retval (*pinfo).lvl1HdrX = retval ; Check for the existence of a startup image ; Set (*pinfo).file1 = filename (if found). ; NOTE: Three possible cases: ; 1) No FTS images found in directory ; 2) 1 FTS image found (either Level-0 or Level-1) ; 3) More than 1 image found cmd = "dir " + imgLoc + "*.fts /B" spawn, cmd,fname, /HIDE if n_elements(fname) gt 0 then begin ; There's at least one file in the directory if n_elements(fname) gt 1 then fname = fname[0] if fname ne "" then begin fname1 = strtrim(fname,2) fname = fname1 (*pinfo).fname = fname ; Which level is this file? Set the structure tag value. if strmid(fname,23,1) eq 'A' then (*pinfo).imgLvl = '0' $ else (*pinfo).imgLvl = '1' (*pinfo).file1 = imgLoc + fname endif endif ; n_elements(fname) gt 0 widget_control, wWidget, set_uname='IDACMainBase' ; Save info structure (pointer=pinfo) in the user ; value of the first child of (this) main base widget chid = widget_info(wWidget,/child) widget_control, chid, set_uvalue=pinfo ; Put version number in title bar of base widget ttl = 'SXI Image Display and Analysis Client ' + ver widget_control,wWidget, tlb_set_title = ttl ; If restricted usage, disable some menu options if restrict eq 3 then begin id = widget_info(wWidget,FIND_BY_uname='IDACAnRegions') widget_control,id,sensitive=0 id = widget_info(wWidget,FIND_BY_uname='IDACAnBrightRegions') widget_control,id,sensitive=0 endif ; If there's a startup image file, call file opener if n_elements(fname) gt 0 and fname ne "" then begin IDACFileOpener,pinfo endif else begin retval = dialog_message("Select image from list",/information) endelse end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOpenFile, Event ; Find the draw widget IDACBaseID = Event.top idDraw = widget_info(IDACBaseID, find_by_uname='IDACDraw') if(idDraw gt 0) then begin ; Make the draw widget the current, active window widget_control, idDraw, get_value=drawWin wset, drawWin endif ; Temporarily turn off motion events widget_control,idDraw,Draw_Motion_Events=0 ; Get pinfo structure chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo (*pinfo).dwin = drawWin ; If Bright Regions display is open, close it (*pinfo).brightR = 0 ; Check if table exists valid = widget_info((*pinfo).dispID,/valid_id) if valid eq 1 then begin widget_control,(*pinfo).dispID,/destroy (*pinfo).dispID = 0L endif ; Currently, can only load SXI FTS images sFile = dialog_pickfile(path=(*pinfo).imgLoc,filter='SXI*.fts') ; If there is a file, draw it to the draw widget if(sFile ne "" and strpos(strupcase(sFile),'.FTS') ne -1) $ then begin ; If window is zoomed, put it back to 100% if (*pinfo).zm gt 1. then begin IDACOnZoom100,Event endif ; Read in the image and header ; Is it Level-0 or Level-1? levelOne = strpos(sFile,"_B") if levelOne ne -1 then begin fData=sxig12_read_one(sFile,fHdr,pinfo) (*pinfo).imgLvl = '1' endif else begin fData=sxig12_read(sFile,fHdr,pinfo) (*pinfo).imgLvl = '0' endelse if n_elements(fData) eq 1 then return (*pinfo).ftsData = fData (*pinfo).ftsHdr = fHdr ; Get information from header and display in text box-- ; also get date and pixels per arc sec and store in pinfo idTxt=widget_info(IDACBaseID, FIND_BY_UNAME='IDACInfoTxt') txt = IDACGetTxt(pinfo) ; Guard against non-SXI-project images being loaded into ; main draw widget--this is done by checking txt (the ; contents of the IDAC text widget composed from selected ; SXI FTS header via the procedure "IDACGetTxt.pro") ;if txt ne "" then begin widget_control,idTxt,set_value=txt (*pinfo).txt = txt if txt eq "" then begin (*pinfo).ftsData = congrid(fData,512,512,/interp) endif else (*pinfo).ftsData = fData (*pinfo).ftsHdr = fHdr ; Save ftsData in uvalue of draw window. The size of this ; image might change, so it should not be declared as a ; structure tag in pinfo. widget_control,idDraw,set_uvalue = (*pinfo).ftsData print,'FTS data extrema:',min(fData),max(fData) tvlct,r,g,b,/get im = (*pinfo).ftsData ; If TrueColor image, quantize image to pseudo-color if(size(im,/n_dim) eq 3) then $ im = color_quan(im,1,r,g,b) ; Handle TrueColor displays device, decomposed = 0 ; Load color table, if one exists if (n_elements(r) gt 0) then tvlct, r,g,b ; Display the image if (*pinfo).logscl then begin IDAClogtv,im,pinfo,(*pinfo).dwin ; ************** endif else begin wset,(*pinfo).dwin tvscl,im endelse ; If Profiles window is open, update its contents, ; that is, force it to draw new axes as soon as ; a mouse button is clicked if (*pinfo).pfl then (*pinfo).pfirst = 1 ; Enable menu options, now that there's an image id = widget_info(IDACBaseID, find_by_uname='IDACFileExport') widget_control,id,/sensitive id = widget_info(IDACBaseID, find_by_uname='IDACFilePrint') widget_control,id,/sensitive id = widget_info(IDACBaseID, find_by_uname='IDACToolsDisplay') widget_control,id,/sensitive id = widget_info(IDACBaseID, find_by_uname='IDACAnProfiles') widget_control,id,/sensitive id = widget_info(IDACBaseID, find_by_uname='IDACAnZoom') widget_control,id,/sensitive id = widget_info(IDACBaseID, find_by_uname='IDACAnZoomNew') widget_control,id,/sensitive id = widget_info((*pinfo).idacID,find_by_uname='IDACAnBrightRegions') widget_control,id,/sensitive ;endif endif ; If ROI Manager is active, update it's display ROIBaseID=(*pinfo).roiID valid = widget_info(ROIBaseID,/valid_id) if valid then begin ; Get rinfo structure chid = widget_info(ROIBaseID,/child) widget_control, chid, get_uvalue=rinfo ; Update pixel coordinates using arcsec coordinates ; and delta time calculated from DATE_OBS in FITS header ROI_UpdatePixCoord,pinfo,ptr=rinfo ; Display all defined regions on the image, with sn numbers roiManDrawID = widget_info(ROIBaseID,find_by_uname='ROIDraw') widget_control,roiManDrawID,get_value=roiManDWin widget_control,ROIBaseID,tlb_set_title= $ 'SXI Regions of Interest: '+(*pinfo).txt wset,roiManDWin if (*pinfo).logscl then begin IDAClogtv,(*pinfo).ftsData,pinfo,roiManDwin ; ************** endif else begin tvscl,(*pinfo).ftsData endelse ROIUpdateManWin,rinfo endif ; Turn on motion events widget_control,idDraw,/Draw_Motion_Events end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnExit, Event IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; In case user has exited IDAC without closing the ; ROI Manager, save the ROI data in the database, ; and close the ROI Manager gracefully. if (*pinfo).updTbl eq 1 then begin widget_control,/hourglass ROI_txt2table,ptr=pinfo (*pinfo).updTbl = 0 endif ROIBaseID = (*pinfo).roiID valid=widget_info(ROIBaseID,/valid_id) if valid then widget_control,ROIBaseID,/destroy widget_control, IDACBaseID, /destroy end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnXLoadct, Event IDACBaseID = Event.top ; Get info structure chid = widget_info(IDACBaseID,/child) widget_control,chid,get_uvalue = pinfo ; Make the Draw widget the current, active window: wset,(*pinfo).dwin img = (*pinfo).ftsData ; Make sure the image exists: if(n_elements(img) ne 0) then begin SXILoadct,group=IDACBaseID,updatename='IDACRefresh', $ updatedata=pinfo, use_current=1 ;, $ ; The following is a reminder of how to do a ; kill_notify event, if needed, when SXILoadct dies. ; Modify the contents of 'IDACSXILoadctKill', and ; add it to the project. Include the following in ; the call to SXILoadct (above). ;killnotify='IDACSXILoadctKill' ; Apply zoom factor isize = size(img) myimg = congrid(img,isize[1] * (*pinfo).zm, $ isize[2] * (*pinfo).zm,/interp) ;DON'T rescale the image as follows! ;IDAClogtv,myimg,pinfo,drawWin ;******* ; Save the image in the uvalue of the main Draw widget: ; Can't do this if main widget has been closed, with ; the Zoom widget still open. valid = widget_info(IDACBaseID,/valid) if valid then begin idDraw = widget_info(IDACBaseID, find_by_uname="IDACDraw") widget_control, idDraw, set_uvalue=myimg endif endif end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnIDL, Event spawn,'\RSI\IDL55\bin\bin.x86\idlde.exe',/noshell,/nowait end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnProfiles, Event IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; Return if profiles already active if (*pinfo).pfl eq 1 then return ; Return if no image is loaded if max((*pinfo).ftsData) eq 0 then return ; Open new draw widget for profiles base = widget_base(/column,frame=5,xsize=490,ysize=370, $ group=IDACBaseID,title='Profiles',uvalue=pinfo, $ kill_notify='IDACOnDestroyPfl',xoff=500) pflDraw = Widget_Draw(base, UNAME='IDACpflDraw' ,XOFFSET=100 $ ,YOFFSET=66 ,XSIZE=480, YSIZE=360) Widget_Control, /REALIZE, base widget_control, pflDraw, get_value=drawWin ; Save *pinfo structure (*pinfo).pfl = 1 (*pinfo).pbase = base (*pinfo).pwin = drawWin (*pinfo).pmode = 1 (*pinfo).pfirst = 1 ; Disable Profiles menu option and ROI check box id = widget_info(IDACBaseID,FIND_BY_uname='IDACAnProfiles') widget_control,id,sensitive=0 id=widget_info(IDACBaseID, FIND_BY_UNAME='IDACDoROICB') widget_control,id,sensitive=0 end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnRegions, Event IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control,chid,get_uvalue=pinfo ROIBaseID = (*pinfo).roiID valid = widget_info(ROIBaseID,/valid_id) widget_control,/hourglass if not(valid) then begin ; ROI Manager is not open; go ahead and open it ROI, group_leader=IDACBaseID,ididac=IDACBaseID ; Disable Regions of Interest in the IDAC menu id = Widget_Info(IDACBaseID, FIND_BY_uname='IDACAnRegions') widget_control,id,sensitive=0 endif end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnCoronal, Event end ;----------------------------------------------------------------- ; ; Empty stub procedure used for autoloading. ; pro IDAC_eventcb end ;----------------------------------------------------------------- ; BUTTON_EVENTS Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_DRAW, ID:0L, TOP:0L, HANDLER:0L, TYPE: 0, X:0, Y:0, ; PRESS:0B, RELEASE:0B, CLICKS:0} ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; TYPE returns a value that describes the type of draw widget ; interaction that generated an event: 0 - Button Press, 1 - ; Button Release, 2 - Motion, 3 - Viewport Moved, 4 - ; Visibility Changed (Expose) ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACDraw_OnButtonEv, Event ;print,!mouse.button IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; If button clicked in profile window, ignore widget_control,Event.id,get_value=win if win eq (*pinfo).pwin then return ; If profile window is active then toggle pmode, etc. if Event.type eq 0 then begin ; Button was clicked -- is profile window active? if (*pinfo).pfl eq 1 then begin ; Update profiles window (*pinfo).pmode = 1 - (*pinfo).pmode (*pinfo).pfirst = 1 ; Don't wait for the mouse to move, just go ahead ; and redraw the axes (calling OnMotionEv does this) IDACDraw_OnMotionEv, Event endif else begin ; Do ROI statistics if doroi is 1 if(*pinfo).doroi eq 1 then begin ; Get size of original image isize = size((*pinfo).ftsData) ix = isize(1) iy = isize(2) ptrInfo = ptr_new() res = IDACDefROI(ix,iy,xverts,yverts, $ zoom=(*pinfo).zm,ptrInfo = pinfo, $ Event) ; Pop up a window showing stats and option to save them IDACGetROIStats,pinfo,res,xverts,yverts endif endelse endif end ;----------------------------------------------------------------- ; MOTION_EVENTS Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_DRAW, ID:0L, TOP:0L, HANDLER:0L, TYPE: 0, X:0, Y:0, ; PRESS:0B, RELEASE:0B, CLICKS:0} ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; TYPE returns a value that describes the type of draw widget ; interaction that generated an event: 0 - Button Press, 1 - ; Button Release, 2 - Motion, 3 - Viewport Moved, 4 - ; Visibility Changed (Expose) ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACDraw_OnMotionEv, Event IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo if max((*pinfo).ftsData) eq 0 then return ; No image loaded zm = (*pinfo).zm ; Get current zoom factor x = fix(Event.x/zm) y = fix(Event.y/zm) fmt = '("X: ",i3.3," Y: ",i3.3)' fmt1 = '(A1,F4.1,1x,A1,F4.1)' fmt2 = '(A3,F6.1,1x,A3,F7.2)' str = string(format=fmt,x,y) retval = fltarr(3) if (*pinfo).helio then begin ; Convert from pixel to heliographic coords retval = sxi_pix2hel(x, y,pinfo) if n_elements(retval) gt 1 then begin if retval[0] eq 0. then begin lat=retval[1] & lon = retval[2] if lat ge 0 then ns='N' else ns='S' if lon ge 0 then ew='W' else ew='E' lat = abs(lat) & lon = abs(lon) str = string(format=fmt1,ns,lat,ew,lon) endif else begin pa = retval[1] & rv = retval[2] str = string(format=fmt2,"PA=",pa,"RV=",rv) endelse endif endif ; Display x and y in IDACLocTxt widget id=widget_info(IDACBaseID, FIND_BY_UNAME='IDACLocTxt') widget_control, id, set_value=str ; Display FTS file data value in IDACIntensTxt widget id=widget_info(IDACBaseID, FIND_BY_UNAME='IDACIntensTxt') fmt = '("Intensity: ",f10.2)' str = string(format=fmt,(*pinfo).ftsData[x,y]) widget_control, id, set_value=str ; If profiles window is active, update it device,window_state=ws if ws[(*pinfo).dwin] eq 1 then $ IDACUpdateProfiles,x,y,pinfo end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnDisplayHdr, Event IDACBaseID = Event.top ; Get FITS header from pinfo structure chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo if (*pinfo).hdrDsp eq 1 then return ; Parse header to get filename, used in window title hdr = (*pinfo).ftsHdr(where((*pinfo).ftsHdr ne "",cnt)) ; Check for standard SXI FTS file i = -1 & n = 0 while ((i eq -1) and (n lt cnt)) do begin p = strpos(hdr[n],'FILENAME') if p ne -1 then i = n n = n+1 endwhile n = 0 ; Check for any standard FTS file. This is not a rigorous test. ; We're just seeing if the header contains 'SIMPLE', not whether ; it's true or not. if i eq -1 then begin while ((i eq -1) and (n lt cnt)) do begin print,hdr[n] p = strpos(hdr[n],'SIMPLE') if p ne -1 then i = n n = n+1 endwhile endif if i gt 0 then begin str1 = (*pinfo).ftsHdr[i] sp = strpos(str1,"'") ; Find first single quote str1 = strmid(str1,sp+1) sp = strpos(str1,"'") ; Find second single quote str1 = strmid(str1,0,sp) str1 = str1 + ' Header' endif else str1 = 'Header' if i ge 0 then begin ; Disable Display FTS Header menu option id = widget_info(IDACBaseID,find_by_uname='IDACToolsDisplay') widget_control,id,sensitive=0 (*pinfo).hdrDsp = 1 (*pinfo).Display = 3 IDACTextPopUp,'dummy.txt',wText=id, text=(*pinfo).ftsHdr, $ width=65, group=IDACBaseID,title = str1, $ ptrInfo=pinfo endif end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnZoom100, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; Store zoom factor for use by motion events (*pinfo).zm = 1.0 IDACZoom,IDACBaseID end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnZoom110, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; Store zoom factor for use by motion events (*pinfo).zm = 1.1 IDACZoom,IDACBaseID end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnZoom150, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; Store zoom factor for use by motion events (*pinfo).zm = 1.5 IDACZoom,IDACBaseID ; If Bright Regions active, relabel the BR's if (*pinfo).brightR eq 1 then IDACUpdateBR,pinfo,(*pinfo).dwin end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnZoom200, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; Store zoom factor for use by motion events (*pinfo).zm = 2.0 IDACZoom,IDACBaseID end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnZoom300, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; Store zoom factor for use by motion events (*pinfo).zm = 3.0 IDACZoom,IDACBaseID end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnZoom400, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; Store zoom factor for use by motion events (*pinfo).zm = 4.0 IDACZoom,IDACBaseID end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnFTS, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo if max((*pinfo).ftsData) eq 0. then return wset,(*pinfo).dwin image = tvrd() ;common colors, ro,go,bo,r,g,b saveFile = dialog_pickfile( $ dialog_parent=IDACBaseID, $ file='temp.fts', $ filter='*.fts', $ ;path='\idl code', $ /write) ;print,'Saving ',saveFile if saveFile ne "" then writefits,saveFile,image else IDACZoom,IDACBaseID end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnPng, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo if max((*pinfo).ftsData) eq 0. then return wset,(*pinfo).dwin ; Get image image=tvrd8() ; Get current colors and find a contrasting color for text tvlct,r,g,b ,/get ; Trim the filename slash = strpos((*pinfo).file1,'\',/reverse_search) fname = strmid((*pinfo).file1,slash+1,200) len = strlen(fname) fname = strmid(fname,0,len-4) + '.png' c = colorContrast(image,0,511) xyouts,.05,.95,fname,/normal, color=c[1] xyouts,.052,.952,fname,/normal, color=c[0] ; This tvrd8().pro was provided by Atle Borsholm of RSI. image = tvrd8() saveFile = dialog_pickfile( $ dialog_parent=IDACBaseID, $ ;file='temp.png', $ file = fname, $ filter='*.png', $ ;path='.\Export', $ ; ******************** /write) ; Removing r,g,b from write_png results in a B&W image if saveFile ne "" then begin write_png,saveFile,image ,r,g,b print, 'Saved ',saveFile endif IDACZoom,IDACBaseID ; If Bright Regions active, relabel the BR's if (*pinfo).brightR eq 1 then IDACOnBrightRegions,Event end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnJpg, Event IDACBaseID = Event.top ; Get pinfo structure from child widget chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo if max((*pinfo).ftsData) eq 0. then return ; Note (*pinfo).dwin is a window#, not a widget ID wset,(*pinfo).dwin image = tvrd8() ; Get current colors and find a contrasting color for text tvlct,r,g,b,/get sz = size(image) image_true = bytarr(sz[1],sz[2],3) image_true[*,*,0] = [r[image]] image_true[*,*,1] = [g[image]] image_true[*,*,2] = [b[image]] ; Trim the filename, then use xyouts to label the image with it slash = strpos((*pinfo).file1,'\',/reverse_search) fname = strmid((*pinfo).file1,slash+1,200) len = strlen(fname) fname = strmid(fname,0,len-4) + '.jpg' c = colorContrast(image,0,511) xyouts,.05,.95,fname,/normal, color=[1] xyouts,.052,.952,fname,/normal, color=c[0] ; Read the image again, now that it has the label image = tvrd8() image_true = bytarr(sz[1],sz[2],3) image_true[*,*,0] = [r[image]] image_true[*,*,1] = [g[image]] image_true[*,*,2] = [b[image]] ; This is here, investigating method of including text ; in the file containing the JPEG image. The file is ; initially saved as temp.jpg, then the user gets to ; specify the filename he/she wants, then temp.jpg gets ; copied to that file. openw,lun,'temp.jpg',/get_lun write_jpeg,unit=lun,image_true,quality=50,true=3 ;,saveFile free_lun,lun saveFile = dialog_pickfile( $ dialog_parent=IDACBaseID, $ file=fname, $ filter='*.jpg', $ ;path='.\Export' $ ; ****************** /write $ ) if saveFile ne "" then begin cmd = "copy temp.jpg " +saveFile+" /B" spawn, cmd, /HIDE print,'Saved ',saveFile endif IDACZoom,IDACBaseID ; If Bright Regions active, relabel the BR's if (*pinfo).brightR eq 1 then IDACOnBrightRegions,Event end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnPrintImage, Event IDACBaseID = Event.top ; Get pinfo structure chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo if max((*pinfo).ftsData) eq 0. then return ; Note (*pinfo).dwin is a window#, not a widget ID wset,(*pinfo).dwin ; Get image from draw widget image = tvrd8() ;id = widget_info(IDACBaseID, find_by_uname='IDACDraw') ;widget_control,id,get_uvalue=image pixelSize=(*pinfo).arcs imageDate=(*pinfo).date IDACPrintImage,pinfo,image,pixelSize,imageDate end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnPrintHdr, Event IDACBaseID = Event.top ; Get FITS header from pinfo structure chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo fHdr = (*pinfo).ftsHdr(where((*pinfo).ftsHdr ne "",cnt)) if cnt eq 0 then return openw,lun,'temp.txt',/get_lun for i = 0,n_elements(fHdr)-1 do begin printf,lun,fHdr[i],string([13B]) endfor free_lun,lun set_plot,'WIN' device, print_file ='temp.txt' end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnPrinterSettings, Event res = dialog_printersetup() ;print,res if res ne 0 then IDACOnPrintImage,Event end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnHelioCoord, Event IDACBaseID = Event.top ; Get pinfo structure and set helio to one chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo (*pinfo).helio = 1 ; Disable helio menu option and enable pixel option id = widget_info(IDACBaseID,FIND_BY_uname='IDACHelioCoord') widget_control,id,sensitive=0 id = widget_info(IDACBaseID,FIND_BY_uname='IDACPixelCoord') widget_control,id,sensitive=1 end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnPixelCoord, Event IDACBaseID = Event.top ; Get pinfo structure and set helio to zero chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo (*pinfo).helio = 0 ; Disable pixel menu option and enable helio option id = widget_info(IDACBaseID,FIND_BY_uname='IDACPixelCoord') widget_control,id,sensitive=0 id = widget_info(IDACBaseID,FIND_BY_uname='IDACHelioCoord') widget_control,id,sensitive=1 end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnDoROICB, Event IDACBaseID = Event.top ; Get info structure chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo if (*pinfo).doroi eq 0 then begin ; Disable Profiles and Zoom menu options id = widget_info(IDACBaseID,FIND_BY_uname='IDACAnProfiles') widget_control,id,sensitive=0 id = widget_info(IDACBaseID,FIND_BY_uname='IDACAnZoom') widget_control,id,sensitive=0 (*pinfo).Display = 1 endif else begin ; Enable Profiles and Zoom menu options id = widget_info(IDACBaseID,FIND_BY_uname='IDACAnProfiles') widget_control,id,sensitive=1 id = widget_info(IDACBaseID,FIND_BY_uname='IDACAnZoom') widget_control,id,sensitive=1 endelse ; If an extra zoom window is open, hide it if (*pinfo).newz then widget_control,(*pinfo).zoomID,map=0 ; Check the ROI box (*pinfo).doroi = Event.select end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnBrightRegions, Event IDACBaseID = Event.top ; NOTE: (*pinfo).brightR gets turned ON by this function ONLY ; if the image displayed in IDAC draw window actually has bright ; regions defined on it. ; Get info structure chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo widget_control,/hourglass Hdr = (*pinfo).ftsHdr ftsname = Hdr[where(strmatch(Hdr,'FILENAME*') eq 1,cnt)] ftsname = strmid(ftsname[0],11,28) ; If restrict is 0 or 1, user is in-house and can use Data Miner, ; otherwise, user is external, and must use DataBridge Server ;******************************************************************** catch,errorStatus if errorStatus ne 0 then begin errstr = strtrim(string(errorStatus),2) + ' ' ;res = dialog_message('Caught an error, suspect DataMiner.') res = 'ERROR: ' + errstr + !ERROR_STATE.MSG msg = dialog_message(res) ; detailed error logging cd,'c:\SXI_Clients' openw,lun, 'errlog.txt',/get_lun ;, /append printf,lun,'Trapped an error in IDACOnBrightRegions' printf,lun,'error_state:' printf,lun,'name = ', !error_state.name printf,lun,'block = ', !error_state.block printf,lun,'code = ', !error_state.code printf,lun,'sys_code = ', !error_state.sys_code printf,lun,'msg = ', !error_state.msg printf,lun,'sys_msg = ', !error_state.sys_msg printf,lun,'msg_prefix = ', !error_state.msg_prefix free_lun,lun return endif ;******************************************************************** if (*pinfo).restrict lt 2 then begin ; Query the database to get the current br's (if any) for this image match = 'SXI_'+strmid(ftsname,4,19)+'BB_12.FTS' if cnt gt 0 then begin q = "select * from tb_g12_BrightRegions where fname='"+match+"'" nbr = Dminer2('SXIDataSource',q,pointer=res) if nbr lt 1 then begin note = "No bright regions available for this image." msg = dialog_message(note,/inform) goto,outtahere endif ;else begin ;msg = dialog_message('Number of BR = '+string(nbr)) ;endelse endif else begin msg = dialog_message('No "FILENAME" in FITS header!') goto,outtahere endelse endif else begin ;======================================================= ; Use the Data Bridge Server to get Bright Region data dtStr1 = (*pinfo).dtStr dtStr2 = dtStr1 res1 = DBS_get_g12_BrightRegionsByDateRange(dtStr1,dtStr2) sz = size(*res1) ; sz[1] contains the number of elements ; All elements are comma-delimited strings ; 0 = column headers ; 1 = data types ; 2 = first data element ; Create res as pointer to data array--ignore first 2 elements nbr = sz[1]-2 res = ptr_new(strarr(nbr,8)) i=0 for k=2,sz[1]-1 do begin sarr = strtok((*res1)[k],string(44B),/extract,/preserve_null) (*res)[i,*] = sarr[0:7] i = i+1 endfor ;======================================================= endelse ;************************************************ catch,/cancel ;************************************************ ;---------------------------------------------------------------- ; Now have bright region information for the image ;---------------------------------------------------------------- ; (*res)[n] array structure: ; 0 Bright Region .txt file names ; 1 Bright Region rank numbers for this image ; 2 Bright Region date obs ; 3 Bright Region x coord ; 4 Bright Region y coord ; 5 Some kind of intensity (Area?) ; 6 Another intensity ; 7 Flag (0,1) for off/on disk ;---------------------------------------------------------------- ; Save bright region info (unzoomed) in (*pinfo).br ;---------------------------------------------------------------- if nbr gt 50 then nbr = 50 for i = 0,nbr-1 do begin (*pinfo).br[i].rank = (*res)[i,1] endfor zm = (*pinfo).zm csize = 1.25 * zm if (*pinfo).brightR eq 0 then begin ; This "if" ensures that, if the main draw window already ; has bright regions displayed on it, they will not disappear ; due to colorContrast being applied twice, e.g. a black ; label turns white and disappears. wset,(*pinfo).dwin image = tvrd() tvlct,r,g,b, /get ; Get pixel coords of on-disk br's from helio coords ; Display the rank in IDAC draw window at br's location ondisk = where((*res)[*,7] eq 1,cnt) if cnt gt 0 then begin xh = float((*res)[ondisk,3]) yh = float((*res)[ondisk,4]) rank = (*res)[ondisk,1] for i = 0,cnt-1 do begin pix = sxi_hel2pix(xh[i],yh[i],pinfo) (*pinfo).br[i].x = pix[0] (*pinfo).br[i].y = pix[1] pix = pix*(*pinfo).zm x = pix[0] & y = pix[1] c = colorContrast(image,x,y) xyouts,x,y-2,rank[i],/device,color=c[1],align=.5, $ charthick = 1.25,charsize=csize ;xyouts,x-1,y-2-1,rank[i],/device,color=c[0],align=.5, $ ; charthick = 1.25,charsize=csize endfor endif offdisk = where((*res)[*,7] eq 0,cnt) if cnt gt 0 then begin ; Get pixel coords of off-disk br's from ; Position angle, radius vector (PA,RV) coords ; and display them in IDAC draw window xh = float((*res)[offdisk,3]) yh = float((*res)[offdisk,4]) rank = (*res)[offdisk,1] for i = 0,cnt-1 do begin pix = sxi_parv2pix(xh[i],yh[i],pinfo) (*pinfo).br[i].x = pix[0] (*pinfo).br[i].y = pix[1] pix = pix*(*pinfo).zm x = pix[0] & y = pix[1] c = colorContrast(image,x,y) xyouts,x,y-2,rank[i],/device,color=c[1],align=.5, $ charthick = 1.25,charsize=csize ;xyouts,x-1,y-2-1,rank[i],/device,color=c[0],align=.5, $ ; charthick = 1.25,charsize=csize endfor endif endif ;---------------------------------------------------------------- ; Take care of extra zoom window if it exists ;---------------------------------------------------------------- zm = (*pinfo).zmNew csize = 1.25 * zm if (*pinfo).newz then begin wset,(*pinfo).zwin image = tvrd() tvlct,r,g,b, /get ; Get pixel coords of on-disk br's from helio coords ; Display the rank in IDAC draw window at br's location ondisk = where((*res)[*,7] eq 1,cnt) if cnt gt 0 then begin xh = float((*res)[ondisk,3]) yh = float((*res)[ondisk,4]) rank = (*res)[ondisk,1] for i = 0,cnt-1 do begin pix = sxi_hel2pix(xh[i],yh[i],pinfo) (*pinfo).br[i].x = pix[0] (*pinfo).br[i].y = pix[1] pix = pix*(*pinfo).zmNew x = pix[0] & y = pix[1] c = colorContrast(image,x,y) xyouts,x,y-2,rank[i],/device,color=c[1],align=.5, $ charthick = 1.25,charsize=csize ;xyouts,x-1,y-2-1,rank[i],/device,color=c[0],align=.5, $ ; charthick = 1.25,charsize=csize endfor endif offdisk = where((*res)[*,7] eq 0,cnt) if cnt gt 0 then begin ; Get pixel coords of off-disk br's from ; Position angle, radius vector (PA,RV) coords ; and display them in IDAC draw window xh = float((*res)[offdisk,3]) yh = float((*res)[offdisk,4]) rank = (*res)[offdisk,1] for i = 0,cnt-1 do begin pix = sxi_parv2pix(xh[i],yh[i],pinfo) (*pinfo).br[i].x = pix[0] (*pinfo).br[i].y = pix[1] pix = pix*(*pinfo).zmNew x = pix[0] & y = pix[1] c = colorContrast(image,x,y) xyouts,x,y-2,rank[i],/device,color=c[1],align=.5, $ charthick = 1.25,charsize=csize ;xyouts,x-1,y-2-1,rank[i],/device,color=c[0],align=.5, $ ; charthick = 1.25,charsize=csize endfor endif endif ;---------------------------------------------------------------- ; Open text display showing bright region info in a table ;---------------------------------------------------------------- hd1 = " Rank Position Area Intensity " hd2 = " ---- ------------------ ---------- ----------------" str1 = strarr(4) & str = strarr(nbr) for i = 0,nbr-1 do begin rank = string(format='(2x,I2.2)',(*res)(i,1)) rank = rank+' ' if (*res)[i,7] eq '0' then begin ;strput,rank,'* ',4 pos = string(format='("PA=",F5.1," RV=",F4.2)', $ (*res)[i,3],(*res)[i,4]) endif else begin if (*res)[i,3] lt 0. then ns = 'S' else ns = 'N' if (*res)[i,4] lt 0. then ew = ' E' else ew = ' W' pos = string(format='("'+ns+'",F4.1,"'+ew+'",F4.1)', $ abs((*res)[i,3]),abs((*res)[i,4])) endelse str1[0] = rank str1[1] = string(format='(A18)',pos) str1[2] = string(format='(F9.2,1x)',(*res)[i,5]) str1[3] = string(format='(F14.3)',(*res)[i,6]) str[i] = strjoin(str1," ",/single) endfor str = [hd1,hd2,str] ; Check if table is already displayed, and get its position valid = widget_info((*pinfo).brDispID,/valid_id) if not valid then begin ; Table isn't already there, so create it (*pinfo).Display = 2 IDACTextPopUp,'dummy.txt',wText=id, text=str, $ width=50, group=IDACBaseID, font='Courier', $ height=8,title = 'Bright Regions -- '+(*res)[0,2], $ ptrInfo=pinfo endif ;---------------------------------------------------------------- ; Turn on bright regions flag and desensitize menu option ;---------------------------------------------------------------- (*pinfo).brightR = 1 id = widget_info((*pinfo).idacID,find_by_uname='IDACAnBrightRegions') widget_control,id,sensitive = 0 outtahere: end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACRestoreFile, Event ; This procedure reloads the selected image in normal size, ; and closes Bright Regions if active. IDACBaseID = Event.top ; Get info structure chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; If Bright Regions display is open, close it. Ditto ; for temporary ROI definition stats box. (*pinfo).brightR = 0 ; Check if table exists valid = widget_info((*pinfo).brDispID,/valid_id) if valid eq 1 then begin widget_control,(*pinfo).brDispID,/destroy (*pinfo).brDispID = 0L endif valid = widget_info((*pinfo).tempRoiDispID,/valid_id) if valid eq 1 then begin widget_control,(*pinfo).tempRoiDispID,/destroy (*pinfo).tempRoiDispID = 0L endif id = widget_info(IDACBaseID,find_by_uname='IDACAnBrightRegions') widget_control,id,/sensitive IDACOnZoom100, Event end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACAnNew100, Event ; Create new zoomed window to display image, adding ; scrollbars only if the window would otherwise exceed ; the desktop size. IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; If there is already a zoomed window, show a ; message and return. (This should never happen.) if (*pinfo).zmNew gt 0. then begin retval = dialog_message("Only one zoomed window allowed at a time." $ ,/information) return endif ; Set flag to indicate zoom is in new window (*pinfo).zmNew = 1.0 id = widget_info(IDACBaseID, FIND_BY_UNAME='IDACAnZoomNew') widget_control,id,sensitive=0 ; Call IDACZoomNew IDACZoomNew,IDACbaseID ; If Bright Regions active, label the BR's if (*pinfo).brightR then IDACUpdateBR,pinfo,(*pinfo).zwin end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACAnNew110, Event ; Create new zoomed window to display image, adding ; scrollbars only if the window would otherwise exceed ; the desktop size. IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; If there is already a zoomed window, show a ; message and return. (This should never happen.) if (*pinfo).zmNew gt 0. then begin retval = dialog_message("Only one zoomed window allowed at a time.", $ /information) return endif ; Set flag to indicate zoom is in new window (*pinfo).zmNew = 1.1 id = widget_info(IDACBaseID, FIND_BY_UNAME='IDACAnZoomNew') widget_control,id,sensitive=0 ; Call IDACZoomNew IDACZoomNew,IDACbaseID ; If Bright Regions active, label the BR's if (*pinfo).brightR then IDACUpdateBR,pinfo,(*pinfo).zwin end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACAnNew150, Event ; Create new zoomed window to display image, adding ; scrollbars only if the window would otherwise exceed ; the desktop size. IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; If there is already a zoomed window, show a ; message and return. (This should never happen.) if (*pinfo).zmNew gt 0. then begin retval = dialog_message("Only one zoomed window allowed at a time.", $ /information) return endif ; Set flag to indicate zoom is in new window (*pinfo).zmNew = 1.5 id = widget_info(IDACBaseID, FIND_BY_UNAME='IDACAnZoomNew') widget_control,id,sensitive=0 ; Call IDACZoomNew IDACZoomNew,IDACbaseID ; If Bright Regions active, label the BR's if (*pinfo).brightR then IDACUpdateBR,pinfo,(*pinfo).zwin end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACAnNew200, Event ; Create new zoomed window to display image, adding ; scrollbars only if the window would otherwise exceed ; the desktop size. IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; If there is already a zoomed window, show a ; message and return. (This should never happen.) if (*pinfo).zmNew gt 0. then begin retval = dialog_message("Only one zoomed window allowed at a time.", $ /information) return endif ; Set flag to indicate zoom is in new window (*pinfo).zmNew = 2.0 id = widget_info(IDACBaseID, FIND_BY_UNAME='IDACAnZoomNew') widget_control,id,sensitive=0 ; If Bright Regions active, label the BR's if (*pinfo).brightR then IDACUpdateBR,pinfo,(*pinfo).zwin ; Call IDACZoomNew IDACZoomNew,IDACbaseID end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACAnNew300, Event ; Create new zoomed window to display image, adding ; scrollbars only if the window would otherwise exceed ; the desktop size. IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; If there is already a zoomed window, show a ; message and return. (This should never happen.) if (*pinfo).zmNew gt 0. then begin retval = dialog_message("Only one zoomed window allowed at a time.", $ /information) return endif ; Set flag to indicate zoom is in new window (*pinfo).zmNew = 3.0 id = widget_info(IDACBaseID, FIND_BY_UNAME='IDACAnZoomNew') widget_control,id,sensitive=0 ; Call IDACZoomNew IDACZoomNew,IDACbaseID ; If Bright Regions active, label the BR's if (*pinfo).brightR then IDACUpdateBR,pinfo,(*pinfo).zwin end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACAnNew400, Event ; Create new zoomed window to display image, adding ; scrollbars only if the window would otherwise exceed ; the desktop size. IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo ; If there is already a zoomed window, show a ; message and return. (This should never happen.) if (*pinfo).zmNew gt 0. then begin retval = dialog_message("Only one zoomed window allowed at a time.", $ /information) return endif ; Set flag to indicate zoom is in new window (*pinfo).zmNew = 4.0 id = widget_info(IDACBaseID, FIND_BY_UNAME='IDACAnZoomNew') widget_control,id,sensitive=0 ; Call IDACZoomNew IDACZoomNew,IDACbaseID ; If Bright Regions active, label the BR's if (*pinfo).brightR then IDACUpdateBR,pinfo,(*pinfo).zwin end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnLog, Event IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo (*pinfo).logscl = 1 IDACZoom,IDACBaseID if (*pinfo).zmNew gt 0 then IDACZoomNew,IDACBaseID ; If ROI Manager open, get rinfo valid = widget_info((*pinfo).roiID,/valid_id) if not valid then return chid=widget_info((*pinfo).roiID,/child) widget_control, chid, get_uvalue=rinfo if (*pinfo).rwin1 gt 0 then begin IDACLogtv,(*pinfo).ftsData,pinfo,(*pinfo).rwin1 ROIUpdateManWin,rinfo endif if (*pinfo).rwin2 gt 0 then begin IDACLogtv,(*pinfo).ftsData,pinfo,(*pinfo).rwin2 ROIUpdateManWin,rinfo endif if (*pinfo).brightR then IDACUpdateBR,pinfo,(*pinfo).dwin if (*pinfo).newz then IDACUpdateBR,pinfo,(*pinfo).zwin end ;----------------------------------------------------------------- ; Activate Button Callback Procedure. ; Argument: ; Event structure: ; ; {WIDGET_BUTTON, ID:0L, TOP:0L, HANDLER:0L, SELECT:0} ; ; ID is the widget ID of the component generating the event. TOP is ; the widget ID of the top level widget containing ID. HANDLER ; contains the widget ID of the widget associated with the ; handler routine. ; SELECT is set to 1 if the button was set, and 0 if released. ; Normal buttons do not generate events when released, so ; SELECT will always be 1. However, toggle buttons (created by ; parenting a button to an exclusive or non-exclusive base) ; return separate events for the set and release actions. ; Retrieve the IDs of other widgets in the widget hierarchy using ; id=widget_info(Event.top, FIND_BY_UNAME=name) ;----------------------------------------------------------------- pro IDACOnLinear, Event IDACBaseID = Event.top chid = widget_info(IDACBaseID,/child) widget_control, chid, get_uvalue=pinfo (*pinfo).logscl = 0 IDACZoom,IDACBaseID if (*pinfo).zmNew gt 0 then IDACZoomNew,IDACBaseID ; If ROI Manager open, get rinfo valid = widget_info((*pinfo).roiID,/valid_id) if not valid then return chid=widget_info((*pinfo).roiID,/child) widget_control, chid, get_uvalue=rinfo if (*pinfo).rwin1 gt 0 then begin wset,(*pinfo).rwin1 tvscl,(*pinfo).ftsData ROIUpdateManWin,rinfo endif if (*pinfo).rwin2 gt 0 then begin wset,(*pinfo).rwin2 tvscl,(*pinfo).ftsData ROIUpdateManWin,rinfo endif if (*pinfo).brightR then IDACUpdateBR,pinfo,(*pinfo).dwin if (*pinfo).newz then IDACUpdateBR,pinfo,(*pinfo).zwin end