@@ -127,6 +127,15 @@ void SpikeDisplayCanvas::update()
127127 SpikePlot* sp = spikeDisplay->addSpikePlot (processor->getNumberOfChannelsForElectrode (i), i,
128128 processor->getNameForElectrode (i));
129129 processor->addSpikePlotForElectrode (sp, i);
130+
131+ if (shouldApplySavedParams)
132+ {
133+ for (int j = 0 ; j < processor->getNumberOfChannelsForElectrode (i); j++)
134+ {
135+ spikeDisplay->setThresholdForWaveAxis (i,j,thresholds[i][j]);
136+ spikeDisplay->setRangeForWaveAxis (i,j,ranges[i][j]);
137+ }
138+ }
130139 }
131140
132141 spikeDisplay->resized ();
@@ -218,6 +227,10 @@ void SpikeDisplayCanvas::saveCustomParametersToXml(XmlElement* xml)
218227
219228void SpikeDisplayCanvas::loadCustomParametersFromXml (XmlElement* xml)
220229{
230+
231+ thresholds.clear ();
232+ ranges.clear ();
233+
221234 for (auto * xmlNode : xml->getChildIterator ())
222235 {
223236 if (xmlNode->hasTagName (" SPIKEDISPLAY" ))
@@ -241,28 +254,17 @@ void SpikeDisplayCanvas::loadCustomParametersFromXml(XmlElement* xml)
241254
242255 for (auto * channelNode : plotNode->getChildIterator ())
243256 {
244-
245257 if (channelNode->hasTagName (" AXIS" ))
246258 {
247259 channelIndex++;
248-
249- // std::cout << "CHANNEL NUMBER " << channelIndex << std::endl;
250-
251- spikeDisplay->setThresholdForWaveAxis (plotIndex,
252- channelIndex,
253- channelNode->getDoubleAttribute (" thresh" ));
254-
255- spikeDisplay->setRangeForWaveAxis (plotIndex,
256- channelIndex,
257- channelNode->getDoubleAttribute (" range" ));
258-
260+ thresholds[plotIndex][channelIndex] = channelNode->getDoubleAttribute (" thresh" );
261+ ranges[plotIndex][channelIndex] = channelNode->getDoubleAttribute (" range" );
259262 }
260263 }
261-
262-
263264 }
264265 }
265-
266266 }
267267 }
268+
269+ shouldApplySavedParams = true ;
268270}
0 commit comments