Skip to content
Snippets Groups Projects
Commit 0a38c98a authored by jsiegle's avatar jsiegle
Browse files

LfpDisplayCanvas now saves the state of the event buttons

parent 836e3a35
No related branches found
No related tags found
No related merge requests found
......@@ -112,7 +112,7 @@ LfpDisplayCanvas::LfpDisplayCanvas(LfpDisplayNode* processor_) :
{
eventDisplayInterface* eventOptions = new eventDisplayInterface(lfpDisplay, this, i);
EventDisplayInterface* eventOptions = new EventDisplayInterface(lfpDisplay, this, i);
eventDisplayInterfaces.add(eventOptions);
addAndMakeVisible(eventOptions);
eventOptions->setBounds(500+(floor(i/2)*20), getHeight()-20-(i%2)*20, 40, 20);
......@@ -448,6 +448,18 @@ void LfpDisplayCanvas::saveVisualizerParameters(XmlElement* xml)
xmlNode->setAttribute("Timebase",timebaseSelection->getSelectedId());
xmlNode->setAttribute("Spread",spreadSelection->getSelectedId());
int eventButtonState = 0;
for (int i = 0; i < 8; i++)
{
if (lfpDisplay->eventDisplayEnabled[i])
{
eventButtonState += (1 << i);
}
}
xmlNode->setAttribute("EventButtonState", eventButtonState);
xmlNode->setAttribute("ScrollX",viewport->getViewPositionX());
xmlNode->setAttribute("ScrollY",viewport->getViewPositionY());
}
......@@ -465,6 +477,15 @@ void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
viewport->setViewPosition(xmlNode->getIntAttribute("ScrollX"),
xmlNode->getIntAttribute("ScrollY"));
int eventButtonState = xmlNode->getIntAttribute("eventButtonState");
for (int i = 0; i < 8; i++)
{
lfpDisplay->eventDisplayEnabled[i] = (eventButtonState >> i) & 1;
eventDisplayInterfaces[i]->checkEnabledState();
}
}
}
......@@ -1078,11 +1099,11 @@ void LfpChannelDisplayInfo::paint(Graphics& g)
// Event display Options --------------------------------------------------------------------
eventDisplayInterface::eventDisplayInterface(LfpDisplay* display_, LfpDisplayCanvas* canvas_, int chNum):
EventDisplayInterface::EventDisplayInterface(LfpDisplay* display_, LfpDisplayCanvas* canvas_, int chNum):
isEnabled(true), display(display_), canvas(canvas_)
{
channelNumber=chNum;
channelNumber = chNum;
chButton = new UtilityButton(String(channelNumber+1), Font("Small Text", 13, Font::plain));
chButton->setRadius(5.0f);
......@@ -1098,19 +1119,19 @@ eventDisplayInterface::eventDisplayInterface(LfpDisplay* display_, LfpDisplayCan
}
eventDisplayInterface::~eventDisplayInterface()
EventDisplayInterface::~EventDisplayInterface()
{
}
void eventDisplayInterface::checkEnabledState()
void EventDisplayInterface::checkEnabledState()
{
isEnabled = display->getEventDisplayState(channelNumber);
//repaint();
}
void eventDisplayInterface::buttonClicked(Button* button)
void EventDisplayInterface::buttonClicked(Button* button)
{
checkEnabledState();
if (isEnabled)
......@@ -1127,7 +1148,7 @@ void eventDisplayInterface::buttonClicked(Button* button)
}
void eventDisplayInterface::paint(Graphics& g)
void EventDisplayInterface::paint(Graphics& g)
{
checkEnabledState();
......
......@@ -33,7 +33,7 @@ class LfpTimescale;
class LfpDisplay;
class LfpChannelDisplay;
class LfpChannelDisplayInfo;
class eventDisplayInterface;
class EventDisplayInterface;
/**
......@@ -100,9 +100,6 @@ private:
static const int MAX_N_SAMP = 5000; // maximum display size in pixels
//float waves[MAX_N_CHAN][MAX_N_SAMP*2]; // we need an x and y point for each sample
LfpDisplayNode* processor;
AudioSampleBuffer* displayBuffer;
AudioSampleBuffer* screenBuffer;
......@@ -120,8 +117,7 @@ private:
StringArray timebases;
StringArray spreads; // option for vertical spacing between channels
OwnedArray<eventDisplayInterface> eventDisplayInterfaces;
OwnedArray<EventDisplayInterface> eventDisplayInterfaces;
void refreshScreenBuffer();
void updateScreenBuffer();
......@@ -133,7 +129,6 @@ private:
int nChans;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LfpDisplayCanvas);
};
......@@ -197,6 +192,7 @@ public:
Array<LfpChannelDisplay*> channels;
Array<LfpChannelDisplayInfo*> channelInfo;
bool eventDisplayEnabled[8];
private:
int numChans;
......@@ -204,11 +200,7 @@ private:
int totalHeight;
LfpDisplayCanvas* canvas;
Viewport* viewport;
bool eventDisplayEnabled[8];
Viewport* viewport;
float range;
......@@ -272,12 +264,12 @@ public:
};
class eventDisplayInterface : public Component,
class EventDisplayInterface : public Component,
public Button::Listener
{
public:
eventDisplayInterface(LfpDisplay*, LfpDisplayCanvas*, int chNum);
~eventDisplayInterface();
EventDisplayInterface(LfpDisplay*, LfpDisplayCanvas*, int chNum);
~EventDisplayInterface();
void paint(Graphics& g);
......@@ -285,12 +277,12 @@ public:
void checkEnabledState();
bool isEnabled;
private:
int channelNumber;
bool isEnabled;
LfpDisplay* display;
LfpDisplayCanvas* canvas;
......
......@@ -92,7 +92,7 @@ UIComponent::UIComponent(MainWindow* mainWindow_, ProcessorGraph* pgraph, AudioC
mainWindow->setMenuBar(this);
#endif
getEditorViewport()->loadState(File("/home/jsiegle/Programming/GUI/Builds/Linux/build/test.xml"));
//getEditorViewport()->loadState(File("/home/jsiegle/Programming/GUI/Builds/Linux/build/test.xml"));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment