@@ -2151,9 +2151,11 @@ void LfpDisplay::resized()
21512151 LfpChannelDisplayInfo* info = drawableChannels[i].channelInfo ;
21522152
21532153 info->setBounds (0 ,
2154- totalHeight-disp->getChannelHeight ()/4 ,
2154+ // totalHeight-disp->getChannelHeight()/4,
2155+ totalHeight-disp->getChannelHeight () + (disp->getChannelOverlap ()*canvas->channelOverlapFactor )/4.0 ,
21552156 canvas->leftmargin + 50 ,
21562157 disp->getChannelHeight ());
2158+ // disp->getChannelHeight()+(disp->getChannelOverlap()*canvas->channelOverlapFactor));
21572159
21582160 totalHeight += disp->getChannelHeight ();
21592161
@@ -2748,7 +2750,7 @@ void LfpDisplay::mouseDown(const MouseEvent& event)
27482750 int cpos = (drawableChannels[n].channel ->getY () + (drawableChannels[n].channel ->getHeight ()/2 ));
27492751 dist = int (abs (y - cpos));
27502752
2751- std::cout << " Mouse down at " << y << " pos is " << cpos << " n: " << n << " dist " << dist << std::endl;
2753+ // std::cout << "Mouse down at " << y << " pos is "<< cpos << " n: " << n << " dist " << dist << std::endl;
27522754
27532755 if (dist < mindist)
27542756 {
@@ -3392,14 +3394,17 @@ LfpChannelDisplayInfo::LfpChannelDisplayInfo(LfpDisplayCanvas* canvas_, LfpDispl
33923394 x = -1 .0f ;
33933395 y = -1 .0f ;
33943396
3395- enableButton = new UtilityButton (String (ch+1 ), Font (" Small Text" , 13 , Font::plain));
3397+ // enableButton = new UtilityButton(String(ch+1), Font("Small Text", 13, Font::plain));
3398+ enableButton = new UtilityButton (" *" , Font (" Small Text" , 13 , Font::plain));
33963399 enableButton->setRadius (5 .0f );
33973400
33983401 enableButton->setEnabledState (true );
33993402 enableButton->setCorners (true , true , true , true );
34003403 enableButton->addListener (this );
34013404 enableButton->setClickingTogglesState (true );
34023405 enableButton->setToggleState (true , dontSendNotification);
3406+
3407+ isSingleChannel = false ;
34033408
34043409 addAndMakeVisible (enableButton);
34053410
@@ -3530,37 +3535,56 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
35303535
35313536 int center = getHeight ()/2 ;
35323537
3533- g.setColour (lineColour);
3534-
3538+ // g.setColour(lineColour);
35353539 // if (chan > 98)
35363540 // g.fillRoundedRectangle(5,center-8,51,22,8.0f);
35373541 // else
3538- g.fillRoundedRectangle (5 ,center-8 ,41 ,22 ,8 .0f );
3539-
3540- g.setFont (Font (" Small Text" , 13 , Font::plain));
3541- g.drawText (typeStr,5 ,center+16 ,41 ,10 ,Justification::centred,false );
3542+
3543+ // g.fillRoundedRectangle(5,center-8,41,22,8.0f);
3544+
3545+ // Draw the channel numbers
3546+ g.setColour (Colours::grey);
3547+ const String channelString = (isChannelNumberHidden () ? (" --" ) : String (getChannelNumber () + 1 ));
3548+ bool isCentered = !getEnabledButtonVisibility ();
3549+
3550+ g.drawText (channelString,
3551+ 2 ,
3552+ center-4 ,
3553+ isCentered ? (getWidth ()/2 -4 ) : (getWidth ()/4 ),
3554+ 10 ,
3555+ isCentered ? Justification::centred : Justification::centredRight,
3556+ false );
3557+
3558+ g.setColour (lineColour);
3559+ g.fillRect (0 , 0 , 2 , getHeight ());
3560+
3561+ if (getChannelTypeStringVisibility ())
3562+ {
3563+ g.setFont (Font (" Small Text" , 13 , Font::plain));
3564+ g.drawText (typeStr,5 ,center+10 ,41 ,10 ,Justification::centred,false );
3565+ }
35423566 // g.setFont(channelHeightFloat*0.3);
35433567 g.setFont (Font (" Small Text" , 11 , Font::plain));
35443568
35453569 if (isSingleChannel)
35463570 {
35473571 g.setColour (Colours::darkgrey);
3548- g.drawText (" STD:" , 5 , center+100 ,41 ,10 ,Justification::centred,false );
3549- g.drawText (" MEAN:" , 5 , center+50 ,41 ,10 ,Justification::centred,false );
3572+ g.drawText (" STD:" , 5 , center+90 ,41 ,10 ,Justification::centred,false );
3573+ g.drawText (" MEAN:" , 5 , center+40 ,41 ,10 ,Justification::centred,false );
35503574
35513575 if (x > 0 )
35523576 {
3553- g.drawText (" uV:" , 5 , center+150 ,41 ,10 ,Justification::centred,false );
3577+ g.drawText (" uV:" , 5 , center+140 ,41 ,10 ,Justification::centred,false );
35543578 }
35553579 // g.drawText("Y:", 5, center+200,41,10,Justification::centred,false);
35563580
35573581 g.setColour (Colours::grey);
3558- g.drawText (String (canvas->getStd (chan)), 5 , center+120 ,41 ,10 ,Justification::centred,false );
3559- g.drawText (String (canvas->getMean (chan)), 5 , center+70 ,41 ,10 ,Justification::centred,false );
3582+ g.drawText (String (canvas->getStd (chan)), 5 , center+110 ,41 ,10 ,Justification::centred,false );
3583+ g.drawText (String (canvas->getMean (chan)), 5 , center+60 ,41 ,10 ,Justification::centred,false );
35603584 if (x > 0 )
35613585 {
35623586 // g.drawText(String(x), 5, center+150,41,10,Justification::centred,false);
3563- g.drawText (String (y), 5 , center+170 ,41 ,10 ,Justification::centred,false );
3587+ g.drawText (String (y), 5 , center+160 ,41 ,10 ,Justification::centred,false );
35643588 }
35653589
35663590 }
@@ -3578,12 +3602,64 @@ void LfpChannelDisplayInfo::updateXY(float x_, float y_)
35783602void LfpChannelDisplayInfo::resized ()
35793603{
35803604
3581- int center = getHeight ()/2 ;
3605+ // int center = getHeight()/2;
35823606
35833607 // if (chan > 98)
35843608 // enableButton->setBounds(8,center-5,45,16);
35853609 // else
3586- enableButton->setBounds (8 ,center-5 ,35 ,16 );
3610+ // enableButton->setBounds(8,center-5,35,16);
3611+
3612+ setEnabledButtonVisibility (getHeight () >= 16 );
3613+
3614+ if (getEnabledButtonVisibility ())
3615+ {
3616+ enableButton->setBounds (getWidth ()/4 + 5 , (getHeight ()/2 ) - 7 , 15 , 15 );
3617+ }
3618+
3619+ setChannelNumberIsHidden (getHeight () < 16 && getChannelNumber () % 5 != 0 );
3620+
3621+ setChannelTypeStringVisibility (getHeight () > 34 );
3622+ }
3623+
3624+ void LfpChannelDisplayInfo::setEnabledButtonVisibility (bool shouldBeVisible)
3625+ {
3626+ if (shouldBeVisible)
3627+ {
3628+ addAndMakeVisible (enableButton);
3629+ std::cout << " adding enableButton to view for channel " << getChannelNumber () << std::endl;
3630+ }
3631+ else if (enableButton->isVisible ())
3632+ {
3633+ std::cout << " removing enableButton for channel " << getChannelNumber () + 1 << std::endl;
3634+ removeChildComponent (enableButton);
3635+ enableButton->setVisible (false );
3636+ }
3637+
3638+ }
3639+
3640+ bool LfpChannelDisplayInfo::getEnabledButtonVisibility ()
3641+ {
3642+ return enableButton->isVisible ();
3643+ }
3644+
3645+ void LfpChannelDisplayInfo::setChannelTypeStringVisibility (bool shouldBeVisible)
3646+ {
3647+ channelTypeStringIsVisible = shouldBeVisible;
3648+ }
3649+
3650+ bool LfpChannelDisplayInfo::getChannelTypeStringVisibility ()
3651+ {
3652+ return channelTypeStringIsVisible || isSingleChannel;
3653+ }
3654+
3655+ void LfpChannelDisplayInfo::setChannelNumberIsHidden (bool shouldBeHidden)
3656+ {
3657+ channelNumberHidden = shouldBeHidden;
3658+ }
3659+
3660+ bool LfpChannelDisplayInfo::isChannelNumberHidden ()
3661+ {
3662+ return channelNumberHidden;
35873663}
35883664
35893665
0 commit comments