Skip to content

Commit 79c9bcc

Browse files
committed
Refresh screen buffer when changing timebase
1 parent 756409a commit 79c9bcc

3 files changed

Lines changed: 20 additions & 26 deletions

File tree

Plugins/LfpDisplayNode/LfpDisplay.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,8 @@ void LfpDisplay::refresh()
444444
totalPixelsToFill = canvasSplit->screenBufferWidth - fillfrom + fillto;
445445
}
446446

447-
std::cout << fillfrom << " : " << fillto << " ::: " << "totalPixelsToFill: " << totalPixelsToFill << std::endl;
447+
//if (totalPixelsToFill > 0)
448+
// std::cout << fillfrom << " : " << fillto << " ::: " << "totalPixelsToFill: " << totalPixelsToFill << std::endl;
448449

449450
int topBorder = viewport->getViewPositionY();
450451
int bottomBorder = viewport->getViewHeight() + topBorder;
@@ -493,11 +494,11 @@ void LfpDisplay::refresh()
493494
fillfrom_local = lastBitmapIndex;
494495
fillto_local = (lastBitmapIndex + totalPixelsToFill) % totalXPixels;
495496

496-
/*if (fillto != 0)
497-
{
498-
std::cout << fillfrom << " : " << fillto << " ::: " <<
499-
fillfrom_local << " : " << fillto_local << " :: " << totalPixelsToFill << " ::: " << totalXPixels << std::endl;
500-
}*/
497+
//if (fillto != 0)
498+
//{
499+
// std::cout << fillfrom << " : " << fillto << " ::: " <<
500+
// fillfrom_local << " : " << fillto_local << " :: " << totalPixelsToFill << " ::: " << totalXPixels << std::endl;
501+
// }
501502

502503

503504
for (int i = 0; i < numChans; i++)
@@ -591,6 +592,7 @@ void LfpDisplay::refresh()
591592

592593
void LfpDisplay::setRange(float r, ContinuousChannel::Type type)
593594
{
595+
594596
range[type] = r;
595597

596598
if (channels.size() > 0)
@@ -601,7 +603,6 @@ void LfpDisplay::setRange(float r, ContinuousChannel::Type type)
601603
if (channels[i]->getType() == type)
602604
channels[i]->setRange(range[type]);
603605
}
604-
canvasSplit->fullredraw = true; //issue full redraw
605606

606607
if (displayIsPaused)
607608
{
@@ -840,8 +841,6 @@ void LfpDisplay::mouseWheelMove(const MouseEvent& e, const MouseWheelDetails&
840841
viewport->setViewPosition(oldX,oldY+scrollBy); // set back to previous position plus offset
841842

842843
options->setSpreadSelection(newHeight); // update combobox
843-
844-
canvasSplit->fullredraw = true;//issue full redraw - scrolling without modifier doesnt require a full redraw
845844
}
846845
else
847846
{
@@ -864,20 +863,15 @@ void LfpDisplay::mouseWheelMove(const MouseEvent& e, const MouseWheelDetails&
864863
}
865864

866865
options->setRangeSelection(h); // update combobox
867-
canvasSplit->fullredraw = true; //issue full redraw - scrolling without modifier doesnt require a full redraw
868-
866+
869867
}
870868
else // just scroll
871869
{
872870
// passes the event up to the viewport so the screen scrolls
873871
if (viewport != nullptr && e.eventComponent == this) // passes only if it's not a listening event
874872
{
875873
viewport->mouseWheelMove(e.getEventRelativeTo(canvasSplit), wheel);
876-
877-
//canvasSplit->syncDisplayBuffer();
878874
}
879-
880-
881875
}
882876

883877
}
@@ -888,8 +882,6 @@ void LfpDisplay::mouseWheelMove(const MouseEvent& e, const MouseWheelDetails&
888882
scrollY = viewport->getViewPositionY();
889883
}
890884

891-
// refresh(); // doesn't seem to be needed now that channels draw to bitmap
892-
893885
}
894886

895887
void LfpDisplay::toggleSingleChannel(LfpChannelTrack drawableChannel)

Plugins/LfpDisplayNode/LfpDisplayCanvas.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -744,10 +744,10 @@ void LfpDisplaySplitter::resized()
744744
viewport->setBounds(0, timescaleHeight, getWidth(), getHeight() - 32);
745745
}
746746

747-
if (screenBufferMean != nullptr)
748-
{
747+
//if (screenBufferMean != nullptr)
748+
//{
749749
refreshScreenBuffer();
750-
}
750+
//}
751751

752752
if (nChans > 0)
753753
{
@@ -1249,7 +1249,7 @@ void LfpDisplaySplitter::updateScreenBuffer()
12491249

12501250
// HELPFUL FOR DEBUGGING:
12511251

1252-
if (channel == 0)
1252+
/*if (channel == 0)
12531253
std::cout << "Split "
12541254
<< splitID << " ch: "
12551255
<< channel << " sbi: "
@@ -1262,7 +1262,7 @@ void LfpDisplaySplitter::updateScreenBuffer()
12621262
<< subSampleOffset << " max: "
12631263
<< maxSamples << " playhead: "
12641264
<< lfpDisplay->lastBitmapIndex
1265-
<< std::endl;
1265+
<< std::endl;*/
12661266

12671267
int sampleNumber = 0;
12681268

@@ -1483,22 +1483,24 @@ void LfpDisplaySplitter::setTimebase(float t)
14831483
{
14841484
timebase = t;
14851485

1486-
if (timebase <= 0.1)
1486+
/*if (timebase <= 0.1)
14871487
{
14881488
stopTimer();
14891489
startTimer(1000);
14901490
}
14911491
else {
14921492
stopTimer();
14931493
startTimer(50);
1494-
}
1494+
}*/
14951495

14961496
if (trialAveraging)
14971497
{
14981498
numTrials = -1;
14991499
}
15001500

15011501
syncDisplay();
1502+
syncDisplayBuffer();
1503+
refreshScreenBuffer();
15021504

15031505
reachedEnd = true;
15041506
}
@@ -1673,7 +1675,7 @@ void LfpDisplaySplitter::refresh()
16731675

16741676
updateScreenBuffer();
16751677

1676-
if(shouldRebuildChannelList)
1678+
if (shouldRebuildChannelList)
16771679
{
16781680
shouldRebuildChannelList = false;
16791681
lfpDisplay->rebuildDrawableChannelsList(); // calls resized()/refresh() after rebuilding list

Plugins/LfpDisplayNode/LfpDisplayOptions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ LfpDisplayOptions::LfpDisplayOptions(LfpDisplayCanvas* canvas_, LfpDisplaySplitt
121121
voltageRanges[ContinuousChannel::Type::ELECTRODE].add("15000");
122122
selectedVoltageRange[ContinuousChannel::Type::ELECTRODE] = 4;
123123
rangeGain[ContinuousChannel::Type::ELECTRODE] = 1; //uV
124-
rangeSteps[ContinuousChannel::Type::ELECTRODE] = 10;
124+
rangeSteps[ContinuousChannel::Type::ELECTRODE] = 20;
125125
rangeUnits.add(CharPointer_UTF8("\xC2\xB5V"));
126126
typeNames.add("DATA");
127127

0 commit comments

Comments
 (0)