Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions Source/Plugins/LfpDisplayNodeAlpha/LfpDisplayCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,18 @@ void LfpDisplayCanvas::resized()
timescale->setBounds(leftmargin,0,getWidth()-scrollBarThickness-leftmargin,30);
viewport->setBounds(0,30,getWidth(),getHeight()-90);

if (lfpDisplay->getSingleChannelState())
lfpDisplay->setChannelHeight(viewport->getHeight(),false);

lfpDisplay->setBounds(0,0,getWidth()-scrollBarThickness, lfpDisplay->getChannelHeight()*lfpDisplay->drawableChannels.size());
if (nChans > 0)
{
if (lfpDisplay->getSingleChannelState())
lfpDisplay->setChannelHeight(viewport->getHeight(),false);

std::cout << "number of channels " << nChans << std::endl;
lfpDisplay->setBounds(0,0,getWidth()-scrollBarThickness, lfpDisplay->getChannelHeight()*lfpDisplay->drawableChannels.size());
}
else
{
lfpDisplay->setBounds(0, 0, getWidth(), getHeight());
}

if (optionsDrawerIsOpen)
options->setBounds(0, getHeight()-200, getWidth(), 200);
Expand Down Expand Up @@ -197,14 +205,16 @@ void LfpDisplayCanvas::endAnimation()

void LfpDisplayCanvas::update()
{
nChans = jmax(processor->getNumInputs(),1);
nChans = jmax(processor->getNumInputs(), 0);

resizeSamplesPerPixelBuffer(nChans);

sampleRate.clear();
screenBufferIndex.clear();
lastScreenBufferIndex.clear();
displayBufferIndex.clear();

options->setEnabled(nChans != 0);

for (int i = 0; i <= nChans; i++) // extra channel for events
{
Expand Down Expand Up @@ -256,9 +266,12 @@ void LfpDisplayCanvas::update()
lfpDisplay->setEnabledState(isChannelEnabled[i], i);

}

lfpDisplay->setBounds(0,0,getWidth()-scrollBarThickness*2, lfpDisplay->getTotalHeight());


if (nChans > 0)
lfpDisplay->setBounds(0,0,getWidth()-scrollBarThickness*2, lfpDisplay->getTotalHeight());
else
lfpDisplay->setBounds(0, 0, getWidth(), getHeight());

resized();
}
else
Expand All @@ -271,7 +284,8 @@ void LfpDisplayCanvas::update()

}

lfpDisplay->rebuildDrawableChannelsList();
if (nChans > 0)
lfpDisplay->rebuildDrawableChannelsList();

}

Expand Down Expand Up @@ -1471,6 +1485,8 @@ void LfpDisplayOptions::setTimebaseAndSelectionText(float timebase)

void LfpDisplayOptions::comboBoxChanged(ComboBox* cb)
{
if (canvas->getNumChannels() == 0) return;

if (cb == channelDisplaySkipSelection)
{
const int skipAmt = pow(2, cb->getSelectedId() - 1);
Expand Down
23 changes: 19 additions & 4 deletions Source/Plugins/LfpDisplayNodeAlpha/LfpDisplayEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using namespace LfpDisplayNodeAlpha;

LfpDisplayEditor::LfpDisplayEditor(GenericProcessor* parentNode, bool useDefaultParameterEditors=true)
: VisualizerEditor(parentNode, useDefaultParameterEditors)

, hasNoInputs(true)
{
lfpProcessor = (LfpDisplayNode*) parentNode;
tabText = "LFP";
Expand Down Expand Up @@ -74,8 +74,8 @@ void LfpDisplayEditor::buttonClicked(Button *button)
// (else) initialization errors. lots of time-critical cross dependencies here,
// should be cleaned up
updateSubprocessorSelectorOptions();
((LfpDisplayCanvas *)canvas.get())->setDrawableSubprocessor(*(inputSubprocessorIndices.begin() + (subprocessorSelection->getSelectedId() - 1)));
// ((LfpDisplayCanvas*)canvas.get())->setDrawableSampleRate(*(inputSampleRates.begin() + (subprocessorSelection->getSelectedId() - 1)));
//((LfpDisplayCanvas *)canvas.get())->setDrawableSubprocessor(*(inputSubprocessorIndices.begin() + (subprocessorSelection->getSelectedId() - 1)));
// setCanvasDrawableSubprocessor(subprocessorSelection->getSelectedId() - 1);

canvas->update();

Expand Down Expand Up @@ -110,6 +110,8 @@ void LfpDisplayEditor::updateSubprocessorSelectorOptions()
inputSampleRates.clear();
subprocessorSelection->clear(dontSendNotification);

hasNoInputs = lfpProcessor->getTotalDataChannels() != 0;

for (int i = 0, len = lfpProcessor->getTotalDataChannels(); i < len; ++i)
{
int subProcessorIdx = lfpProcessor->getDataChannel(i)->getSubProcessorIdx();
Expand Down Expand Up @@ -142,13 +144,26 @@ void LfpDisplayEditor::updateSubprocessorSelectorOptions()
subprocessorSampleRateLabel->setText(sampleRateLabelText, dontSendNotification);
setCanvasDrawableSubprocessor(subprocessorToSet);
}
else
{
subprocessorSelection->addItem ("None", 1);
subprocessorSelection->setSelectedId(1, dontSendNotification);

String sampleRateLabelText = "Sample Rate: <not available>";
subprocessorSampleRateLabel->setText(sampleRateLabelText, dontSendNotification);
setCanvasDrawableSubprocessor(-1);

}
}

void LfpDisplayEditor::setCanvasDrawableSubprocessor(int index)
{
if (canvas)
{
((LfpDisplayCanvas *)canvas.get())->setDrawableSubprocessor(*(inputSubprocessorIndices.begin() + index));
if (index >= 0)
((LfpDisplayCanvas *)canvas.get())->setDrawableSubprocessor(*(inputSubprocessorIndices.begin() + index));
else
((LfpDisplayCanvas *)canvas.get())->setDrawableSubprocessor(-1);
}
}

2 changes: 2 additions & 0 deletions Source/Plugins/LfpDisplayNodeAlpha/LfpDisplayEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class LfpDisplayEditor : public VisualizerEditor,

ScopedPointer<Label> subprocessorSampleRateLabel;

bool hasNoInputs;

/** Communicates the drawable subprocessor information to the canvas, if
one exists
*/
Expand Down