Prevent from resizing in initialization process

This commit is contained in:
Takeshi Yokemura 2021-05-16 22:29:55 +09:00
parent 1245490e52
commit 2b0da1a0b4
2 changed files with 8 additions and 1 deletions

View File

@ -25,6 +25,8 @@ Magical8bitPlug2AudioProcessorEditor::Magical8bitPlug2AudioProcessorEditor (Magi
{
// Make sure that before the constructor has finished, you've set the
// editor's size to whatever you need it to be.
isComponentsReady = false;
applyLookAndFeel();
basicCompo.reset (new BasicParamsComponent (p, *this));
@ -54,7 +56,7 @@ Magical8bitPlug2AudioProcessorEditor::Magical8bitPlug2AudioProcessorEditor (Magi
(p.parameters.getParameter ("isVolumeSequenceEnabled_raw"))->addListener (this);
(p.parameters.getParameter ("isDutySequenceEnabled_raw"))->addListener (this);
isComponentsReady = true;
resizeWholePanel();
}
@ -271,6 +273,9 @@ void Magical8bitPlug2AudioProcessorEditor::resized()
void Magical8bitPlug2AudioProcessorEditor::resizeWholePanel()
{
if (!isComponentsReady) {
return;
}
bool isMono = (int)(*processor.settingRefs.maxPoly) == 1;
setSize (sizes.totalWidth, sizes.totalHeight (processor.settingRefs.isAdvancedPanelOpen(), isMono));
}

View File

@ -51,6 +51,8 @@ private:
std::unique_ptr<BendParamsComponent> bendCompo;
std::unique_ptr<SweepParamsComponent> sweepCompo;
std::unique_ptr<VibratoParamsComponent> vibCompo;
bool isComponentsReady;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Magical8bitPlug2AudioProcessorEditor)
};