diff --git a/Source/Processors/Editors/SpikeDetectorEditor.cpp b/Source/Processors/Editors/SpikeDetectorEditor.cpp index ff18041b126c8867d7b2a87ee71448ac52e1eae3..a75a65fdf2b70c30d8c753c9e81bb2f502f065c1 100755 --- a/Source/Processors/Editors/SpikeDetectorEditor.cpp +++ b/Source/Processors/Editors/SpikeDetectorEditor.cpp @@ -479,6 +479,11 @@ void SpikeDetectorEditor::comboBoxChanged(ComboBox* comboBox) thresholdSlider->setActive(false); } +void SpikeDetectorEditor::checkSettings() +{ + electrodeList->setSelectedItemIndex(0); +} + void SpikeDetectorEditor::drawElectrodeButtons(int ID) { @@ -511,6 +516,8 @@ void SpikeDetectorEditor::drawElectrodeButtons(int ID) else { activeChannels.add(processor->getChannel(ID,i)); + + button->setToggleState(processor->isChannelActive(ID,i), false); } if (numChannels < 3) diff --git a/Source/Processors/Editors/SpikeDetectorEditor.h b/Source/Processors/Editors/SpikeDetectorEditor.h index 2bbf5d90f55abb38a4e5d3b45b06f5f58b863d27..706a2582185501322405c3e0e745132524a09191 100755 --- a/Source/Processors/Editors/SpikeDetectorEditor.h +++ b/Source/Processors/Editors/SpikeDetectorEditor.h @@ -154,6 +154,8 @@ public: bool addElectrode(int nChans); + void checkSettings(); + private: void drawElectrodeButtons(int); diff --git a/Source/Processors/SpikeDetector.cpp b/Source/Processors/SpikeDetector.cpp index f333dd4053d6ed1d929b809786ec1607bb71cbd2..191d23e157cf845a7ac77162b4dfd590dfca3dcd 100755 --- a/Source/Processors/SpikeDetector.cpp +++ b/Source/Processors/SpikeDetector.cpp @@ -634,31 +634,37 @@ void SpikeDetector::loadCustomParametersFromXml() if (xmlNode->hasTagName("ELECTRODE")) { -// electrodeIndex++; -// -// int channelsPerElectrode = xmlNode->getIntAttribute("numChannels"); -// -// SpikeDetectorEditor* sde = (SpikeDetectorEditor*) getEditor(); -// sde->addElectrode(channelsPerElectrode); -// -// setElectrodeName(electrodeIndex+1, xmlNode->getStringAttribute("name")); -// -// int channelIndex = -1; -// -// forEachXmlChildElement(*parametersAsXml, channelNode) -// { -// if (channelNode->hasTagName("SUBCHANNEL")) -// { -// channelIndex++; -// -// setChannel(electrodeIndex, channelIndex, channelNode->getIntAttribute("ch")); -// setChannelThreshold(electrodeIndex, channelIndex, channelNode->getDoubleAttribute("thresh")); -// setChannelActive(electrodeIndex, channelIndex, channelNode->getBoolAttribute("isActive")); -// } -// } + electrodeIndex++; + + int channelsPerElectrode = xmlNode->getIntAttribute("numChannels"); + + SpikeDetectorEditor* sde = (SpikeDetectorEditor*) getEditor(); + sde->addElectrode(channelsPerElectrode); + + setElectrodeName(electrodeIndex+1, xmlNode->getStringAttribute("name")); + + int channelIndex = -1; + + forEachXmlChildElement(*xmlNode, channelNode) + { + if (channelNode->hasTagName("SUBCHANNEL")) + { + channelIndex++; + + std::cout << "Subchannel " << channelIndex << std::endl; + + setChannel(electrodeIndex, channelIndex, channelNode->getIntAttribute("ch")); + setChannelThreshold(electrodeIndex, channelIndex, channelNode->getDoubleAttribute("thresh")); + setChannelActive(electrodeIndex, channelIndex, channelNode->getBoolAttribute("isActive")); + } + } + } } } + SpikeDetectorEditor* ed = (SpikeDetectorEditor*) getEditor(); + ed->checkSettings(); + } diff --git a/Source/Processors/Visualization/LfpDisplayCanvas.cpp b/Source/Processors/Visualization/LfpDisplayCanvas.cpp index 42dc6e02a70e1d1401eea463cb3b6f2faaf7a197..db469dfbce6ab533c2103ee134f6407e2fe1fb01 100755 --- a/Source/Processors/Visualization/LfpDisplayCanvas.cpp +++ b/Source/Processors/Visualization/LfpDisplayCanvas.cpp @@ -511,9 +511,9 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml) if (channelDisplayState.substring(i,i+1).equalsIgnoreCase("1")) { - lfpDisplay->setEnabledState(true, i); + lfpDisplay->enableChannel(true, i); } else { - lfpDisplay->setEnabledState(false, i); + lfpDisplay->enableChannel(false, i); } @@ -891,6 +891,15 @@ bool LfpDisplay::getEventDisplayState(int ch) return eventDisplayEnabled[ch]; } +void LfpDisplay::enableChannel(bool state, int chan) +{ + + if (chan < numChans) + { + channelInfo[chan]->setEnabledState(state); + } +} + void LfpDisplay::setEnabledState(bool state, int chan) { @@ -898,7 +907,6 @@ void LfpDisplay::setEnabledState(bool state, int chan) { channels[chan]->setEnabledState(state); - channelInfo[chan]->setEnabledState(state); } } @@ -941,10 +949,13 @@ LfpChannelDisplay::~LfpChannelDisplay() void LfpChannelDisplay::setEnabledState(bool state) { - - std::cout << "Setting channel " << name << " to " << state << std::endl; + if (state) + std::cout << "Setting channel " << name << " to true." << std::endl; + else + std::cout << "Setting channel " << name << " to false." << std::endl; isEnabled = state; + } void LfpChannelDisplay::paint(Graphics& g) @@ -1191,7 +1202,7 @@ void LfpChannelDisplayInfo::buttonClicked(Button* button) void LfpChannelDisplayInfo::setEnabledState(bool state) { - enableButton->setToggleState(state, false); + enableButton->setToggleState(state, true); } void LfpChannelDisplayInfo::paint(Graphics& g) diff --git a/Source/Processors/Visualization/LfpDisplayCanvas.h b/Source/Processors/Visualization/LfpDisplayCanvas.h index 4c6426480d74986b539d22cd4a71cb2b89c10e02..baee4957d13e26448b282a93a889ddaf5273e8a7 100755 --- a/Source/Processors/Visualization/LfpDisplayCanvas.h +++ b/Source/Processors/Visualization/LfpDisplayCanvas.h @@ -188,6 +188,7 @@ public: void setEnabledState(bool, int); bool getEnabledState(int); + void enableChannel(bool, int); Array<Colour> channelColours;