@@ -145,10 +145,18 @@ void LfpDisplayCanvas::resized()
145145 timescale->setBounds (leftmargin,0 ,getWidth ()-scrollBarThickness-leftmargin,30 );
146146 viewport->setBounds (0 ,30 ,getWidth (),getHeight ()-90 );
147147
148- if (lfpDisplay->getSingleChannelState ())
149- lfpDisplay->setChannelHeight (viewport->getHeight (),false );
150-
151- lfpDisplay->setBounds (0 ,0 ,getWidth ()-scrollBarThickness, lfpDisplay->getChannelHeight ()*lfpDisplay->drawableChannels .size ());
148+ if (nChans > 0 )
149+ {
150+ if (lfpDisplay->getSingleChannelState ())
151+ lfpDisplay->setChannelHeight (viewport->getHeight (),false );
152+
153+ std::cout << " number of channels " << nChans << std::endl;
154+ lfpDisplay->setBounds (0 ,0 ,getWidth ()-scrollBarThickness, lfpDisplay->getChannelHeight ()*lfpDisplay->drawableChannels .size ());
155+ }
156+ else
157+ {
158+ lfpDisplay->setBounds (0 , 0 , getWidth (), getHeight ());
159+ }
152160
153161 if (optionsDrawerIsOpen)
154162 options->setBounds (0 , getHeight ()-200 , getWidth (), 200 );
@@ -198,14 +206,16 @@ void LfpDisplayCanvas::endAnimation()
198206
199207void LfpDisplayCanvas::update ()
200208{
201- nChans = jmax (processor->getNumInputs (),1 );
209+ nChans = jmax (processor->getNumInputs (), 0 );
202210
203211 resizeSamplesPerPixelBuffer (nChans);
204212
205213 sampleRate.clear ();
206214 screenBufferIndex.clear ();
207215 lastScreenBufferIndex.clear ();
208216 displayBufferIndex.clear ();
217+
218+ options->setEnabled (nChans != 0 );
209219
210220 for (int i = 0 ; i <= nChans; i++) // extra channel for events
211221 {
@@ -257,9 +267,12 @@ void LfpDisplayCanvas::update()
257267 lfpDisplay->setEnabledState (isChannelEnabled[i], i);
258268
259269 }
260-
261- lfpDisplay->setBounds (0 ,0 ,getWidth ()-scrollBarThickness*2 , lfpDisplay->getTotalHeight ());
262-
270+
271+ if (nChans > 0 )
272+ lfpDisplay->setBounds (0 ,0 ,getWidth ()-scrollBarThickness*2 , lfpDisplay->getTotalHeight ());
273+ else
274+ lfpDisplay->setBounds (0 , 0 , getWidth (), getHeight ());
275+
263276 resized ();
264277 }
265278 else
@@ -272,7 +285,8 @@ void LfpDisplayCanvas::update()
272285
273286 }
274287
275- lfpDisplay->rebuildDrawableChannelsList ();
288+ if (nChans > 0 )
289+ lfpDisplay->rebuildDrawableChannelsList ();
276290
277291}
278292
@@ -1472,6 +1486,8 @@ void LfpDisplayOptions::setTimebaseAndSelectionText(float timebase)
14721486
14731487void LfpDisplayOptions::comboBoxChanged (ComboBox* cb)
14741488{
1489+ if (canvas->getNumChannels () == 0 ) return ;
1490+
14751491 if (cb == channelDisplaySkipSelection)
14761492 {
14771493 const int skipAmt = pow (2 , cb->getSelectedId () - 1 );
0 commit comments