Skip to content

Commit 10a567f

Browse files
committed
ChannelSelector:removed listener. Changed channelChanged() signature.
1 parent 42b8daf commit 10a567f

16 files changed

Lines changed: 42 additions & 62 deletions

File tree

Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ void SpikeDetectorEditor::buttonEvent(Button* button)
383383

384384
}
385385

386-
void SpikeDetectorEditor::channelChanged(int chan)
386+
void SpikeDetectorEditor::channelChanged (int channel, bool /*newState*/)
387387
{
388388

389389
if (electrodeEditorButtons[0]->getToggleState()) // editing is active
@@ -394,13 +394,13 @@ void SpikeDetectorEditor::channelChanged(int chan)
394394
{
395395
if (electrodeButtons[i]->getToggleState())
396396
{
397-
electrodeButtons[i]->setChannelNum(chan);
397+
electrodeButtons[i]->setChannelNum (channel);
398398
electrodeButtons[i]->repaint();
399399

400400
SpikeDetector* processor = (SpikeDetector*) getProcessor();
401401
processor->setChannel(electrodeList->getSelectedItemIndex(),
402402
i,
403-
chan-1);
403+
channel - 1);
404404
}
405405
}
406406
}

Source/Plugins/BasicSpikeDisplay/SpikeDetector/SpikeDetectorEditor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class SpikeDetectorEditor : public GenericEditor,
5858
void comboBoxChanged(ComboBox* comboBox);
5959
void sliderEvent(Slider* slider);
6060

61-
void channelChanged(int chan);
61+
void channelChanged (int channel, bool newState) override;
6262

6363
bool addElectrode(int nChans, int electrodeID = 0);
6464
void removeElectrode(int index);

Source/Plugins/CAR/CAREditor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ CAREditor::CAREditor (GenericProcessor* parentProcessor, bool useDefaultParamete
6868
addAndMakeVisible (m_gainSlider);
6969

7070
channelSelector->paramButtonsToggledByDefault (false);
71-
channelSelector->addListener (this);
7271

7372
setDesiredWidth (280);
7473
}
@@ -126,7 +125,7 @@ void CAREditor::buttonClicked (Button* buttonThatWasClicked)
126125
}
127126

128127

129-
void CAREditor::channelSelectionChanged (int channel, bool newState)
128+
void CAREditor::channelChanged (int channel, bool newState)
130129
{
131130
auto processor = static_cast<CAR*> (getProcessor());
132131
if (m_currentChannelsView == REFERENCE_CHANNELS)

Source/Plugins/CAR/CAREditor.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class ParameterSlider;
3535
@see CAR
3636
*/
3737
class CAREditor : public GenericEditor
38-
, private ChannelSelector::Listener
3938
{
4039
public:
4140
CAREditor (GenericProcessor* parentProcessor, bool useDefaultParameterEditors);
@@ -49,14 +48,11 @@ class CAREditor : public GenericEditor
4948
// ==========================================================
5049
void buttonClicked (Button* buttonThatWasClicked) override;
5150

52-
// ChannelSelector::Listener methods
53-
// =========================================================
54-
void channelSelectionChanged (int channel, bool newState) override;
55-
5651
// GenericEditor methods
5752
// =========================================================
5853
/** This methods is called when any sliders that we are listen for change their values */
5954
void sliderEvent (Slider* sliderWhichValueHasChanged) override;
55+
void channelChanged (int channel, bool newState) override;
6056

6157

6258
private:

Source/Plugins/ChannelMappingNode/ChannelMappingEditor.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,14 +612,14 @@ void ChannelMappingEditor::setChannelReference(ElectrodeButton* button)
612612

613613
}
614614

615-
void ChannelMappingEditor::channelChanged(int chan)
615+
void ChannelMappingEditor::channelChanged (int channel, bool /*newState*/)
616616
{
617-
if (!reorderActive)
617+
if (! reorderActive)
618618
{
619-
setConfigured(true);
620-
getProcessor()->setCurrentChannel(chan-1);
621-
getProcessor()->setParameter(2,selectedReference);
622-
referenceChannels.set(selectedReference,chan-1);
619+
setConfigured (true);
620+
getProcessor()->setCurrentChannel (channel - 1);
621+
getProcessor()->setParameter (2, selectedReference);
622+
referenceChannels.set (selectedReference, channel - 1);
623623
}
624624
}
625625

Source/Plugins/ChannelMappingNode/ChannelMappingEditor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ChannelMappingEditor : public GenericEditor,
5555
void saveCustomParameters(XmlElement* xml);
5656
void loadCustomParameters(XmlElement* xml);
5757

58-
void channelChanged(int chan);
58+
void channelChanged (int channel, bool newState) override;
5959

6060
void mouseDrag(const MouseEvent& e);
6161

Source/Plugins/FilterNode/FilterEditor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ void FilterEditor::labelTextChanged(Label* label)
162162

163163
}
164164

