;------------------------------------------------------------- ;+ ; NAME: ; mdsw_noch ; PURPOSE: ; Plot one MDS signal with Crosshairs ; CATEGORY: ; Example ; CALLING SEQUENCE: ; mdsw_noch ; COMMON BLOCKS: ; mdsw_noch ; NOTES: ; Your display may have to be set to 256 colors to see the crosshairs. ; LIMITATIONS: ; The printers and help file used here only work from UNIX. ; Only one version of this program may be run from a given IDL session. ; MODIFICATION HISTORY: ; 11-Feb-99 Using UNSETUP_X rather than SETUP_X ; 28-Jan-99 Took out cross-hair routines ; 26-Jan-99 Modified for using MDS at PPPL by Bill Davis ; 8/29/97 CH_example written by Bill Davis, ; ; GA Crosshair routines originally written by John Ferron. ; Now maintained by T. Terpstra ;- ;-------------------------------------------------------------- PRO PlotSomething COMMON mdsw_noch, which_plot ; if more than one type, remember which type COMMON mdsw_noch_INPUTS, MDSserver, shot_num, signal_name, Printer_List, Printer IF N_ELEMENTS( which_plot ) EQ 0 THEN BEGIN PLOT, SIN(FINDGEN(100)/5), /NODATA which_plot = 'whatever' RETURN ENDIF cYdata = MDSGetSig( signal_name, SIGUNITS=yUnits, XAXIS=cXdata, $ XUNITS=xUnits, STAT=readStat ) IF ( readStat ) THEN BEGIN pTitle = signal_name +' for shot ' + STRTRIM(shot_num,2) PLOT, cXdata, cYdata, XSTYLE=2, YSTYLE=2,LINESTYLE=0, $ YTITLE=yUnits, XTITLE=xUnits, TITLE=pTitle, CHARSIZE=1.1 ENDIF ELSE BEGIN dum=DIALOG_MESSAGE( 'Signal NOT found' ) ENDELSE RETURN END ;-------------------------------------------------------------- PRO mdsw_noch_event, ev, GROUP_LEADER=group_leader COMMON mdsw_noch, which_plot ; if more than one type, remember which type COMMON mdsw_noch_INPUTS, MDSserver, shot_num, signal_name, Printer_List, Printer WIDGET_CONTROL,ev.id,get_UVALUE = UVALUE ;;;PRINT, 'In mdsw_noch_event; UVALUE=', UVALUE CASE UVALUE of "Server": BEGIN ; read a new shot number from the screen widget WIDGET_CONTROL, ev.id, GET_VALUE=MDSserver MDSserver = STRTRIM( MDSserver(0), 2) stat = OpenMDSshot( MDSserver, shot_num ) IF NOT stat THEN BEGIN dum=Dialog_Message('Error opening that server') ENDIF END "Shot": BEGIN ; read a new shot number from the screen widget WIDGET_CONTROL, ev.id, GET_VALUE=shot_num shot_num = shot_num(0) stat = OpenMDSshot( MDSserver, shot_num ) IF NOT stat THEN BEGIN dum=Dialog_Message('Error opening that shot') ENDIF END "Signal": BEGIN ; read a new shot number from the screen widget WIDGET_CONTROL, ev.id, GET_VALUE=signal_name signal_name = STRTRIM( signal_name(0), 2) END 'Plot': BEGIN which_plot = 'whatever' stat = OpenMDSshot( MDSserver, shot_num ) PlotSomething END 'Printer_Select': BEGIN printer_index = ev.index printer = Printer_List( printer_index ) END 'print_plot': BEGIN stat = OpenMDSshot( MDSserver, shot_num ) ; make sure is open name = 'mdsw_noch' ; will leave a file with this name.ps IF ( (!D.NAME EQ 'X') OR (!D.NAME EQ 'MAC') ) THEN WIDGET_CONTROL,/hourglass SETUP_PS, name, PRINTER=printer PlotSomething UNSETUP_PS ; will print the above .ps file END 'Help_Program': BEGIN XDISPLAYFILE,'~bdavis/Class/mdsw_noch.txt',GROUP=ev.top END 'exit': WIDGET_CONTROL,/DESTROY,ev.top ENDCASE RETURN END ;--------------------------------------------------------------- PRO mdsw_noch COMMON mdsw_noch_INPUTS, MDSserver, shot_num, signal_name, Printer_List, Printer ; defaults for input fields MDSserver = 'nstx' shot_num = 89725 signal_name = '.waveforms:MB_IP_SL' !P.COLOR = MK_COLOR('black', TABLE=11) ; table 11 gives red box on middle button !P.BACKGROUND = MK_COLOR('white') !P.MULTI = 0 !X.MARGIN=[12,3] ; for when exponents needed on ticks ;--------------------------------------------------------------- ; Create a base baseID = WIDGET_BASE( TITLE='MDS Plotter', /COLUMN, MBAR=wMBarBase) wFileMenu = Widget_Button( wMBarBase, VALUE='File', /MENU) Forward_Function printerMenu ;;;wPrintSelect = CW_PDMENU( wMBarBase, printerMenu() ,/MBAR, $ ;;; UVALUE='Printer_Select', /RETURN_ID) wQuitButton = Widget_Button( wFileMenu, VALUE='Quit', UVALUE='exit') wHelpMenu = Widget_Button( wMBarBase, VALUE='Help', /HELP) wHelpButton = Widget_Button( wHelpMenu, VALUE='Help', UVALUE='Help_Program') wLRow = WIDGET_BASE(baseID, /ROW) textID1 = CW_Field(wLRow, Title='Server: ', /RETURN_EVENTS, /STRING, $ XSIZE=8, VALUE=MDSserver, UVALUE = 'Server' ) textID1 = CW_Field(wLRow, Title='Shot: ', /RETURN_EVENTS, /LONG, $ XSIZE=7, VALUE=shot_num, UVALUE = 'Shot' ) textID1 = CW_Field(wLRow, Title='Signal: ', /RETURN_EVENTS, /STRING, $ XSIZE=30, VALUE=signal_name, UVALUE = 'Signal' ) buttonID2 = WIDGET_BUTTON(wLRow, VALUE='Plot', UVALUE='Plot') ;--------------------------------------------------------------- ; Create the Draw widget baseRow1 = WIDGET_BASE( baseID, /ROW ) graphicsDrawID = WIDGET_DRAW(baseRow1, RETAIN=2, XSIZE=550, YSIZE=400) ; create location fields baseRow2 = WIDGET_BASE( baseID, /ROW ,xoffset=100, yoffset=100 ) bmid5 = WIDGET_BUTTON( baseRow2, VALUE='Print', UVALUE = 'print_plot') dum = WIDGET_LABEL(baseRow2, VALUE = 'to') ; make a menu of your favorite printer queues Printer_List = ['b143-lp4517 - Apple Laserwriter in B143', $ 'lwplusb248 - LW+ B248@LOB W. 2nd fl', $ 'lob201lw - LOB-201 Laser Writer', $ 'theoryne - Laser Writer in the Theory Hallway',$ 'crps - TFTR Control Room Laser #1' ] Printer = Printer_List(0) wPrintSelect = WIDGET_DROPLIST( baseRow2, VALUE=Printer_List, $ UVALUE='Printer_Select') WIDGET_CONTROL,baseID,/REALIZE WIDGET_CONTROL, graphicsDrawID, GET_VALUE=graphicsWindowID WSET, graphicsWindowID ;--------------------------------------------------------------- ; call XMANAGER, which will wait for events idlvers = FIX( STRMID(!VERSION.RELEASE,0,STRPOS(!VERSION.RELEASE,'.')) ) IF idlvers GE 5 THEN BEGIN XMANAGER,'mdsw_noch', baseID, /no_block ; /NO_BLOCK will return IDL prompt ENDIF ELSE BEGIN XMANAGER,'mdsw_noch', baseID ENDELSE END