@@ -38,8 +38,8 @@ static Constant FROM_WAVE_TO_PANEL = 0x2
38
38
39
39
Function WB_OpenStimulusSetInWaveBuilder ()
40
40
41
- string graph, trace, extPanel, waveBuilder
42
- variable sweepNo, headstage
41
+ string graph, trace, extPanel, waveBuilder, stimset , device
42
+ variable sweepNo, headstage, abIndex , sbIndex
43
43
44
44
GetLastUserMenuInfo
45
45
graph = S_graphName
@@ -57,16 +57,44 @@ Function WB_OpenStimulusSetInWaveBuilder()
57
57
headstage = str2num ( TUD_GetUserData ( graph, trace, "headstage" ))
58
58
WAVE /T textualValues = $ TUD_GetUserData ( graph, trace, "textualValues" )
59
59
60
- WAVE /T/ Z stimset = GetLastSetting ( textualValues, sweepNo, STIM_WAVE_NAME_KEY, DATA_ACQUISITION_MODE)
60
+ WAVE /T/ Z stimsetLBN = GetLastSetting ( textualValues, sweepNo, STIM_WAVE_NAME_KEY, DATA_ACQUISITION_MODE)
61
61
62
- if ( ! WaveExists ( stimset ))
62
+ if ( ! WaveExists ( stimsetLBN ) || IsNaN ( headstage ))
63
63
printf "Context menu option \" %s\" could not find the stimulus set of the trace %s.\r " , S_Value, trace
64
64
ControlWindowToFront ()
65
65
return NaN
66
66
endif
67
67
68
+ stimset = stimsetLBN[ headstage]
69
+
70
+ WAVE /Z stimsetWave = WB_CreateAndGetStimSet ( stimset)
71
+
72
+ if ( ! WaveExists ( stimsetWave))
73
+ if ( BSP_IsDataBrowser ( graph))
74
+ printf "Context menu option \" %s\" could not be find the stimulus set %s." , S_Value, stimset
75
+ ControlWindowToFront ()
76
+ return NaN
77
+ else
78
+ // we might need to load the stimset
79
+ WAVE traceWave = $ TUD_GetUserData ( graph, trace, "fullPath" )
80
+ DFREF sweepDataDFR = GetWavesDataFolderDFR ( traceWave)
81
+ sbIndex = SB_GetIndexFromSweepDataPath ( graph, sweepDataDFR)
82
+
83
+ DFREF sweepBrowserDFR = SB_GetSweepBrowserFolder ( graph)
84
+ WAVE /T sweepMap = GetSweepBrowserMap ( sweepBrowserDFR)
85
+
86
+ abIndex = SB_TranslateSBMapIndexToABMapIndex ( graph, sbIndex)
87
+ device = sweepMap[ sbIndex][ % Device]
88
+ if ( AB_LoadStimsetForSweep ( device, abIndex, sweepNo))
89
+ printf "Context menu option \" %s\" could not load the stimulus set %s." , S_Value, stimset
90
+ ControlWindowToFront ()
91
+ return NaN
92
+ endif
93
+ endif
94
+ endif
95
+
68
96
waveBuilder = WBP_CreateWaveBuilderPanel ()
69
- PGC_SetAndActivateControl ( waveBuilder, "popup_WaveBuilder_SetList" , str = stimset[ headstage ] )
97
+ PGC_SetAndActivateControl ( waveBuilder, "popup_WaveBuilder_SetList" , str = stimset)
70
98
End
71
99
72
100
Function /S WBP_CreateWaveBuilderPanel ()
0 commit comments