diff --git a/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.cpp b/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.cpp index 34723c468a78725da659ebe889e6fe440da1a06b..50100748ae1862ae74ec306f33bd89d059ee7d2f 100644 --- a/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.cpp +++ b/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.cpp @@ -383,7 +383,7 @@ void SpikeDetectorEditor::buttonEvent(Button* button) } -void SpikeDetectorEditor::channelChanged(int chan) +void SpikeDetectorEditor::channelChanged (int channel, bool /*newState*/) { if (electrodeEditorButtons[0]->getToggleState()) // editing is active @@ -394,13 +394,13 @@ void SpikeDetectorEditor::channelChanged(int chan) { if (electrodeButtons[i]->getToggleState()) { - electrodeButtons[i]->setChannelNum(chan); + electrodeButtons[i]->setChannelNum (channel); electrodeButtons[i]->repaint(); SpikeDetector* processor = (SpikeDetector*) getProcessor(); processor->setChannel(electrodeList->getSelectedItemIndex(), i, - chan-1); + channel - 1); } } } diff --git a/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.h b/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.h index 086129d380ae20853eae9a694ae3ab31ea1d631b..07162cd7787d7a516038b5b1a9130f9e0f480cf0 100644 --- a/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.h +++ b/Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.h @@ -58,7 +58,7 @@ public: void comboBoxChanged(ComboBox* comboBox); void sliderEvent(Slider* slider); - void channelChanged(int chan); + void channelChanged (int channel, bool newState) override; bool addElectrode(int nChans, int electrodeID = 0); void removeElectrode(int index); diff --git a/Source/Plugins/CAR/CAREditor.cpp b/Source/Plugins/CAR/CAREditor.cpp index 59c24025479c5f992af4ea421b8e128c7e679072..8de479043533ded95e2171eabfc8794d18b3029f 100644 --- a/Source/Plugins/CAR/CAREditor.cpp +++ b/Source/Plugins/CAR/CAREditor.cpp @@ -68,7 +68,6 @@ CAREditor::CAREditor (GenericProcessor* parentProcessor, bool useDefaultParamete addAndMakeVisible (m_gainSlider); channelSelector->paramButtonsToggledByDefault (false); - channelSelector->addListener (this); setDesiredWidth (280); } @@ -126,7 +125,7 @@ void CAREditor::buttonClicked (Button* buttonThatWasClicked) } -void CAREditor::channelSelectionChanged (int channel, bool newState) +void CAREditor::channelChanged (int channel, bool newState) { auto processor = static_cast<CAR*> (getProcessor()); if (m_currentChannelsView == REFERENCE_CHANNELS) diff --git a/Source/Plugins/CAR/CAREditor.h b/Source/Plugins/CAR/CAREditor.h index 5b66ff13565c9bf59dc9e6a818eeeb3c77789276..f17ca1c0a319cb954d1a6dc935a7eb80c3154864 100644 --- a/Source/Plugins/CAR/CAREditor.h +++ b/Source/Plugins/CAR/CAREditor.h @@ -35,7 +35,6 @@ class ParameterSlider; @see CAR */ class CAREditor : public GenericEditor - , private ChannelSelector::Listener { public: CAREditor (GenericProcessor* parentProcessor, bool useDefaultParameterEditors); @@ -49,14 +48,11 @@ public: // ========================================================== void buttonClicked (Button* buttonThatWasClicked) override; - // ChannelSelector::Listener methods - // ========================================================= - void channelSelectionChanged (int channel, bool newState) override; - // GenericEditor methods // ========================================================= /** This methods is called when any sliders that we are listen for change their values */ void sliderEvent (Slider* sliderWhichValueHasChanged) override; + void channelChanged (int channel, bool newState) override; private: diff --git a/Source/Plugins/ChannelMappingNode/ChannelMappingEditor.cpp b/Source/Plugins/ChannelMappingNode/ChannelMappingEditor.cpp index ac4fcbc04094aa967e022b7b72cf48a1bbd6ba10..9835bb378167da213e81dfa802f6dbf7023586de 100644 --- a/Source/Plugins/ChannelMappingNode/ChannelMappingEditor.cpp +++ b/Source/Plugins/ChannelMappingNode/ChannelMappingEditor.cpp @@ -612,14 +612,14 @@ void ChannelMappingEditor::setChannelReference(ElectrodeButton* button) } -void ChannelMappingEditor::channelChanged(int chan) +void ChannelMappingEditor::channelChanged (int channel, bool /*newState*/) { - if (!reorderActive) + if (! reorderActive) { - setConfigured(true); - getProcessor()->setCurrentChannel(chan-1); - getProcessor()->setParameter(2,selectedReference); - referenceChannels.set(selectedReference,chan-1); + setConfigured (true); + getProcessor()->setCurrentChannel (channel - 1); + getProcessor()->setParameter (2, selectedReference); + referenceChannels.set (selectedReference, channel - 1); } } diff --git a/Source/Plugins/ChannelMappingNode/ChannelMappingEditor.h b/Source/Plugins/ChannelMappingNode/ChannelMappingEditor.h index be25bf7c68afd02b3f4d7ada4a06e521296ad890..e2b2408b451440d8902ea021f4d17a499b279338 100644 --- a/Source/Plugins/ChannelMappingNode/ChannelMappingEditor.h +++ b/Source/Plugins/ChannelMappingNode/ChannelMappingEditor.h @@ -55,7 +55,7 @@ public: void saveCustomParameters(XmlElement* xml); void loadCustomParameters(XmlElement* xml); - void channelChanged(int chan); + void channelChanged (int channel, bool newState) override; void mouseDrag(const MouseEvent& e); diff --git a/Source/Plugins/FilterNode/FilterEditor.cpp b/Source/Plugins/FilterNode/FilterEditor.cpp index 29a777f869a680ba7eb6a2825669f34da3f0af63..4983f530ce402900b133799b83b893cee6c21fa5 100644 --- a/Source/Plugins/FilterNode/FilterEditor.cpp +++ b/Source/Plugins/FilterNode/FilterEditor.cpp @@ -162,13 +162,13 @@ void FilterEditor::labelTextChanged(Label* label) } -void FilterEditor::channelChanged(int chan) +void FilterEditor::channelChanged (int channel, bool /*newState*/) { FilterNode* fn = (FilterNode*) getProcessor(); - highCutValue->setText(String(fn->getHighCutValueForChannel(chan)), dontSendNotification); - lowCutValue->setText(String(fn->getLowCutValueForChannel(chan)), dontSendNotification); - applyFilterOnChan->setToggleState(fn->getBypassStatusForChannel(chan), dontSendNotification); + highCutValue->setText (String (fn->getHighCutValueForChannel (channel)), dontSendNotification); + lowCutValue->setText (String (fn->getLowCutValueForChannel (channel)), dontSendNotification); + applyFilterOnChan->setToggleState (fn->getBypassStatusForChannel (channel), dontSendNotification); } diff --git a/Source/Plugins/FilterNode/FilterEditor.h b/Source/Plugins/FilterNode/FilterEditor.h index 2ab56711c588adecabb9acb835709300871ca3d6..79f5df09581ca4773b55429440a03b714201eac4 100644 --- a/Source/Plugins/FilterNode/FilterEditor.h +++ b/Source/Plugins/FilterNode/FilterEditor.h @@ -52,7 +52,7 @@ public: void setDefaults(double lowCut, double highCut); - void channelChanged(int chan); + void channelChanged (int chan, bool newState); private: diff --git a/Source/Plugins/SpikeSorter/SpikeSorterEditor.cpp b/Source/Plugins/SpikeSorter/SpikeSorterEditor.cpp index 9bd835626f9d742d5df2d804b15cb3b65c0844c3..bf4bff7e8ac50b7c7878c46919eaf6ecdad37086 100644 --- a/Source/Plugins/SpikeSorter/SpikeSorterEditor.cpp +++ b/Source/Plugins/SpikeSorter/SpikeSorterEditor.cpp @@ -494,42 +494,43 @@ void SpikeSorterEditor::setThresholdValue(int channel, double threshold) repaint(); } -void SpikeSorterEditor::channelChanged(int chan) +void SpikeSorterEditor::channelChanged (int channel, bool newState) { //std::cout << "New channel: " << chan << std::endl; - if (chan <=0) + if (channel <= 0) return; - for (int i = 0; i < electrodeButtons.size(); i++) + const int numElectrodeButtons = electrodeButtons.size(); + for (int i = 0; i < numElectrodeButtons; ++i) { if (electrodeButtons[i]->getToggleState()) { - electrodeButtons[i]->setChannelNum(chan); + electrodeButtons[i]->setChannelNum (channel); electrodeButtons[i]->repaint(); + Array<int> a; - a.add(chan-1); - channelSelector->setActiveChannels(a); + a.add (channel - 1); + channelSelector->setActiveChannels (a); + SpikeSorter* processor = (SpikeSorter*) getProcessor(); processor->setChannel(electrodeList->getSelectedItemIndex(), i, - chan-1); + channel - 1); // if DAC is selected, update the mapping. - int dacchannel = dacCombo->getSelectedId()-2; + int dacchannel = dacCombo->getSelectedId() - 2; if (dacchannel >=0) { - processor->assignDACtoChannel(dacchannel, chan-1); + processor->assignDACtoChannel (dacchannel, channel - 1); } if (processor->getAutoDacAssignmentStatus()) { - processor->assignDACtoChannel(0,chan-1); - processor->assignDACtoChannel(1,chan-1); + processor->assignDACtoChannel (0, channel - 1); + processor->assignDACtoChannel (1, channel - 1); break; } - } } - } int SpikeSorterEditor::getSelectedElectrode() diff --git a/Source/Plugins/SpikeSorter/SpikeSorterEditor.h b/Source/Plugins/SpikeSorter/SpikeSorterEditor.h index 08c51458a3aef0092bc4b2b0d3bc6d7730f02670..b0213feb07963ff5eb7e6ab118df78471e5829c3 100644 --- a/Source/Plugins/SpikeSorter/SpikeSorterEditor.h +++ b/Source/Plugins/SpikeSorter/SpikeSorterEditor.h @@ -54,7 +54,7 @@ public: void comboBoxChanged(ComboBox* comboBox); void sliderEvent(Slider* slider); - void channelChanged(int chan); + void channelChanged (int chan, bool newState) override; Visualizer* createNewCanvas(); void checkSettings(); diff --git a/Source/Processors/DataThreads/RhythmNode/RHD2000Editor.cpp b/Source/Processors/DataThreads/RhythmNode/RHD2000Editor.cpp index 5de38bd7ab3f88297f1dfffbb103066f124014e2..ccf6b80ac99b70457042170d23d7041bf3754c58 100644 --- a/Source/Processors/DataThreads/RhythmNode/RHD2000Editor.cpp +++ b/Source/Processors/DataThreads/RhythmNode/RHD2000Editor.cpp @@ -867,16 +867,15 @@ void RHD2000Editor::buttonEvent(Button* button) } -void RHD2000Editor::channelChanged(int chan) +void RHD2000Editor::channelChanged (int channel, bool /*newState*/) { for (int i = 0; i < 2; i++) { if (electrodeButtons[i]->getToggleState()) { - electrodeButtons[i]->setChannelNum(chan); + electrodeButtons[i]->setChannelNum (channel); electrodeButtons[i]->repaint(); - board->setDACchannel(i, chan); - + board->setDACchannel (i, channel); } } } diff --git a/Source/Processors/DataThreads/RhythmNode/RHD2000Editor.h b/Source/Processors/DataThreads/RhythmNode/RHD2000Editor.h index ab18fab07484bb46e280b1c8784c546dd9e74f6d..2d784906dd7d0e3cb11a801b009b17d2f72fdfd1 100644 --- a/Source/Processors/DataThreads/RhythmNode/RHD2000Editor.h +++ b/Source/Processors/DataThreads/RhythmNode/RHD2000Editor.h @@ -176,7 +176,7 @@ public: void startAcquisition(); void stopAcquisition(); - void channelChanged(int chan); + void channelChanged (int channel, bool newState) override; void saveCustomParameters(XmlElement* xml); void loadCustomParameters(XmlElement* xml); diff --git a/Source/Processors/Editors/ChannelSelector.cpp b/Source/Processors/Editors/ChannelSelector.cpp index 53c02c8fb533f5de0242613167bac85071128bf1..f9fca0de3223322ca88133c2b873a6b1e4eb2c3d 100755 --- a/Source/Processors/Editors/ChannelSelector.cpp +++ b/Source/Processors/Editors/ChannelSelector.cpp @@ -610,7 +610,7 @@ void ChannelSelector::buttonClicked(Button* button) { // send a message to parent GenericEditor* editor = (GenericEditor*) getParentComponent(); - editor->channelChanged(-1); + editor->channelChanged (-1, false); } } else @@ -668,18 +668,15 @@ void ChannelSelector::buttonClicked(Button* button) else // parameter type { GenericEditor* editor = (GenericEditor*) getParentComponent(); - editor->channelChanged(b->getChannel()-1); + editor->channelChanged (b->getChannel() - 1, b->getToggleState()); // do nothing if (radioStatus) // if radio buttons are active { // send a message to parent GenericEditor* editor = (GenericEditor*) getParentComponent(); - editor->channelChanged(b->getChannel()); + editor->channelChanged (b->getChannel(), b->getToggleState()); } - - m_listeners.call (&ChannelSelector::Listener::channelSelectionChanged, - b->getChannel() - 1, b->getToggleState()); } } refreshParameterColors(); diff --git a/Source/Processors/Editors/ChannelSelector.h b/Source/Processors/Editors/ChannelSelector.h index 77b8af339f3c9972ab1f7ca9c65695d5abea6dd5..ad7bd399220ac3ee47901128944c664413506cc3 100644 --- a/Source/Processors/Editors/ChannelSelector.h +++ b/Source/Processors/Editors/ChannelSelector.h @@ -52,19 +52,9 @@ class PLUGIN_API ChannelSelector : public Component , public Timer { public: - class PLUGIN_API Listener - { - public: - virtual ~Listener() { } - virtual void channelSelectionChanged (int channel, bool newState) = 0; - }; - ChannelSelector(bool createButtons, Font& titleFont); ~ChannelSelector(); - void addListener (Listener* listener) { m_listeners.add (listener); } - void removeListener (Listener* listener) { m_listeners.remove (listener); } - /** button callback */ void buttonClicked(Button* button); @@ -158,8 +148,6 @@ private: will be written to disk when the record button is pressed. */ Array<ChannelSelectorButton*> recordButtons; - ListenerList<Listener> m_listeners; - bool paramsToggled; bool paramsActive; bool recActive; diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp index 96543c97aeb37d5447d2a51839d9de340424ebcb..c41d7caf49077be3cc8ce870543870b42660eb9e 100755 --- a/Source/Processors/Editors/GenericEditor.cpp +++ b/Source/Processors/Editors/GenericEditor.cpp @@ -1158,7 +1158,7 @@ void GenericEditor::updateSettings() {} void GenericEditor::updateVisualizer() {} -void GenericEditor::channelChanged(int chan) {} +void GenericEditor::channelChanged (int channel, bool newState) {} void GenericEditor::saveCustomParameters(XmlElement* xml) { } diff --git a/Source/Processors/Editors/GenericEditor.h b/Source/Processors/Editors/GenericEditor.h index b98f7103eacbebe8f304df816a84067f54d98954..d6481971a04019b4b63d9de3e72678523211a719 100755 --- a/Source/Processors/Editors/GenericEditor.h +++ b/Source/Processors/Editors/GenericEditor.h @@ -234,7 +234,7 @@ public: virtual void updateVisualizer(); /** Used by SpikeDetectorEditor. */ - virtual void channelChanged(int chan); + virtual void channelChanged (int channel, bool newState); /** Returns all selected channels from the ChannelSelector. */ Array<int> getActiveChannels();