1. Richard Gerkin
  2. Recording Artist

Commits

Richard Gerkin  committed fb637ae

Changes for Gilberto

  • Participants
  • Parent commits 5be2832
  • Branches default

Comments (0)

Files changed (7)

File Acquisition/Acquisition Settings.ipf

View file
  • Ignore whitespace
 end
 
 // Applies a loaded package instance to the given channel.  Deals with some of the hierarchical application of package instances, e.g. selecting a channel configuration often implies selecting a stimulus.  
-Function SelectPackageInstance(module,package,instance[,special])
-	string package,instance,module,special
+Function SelectPackageInstance(package,instance[,special])
+	string package,instance,special
 	
 	special=selectstring(!paramisdefault(special),"",special)
 	variable chan=NumberByKey("CHAN",special)
 	endif
 	
 	strswitch(package)
+		case "sweepsWin":
+			string liveInstance = "win0"
+			strswitch(instance)
+				case "_Save_":
+					do
+						string targetInstance = Core#DefaultInstance(module,package)
+						prompt targetInstance,"Name:"
+						DoPrompt "Enter the desired name for this "+package+" instance",targetInstance
+						if(!v_flag)
+							// Save cursors and axes for current view.  
+							string curr_view=GetCurrSweepsView()
+							SaveAxes(curr_view,win=package) // Assumes package and window have the same name.  
+							
+							struct rect coords
+							Core#CopyInstance(module,package,liveInstance,targetInstance)
+							Core#GetWinCoords(package,coords) // Assumes package and window have the same name.  
+							Core#SetVarPackageSetting(module,package,targetInstance,"left",coords.left,sub="position")
+							Core#SetVarPackageSetting(module,package,targetInstance,"top",coords.top,sub="position")
+							Core#SetVarPackageSetting(module,package,targetInstance,"right",coords.right,sub="position")
+							Core#SetVarPackageSetting(module,package,targetInstance,"bottom",coords.bottom,sub="position")
+							
+							// Copy one of the vertical axes to the generic "Ampl_Axis".   
+							dfref df = Core#InstanceHome(module,package,targetInstance,sub=curr_view)
+							string acqModes = ListAcqModes()
+							variable i
+							for(i=0;i<itemsinlist(acqModes);i+=1)
+								string acqMode = stringfromlist(i,acqModes)
+								dfref sourceDF = df:$(acqMode+"_axis")
+								if(datafolderrefstatus(sourceDF))
+									break
+								endif
+							endfor
+							if(datafolderrefstatus(sourceDF))
+								string targetFolder = joinpath({getdatafolder(1,df),"Ampl_Axis"})
+								Core#CopyData(sourceDF,targetFolder)
+							endif
+							
+							if(!Core#SavePackageInstance(module,package,targetInstance))
+								printf "%s instance %s successfully saved.\r",package,targetInstance
+							endif
+						else
+							break
+						endif
+					while(!strlen(targetInstance)) // User must supply an instance name of some length.  
+					break	
+				default:
+					Core#CopyInstance(module,package,instance,liveInstance)
+				endswitch
+			break
 		case "DAQs":
 			strswitch(instance)
 				case "_Save_":
 								Core#CopyInstance(module,package,winDAQ,targetDAQ)
 								Core#SetWavTPackageSetting(module,"DAQs",targetDAQ,"channelConfigs",labels)
 								string win = GetDAQWin(DAQ = winDAQ)
-								struct rect coords
 								Core#GetWinCoords(win,coords)
 								Core#SetVarPackageSetting(module,package,targetDAQ,"left",coords.left,sub="position")
 								Core#SetVarPackageSetting(module,package,targetDAQ,"top",coords.top,sub="position")
 								if(!Core#SavePackageInstance(module,package,targetDAQ))
-									printf "DAQ instance %s successfully saved.\r",targetDAQ
+									printf "%s instance %s successfully saved.\r",package,targetDAQ
 								endif
 							endif
 						else
 		case "channelConfigs":
 			Core#SetStrPackageSetting(module,"channelConfigs",name,"DAQ",DAQ) // Set the stimulus name.  
 			string stimName=GetStimulusName(chan)
-			SelectPackageInstance(module,"stimuli",stimName,special=special)
+			SelectPackageInstance("stimuli",stimName,special=special)
 			break
 		case "stimuli":
 			Core#SetStrPackageSetting(module,"channelConfigs",name,"stimulus",instance) // Set the stimulus name.  
 			string vars="pulseSets;duration;ISI;sweepsLeft;"
-			variable i
 			for(i=0;i<itemsinlist(vars);i+=1)
 				string var=stringfromlist(i,vars)
 				nvar /z/sdfr=instanceDF val=$var
 					Core#SetVarPackageSetting(module,"DAQs",DAQ,var,val)
 				endif
 			endfor
-			string acqMode=Core#StrPackageSetting(module,package,instance,"acqMode")
+			acqMode=Core#StrPackageSetting(module,package,instance,"acqMode")
 			if(strlen(acqMode) && !stringmatch(acqMode," "))
-				string acqModes=ListAcqModes()
+				acqModes=ListAcqModes()
 				if(WhichListItem(acqMode,acqModes)<0)
 					string default_acqMode = StringFromList(0,acqModes)
 					string alert

File Acquisition/Acquisition Wave Functions.ipf

View file
  • Ignore whitespace
 	return Core#StrPackageSetting(module,"channelConfigs",GetChanName(chan),"acqMode",quiet=quiet)
 End
 
-Function /S GetAcqModeOutputType(modeName)
+Function /S GetAcqModeOutputQuantity(modeName)
 	string modeName
 	
 	return Core#StrPackageSetting(module,"acqModes",modeName,"outputType")
 End
 
-Function /S GetAcqModeInputType(modeName)
+Function /S GetAcqModeInputQuantity(modeName)
 	string modeName
 	
 	return Core#StrPackageSetting(module,"acqModes",modeName,"inputType")
 function /s GetOutputUnits(chan)
 	variable chan
 	
-	string type=GetOutputType(chan)
-	return Core#StrPackageSetting(module,"quantities",type,"units")
+	string quantity=GetOutputQuantity(chan)
+	string units = Core#StrPackageSetting(module,"quantities",quantity,"units")
+	string prefix = Core#StrPackageSetting(module,"quantities",quantity,"prefix")
+	return prefix+units
 end
 
 function /s GetInputUnits(chan)
 	variable chan
 	
-	string type=GetInputType(chan)
-	string units = Core#StrPackageSetting(module,"quantities",type,"units")
-	string prefix = Core#StrPackageSetting(module,"quantities",type,"prefix")
+	string quantity=GetInputQuantity(chan)
+	string units = Core#StrPackageSetting(module,"quantities",quantity,"units")
+	string prefix = Core#StrPackageSetting(module,"quantities",quantity,"prefix")
 	return prefix+units
 end
 
-Function /S GetOutputType(chan)
+Function /S GetOutputQuantity(chan)
 	Variable chan
 	
 	string type=""
 			break
 		default:
 			string modeName=GetAcqMode(chan)
-			type=GetAcqModeOutputType(modeName)
+			type=GetAcqModeOutputQuantity(modeName)
 	endswitch
 	return type
 End
 
-Function /S GetInputType(chan)
+Function /S GetInputQuantity(chan)
 	Variable chan
 	
 	string type=""
 			break
 		default:
 			string modeName=GetAcqMode(chan)
-			type=GetAcqModeInputtype(modeName)
+			type=GetAcqModeInputQuantity(modeName)
 	endswitch
 	return type
 End
 
+function /S GetInputType(chan)
+	variable chan
+	
+	string quantity = GetInputQuantity(chan)
+	string type = Core#StrPackageSetting(module,"quantities",quantity,"type")
+	return type
+end
+
+function /S GetOutputType(chan)
+	variable chan
+	
+	string quantity = GetOutputQuantity(chan)
+	string type = Core#StrPackageSetting(module,"quantities",quantity,"type")
+	return type
+end
+
 Function /S SelectedMethod()
 	string result=""
 	dfref analysisWinDF=Core#PackageHome(module,"analysisWin")

File Acquisition/Acquisition Windows.ipf

View file
  • Ignore whitespace
 						Core#SetControlUserData(info.ctrlName,"oldLabel",newLabel)
 						Core#SetStrPackageSetting(module,"channelConfigs",name,"label_",newLabel) // Update the channel label.  
 					endif
-					SelectPackageInstance(module,"channelConfigs",newLabel,special=special)
+					SelectPackageInstance("channelConfigs",newLabel,special=special)
 					SetVariable $info.ctrlName userData(oldLabel)=Labels[chan]
 					string chanName=GetChanName(chan)
 					if(!stringmatch(newLabel,chanName))
 					break
 				default:
 					string stimName=info.popStr
-					SelectPackageInstance(module,"stimuli",stimName,special=special)
+					SelectPackageInstance("stimuli",stimName,special=special)
 			endswitch
 			break
 		case "SaveMode":
 	SwitchView(default_view) // Set broad or focused (check user data for SwitchView button)	
 	ResetSweepAxes(default_view)
 	SweepsWinControlsUpdate()
-	SetWindow SweepsWin hook=RefreshHook, hookEvents=5
-	RefreshHook("WINDOW:SweepsWin;EVENT:resize")
+	SetWindow SweepsWin hook(mainHook)=SweepsWinHook
+	struct wmwinhookstruct info
+	info.eventName="resize"
+	SweepsWinHook(info)
 	//KillVariables /Z red,green,blue
 End
 
 	endfor
 End
 
+function /s GetCurrSweepsView()
+	return GetUserData("SweepsWin","SwitchView","")
+end
+
 // A window that show whole sweeps.  By default it shows the last sweep from each channel, and other
 // sweeps can be shown, too.  
 Function SwitchView(view)
 	wave /T Labels=GetChanLabels()
 	
 	// Determine requested view and save current view.  
-	String curr_view=GetUserData("SweepsWin","SwitchView","")
+	string curr_view=GetCurrSweepsView()
 	SaveCursors(curr_view,win="SweepsWin")
 	SaveAxes(curr_view,win="SweepsWin")
 	if(StringMatch(view,"SwitchView"))
 End
 
 // Handles all hooks for windows
+
+function SweepsWinHook(info)
+	struct WMWinHookStruct &info
+	if(info.eventCode==4)
+		return 0
+	endif
+	strswitch(info.eventName)
+		case "cursormoved":
+			string method=SelectedMethod()
+			if(strlen(method))
+				dfref instanceDF=Core#InstanceHome(module,"analysisMethods",method,create=1)
+				ControlInfo /W=SweepsWin SwitchView; String view=S_userdata
+				Variable focused=StringMatch(view,"Focused")
+				dfref instanceDF=Core#InstanceHome(module,"analysisMethods",method)
+				strswitch(info.cursorName)
+					case "A":
+						variable /g instanceDF:$("x_left_"+view)=focused ? xcsr2("A",win="SweepsWin") : xcsr(A,"SweepsWin")
+						break
+					case "B":
+						variable /G instanceDF:$("x_right_"+view)=focused ? xcsr2("B",win="SweepsWin") : xcsr(B,"SweepsWin")
+						break
+					endswitch
+				endif
+			break
+		case "resize":
+			if(!WinType("SweepsWin"))
+				return -1
+			endif
+			GetWindow SweepsWin,wsizeDC
+			Variable narrow=(V_right-V_left<1200)
+			ControlBar /W=SweepsWin /L 105*narrow
+			variable numChannels=GetNumChannels()
+			String sweepsWinButtons="WaveSelector;Logger"
+			variable i
+			for(i=0;i<ItemsInList(sweepsWinButtons);i+=1)
+				String buttonName=StringFromList(i,sweepsWinButtons)
+				Variable ypos=max(3,numChannels)*18+5
+				Button $buttonName pos={narrow ? 2 : V_right-(2-i)*201,narrow ? ypos+i*35 : 5}, fsize=GetFontSize()+2, win=SweepsWin
+			endfor
+			break
+		case "modified":
+			ControlInfo /W=SweepsWin sweepOverlay
+			if(v_flag<=0 || !StringMatch(ClearBrackets(s_value),"Split"))
+				break
+			endif
+			String axes=AxisList("SweepsWin")
+			for(i=0;i<ItemsInList(axes);i+=1)
+				String axis=StringFromList(i,axes)
+				String axis_info=AxisInfo("SweepsWin",axis)
+				String axisType=StringByKey("AXTYPE",axis_info)
+				if((StringMatch(axisType,"left") || StringMatch(axisType,"right")) && !StringMatch(axis,"Stim*") && !StringMatch(axis,"TestPulse*"))
+					SweepsWinVertAxisOffsets(axis)
+				endif
+			endfor
+		case "mousedown":
+			string str
+			structput /s info.mouseLoc str
+			SetWindow SweepsWin userData(mouseDown)=str
+			if(info.mouseLoc.v<30)
+				PopupContextualMenu Core#ListPackageInstances(module,"sweepsWin")+"_Save_"
+				if(v_flag>=0)
+					SelectPackageInstance("sweepsWin",s_selection)
+				endif
+			endif
+			break
+		case "mouseup":
+			structput /s info.mouseLoc str
+			SetWindow SweepsWin userData(mouseUp)=str
+			break
+	endswitch
+end
+
 Function RefreshHook(info_str)
 	string info_str
 	
 					string str
 					structput /s mouseDown str
 					SetWindow SweepsWin userData(mouseDown)=str
+					if(mouseDown.v<30)
+						PopupContextualMenu Core#ListPackageInstances(module,"sweepsWin")+"_Save_"
+					endif
+					break
+				case "mouseup":
+					struct point mouseUp
+					mouseUp.h=NumberByKey("MouseX",info_str)
+					mouseUp.v=NumberByKey("MouseY",info_str)
+					structput /s mouseUp str
+					SetWindow SweepsWin userData(mouseUp)=str
 					break
 			endswitch
 			//SetWindow SweepsWin hook=RefreshHook

File Acquisition/SuperClamp.ipf

View file
  • Ignore whitespace
 				Slider $("Offset_"+num2str(i)),size={100,25},limits={low,high,0.25},fsize=7,vert=0,title="Offset",userTicks={f:TickValues,f:TickLabels},win=SuperClampWin
 			endif
 			
-			
 			// Update control positions, units, and titles.  
 			Variable red,green,blue
 			GetChanColor(i,red,green,blue)
 			String titleStr
 			sprintf titleStr,"\K(%d,%d,%d)%s",red,green,blue,Chan2Label(i)
 			Checkbox $("Hold_"+num2str(i)) pos={5,row*25+5},title=titleStr, win=SuperClampWin
-			SetVariable $("CommandMV_"+num2str(i)) pos={55,row*25+5},title="mV", win=SuperClampWin
-			SetVariable $("CommandPA_"+num2str(i)) pos={130,row*25+5},title="pA", win=SuperClampWin
-			Slider $("Offset_"+num2str(i)) pos={210,row*25+2},win=SuperClampWin
+			SetVariable $("CommandMV_"+num2str(i)) pos={65,row*25+5},title="mV", win=SuperClampWin
+			SetVariable $("CommandPA_"+num2str(i)) pos={140,row*25+5},title="pA", win=SuperClampWin
+			Slider $("Offset_"+num2str(i)) pos={220,row*25+2},win=SuperClampWin
 			validChannels+=num2str(i)+";"
 		else
 			// Kill old controls for channels that no longer have the right acquisition mode.  

File Basics/Graphing.ipf

View file
  • Ignore whitespace
 	
 	win=selectstring(!ParamIsDefault(win),winname(0,1),win)
 	name=selectstring(strlen(name),"Broad",name)
-	dfref df=Core#InstanceHome("Acq",win,name,create=1)
+	dfref df=Core#InstanceHome("Acq",win,"win0",create=1,sub=name)
 	String cursors="A;B",stem="xcsr_"
 	Variable i
 	for(i=0;i<ItemsInList(cursors);i+=1)
 	Variable offset // An constant offset for the cursors with respect to the saved positions.
 	win=selectstring(!ParamIsDefault(win),winname(0,1),win)
 	name=selectstring(strlen(name),"Broad",name)
-	dfref df=Core#InstanceHome("Acq",win,name,quiet=1)
+	dfref df=Core#InstanceHome("Acq",win,"win0",sub=name,quiet=1)
 	if(!datafolderrefstatus(df))
 		//printf "Could not find data '%s' to restore cursors for window '%s'.\r",name,win
 		return -1
 	String name,win
 	
 	win=selectstring(!ParamIsDefault(win),winname(0,1),win)
-	string package=RemoveEnding(win,"win")
-	dfref df=Core#InstanceHome("Acq",package,name,create=1)
+	string package=win//RemoveEnding(win,"win")
+	dfref df=Core#InstanceHome("Acq",package,"win0:"+name,create=1)
 	
 	string axis_list=AxisList(win)
 	variable i
 	
 	win=selectstring(!ParamIsDefault(win),winname(0,1),win)
 	name=selectstring(strlen(name),"Broad",name)
-	string package=RemoveEnding(win,"win")
-	dfref df=Core#InstanceHome("Acq",package,name)
+	string package=win//RemoveEnding(win,"win")
+	dfref df=Core#InstanceHome("Acq",package,"win0:"+name)
 	
 	variable err=0
 	if(!datafolderrefstatus(df))

File Core/Settings.ipf

View file
  • Ignore whitespace
 		dfref objectDF=ObjectManifest(module,package,object,sub=sub)
 		string objectLoc=getdatafolder(1,objectDF)
 		string valueLoc=joinpath({getdatafolder(1,instanceDF),object}) // Location of the object containing the actual data value(s).  
-		string info=module+"_"+package+"_"+object+"_"+instance
+		string info=module+"_"+package+"_"+selectstring(strlen(sub),"",replacestring(":",sub,"_")+"_")+object+"_"+instance
 		string control=strvarordefault(joinpath({objectLoc,"control"}),"")
 		string type=ObjectType(joinpath({objectLoc,"value"}))
 		string controlsToModify=""
 				ShowPackageInstanceObject(module,package,instance,object,info+"_0",x,y,yJump,generic=generic,sub=sub,hideVars=hideVars,firstInstance=firstInstance)
 				break
 			case "FLDR": // Subpackage.  
+				ShowPackageInstanceObject(module,package,instance,object,info+"_0",x,y,yJump,generic=generic,sub=sub,hideVars=hideVars,firstInstance=firstInstance)
 				ShowPackageInstance(module,package,instance,x,y,generic=generic,sub=joinpath({sub,object}),hideVars=hideVars,firstInstance=firstInstance)
 				//isSubPackage_=1
 				continue
 	string module,package,instance,object,info,sub
 	variable generic,hideVars,&x,&y,yJump,row,firstInstance
 	
+	sub = selectstring(!paramisdefault(sub),"",sub)
 	dfref instanceDF=InstanceHome(module,package,instance,sub=sub,create=1)
 	dfref manifestDF=ObjectManifest(module,package,object,sub=sub)
 	string objectLoc=getdatafolder(1,manifestDF) // Location of the folder containing the manifest data for this object.  
 	string valueLoc=joinpath({getdatafolder(1,instanceDF),object}) // Location of the object containing the actual data value(s).  
 	if(!exists(valueLoc))
-		CopyDefaultInstanceObject(module,package,instance,object)
+		CopyDefaultInstanceObject(module,package,instance,object,sub=sub)
 	endif
 	string options
 	sprintf options,"Core#StrPackageSetting(\"%s\",\"%s\",\"%s\",\"%s\",setting=\"%s\")",module,package,instance,object,"options"
 				top=y
 			endif
 		endif
-		TitleBox /z $(object+"_title") pos={5+itemsinlist(sub,":")*5,top},title=title,disable=0
+		string titlebox_name = selectstring(strlen(sub),"",replacestring(":",sub,"_")+"_")+object+"_title"
+		variable indent = (1+itemsinlist(sub,":"))*5 // Indent by 5 pixels for each level of subpackage depth.  
+		TitleBox /z $titlebox_name pos={indent,top},title=title,disable=0
 	endif
 	string controlsToModify=controlName+";"
 	strswitch(type)
+		case "FLDR": // Subpackage.  
+			break
 		case "WAV":
 			wave WAV=$valueLoc
 			strswitch(control)
 	return instances
 end
 
+function /s ListSubPackages(module,package[,sub,recurse])
+	string module,package,sub
+	variable recurse
+	
+	sub=selectstring(!paramisdefault(sub),"",sub)
+	dfref df = PackageManifest(module,package,sub=sub)
+	variable i
+	string list = ""
+	for(i=0;i<CountObjectsDFR(df,4);i+=1)
+		string object = GetIndexedObjNameDFR(df,4,i)
+		if(IsSubPackage(module,package,object,sub=sub))
+			list+=object+";"
+			if(recurse)
+				list += ListSubPackages(module,package,sub=joinpath({sub,object}))
+			endif
+		endif
+	endfor
+	return list
+end
+
 function /s PackageObjectHelp(module,package,object[,sub])
 	string module,package,object,sub
 	
 			svar str=$loc
 			string /g df:$object=str
 			break
+		case "FLDR": // Subpackage
+			break
 		default:
 			printf "Could not find any object in the manifest at %s.\r",loc
 			err=-1
 Function SavePackageInstance(module,package,instance[,special])
 	string module,package,instance,special
 	
+	special=selectstring(!paramisdefault(special),"",special)
 	variable err=0
 	dfref currDF=getdatafolderdfr()
 	// Module specific functions.  
-	funcref SavePackageInstance f=$(module+"SavePackageInstance")
-	if(strlen(stringbykey("NAME",funcrefinfo(f))))
-		f(module,package,instance)
-	endif
-	
+	string cmd
+	sprintf cmd,"ProcGlobal#%s#SavePackageInstance(%s,%s,special=%s)",module,package,instance,special
+	Execute /Q/Z cmd
+
 	string path
 	sprintf path,"%sprofiles:%s:%s",SpecialDirPath("Packages",0,0,0),CurrProfileName(),module
 	variable generic=IsGenericPackage(module,package)
 	return err
 End
 
+// Applies a loaded package instance to the given channel.  
+Function SelectPackageInstance(module,package,instance[,special])
+	String package,instance,special,module
+	Variable chan
+	
+	special=selectstring(!paramisdefault(special),"",special)
+	string cmd
+	sprintf cmd,"ProcGlobal#%s#SelectPackageInstance(%s,%s,special=%s)",module,package,instance,special
+	Execute /Q/Z cmd
+End
+
 function /s PackageObjectList(module,package[,sub])
 	string module,package,sub
 	
 	return newList1+newList2
 end
 
-// Applies a loaded package instance to the given channel.  
-Function SelectPackageInstance(module,package,instance[,special])
-	String package,instance,special,module
-	Variable chan
-	
-	special=selectstring(!paramisdefault(special),"",special)
-	funcref SelectPackageInstance f=$(module+"#SelectPackageInstance")
-	if(strlen(stringbykey("NAME",funcrefinfo(f))))
-		f(module,package,instance,special=special)
-	endif
-End
-
 // ------------------------ Utility Functions -------------------------- //
 
 function /s JoinPath(folders)

File Modules/Acq/Manifest.pxp

  • Ignore whitespace
Binary file modified.