@@ -1895,10 +1895,18 @@ void LfpTimescale::paint(Graphics& g)
18951895 g.drawText (timeScaleUnitLabel,5 ,0 ,100 ,getHeight (),Justification::left, false );
18961896
18971897 const int steps = labels.size () + 1 ;
1898- for (int i = 1 ; i < steps; i++)
1898+ for (int i = 0 ; i < steps; i++)
18991899 {
19001900
19011901 // TODO: (kelly) added an extra spatial dimension to the timeline ticks, may be overkill
1902+ if (i == 0 )
1903+ {
1904+ g.drawLine (1 ,
1905+ 0 ,
1906+ 1 ,
1907+ getHeight (),
1908+ 3 .0f );
1909+ }
19021910 if (i != 0 && i % 4 == 0 )
19031911 {
19041912 g.drawLine (getWidth ()/steps*i,
@@ -1924,7 +1932,7 @@ void LfpTimescale::paint(Graphics& g)
19241932 2 .0f );
19251933 }
19261934
1927- if (i % 2 == 0 )
1935+ if (i != 0 && i % 2 == 0 )
19281936 g.drawText (labels[i-1 ],getWidth ()/steps*i+3 ,0 ,100 ,getHeight (),Justification::left, false );
19291937 }
19301938
@@ -2247,9 +2255,11 @@ void LfpDisplay::resized()
22472255 LfpChannelDisplayInfo* info = drawableChannels[i].channelInfo ;
22482256
22492257 info->setBounds (0 ,
2250- totalHeight-disp->getChannelHeight ()/4 ,
2258+ // totalHeight-disp->getChannelHeight()/4,
2259+ totalHeight-disp->getChannelHeight () + (disp->getChannelOverlap ()*canvas->channelOverlapFactor )/4.0 ,
22512260 canvas->leftmargin + 50 ,
22522261 disp->getChannelHeight ());
2262+ // disp->getChannelHeight()+(disp->getChannelOverlap()*canvas->channelOverlapFactor));
22532263
22542264 totalHeight += disp->getChannelHeight ();
22552265
@@ -2566,6 +2576,8 @@ void LfpDisplay::setChannelDisplaySkipAmount(int skipAmt)
25662576
25672577 if (!getSingleChannelState ())
25682578 rebuildDrawableChannelsList ();
2579+
2580+ canvas->redraw ();
25692581}
25702582
25712583bool LfpDisplay::getMedianOffsetPlotting ()
@@ -2846,7 +2858,7 @@ void LfpDisplay::mouseDown(const MouseEvent& event)
28462858 int cpos = (drawableChannels[n].channel ->getY () + (drawableChannels[n].channel ->getHeight ()/2 ));
28472859 dist = int (abs (y - cpos));
28482860
2849- std::cout << " Mouse down at " << y << " pos is " << cpos << " n: " << n << " dist " << dist << std::endl;
2861+ // std::cout << "Mouse down at " << y << " pos is "<< cpos << " n: " << n << " dist " << dist << std::endl;
28502862
28512863 if (dist < mindist)
28522864 {
@@ -3492,14 +3504,17 @@ LfpChannelDisplayInfo::LfpChannelDisplayInfo(LfpDisplayCanvas* canvas_, LfpDispl
34923504 x = -1 .0f ;
34933505 y = -1 .0f ;
34943506
3495- enableButton = new UtilityButton (String (ch+1 ), Font (" Small Text" , 13 , Font::plain));
3507+ // enableButton = new UtilityButton(String(ch+1), Font("Small Text", 13, Font::plain));
3508+ enableButton = new UtilityButton (" *" , Font (" Small Text" , 13 , Font::plain));
34963509 enableButton->setRadius (5 .0f );
34973510
34983511 enableButton->setEnabledState (true );
34993512 enableButton->setCorners (true , true , true , true );
35003513 enableButton->addListener (this );
35013514 enableButton->setClickingTogglesState (true );
35023515 enableButton->setToggleState (true , dontSendNotification);
3516+
3517+ isSingleChannel = false ;
35033518
35043519 addAndMakeVisible (enableButton);
35053520
@@ -3628,39 +3643,58 @@ void LfpChannelDisplayInfo::mouseUp(const MouseEvent &e)
36283643void LfpChannelDisplayInfo::paint (Graphics& g)
36293644{
36303645
3631- int center = getHeight ()/2 ;
3632-
3633- g.setColour (lineColour);
3646+ int center = getHeight ()/2 - (isSingleChannel?(75 ):(0 ));
36343647
3648+ // g.setColour(lineColour);
36353649 // if (chan > 98)
36363650 // g.fillRoundedRectangle(5,center-8,51,22,8.0f);
36373651 // else
3638- g.fillRoundedRectangle (5 ,center-8 ,41 ,22 ,8 .0f );
3639-
3640- g.setFont (Font (" Small Text" , 13 , Font::plain));
3641- g.drawText (typeStr,5 ,center+16 ,41 ,10 ,Justification::centred,false );
3652+
3653+ // g.fillRoundedRectangle(5,center-8,41,22,8.0f);
3654+
3655+ // Draw the channel numbers
3656+ g.setColour (Colours::grey);
3657+ const String channelString = (isChannelNumberHidden () ? (" --" ) : String (getChannelNumber () + 1 ));
3658+ bool isCentered = !getEnabledButtonVisibility ();
3659+
3660+ g.drawText (channelString,
3661+ 2 ,
3662+ center-4 ,
3663+ isCentered ? (getWidth ()/2 -4 ) : (getWidth ()/4 ),
3664+ 10 ,
3665+ isCentered ? Justification::centred : Justification::centredRight,
3666+ false );
3667+
3668+ g.setColour (lineColour);
3669+ g.fillRect (0 , 0 , 2 , getHeight ());
3670+
3671+ if (getChannelTypeStringVisibility ())
3672+ {
3673+ g.setFont (Font (" Small Text" , 13 , Font::plain));
3674+ g.drawText (typeStr,5 ,center+10 ,41 ,10 ,Justification::centred,false );
3675+ }
36423676 // g.setFont(channelHeightFloat*0.3);
36433677 g.setFont (Font (" Small Text" , 11 , Font::plain));
36443678
36453679 if (isSingleChannel)
36463680 {
36473681 g.setColour (Colours::darkgrey);
3648- g.drawText (" STD:" , 5 , center+100 ,41 ,10 ,Justification::centred,false );
3649- g.drawText (" MEAN:" , 5 , center+50 ,41 ,10 ,Justification::centred,false );
3682+ g.drawText (" STD:" , 5 , center+90 ,41 ,10 ,Justification::centred,false );
3683+ g.drawText (" MEAN:" , 5 , center+40 ,41 ,10 ,Justification::centred,false );
36503684
36513685 if (x > 0 )
36523686 {
3653- g.drawText (" uV:" , 5 , center+150 ,41 ,10 ,Justification::centred,false );
3687+ g.drawText (" uV:" , 5 , center+140 ,41 ,10 ,Justification::centred,false );
36543688 }
36553689 // g.drawText("Y:", 5, center+200,41,10,Justification::centred,false);
36563690
36573691 g.setColour (Colours::grey);
3658- g.drawText (String (canvas->getStd (chan)), 5 , center+120 ,41 ,10 ,Justification::centred,false );
3659- g.drawText (String (canvas->getMean (chan)), 5 , center+70 ,41 ,10 ,Justification::centred,false );
3692+ g.drawText (String (canvas->getStd (chan)), 5 , center+110 ,41 ,10 ,Justification::centred,false );
3693+ g.drawText (String (canvas->getMean (chan)), 5 , center+60 ,41 ,10 ,Justification::centred,false );
36603694 if (x > 0 )
36613695 {
36623696 // g.drawText(String(x), 5, center+150,41,10,Justification::centred,false);
3663- g.drawText (String (y), 5 , center+170 ,41 ,10 ,Justification::centred,false );
3697+ g.drawText (String (y), 5 , center+160 ,41 ,10 ,Justification::centred,false );
36643698 }
36653699
36663700 }
@@ -3678,12 +3712,62 @@ void LfpChannelDisplayInfo::updateXY(float x_, float y_)
36783712void LfpChannelDisplayInfo::resized ()
36793713{
36803714
3681- int center = getHeight ()/2 ;
3715+ int center = getHeight ()/2 - (isSingleChannel?( 75 ):( 0 )) ;
36823716
36833717 // if (chan > 98)
36843718 // enableButton->setBounds(8,center-5,45,16);
36853719 // else
3686- enableButton->setBounds (8 ,center-5 ,35 ,16 );
3720+ // enableButton->setBounds(8,center-5,35,16);
3721+
3722+ setEnabledButtonVisibility (getHeight () >= 16 );
3723+
3724+ if (getEnabledButtonVisibility ())
3725+ {
3726+ enableButton->setBounds (getWidth ()/4 + 5 , (center) - 7 , 15 , 15 );
3727+ }
3728+
3729+ setChannelNumberIsHidden (getHeight () < 16 && (getChannelNumber () + 1 ) % 10 != 0 );
3730+
3731+ setChannelTypeStringVisibility (getHeight () > 34 );
3732+ }
3733+
3734+ void LfpChannelDisplayInfo::setEnabledButtonVisibility (bool shouldBeVisible)
3735+ {
3736+ if (shouldBeVisible)
3737+ {
3738+ addAndMakeVisible (enableButton);
3739+ }
3740+ else if (enableButton->isVisible ())
3741+ {
3742+ removeChildComponent (enableButton);
3743+ enableButton->setVisible (false );
3744+ }
3745+
3746+ }
3747+
3748+ bool LfpChannelDisplayInfo::getEnabledButtonVisibility ()
3749+ {
3750+ return enableButton->isVisible ();
3751+ }
3752+
3753+ void LfpChannelDisplayInfo::setChannelTypeStringVisibility (bool shouldBeVisible)
3754+ {
3755+ channelTypeStringIsVisible = shouldBeVisible;
3756+ }
3757+
3758+ bool LfpChannelDisplayInfo::getChannelTypeStringVisibility ()
3759+ {
3760+ return channelTypeStringIsVisible || isSingleChannel;
3761+ }
3762+
3763+ void LfpChannelDisplayInfo::setChannelNumberIsHidden (bool shouldBeHidden)
3764+ {
3765+ channelNumberHidden = shouldBeHidden;
3766+ }
3767+
3768+ bool LfpChannelDisplayInfo::isChannelNumberHidden ()
3769+ {
3770+ return channelNumberHidden;
36873771}
36883772
36893773
0 commit comments