diff --git a/Source/Processors/Visualization/LfpDisplayCanvas.cpp b/Source/Processors/Visualization/LfpDisplayCanvas.cpp index b5ba479797032a34acd0b7a57575c3af3e8e0f0b..3f9bc8cc763fbca7c3c8e4d91d6672f71da49ddc 100644 --- a/Source/Processors/Visualization/LfpDisplayCanvas.cpp +++ b/Source/Processors/Visualization/LfpDisplayCanvas.cpp @@ -105,6 +105,14 @@ void LfpDisplayCanvas::setParameter(int param, float val) } +void LfpDisplayCanvas::refreshState() +{ + // called when the component's tab becomes visible again + displayBufferIndex = processor->getDisplayBufferIndex(); + screenBufferIndex = 0; + +} + void LfpDisplayCanvas::updateScreenBuffer() { // copy new samples from the displayBuffer into the screenBuffer @@ -112,6 +120,8 @@ void LfpDisplayCanvas::updateScreenBuffer() int index = processor->getDisplayBufferIndex(); + //std::cout << index << screenBufferIndex << std::endl; + int nSamples = index - displayBufferIndex; if (nSamples < 0) @@ -218,6 +228,8 @@ void LfpDisplayCanvas::renderOpenGL() } } drawScrollBars(); + + std::cout << "Render." << std::endl; } void LfpDisplayCanvas::drawWaveform(int chan, bool isSelected) diff --git a/Source/Processors/Visualization/LfpDisplayCanvas.h b/Source/Processors/Visualization/LfpDisplayCanvas.h index 8d5c1a6396a1ee4bb1c21901606a15f4dd0e9d13..7f577077ec989d6cd3c30f1838449a030b95304f 100644 --- a/Source/Processors/Visualization/LfpDisplayCanvas.h +++ b/Source/Processors/Visualization/LfpDisplayCanvas.h @@ -43,6 +43,8 @@ public: void beginAnimation(); void endAnimation(); + void refreshState(); + void updateNumInputs(int); void updateSampleRate(float); diff --git a/Source/Processors/Visualization/OpenGLCanvas.cpp b/Source/Processors/Visualization/OpenGLCanvas.cpp index 3807f3b25cefba0d1d655ae2d80d3c0ac2ef31d4..246cf6ccb44bf8f078796962364c8b0a721dffd7 100644 --- a/Source/Processors/Visualization/OpenGLCanvas.cpp +++ b/Source/Processors/Visualization/OpenGLCanvas.cpp @@ -28,7 +28,7 @@ OpenGLCanvas::OpenGLCanvas() : //OpenGLComponent(OpenGLComponent::OpenGLType::openGLDefault, true), scrollPix(0), scrollTime(0), scrollDiff(0), originalScrollPix(0), scrollBarWidth(15), PI(3.1415926), showScrollTrack(true), - animationIsActive(false), refreshMs(60) + animationIsActive(false), refreshMs(200) { loadFonts(); diff --git a/Source/Processors/Visualization/OpenGLCanvas.h b/Source/Processors/Visualization/OpenGLCanvas.h index 7500a79b25cd9d667995dfef77e349b51a5bc674..3712b51d8bf2a1ca71d93d580d13ea256f7b56c9 100644 --- a/Source/Processors/Visualization/OpenGLCanvas.h +++ b/Source/Processors/Visualization/OpenGLCanvas.h @@ -38,6 +38,8 @@ public: void setUp2DCanvas(); void activateAntiAliasing(); + virtual void refreshState() {}; + void mouseDownInCanvas(const MouseEvent& e); void mouseDragInCanvas(const MouseEvent& e); void mouseMoveInCanvas(const MouseEvent& e); diff --git a/Source/UI/DataViewport.cpp b/Source/UI/DataViewport.cpp index 608669a04204ee57af3a2dac77ef4ef7bf4a585f..565b74dd42fa275a3e1b356bd8b39ee06700430d 100644 --- a/Source/UI/DataViewport.cpp +++ b/Source/UI/DataViewport.cpp @@ -22,6 +22,7 @@ */ #include "DataViewport.h" +#include "../Processors/Visualization/OpenGLCanvas.h" DataViewport::DataViewport() : TabbedComponent(TabbedButtonBar::TabsAtRight), @@ -67,9 +68,6 @@ DataViewport::~DataViewport() int newIndex = tabArray->indexOf(index); tabArray->remove(newIndex); - //Component* p = getTabContentComponent(newIndex); - //removeChildComponent(p); - getTabbedButtonBar().removeTab(newIndex); if (tabArray->size() == 0) @@ -77,6 +75,12 @@ DataViewport::~DataViewport() } + void DataViewport::currentTabChanged(int newIndex, const String& newTabName) + { + OpenGLCanvas* canvas = (OpenGLCanvas*) getTabContentComponent(newIndex); + canvas->refreshState(); + } + void DataViewport::paint(Graphics& g) { @@ -97,16 +101,6 @@ void DataViewport::paint(Graphics& g) r -= tabDepth; g.setColour(Colour(58,58,58)); - - // Colour c1 (103, 116, 140); - /// Colour c2 (120, 130, 155); - - // g.setGradientFill (ColourGradient (c1, - // 0.0f, 0.0f, - // c2, - // 0.0f, (float) getHeight(), - // false)); - g.fillRoundedRectangle(x,y,r-x,b-y,5.0f); g.fillRect(x,y,r-20,b-y); g.fillRect(x,20,r-x,b-20); diff --git a/Source/UI/DataViewport.h b/Source/UI/DataViewport.h index f56a6934d76c58d0a11342f73f306c9a7b5fc360..21ac3ba9c71f8f11d430383cf70f1f73ab70e0a9 100644 --- a/Source/UI/DataViewport.h +++ b/Source/UI/DataViewport.h @@ -48,6 +48,8 @@ public: int addTabToDataViewport(String tabName, Component* componentToAdd); void removeTab(int); + void currentTabChanged(int newIndex, const String& newTabName); + private: Array<int>* tabArray; diff --git a/Source/UI/FilterList.cpp b/Source/UI/FilterList.cpp index 8ab4415e4ce3235149bc10b1597083f3b577871f..c5a27adc14396ee8332a469a866399d8a02f47e5 100644 --- a/Source/UI/FilterList.cpp +++ b/Source/UI/FilterList.cpp @@ -28,17 +28,14 @@ #include "UIComponent.h" -FilterList::FilterList() : isDragging(false) +FilterList::FilterList() : isDragging(false), + itemHeight(32), + subItemHeight(22), + totalHeight(800), + xBuffer(1), + yBuffer(1) { - //setBounds(0,0,225,500); - - itemHeight = 32; - subItemHeight = 22; - totalHeight = 800; - xBuffer = 1; - yBuffer = 1; - FilterListItem* sources = new FilterListItem("Sources"); sources->addSubItem(new FilterListItem("Intan Demo Board")); sources->addSubItem(new FilterListItem("Signal Generator")); diff --git a/Source/UI/FilterList.h b/Source/UI/FilterList.h index ed0b642fd4023d3e9f54e30695d21c677164c7d0..bed15e48b57a4feb48b1c8fe80e45ed81a741360 100644 --- a/Source/UI/FilterList.h +++ b/Source/UI/FilterList.h @@ -77,7 +77,6 @@ private: int totalHeight, itemHeight, subItemHeight; int xBuffer, yBuffer; - UIComponent* UI; String category;