@@ -52,7 +52,11 @@ LfpDisplayOptions::LfpDisplayOptions (LfpDisplayCanvas* canvas_, LfpDisplaySplit
5252 selectedChannelType (ContinuousChannel::Type::ELECTRODE ),
5353 labelColour (100 , 100 , 100 ),
5454 medianOffsetOnForSpikeRaster (false ),
55- ttlWordString (" NONE" )
55+ ttlWordString (" NONE" ),
56+ channelLabelDisplayMode (ChannelLabelDisplayMode::Name),
57+ channelNameButton (nullptr ),
58+ channelNumberButton (nullptr ),
59+ channelDepthButton (nullptr )
5660{
5761 setBufferedToImage (true );
5862
@@ -166,7 +170,7 @@ LfpDisplayOptions::LfpDisplayOptions (LfpDisplayCanvas* canvas_, LfpDisplaySplit
166170 voltageRanges[ContinuousChannel::Type::AUX ].add (" 1000" );
167171 voltageRanges[ContinuousChannel::Type::AUX ].add (" 2000" );
168172 selectedVoltageRange[ContinuousChannel::Type::AUX ] = 1 ; // Default to Auto
169- rangeGain[ContinuousChannel::Type::AUX ] = 0 . 001f ; // mV
173+ rangeGain[ContinuousChannel::Type::AUX ] = 1 ; // mV
170174 rangeSteps[ContinuousChannel::Type::AUX ] = 10 ;
171175 rangeUnits.add (" mV" );
172176 typeNames.add (" AUX" );
@@ -426,19 +430,31 @@ LfpDisplayOptions::LfpDisplayOptions (LfpDisplayCanvas* canvas_, LfpDisplaySplit
426430 channelDisplaySkipLabel->setFont (labelFont);
427431 extendedOptions->addAndMakeVisible (channelDisplaySkipLabel.get ());
428432
429- // Show channel number button
430- showChannelNumberButton = std::make_unique<UtilityButton> (" OFF" );
431- showChannelNumberButton->setRadius (5 .0f );
432- showChannelNumberButton->setEnabledState (true );
433- showChannelNumberButton->setCorners (true , true , true , true );
434- showChannelNumberButton->addListener (this );
435- showChannelNumberButton->setClickingTogglesState (true );
436- showChannelNumberButton->setToggleState (false , sendNotification);
437- extendedOptions->addAndMakeVisible (showChannelNumberButton.get ());
433+ // Channel label display mode
434+ channelNameButton = new TextButton (" Name" , " Show channel names" );
435+ channelNameButton->setClickingTogglesState (true );
436+ channelNameButton->setToggleState (true , dontSendNotification);
438437
439- showChannelNumberLabel = std::make_unique<Label> (" ShowChannelNumberLabel" , " Show number:" );
440- showChannelNumberLabel->setFont (labelFont);
441- extendedOptions->addAndMakeVisible (showChannelNumberLabel.get ());
438+ channelNumberButton = new TextButton (" Num" , " Show channel numbers" );
439+ channelNumberButton->setClickingTogglesState (true );
440+ channelNumberButton->setToggleState (false , dontSendNotification);
441+
442+ channelDepthButton = new TextButton (" Depth" , " Show channel depth values" );
443+ channelDepthButton->setClickingTogglesState (true );
444+ channelDepthButton->setToggleState (false , dontSendNotification);
445+
446+ channelLabelButtonManager = std::make_unique<LinearButtonGroupManager>();
447+ channelLabelButtonManager->addButton (channelNameButton);
448+ channelLabelButtonManager->addButton (channelNumberButton);
449+ channelLabelButtonManager->addButton (channelDepthButton);
450+ channelLabelButtonManager->setRadioButtonMode (true );
451+ channelLabelButtonManager->setButtonListener (this );
452+ channelLabelButtonManager->setSelectedButtonIndex (static_cast <int > (channelLabelDisplayMode));
453+ extendedOptions->addAndMakeVisible (channelLabelButtonManager.get ());
454+
455+ channelLabelDisplayLabel = std::make_unique<Label> (" ChannelLabelDisplayLabel" , " Label:" );
456+ channelLabelDisplayLabel->setFont (labelFont);
457+ extendedOptions->addAndMakeVisible (channelLabelDisplayLabel.get ());
442458
443459 // SIGNAL PROCESSING SECTION
444460 sectionTitles.add (" SIGNALS" );
@@ -675,7 +691,7 @@ void LfpDisplayOptions::resized()
675691 else
676692 extendedOptionsHolder->setBounds (0 , 0 , getWidth (), 0 );
677693
678- int extendedWidth = getWidth () < 755 ? 755 : getWidth ();
694+ int extendedWidth = getWidth () < 775 ? 775 : getWidth ();
679695 extendedWidth = extendedWidth > 1500 ? 1500 : extendedWidth;
680696 extendedOptions->setBounds (0 , 0 , extendedWidth, extendedOptionsHolder->getHeight ());
681697
@@ -686,7 +702,7 @@ void LfpDisplayOptions::resized()
686702 extendedOptionsBox.alignItems = FlexBox::AlignItems::center;
687703
688704 extendedOptionsBox.items .add (FlexItem (185 , getHeight () - 60 )); // THRESHOLDS
689- extendedOptionsBox.items .add (FlexItem (185 , getHeight () - 60 )); // CHANNELS
705+ extendedOptionsBox.items .add (FlexItem (205 , getHeight () - 60 )); // CHANNELS
690706 extendedOptionsBox.items .add (FlexItem (185 , getHeight () - 60 )); // SIGNAL PROCESSING
691707 extendedOptionsBox.items .add (FlexItem (190 , getHeight () - 60 )); // TRIGGERED DISPLAY
692708
@@ -721,7 +737,7 @@ void LfpDisplayOptions::resized()
721737 // CHANNELS
722738 xOffset = extendedOptionsBox.items [1 ].currentBounds .getX ();
723739 xLimit = extendedOptionsBox.items [1 ].currentBounds .getRight ();
724- channelsGroup->setBounds (xOffset, 5 , 185 , 135 );
740+ channelsGroup->setBounds (xOffset, 5 , 205 , 135 );
725741
726742 reverseChannelsDisplayButton->setBounds (xLimit - 45 ,
727743 startHeight,
@@ -753,15 +769,15 @@ void LfpDisplayOptions::resized()
753769 80 ,
754770 height);
755771
756- showChannelNumberButton ->setBounds (xLimit - 45 ,
757- startHeight + + verticalSpacing * 3 ,
758- 35 ,
759- height);
772+ channelLabelButtonManager ->setBounds (xLimit - 145 ,
773+ startHeight + verticalSpacing * 3 ,
774+ 135 ,
775+ height);
760776
761- showChannelNumberLabel ->setBounds (xOffset + 10 ,
762- startHeight + verticalSpacing * 3 ,
763- 100 ,
764- height);
777+ channelLabelDisplayLabel ->setBounds (xOffset + 10 ,
778+ startHeight + verticalSpacing * 3 ,
779+ 50 ,
780+ height);
765781
766782 // SIGNAL PROCESSING
767783 xOffset = extendedOptionsBox.items [2 ].currentBounds .getX ();
@@ -789,9 +805,9 @@ void LfpDisplayOptions::resized()
789805 height);
790806
791807 highPassCutoffButton->setBounds (xLimit - 45 ,
792- startHeight + verticalSpacing * 2 ,
793- 35 ,
794- height);
808+ startHeight + verticalSpacing * 2 ,
809+ 35 ,
810+ height);
795811
796812 highPassCutoffLabel->setBounds (xOffset + 10 ,
797813 startHeight + verticalSpacing * 2 ,
@@ -871,9 +887,9 @@ bool LfpDisplayOptions::getInputInvertedState()
871887 return invertInputButton->getToggleState ();
872888}
873889
874- bool LfpDisplayOptions::getChannelNameState ()
890+ LfpDisplayOptions::ChannelLabelDisplayMode LfpDisplayOptions::getChannelLabelDisplayMode () const
875891{
876- return showChannelNumberButton-> getToggleState () ;
892+ return channelLabelDisplayMode ;
877893}
878894
879895void LfpDisplayOptions::setPausedState (bool isPaused)
@@ -1069,20 +1085,18 @@ void LfpDisplayOptions::setSortByDepth (bool state)
10691085 }
10701086}
10711087
1072- void LfpDisplayOptions::setShowChannelNumbers ( bool state )
1088+ void LfpDisplayOptions::setChannelLabelDisplayMode (ChannelLabelDisplayMode mode )
10731089{
1074- showChannelNumberButton->setToggleState (state, dontSendNotification);
1090+ const int modeIndex = jlimit (0 , 2 , static_cast <int > (mode));
1091+ channelLabelDisplayMode = static_cast <ChannelLabelDisplayMode> (modeIndex);
10751092
1076- lfpDisplay->channelInfo ->repaint ();
1093+ channelNameButton->setToggleState (channelLabelDisplayMode == ChannelLabelDisplayMode::Name, dontSendNotification);
1094+ channelNumberButton->setToggleState (channelLabelDisplayMode == ChannelLabelDisplayMode::Number, dontSendNotification);
1095+ channelDepthButton->setToggleState (channelLabelDisplayMode == ChannelLabelDisplayMode::Depth, dontSendNotification);
1096+ channelLabelButtonManager->setSelectedButtonIndex (modeIndex);
10771097
1078- if (state)
1079- {
1080- showChannelNumberButton->setLabel (" ON" );
1081- }
1082- else
1083- {
1084- showChannelNumberButton->setLabel (" OFF" );
1085- }
1098+ canvasSplit->refreshLeftMargin ();
1099+ lfpDisplay->resized ();
10861100}
10871101
10881102void LfpDisplayOptions::setTTLWord (String word)
@@ -1149,9 +1163,21 @@ void LfpDisplayOptions::buttonClicked (Button* b)
11491163 canvas->toggleOptionsDrawer (b->getToggleState ());
11501164 }
11511165
1152- if (b == showChannelNumberButton.get ())
1166+ if (b == channelNameButton)
1167+ {
1168+ setChannelLabelDisplayMode (ChannelLabelDisplayMode::Name);
1169+ return ;
1170+ }
1171+
1172+ if (b == channelNumberButton)
1173+ {
1174+ setChannelLabelDisplayMode (ChannelLabelDisplayMode::Number);
1175+ return ;
1176+ }
1177+
1178+ if (b == channelDepthButton)
11531179 {
1154- setShowChannelNumbers (b-> getToggleState () );
1180+ setChannelLabelDisplayMode (ChannelLabelDisplayMode::Depth );
11551181 return ;
11561182 }
11571183
@@ -1604,7 +1630,7 @@ void LfpDisplayOptions::saveParameters (XmlElement* xml)
16041630 xmlNode->setAttribute (" reverseOrder" , reverseChannelsDisplayButton->getToggleState ());
16051631 xmlNode->setAttribute (" sortByDepth" , sortByDepthButton->getToggleState ());
16061632 xmlNode->setAttribute (" channelSkip" , channelDisplaySkipSelection->getSelectedId ());
1607- xmlNode->setAttribute (" showChannelNum " , showChannelNumberButton-> getToggleState ( ));
1633+ xmlNode->setAttribute (" channelLabelMode " , static_cast < int > (channelLabelDisplayMode ));
16081634 xmlNode->setAttribute (" subtractOffset" , medianOffsetPlottingButton->getToggleState ());
16091635
16101636 xmlNode->setAttribute (" isInverted" , invertInputButton->getToggleState ());
@@ -1774,9 +1800,17 @@ void LfpDisplayOptions::loadParameters (XmlElement* xml)
17741800 // LOGD(" --> setSortByDepth: ", MS_FROM_START, " milliseconds");
17751801 start = Time::getHighResolutionTicks ();
17761802
1777- setShowChannelNumbers (xmlNode->getBoolAttribute (" showChannelNum" , false ));
1803+ if (xmlNode->hasAttribute (" channelLabelMode" ))
1804+ {
1805+ setChannelLabelDisplayMode (static_cast <ChannelLabelDisplayMode> (xmlNode->getIntAttribute (" channelLabelMode" , 0 )));
1806+ }
1807+ else
1808+ {
1809+ const bool showChannelNum = xmlNode->getBoolAttribute (" showChannelNum" , false );
1810+ setChannelLabelDisplayMode (showChannelNum ? ChannelLabelDisplayMode::Number : ChannelLabelDisplayMode::Name);
1811+ }
17781812
1779- // LOGD(" --> setShowChannelNumbers : ", MS_FROM_START, " milliseconds");
1813+ // LOGD(" --> setChannelLabelDisplayMode : ", MS_FROM_START, " milliseconds");
17801814 start = Time::getHighResolutionTicks ();
17811815
17821816 bool shouldInvert = xmlNode->getBoolAttribute (" isInverted" , false );
0 commit comments