Skip to content

Commit ae2ec2a

Browse files
committed
Restore canvas settings even when it's not open
1 parent d918f8c commit ae2ec2a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Source/PhaseCalculatorEditor.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
3333
tabText = "Event Phase Plot";
3434
int filterWidth = 80;
3535

36-
PhaseCalculator* processor = static_cast<PhaseCalculator*>(parentNode);
36+
// make the canvas now, so that restoring its parameters always works.
37+
canvas = new PhaseCalculatorCanvas(parentNode);
3738

3839
lowCutLabel = new Label("lowCutL", "Low cut");
3940
lowCutLabel->setBounds(10, 30, 80, 20);
@@ -45,7 +46,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
4546
lowCutEditable->setEditable(true);
4647
lowCutEditable->addListener(this);
4748
lowCutEditable->setBounds(15, 47, 60, 18);
48-
lowCutEditable->setText(String(processor->lowCut), dontSendNotification);
49+
lowCutEditable->setText(String(parentNode->lowCut), dontSendNotification);
4950
lowCutEditable->setColour(Label::backgroundColourId, Colours::grey);
5051
lowCutEditable->setColour(Label::textColourId, Colours::white);
5152
addAndMakeVisible(lowCutEditable);
@@ -60,7 +61,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
6061
highCutEditable->setEditable(true);
6162
highCutEditable->addListener(this);
6263
highCutEditable->setBounds(15, 87, 60, 18);
63-
highCutEditable->setText(String(processor->highCut), dontSendNotification);
64+
highCutEditable->setText(String(parentNode->highCut), dontSendNotification);
6465
highCutEditable->setColour(Label::backgroundColourId, Colours::grey);
6566
highCutEditable->setColour(Label::textColourId, Colours::white);
6667
addAndMakeVisible(highCutEditable);
@@ -77,7 +78,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
7778
{
7879
hilbertLengthBox->addItem(String(1 << pow), pow);
7980
}
80-
hilbertLengthBox->setText(String(processor->hilbertLength), dontSendNotification);
81+
hilbertLengthBox->setText(String(parentNode->hilbertLength), dontSendNotification);
8182
hilbertLengthBox->setTooltip(HILB_LENGTH_TOOLTIP);
8283
hilbertLengthBox->setBounds(filterWidth + 10, 45, 80, 20);
8384
hilbertLengthBox->addListener(this);
@@ -106,7 +107,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
106107
pastLengthEditable = new Label("pastLengthE");
107108
pastLengthEditable->setEditable(true);
108109
pastLengthEditable->addListener(this);
109-
pastLengthEditable->setText(String(processor->hilbertLength - processor->predictionLength), dontSendNotification);
110+
pastLengthEditable->setText(String(parentNode->hilbertLength - parentNode->predictionLength), dontSendNotification);
110111
pastLengthEditable->setBounds(filterWidth + 8, 102, 60, 18);
111112
pastLengthEditable->setColour(Label::backgroundColourId, Colours::grey);
112113
pastLengthEditable->setColour(Label::textColourId, Colours::white);
@@ -115,7 +116,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
115116
predLengthEditable = new Label("predLengthE");
116117
predLengthEditable->setEditable(true);
117118
predLengthEditable->addListener(this);
118-
predLengthEditable->setText(String(processor->predictionLength), dontSendNotification);
119+
predLengthEditable->setText(String(parentNode->predictionLength), dontSendNotification);
119120
predLengthEditable->setBounds(filterWidth + 70, 102, 60, 18);
120121
predLengthEditable->setColour(Label::backgroundColourId, Colours::grey);
121122
predLengthEditable->setColour(Label::textColourId, Colours::white);
@@ -131,8 +132,8 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
131132
predLengthSlider->setColour(Slider::backgroundColourId, Colour(51, 102, 255));
132133
predLengthSlider->setTooltip(PRED_LENGTH_TOOLTIP);
133134
predLengthSlider->addListener(this);
134-
predLengthSlider->setRange(0, processor->hilbertLength, 1);
135-
predLengthSlider->setValue(processor->hilbertLength - processor->predictionLength, dontSendNotification);
135+
predLengthSlider->setRange(0, parentNode->hilbertLength, 1);
136+
predLengthSlider->setValue(parentNode->hilbertLength - parentNode->predictionLength, dontSendNotification);
136137
addAndMakeVisible(predLengthSlider);
137138

138139
recalcIntervalLabel = new Label("recalcL", "AR Refresh:");
@@ -147,7 +148,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
147148
recalcIntervalEditable->setBounds(filterWidth + 145, 44, 55, 18);
148149
recalcIntervalEditable->setColour(Label::backgroundColourId, Colours::grey);
149150
recalcIntervalEditable->setColour(Label::textColourId, Colours::white);
150-
recalcIntervalEditable->setText(String(processor->calcInterval), dontSendNotification);
151+
recalcIntervalEditable->setText(String(parentNode->calcInterval), dontSendNotification);
151152
recalcIntervalEditable->setTooltip(RECALC_INTERVAL_TOOLTIP);
152153
addAndMakeVisible(recalcIntervalEditable);
153154

@@ -169,7 +170,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
169170
arOrderEditable->setBounds(filterWidth + 195, 66, 25, 18);
170171
arOrderEditable->setColour(Label::backgroundColourId, Colours::grey);
171172
arOrderEditable->setColour(Label::textColourId, Colours::white);
172-
arOrderEditable->setText(String(processor->arOrder), sendNotificationAsync);
173+
arOrderEditable->setText(String(parentNode->arOrder), sendNotificationAsync);
173174
arOrderEditable->setTooltip(AR_ORDER_TOOLTIP);
174175
addAndMakeVisible(arOrderEditable);
175176

@@ -184,7 +185,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
184185
outputModeBox->addItem("MAG", MAG);
185186
outputModeBox->addItem("PH+MAG", PH_AND_MAG);
186187
outputModeBox->addItem("IMAG", IM);
187-
outputModeBox->setSelectedId(processor->outputMode);
188+
outputModeBox->setSelectedId(parentNode->outputMode);
188189
outputModeBox->setTooltip(OUTPUT_MODE_TOOLTIP);
189190
outputModeBox->setBounds(filterWidth + 145, 105, 76, 19);
190191
outputModeBox->addListener(this);
@@ -369,7 +370,6 @@ void PhaseCalculatorEditor::stopAcquisition()
369370

370371
Visualizer* PhaseCalculatorEditor::createNewCanvas()
371372
{
372-
canvas = new PhaseCalculatorCanvas(static_cast<PhaseCalculator*>(getProcessor()));
373373
return canvas;
374374
}
375375

0 commit comments

Comments
 (0)