Skip to content

Commit

Permalink
Restore canvas settings even when it's not open
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanbb committed Jan 24, 2019
1 parent d918f8c commit ae2ec2a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Source/PhaseCalculatorEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
tabText = "Event Phase Plot";
int filterWidth = 80;

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

lowCutLabel = new Label("lowCutL", "Low cut");
lowCutLabel->setBounds(10, 30, 80, 20);
Expand All @@ -45,7 +46,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
lowCutEditable->setEditable(true);
lowCutEditable->addListener(this);
lowCutEditable->setBounds(15, 47, 60, 18);
lowCutEditable->setText(String(processor->lowCut), dontSendNotification);
lowCutEditable->setText(String(parentNode->lowCut), dontSendNotification);
lowCutEditable->setColour(Label::backgroundColourId, Colours::grey);
lowCutEditable->setColour(Label::textColourId, Colours::white);
addAndMakeVisible(lowCutEditable);
Expand All @@ -60,7 +61,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
highCutEditable->setEditable(true);
highCutEditable->addListener(this);
highCutEditable->setBounds(15, 87, 60, 18);
highCutEditable->setText(String(processor->highCut), dontSendNotification);
highCutEditable->setText(String(parentNode->highCut), dontSendNotification);
highCutEditable->setColour(Label::backgroundColourId, Colours::grey);
highCutEditable->setColour(Label::textColourId, Colours::white);
addAndMakeVisible(highCutEditable);
Expand All @@ -77,7 +78,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
{
hilbertLengthBox->addItem(String(1 << pow), pow);
}
hilbertLengthBox->setText(String(processor->hilbertLength), dontSendNotification);
hilbertLengthBox->setText(String(parentNode->hilbertLength), dontSendNotification);
hilbertLengthBox->setTooltip(HILB_LENGTH_TOOLTIP);
hilbertLengthBox->setBounds(filterWidth + 10, 45, 80, 20);
hilbertLengthBox->addListener(this);
Expand Down Expand Up @@ -106,7 +107,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
pastLengthEditable = new Label("pastLengthE");
pastLengthEditable->setEditable(true);
pastLengthEditable->addListener(this);
pastLengthEditable->setText(String(processor->hilbertLength - processor->predictionLength), dontSendNotification);
pastLengthEditable->setText(String(parentNode->hilbertLength - parentNode->predictionLength), dontSendNotification);
pastLengthEditable->setBounds(filterWidth + 8, 102, 60, 18);
pastLengthEditable->setColour(Label::backgroundColourId, Colours::grey);
pastLengthEditable->setColour(Label::textColourId, Colours::white);
Expand All @@ -115,7 +116,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
predLengthEditable = new Label("predLengthE");
predLengthEditable->setEditable(true);
predLengthEditable->addListener(this);
predLengthEditable->setText(String(processor->predictionLength), dontSendNotification);
predLengthEditable->setText(String(parentNode->predictionLength), dontSendNotification);
predLengthEditable->setBounds(filterWidth + 70, 102, 60, 18);
predLengthEditable->setColour(Label::backgroundColourId, Colours::grey);
predLengthEditable->setColour(Label::textColourId, Colours::white);
Expand All @@ -131,8 +132,8 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
predLengthSlider->setColour(Slider::backgroundColourId, Colour(51, 102, 255));
predLengthSlider->setTooltip(PRED_LENGTH_TOOLTIP);
predLengthSlider->addListener(this);
predLengthSlider->setRange(0, processor->hilbertLength, 1);
predLengthSlider->setValue(processor->hilbertLength - processor->predictionLength, dontSendNotification);
predLengthSlider->setRange(0, parentNode->hilbertLength, 1);
predLengthSlider->setValue(parentNode->hilbertLength - parentNode->predictionLength, dontSendNotification);
addAndMakeVisible(predLengthSlider);

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

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

Expand All @@ -184,7 +185,7 @@ PhaseCalculatorEditor::PhaseCalculatorEditor(PhaseCalculator* parentNode, bool u
outputModeBox->addItem("MAG", MAG);
outputModeBox->addItem("PH+MAG", PH_AND_MAG);
outputModeBox->addItem("IMAG", IM);
outputModeBox->setSelectedId(processor->outputMode);
outputModeBox->setSelectedId(parentNode->outputMode);
outputModeBox->setTooltip(OUTPUT_MODE_TOOLTIP);
outputModeBox->setBounds(filterWidth + 145, 105, 76, 19);
outputModeBox->addListener(this);
Expand Down Expand Up @@ -369,7 +370,6 @@ void PhaseCalculatorEditor::stopAcquisition()

Visualizer* PhaseCalculatorEditor::createNewCanvas()
{
canvas = new PhaseCalculatorCanvas(static_cast<PhaseCalculator*>(getProcessor()));
return canvas;
}

Expand Down

0 comments on commit ae2ec2a

Please sign in to comment.