Skip to content

Commit

Permalink
Merge pull request #259 from tne-lab/filternode-restore-labels
Browse files Browse the repository at this point in the history
FilterNode: Make restoring high and low cut text work consistently
  • Loading branch information
aacuevas authored Sep 23, 2018
2 parents 4ccc617 + 58b3f23 commit 5f3186d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
11 changes: 9 additions & 2 deletions Source/Plugins/FilterNode/FilterEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ void FilterEditor::setDefaults(double lowCut, double highCut)
lastHighCutString = String(roundFloatToInt(highCut));
lastLowCutString = String(roundFloatToInt(lowCut));

resetToSavedText();
}

void FilterEditor::resetToSavedText()
{
highCutValue->setText(lastHighCutString, dontSendNotification);
lowCutValue->setText(lastLowCutString, dontSendNotification);
}
Expand Down Expand Up @@ -219,8 +224,10 @@ void FilterEditor::loadCustomParameters(XmlElement* xml)
{
if (xmlNode->hasTagName("VALUES"))
{
highCutValue->setText(xmlNode->getStringAttribute("HighCut"),dontSendNotification);
lowCutValue->setText(xmlNode->getStringAttribute("LowCut"),dontSendNotification);
lastHighCutString = xmlNode->getStringAttribute("HighCut", lastHighCutString);
lastLowCutString = xmlNode->getStringAttribute("LowCut", lastLowCutString);
resetToSavedText();

applyFilterOnADC->setToggleState(xmlNode->getBoolAttribute("ApplyToADC",false), sendNotification);
}
}
Expand Down
1 change: 1 addition & 0 deletions Source/Plugins/FilterNode/FilterEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class FilterEditor : public GenericEditor,
void loadCustomParameters(XmlElement* xml);

void setDefaults(double lowCut, double highCut);
void resetToSavedText();

void channelChanged (int chan, bool newState);

Expand Down
3 changes: 3 additions & 0 deletions Source/Plugins/FilterNode/FilterNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ void FilterNode::loadCustomChannelParametersFromXml(XmlElement* channelInfo, Inf

if (channelType == InfoObjectCommon::DATA_CHANNEL)
{
// restore high and low cut text in case they were changed by channelChanged
static_cast<FilterEditor*>(getEditor())->resetToSavedText();

forEachXmlChildElement (*channelInfo, subNode)
{
if (subNode->hasTagName ("PARAMETERS"))
Expand Down
4 changes: 2 additions & 2 deletions Source/Plugins/FilterNode/FilterNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class FilterNode : public GenericProcessor

void updateSettings() override;

void saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNumber, InfoObjectCommon::InfoObjectType channelTypel) override;
void loadCustomChannelParametersFromXml(XmlElement* channelInfo, InfoObjectCommon::InfoObjectType channelType) override;
void saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNumber, InfoObjectCommon::InfoObjectType channelTypel) override;
void loadCustomChannelParametersFromXml(XmlElement* channelInfo, InfoObjectCommon::InfoObjectType channelType) override;

double getLowCutValueForChannel (int chan) const;
double getHighCutValueForChannel (int chan) const;
Expand Down

0 comments on commit 5f3186d

Please sign in to comment.