@@ -32,7 +32,7 @@ using namespace LfpViewer;
3232#pragma mark - LfpDisplayCanvas -
3333
3434LfpDisplayCanvas::LfpDisplayCanvas (LfpDisplayNode* processor_) :
35- timebase(1 .0f ), displayGain(1 .0f ), timeOffset(0 .0f ),
35+ timebase(1 .0f ), displayGain(1 .0f ), timeOffset(0 .0f ),
3636 processor(processor_)
3737{
3838
@@ -947,7 +947,21 @@ LfpDisplayOptions::LfpDisplayOptions(LfpDisplayCanvas* canvas_, LfpTimescale* ti
947947 medianOffsetPlottingButton->setToggleState (false , sendNotification);
948948 addAndMakeVisible (medianOffsetPlottingButton);
949949
950-
950+ // init channel name toggle
951+ showChannelNumberLabel = new Label (" showcChannelLabel" , " Show channel number instead of name" );
952+ showChannelNumberLabel->setFont (labelFont);
953+ showChannelNumberLabel->setColour (Label::textColourId, labelColour);
954+ addAndMakeVisible (showChannelNumberLabel);
955+
956+ showChannelNumberButton = new UtilityButton (" 0" , labelFont);
957+ showChannelNumberButton->setRadius (5 .0f );
958+ showChannelNumberButton->setEnabledState (true );
959+ showChannelNumberButton->setCorners (true , true , true , true );
960+ showChannelNumberButton->addListener (this );
961+ showChannelNumberButton->setClickingTogglesState (true );
962+ showChannelNumberButton->setToggleState (false , sendNotification);
963+ addAndMakeVisible (showChannelNumberButton);
964+
951965
952966 // init show/hide options button
953967 showHideOptionsButton = new ShowHideOptionsButton (this );
@@ -1151,7 +1165,7 @@ LfpDisplayOptions::LfpDisplayOptions(LfpDisplayCanvas* canvas_, LfpTimescale* ti
11511165 EventDisplayInterface* eventOptions = new EventDisplayInterface (lfpDisplay, canvas, i);
11521166 eventDisplayInterfaces.add (eventOptions);
11531167 addAndMakeVisible (eventOptions);
1154- eventOptions->setBounds (500 +(floor (i/2 )*20 ), getHeight ()-20 -(i%2 )*20 , 40 , 20 );
1168+ eventOptions->setBounds (700 +(floor (i/2 )*20 ), getHeight ()-20 -(i%2 )*20 , 40 , 20 );
11551169
11561170 lfpDisplay->setEventDisplayState (i,true );
11571171
@@ -1221,6 +1235,15 @@ void LfpDisplayOptions::resized()
12211235 150 ,
12221236 22 );
12231237
1238+ // Channel name toggle
1239+ showChannelNumberButton->setBounds (medianOffsetPlottingLabel->getRight () + 5 ,
1240+ medianOffsetPlottingLabel->getY (),
1241+ 20 ,
1242+ 20 );
1243+ showChannelNumberLabel->setBounds (showChannelNumberButton->getRight (),
1244+ showChannelNumberButton->getY (),
1245+ 200 ,
1246+ 22 );
12241247
12251248 // Spike raster plotting button
12261249 spikeRasterSelection->setBounds (medianOffsetPlottingButton->getX (),
@@ -1332,6 +1355,11 @@ bool LfpDisplayOptions::getInputInvertedState()
13321355 return invertInputButton->getToggleState ();
13331356}
13341357
1358+ bool LfpDisplayOptions::getChannelNameState ()
1359+ {
1360+ return showChannelNumberButton->getToggleState ();
1361+ }
1362+
13351363bool LfpDisplayOptions::getDisplaySpikeRasterizerState ()
13361364{
13371365// return spikeRasterButton->getToggleState();
@@ -1444,6 +1472,16 @@ void LfpDisplayOptions::buttonClicked(Button* b)
14441472 canvas->toggleOptionsDrawer (b->getToggleState ());
14451473 }
14461474
1475+ if (b == showChannelNumberButton)
1476+ {
1477+ int numChannels = lfpDisplay->channelInfo .size ();
1478+ for (int i = 0 ; i < numChannels; ++i)
1479+ {
1480+ lfpDisplay->channelInfo [i]->repaint ();
1481+ }
1482+ return ;
1483+ }
1484+
14471485 int idx = typeButtons.indexOf ((UtilityButton*)b);
14481486
14491487 if ((idx >= 0 ) && (b->getToggleState ()))
@@ -3732,14 +3770,16 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
37323770{
37333771
37343772 int center = getHeight ()/2 - (isSingleChannel?(75 ):(0 ));
3773+ const bool showChannelNumbers = options->getChannelNameState ();
37353774
37363775 // Draw the channel numbers
37373776 g.setColour (Colours::grey);
3738- const String channelString = (isChannelNumberHidden () ? (" --" ) : getName ());
3777+ const String channelString = (isChannelNumberHidden () ? (" --" ) :
3778+ showChannelNumbers ? String (getChannelNumber () + 1 ) : getName ());
37393779 bool isCentered = !getEnabledButtonVisibility ();
37403780
37413781 g.drawText (channelString,
3742- 2 ,
3782+ showChannelNumbers ? 6 : 2 ,
37433783 center-4 ,
37443784 getWidth ()/2 ,
37453785 10 ,
0 commit comments