Skip to content

Commit 5f3186d

Browse files
authored
Merge pull request #259 from tne-lab/filternode-restore-labels
FilterNode: Make restoring high and low cut text work consistently
2 parents 4ccc617 + 58b3f23 commit 5f3186d

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

Source/Plugins/FilterNode/FilterEditor.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ void FilterEditor::setDefaults(double lowCut, double highCut)
9494
lastHighCutString = String(roundFloatToInt(highCut));
9595
lastLowCutString = String(roundFloatToInt(lowCut));
9696

97+
resetToSavedText();
98+
}
99+
100+
void FilterEditor::resetToSavedText()
101+
{
97102
highCutValue->setText(lastHighCutString, dontSendNotification);
98103
lowCutValue->setText(lastLowCutString, dontSendNotification);
99104
}
@@ -219,8 +224,10 @@ void FilterEditor::loadCustomParameters(XmlElement* xml)
219224
{
220225
if (xmlNode->hasTagName("VALUES"))
221226
{
222-
highCutValue->setText(xmlNode->getStringAttribute("HighCut"),dontSendNotification);
223-
lowCutValue->setText(xmlNode->getStringAttribute("LowCut"),dontSendNotification);
227+
lastHighCutString = xmlNode->getStringAttribute("HighCut", lastHighCutString);
228+
lastLowCutString = xmlNode->getStringAttribute("LowCut", lastLowCutString);
229+
resetToSavedText();
230+
224231
applyFilterOnADC->setToggleState(xmlNode->getBoolAttribute("ApplyToADC",false), sendNotification);
225232
}
226233
}

Source/Plugins/FilterNode/FilterEditor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class FilterEditor : public GenericEditor,
5151
void loadCustomParameters(XmlElement* xml);
5252

5353
void setDefaults(double lowCut, double highCut);
54+
void resetToSavedText();
5455

5556
void channelChanged (int chan, bool newState);
5657

Source/Plugins/FilterNode/FilterNode.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ void FilterNode::loadCustomChannelParametersFromXml(XmlElement* channelInfo, Inf
310310

311311
if (channelType == InfoObjectCommon::DATA_CHANNEL)
312312
{
313+
// restore high and low cut text in case they were changed by channelChanged
314+
static_cast<FilterEditor*>(getEditor())->resetToSavedText();
315+
313316
forEachXmlChildElement (*channelInfo, subNode)
314317
{
315318
if (subNode->hasTagName ("PARAMETERS"))

Source/Plugins/FilterNode/FilterNode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ class FilterNode : public GenericProcessor
5050

5151
void updateSettings() override;
5252

53-
void saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNumber, InfoObjectCommon::InfoObjectType channelTypel) override;
54-
void loadCustomChannelParametersFromXml(XmlElement* channelInfo, InfoObjectCommon::InfoObjectType channelType) override;
53+
void saveCustomChannelParametersToXml(XmlElement* channelInfo, int channelNumber, InfoObjectCommon::InfoObjectType channelTypel) override;
54+
void loadCustomChannelParametersFromXml(XmlElement* channelInfo, InfoObjectCommon::InfoObjectType channelType) override;
5555

5656
double getLowCutValueForChannel (int chan) const;
5757
double getHighCutValueForChannel (int chan) const;

0 commit comments

Comments
 (0)