diff --git a/Examples/PlayerExample/Source/MainComponent.cpp b/Examples/PlayerExample/Source/MainComponent.cpp index 15dbf545..a5a9ac00 100644 --- a/Examples/PlayerExample/Source/MainComponent.cpp +++ b/Examples/PlayerExample/Source/MainComponent.cpp @@ -184,5 +184,5 @@ void MainComponent::paint (juce::Graphics& g) void MainComponent::resized() { - magicBuilder.updateLayout(); + magicBuilder.updateLayout (getLocalBounds()); } diff --git a/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.cpp b/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.cpp index 3b27e200..b88f01fe 100644 --- a/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.cpp +++ b/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.cpp @@ -135,7 +135,7 @@ void MagicGUIBuilder::showOverlayDialog (std::unique_ptr dialog overlayDialog = std::move (dialog); parent->addAndMakeVisible (overlayDialog.get()); - updateLayout(); + parent->resized(); } void MagicGUIBuilder::closeOverlayDialog() @@ -171,31 +171,31 @@ void MagicGUIBuilder::updateComponents() root->setEditMode (editMode); } -void MagicGUIBuilder::updateLayout() +void MagicGUIBuilder::updateLayout (juce::Rectangle bounds) { if (parent == nullptr) return; if (root.get() != nullptr) { - if (!stylesheet.setMediaSize (parent->getWidth(), parent->getHeight())) + if (!stylesheet.setMediaSize (bounds.getWidth(), bounds.getHeight())) { stylesheet.updateValidRanges(); root->updateInternal(); } - if (root->getBounds() == parent->getLocalBounds()) + if (root->getBounds() == bounds) root->updateLayout(); else - root->setBounds (parent->getLocalBounds()); + root->setBounds (bounds); } if (overlayDialog) { - if (overlayDialog->getBounds() == parent->getLocalBounds()) + if (overlayDialog->getBounds() == bounds) overlayDialog->resized(); else - overlayDialog->setBounds (parent->getLocalBounds()); + overlayDialog->setBounds (bounds); } parent->repaint(); @@ -365,7 +365,7 @@ void MagicGUIBuilder::changeListenerCallback (juce::ChangeBroadcaster*) if (root.get() != nullptr) root->updateInternal(); - updateLayout(); + root->resized(); } void MagicGUIBuilder::valueTreeRedirected (juce::ValueTree& treeWhichHasBeenChanged) diff --git a/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.h b/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.h index 7f392bd9..50c77e45 100644 --- a/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.h +++ b/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.h @@ -110,7 +110,7 @@ class MagicGUIBuilder /** Recalculates the layout of all components */ - void updateLayout(); + void updateLayout (juce::Rectangle bounds); /** Resolve all colours fresh, in case the palette has changed diff --git a/modules/foleys_gui_magic/General/foleys_MagicPluginEditor.cpp b/modules/foleys_gui_magic/General/foleys_MagicPluginEditor.cpp index 9efd5ab0..159b3d5e 100644 --- a/modules/foleys_gui_magic/General/foleys_MagicPluginEditor.cpp +++ b/modules/foleys_gui_magic/General/foleys_MagicPluginEditor.cpp @@ -142,7 +142,7 @@ void MagicPluginEditor::paint (juce::Graphics& g) void MagicPluginEditor::resized() { - builder->updateLayout(); + builder->updateLayout (getLocalBounds()); processorState.setLastEditorSize (getWidth(), getHeight()); }