165-
void FilterEditor::channelChanged(int chan)
165+
void FilterEditor::channelChanged (int channel, bool /*newState*/)
166166
{
167167
FilterNode* fn = (FilterNode*) getProcessor();
168168

169-
highCutValue->setText(String(fn->getHighCutValueForChannel(chan)), dontSendNotification);
170-
lowCutValue->setText(String(fn->getLowCutValueForChannel(chan)), dontSendNotification);
171-
applyFilterOnChan->setToggleState(fn->getBypassStatusForChannel(chan), dontSendNotification);
169+
highCutValue->setText (String (fn->getHighCutValueForChannel (channel)), dontSendNotification);
170+
lowCutValue->setText (String (fn->getLowCutValueForChannel (channel)), dontSendNotification);
171+
applyFilterOnChan->setToggleState (fn->getBypassStatusForChannel (channel), dontSendNotification);
172172

173173
}
174174

Source/Plugins/FilterNode/FilterEditor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class FilterEditor : public GenericEditor,
5252

5353
void setDefaults(double lowCut, double highCut);
5454

55-
void channelChanged(int chan);
55+
void channelChanged (int chan, bool newState);
5656

5757
private:
5858

Source/Plugins/SpikeSorter/SpikeSorterEditor.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -494,42 +494,43 @@ void SpikeSorterEditor::setThresholdValue(int channel, double threshold)
494494
repaint();
495495
}
496496

497-
void SpikeSorterEditor::channelChanged(int chan)
497+
void SpikeSorterEditor::channelChanged (int channel, bool newState)
498498
{
499499
//std::cout << "New channel: " << chan << std::endl;
500-
if (chan <=0)
500+
if (channel <= 0)
501501
return;
502502

503-
for (int i = 0; i < electrodeButtons.size(); i++)
503+
const int numElectrodeButtons = electrodeButtons.size();
504+
for (int i = 0; i < numElectrodeButtons; ++i)
504505
{
505506
if (electrodeButtons[i]->getToggleState())
506507
{
507-
electrodeButtons[i]->setChannelNum(chan);
508+
electrodeButtons[i]->setChannelNum (channel);
508509
electrodeButtons[i]->repaint();
510+
509511
Array<int> a;
510-
a.add(chan-1);
511-
channelSelector->setActiveChannels(a);
512+
a.add (channel - 1);
513+
channelSelector->setActiveChannels (a);
514+
512515
SpikeSorter* processor = (SpikeSorter*) getProcessor();
513516
processor->setChannel(electrodeList->getSelectedItemIndex(),
514517
i,
515-
chan-1);
518+
channel - 1);
516519

517520
// if DAC is selected, update the mapping.
518-
int dacchannel = dacCombo->getSelectedId()-2;
521+
int dacchannel = dacCombo->getSelectedId() - 2;
519522
if (dacchannel >=0)
520523
{
521-
processor->assignDACtoChannel(dacchannel, chan-1);
524+
processor->assignDACtoChannel (dacchannel, channel - 1);
522525
}
523526
if (processor->getAutoDacAssignmentStatus())
524527
{
525-
processor->assignDACtoChannel(0,chan-1);
526-
processor->assignDACtoChannel(1,chan-1);
528+
processor->assignDACtoChannel (0, channel - 1);
529+
processor->assignDACtoChannel (1, channel - 1);
527530
break;
528531
}
529-
530532
}
531533
}
532-
533534
}
534535

535536
int SpikeSorterEditor::getSelectedElectrode()

Source/Plugins/SpikeSorter/SpikeSorterEditor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class SpikeSorterEditor : public VisualizerEditor,
5454
void comboBoxChanged(ComboBox* comboBox);
5555
void sliderEvent(Slider* slider);
5656

57-
void channelChanged(int chan);
57+
void channelChanged (int chan, bool newState) override;
5858

5959
Visualizer* createNewCanvas();
6060
void checkSettings();

0 commit comments

Comments
 (0)