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

Allow LfpDisplayCanvas to save its parameters

parent e9da08d7
No related branches found
No related tags found
No related merge requests found
...@@ -270,6 +270,11 @@ void VisualizerEditor::saveEditorParameters(XmlElement* xml) ...@@ -270,6 +270,11 @@ void VisualizerEditor::saveEditorParameters(XmlElement* xml)
windowButtonState->setAttribute("height",dataWindow->getHeight()); windowButtonState->setAttribute("height",dataWindow->getHeight());
} }
if (canvas != nullptr)
{
canvas->saveVisualizerParameters(xml);
}
} }
void VisualizerEditor::loadEditorParameters(XmlElement* xml) void VisualizerEditor::loadEditorParameters(XmlElement* xml)
...@@ -302,4 +307,20 @@ void VisualizerEditor::loadEditorParameters(XmlElement* xml) ...@@ -302,4 +307,20 @@ void VisualizerEditor::loadEditorParameters(XmlElement* xml)
} }
} }
if (canvas != nullptr)
{
canvas->loadVisualizerParameters(xml);
}
} }
void VisualizerEditor::saveVisualizerParameters(XmlElement* xml)
{
}
void VisualizerEditor::loadVisualizerParameters(XmlElement* xml)
{
}
\ No newline at end of file
...@@ -83,6 +83,10 @@ public: ...@@ -83,6 +83,10 @@ public:
void saveEditorParameters(XmlElement* xml); void saveEditorParameters(XmlElement* xml);
void loadEditorParameters(XmlElement* xml); void loadEditorParameters(XmlElement* xml);
virtual void saveVisualizerParameters(XmlElement* xml);
virtual void loadVisualizerParameters(XmlElement* xml);
ScopedPointer<DataWindow> dataWindow; ScopedPointer<DataWindow> dataWindow;
ScopedPointer<Visualizer> canvas; ScopedPointer<Visualizer> canvas;
......
...@@ -98,8 +98,8 @@ void LfpDisplayCanvas::resized() ...@@ -98,8 +98,8 @@ void LfpDisplayCanvas::resized()
lfpDisplay->setBounds(0,0,getWidth()-scrollBarThickness, lfpDisplay->getTotalHeight()); lfpDisplay->setBounds(0,0,getWidth()-scrollBarThickness, lfpDisplay->getTotalHeight());
rangeSelection->setBounds(100,getHeight()-50,100,25); rangeSelection->setBounds(5,getHeight()-30,100,25);
timebaseSelection->setBounds(300,getHeight()-50,100,25); timebaseSelection->setBounds(175,getHeight()-30,100,25);
} }
...@@ -323,9 +323,13 @@ void LfpDisplayCanvas::paint(Graphics& g) ...@@ -323,9 +323,13 @@ void LfpDisplayCanvas::paint(Graphics& g)
g.drawLine(0,getHeight()-60,getWidth(),getHeight()-60,3.0f); g.drawLine(0,getHeight()-60,getWidth(),getHeight()-60,3.0f);
// g.setColour(Colours::yellow); g.setFont(Font("Default", 16, Font::plain));
// g.drawLine(screenBufferIndex, 0, screenBufferIndex, getHeight()); g.setColour(Colour(100,100,100));
g.drawText("Voltage range (uV)",5,getHeight()-55,300,20,Justification::left, false);
g.drawText("Timebase (s)",175,getHeight()-55,300,20,Justification::left, false);
} }
...@@ -339,6 +343,35 @@ void LfpDisplayCanvas::refresh() ...@@ -339,6 +343,35 @@ void LfpDisplayCanvas::refresh()
} }
void LfpDisplayCanvas::saveVisualizerParameters(XmlElement* xml)
{
XmlElement* xmlNode = xml->createNewChildElement("LFPDISPLAY");
xmlNode->setAttribute("Range",rangeSelection->getSelectedId());
xmlNode->setAttribute("Timebase",timebaseSelection->getSelectedId());
xmlNode->setAttribute("ScrollX",viewport->getViewPositionX());
xmlNode->setAttribute("ScrollY",viewport->getViewPositionY());
}
void LfpDisplayCanvas::loadVisualizerParameters(XmlElement* xml)
{
forEachXmlChildElement(*xml, xmlNode)
{
if (xmlNode->hasTagName("LFPDISPLAY"))
{
rangeSelection->setSelectedId(xmlNode->getIntAttribute("Range"));
timebaseSelection->setSelectedId(xmlNode->getIntAttribute("Timebase"));
viewport->setViewPosition(xmlNode->getIntAttribute("ScrollX"),
xmlNode->getIntAttribute("ScrollY"));
}
}
}
// ------------------------------------------------------------- // -------------------------------------------------------------
LfpTimescale::LfpTimescale(LfpDisplayCanvas* c) : canvas(c) LfpTimescale::LfpTimescale(LfpDisplayCanvas* c) : canvas(c)
...@@ -604,3 +637,5 @@ void LfpChannelDisplay::setColour(Colour c) ...@@ -604,3 +637,5 @@ void LfpChannelDisplay::setColour(Colour c)
{ {
lineColour = c; lineColour = c;
} }
...@@ -73,6 +73,12 @@ public: ...@@ -73,6 +73,12 @@ public:
void comboBoxChanged(ComboBox* cb); void comboBoxChanged(ComboBox* cb);
void saveVisualizerParameters(XmlElement* xml);
void loadVisualizerParameters(XmlElement* xml);
private: private:
float sampleRate; float sampleRate;
......
...@@ -87,6 +87,15 @@ public: ...@@ -87,6 +87,15 @@ public:
/** Refresh rate in Hz. */ /** Refresh rate in Hz. */
float refreshRate; float refreshRate;
/** Saves parameters as XML */
virtual void saveVisualizerParameters(XmlElement* xml) { }
/** Loads parameters from XML */
virtual void loadVisualizerParameters(XmlElement* 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