Skip to content

Commit 5958b69

Browse files
committed
Restore calls to refreshState() for Visualizers in tabs
1 parent 4028a56 commit 5958b69

4 files changed

Lines changed: 25 additions & 13 deletions

File tree

Plugins/LfpDisplayNode/LfpDisplayCanvas.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,6 @@ void LfpDisplayCanvas::update()
295295
void LfpDisplayCanvas::refreshState()
296296
{
297297

298-
for (auto split : displaySplits)
299-
{
300-
split->refreshSplitterState();
301-
}
302-
303298
}
304299

305300
void LfpDisplayCanvas::select(LfpDisplaySplitter* splitter)

Source/UI/DataViewport.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ int DataViewport::addTabToDataViewport(String name,
5555

5656
addTab(name, Colours::lightgrey, component, false, tabIndex);
5757

58-
getTabbedButtonBar().setCurrentTabIndex(tabIndex);
59-
6058
getTabbedButtonBar().setTabBackgroundColour(tabIndex, Colours::darkgrey);
6159

6260
setOutline(0);
@@ -94,7 +92,7 @@ void DataViewport::destroyTab(int index)
9492

9593
tabArray.remove(newIndex);
9694
tabIndex--;
97-
95+
9896
removeTab(newIndex);
9997

10098
if (tabArray.size() == 0)
@@ -141,11 +139,17 @@ void DataViewport::disableConnectionToEditorViewport()
141139

142140
void DataViewport::currentTabChanged(int newIndex, const String& newTabName)
143141
{
144-
LOGDD("Data Viewport current tab changed; newIndex = ", newIndex);
142+
LOGD("Data Viewport current tab changed; newIndex = ", newIndex);
145143

146144
if (!shutdown)
147145
{
148-
getTopLevelComponent()->repaint();
146+
147+
if (getTabContentComponent(newIndex) != nullptr)
148+
{
149+
LOGD("Refreshing state for ", newTabName);
150+
Visualizer* v = (Visualizer*)getTabContentComponent(newIndex);
151+
v->refreshState();
152+
}
149153
}
150154
}
151155

Source/UI/GraphViewer.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include "../AccessClass.h"
2828
#include "../Processors/Editors/GenericEditor.h"
29+
#include "../Processors/Visualization/Visualizer.h"
2930

3031
#include "../../JuceLibraryCode/JuceHeader.h"
3132

@@ -108,7 +109,7 @@ class GraphNode : public Component,
108109

109110
/** Paint component */
110111
void paint (Graphics& g) override;
111-
112+
112113
/** Behavior on start of mouse hover */
113114
void mouseEnter (const MouseEvent& event) override;
114115

@@ -198,7 +199,7 @@ class GraphNode : public Component,
198199
Allows the GraphViewer to be scrolled
199200
200201
*/
201-
class GraphViewport : public Component
202+
class GraphViewport : public Visualizer
202203
{
203204
public:
204205
/** Constructor */
@@ -210,6 +211,11 @@ class GraphViewport : public Component
210211
/** Draws the Open Ephys Logo*/
211212
void paint(Graphics& g) override;
212213

214+
/** Visualizer virtual functions */
215+
void refresh() { }
216+
void update() { }
217+
void refreshState() { }
218+
213219
/** Sets viewport bounds*/
214220
void resized() override;
215221

Source/UI/InfoLabel.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
#include "../../JuceLibraryCode/JuceHeader.h"
2929

30+
#include "../Processors/Visualization/Visualizer.h"
31+
3032
/**
3133
3234
Makes it possible to switch between different tabs
@@ -56,7 +58,7 @@ class InfoLabelTabButton : public Button
5658
5759
*/
5860

59-
class InfoLabel : public Component,
61+
class InfoLabel : public Visualizer,
6062
public Button::Listener
6163

6264
{
@@ -70,6 +72,11 @@ class InfoLabel : public Component,
7072
/** Fills the background and draws a logo.*/
7173
void paint(Graphics& g);
7274

75+
/** Visualizer virtual functions */
76+
void refresh() { }
77+
void update() { }
78+
void refreshState() { }
79+
7380
/** Resizes text field*/
7481
void resized();
7582

0 commit comments

Comments
 (0)