#pragma TextEncoding = "UTF-8" #pragma rtGlobals=3 // Use modern global access method and strict wave access //Basic Interface Window Box_IT_Panel() : Panel PauseUpdate; Silent 1 // building window... SetUp_Package() NewPanel /K=1 /W=(647,148,1289,505) as "Nominal Data Manipulation" PopupMenu XWave,pos={45.00,128.00},size={114.00,20.00},proc=SetXWavePopUp PopupMenu XWave,title="Wave",fSize=14 PopupMenu XWave,mode=7,popvalue="Text_A",value= #"wavelist(\"*\",\";\",\"\")" PopupMenu Xvar,pos={49.00,169.00},size={134.00,20.00},proc=SetXVarPopUp PopupMenu Xvar,title="X Variable",fSize=14 PopupMenu Xvar,mode=1,popvalue="Data",value= #"pop_up_var_X()" PopupMenu Yvar,pos={39.00,296.00},size={134.00,20.00},proc=SetYVariablePopUp PopupMenu Yvar,title="Y Variable",fSize=14 PopupMenu Yvar,mode=1,popvalue="Data",value= #"pop_up_var_Y()" Button Box_IT,pos={527.00,37.00},size={75.00,50.00},proc=Run_Do_It Button Box_IT,title="Do\rIt",fSize=18,fStyle=1,fColor=(0,0,65535) ListBox MarkerPick,pos={273.00,35.00},size={212.00,251.00},disable=2,fSize=14 ListBox MarkerPick,listWave=root:Packages:Box_It:Markerlabels ListBox MarkerPick,selWave=root:Packages:Box_It:SelWave ListBox MarkerPick,colorWave=root:Packages:Box_It:MarkerColor,mode= 4 PopupMenu Markerpop,pos={277.00,301.00},size={100.00,20.00},disable=2,proc=MarkerSet PopupMenu Markerpop,title="Marker",fSize=14,mode=17,value= #"\"*MARKERPOP*\"" PopupMenu MarkerColor,pos={387.00,301.00},size={90.00,20.00},disable=2,proc=SetColor PopupMenu MarkerColor,title="Color",fSize=14 PopupMenu MarkerColor,mode=1,popColor= (65535,32764,16385),value= #"\"*COLORPOP*\"" GroupBox GroupX,pos={19.00,94.00},size={232.00,120.00},title="X Wave/Variable" GroupBox GroupX,fSize=18,fStyle=1 GroupBox GroupY,pos={25.00,226.00},size={227.00,103.00},title="Y Wave/Variable" GroupBox GroupY,fSize=18,fStyle=1 CheckBox DoMarkers,pos={25.00,45.00},size={56.00,26.00},proc=SetModeCheckBox CheckBox DoMarkers,title="\\JLNone\rMarkers",fSize=10,value= 0,mode=1 CheckBox DoBox,pos={87.00,45.00},size={73.00,26.00},proc=SetModeCheckBox CheckBox DoBox,title="\\JLContinuous\rBox Plot",fSize=10,value= 1,mode=1 CheckBox DoMosaic,pos={165.00,47.00},size={72.00,26.00},proc=SetModeCheckBox CheckBox DoMosaic,title="\\JLNominal\rMosaic Plot",fSize=10,value= 0,mode=1 TitleBox MarkerNote,pos={280.00,329.00},size={156.00,19.00} TitleBox MarkerNote,title="Hold Modifier Key to Clear Marker" PopupMenu Ywave,pos={39.00,258.00},size={149.00,20.00},proc=SetYWavePopUp PopupMenu Ywave,title="Wave",fSize=14 PopupMenu Ywave,mode=1,popvalue="Single_Var_A",value= #"Pop_up_y_wave()" Button SendAnnotationToClip,pos={527.00,96.00},size={75.00,30.00},proc=SaveAnnotationTextButton Button SendAnnotationToClip,title="Save Legend\rto Clipboard",fSize=9 GroupBox ModeGroup,pos={13.00,9.00},size={250.00,81.00},title="Mode Selection" GroupBox ModeGroup,fSize=18,fStyle=1 EndMacro Function SetUp_Package() If(!DatafolderExists("root:Packages:Box_It")) NewDataFolder/O root:Packages NewDataFolder/O root:Packages:Box_It NewDataFolder/O root:Packages:Box_It:Mosaic Make/O/T /N =7 root:Packages:Box_It:PopUpSelection="" Wave/T PopupSelection =root:Packages:Box_It:PopUpSelection Setlabels("Xwave;Xvar;Ywave;Yvar;Mode;xType;Ytype",PopUpSelection,0) Make/O /N=10 root:Packages:Box_It:MarkerWave Make/O/T /N=(10,2) root:Packages:Box_It:Markerlabels Make/O/n=(10,2,2) root:packages:box_It:SelWave=0 Make/W/U/O/n=(10,4) root:packages:box_It:MarkerColor endif end //Interface Controls Function SetModeCheckBox(cba) : CheckBoxControl STRUCT WMCheckboxAction &cba Wave/T PopUpSelection = root:packages:box_it:popupSelection String ButtonGroup ="DoMarkers;DoBox;DoMosaic" String thepick Variable i switch( cba.eventCode ) case 2: // mouse up Variable checked = cba.checked for(i=0;i<3;i+=1) thepick = stringfromlist(i,ButtonGroup) checkbox $thepick value=stringmatch(cba.ctrlname,thepick) endfor popupMenu yvar disable=(stringmatch(cba.ctrlname,"DoMarkers")? 2 : 0) popupMenu ywave disable=(stringmatch(cba.ctrlname,"DoMarkers")? 2 : 0) popupselection[%mode] = cba.ctrlName strswitch(cba.ctrlName) case "DoMarkers": listbox markerpick disable=0 popupMenu Markerpop disable=0 popupMenu MarkerColor disable=0 break case "DoBox": listbox markerpick disable=2 popupMenu Markerpop disable=2 popupMenu MarkerColor disable=2 break case "DoMosaic": listbox markerpick disable=0 popupMenu Markerpop disable=2 popupMenu MarkerColor disable=0 break endswitch break case -1: // control being killed break endswitch return 0 End //X Wave uses generic wavelist to fill Function SetXWavePopUp(pa) : PopupMenuControl STRUCT WMPopupAction &pa Wave/T PopUpSelection = root:packages:box_it:popupSelection switch( pa.eventCode ) case 2: // mouse up Variable popNum = pa.popNum String popStr = pa.popStr //Populate entry into lookup wave PopUpSelection[%$pa.ctrlName]=popStr Wave TypeTest =$popstr PopUpSelection[%xType] = returntype(TypeTest) break case -1: // control being killed break endswitch return 0 End Function/T pop_up_var_X() //Decision Process: Which is Used Base Data where it is either a text wave or numeric, the data row dimension labels if they exist, or 2d wave the column names Variable index,maxindex string labelstring="" Wave/T PopupSelection =root:Packages:Box_It:PopUpSelection wave input=$popupselection[%xwave] if(waveExists(input)) //Does it have row labels if(hasRowLabels(input,0)) labelstring +="Row Labels;" endif if(waveDims(input)==1)//Used only for 1D waves labelstring +="Data;" endif //Does it Column Labels if(hasrowLabels(input,1)) maxindex=dimsize(input,1) for(index=0;index0 end Function/T MarkerAnnotationText() wave/T ML = root:packages:box_it:markerlabels wave MC = root:packages:box_it:markerColor String Thetext="" String ColorText,ColorMarker variable index, maxindex maxindex = dimsize(ML,0) for(index=0;index=numpnts(lba.listwave)) return 0 endif Duplicate /free lba.selwave order order[][0] = x order[dragNum][0] = (lba.row>dragNum) ? lba.row+0.5 : lba.row-0.5 Sort order, lba.listwave ListBox $lba.ctrlName, win=$lba.win, userdata(drag)=num2str(lba.row) endif end Function /Wave TextWave_Return(Which) String Which Wave/T SL = root:packages:box_it:popupSelection wave tempX = $SL[%xwave] Make/FREE/T /N=(dimsize(tempx,0)) TotalText String dWave,dVar,dType dWave = SL[%$(Which+"wave")] dVar = SL[%$Which+"var"] dType = SL[%$(Which+"Type")] //Handle row labels seperately since I don't need to know type Wave Subject =$dWave if(stringMatch(dVar,"Row Labels")) Totaltext =getdimLabel(Subject,0,p) else if(stringMatch(dType,"Numeric")) Wave SubNum =$dWave if(stringMatch(dVar,"Data")) totaltext = num2str(SubNum[p]) else totaltext[]=num2str(subNum[p][%$dVar]) endif else Wave/T SubTx=$dWave if(stringMatch(dVAr,"Data")) totaltext = subtx else totaltext[]=subtx[p][%$dVar] endif endif endif return TotalText End Function/S provenance() String History="" Wave/T SL = root:packages:box_it:popupSelection Variable Index,maxindex maxindex = numpnts(sl) for (index=0;index