Browse Source

StandaloneFilterWindow: Avoid recursively resizing plugin editor

v6.1.6
reuk 4 years ago
parent
commit
718097fd60
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 11 additions and 3 deletions
  1. +11
    -3
      modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h

+ 11
- 3
modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h View File

@@ -904,9 +904,14 @@ private:
notification.setBounds (r.removeFromTop (NotificationArea::height)); notification.setBounds (r.removeFromTop (NotificationArea::height));
if (editor != nullptr) if (editor != nullptr)
editor->setBoundsConstrained (editor->getLocalArea (this, r.toFloat())
.withPosition (r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted()))
.toNearestInt());
{
const auto newPos = r.getTopLeft().toFloat().transformedBy (editor->getTransform().inverted());
if (preventResizingEditor)
editor->setTopLeftPosition (newPos.roundToInt());
else
editor->setBoundsConstrained (editor->getLocalArea (this, r.toFloat()).withPosition (newPos).toNearestInt());
}
} }
private: private:
@@ -1001,6 +1006,8 @@ private:
//============================================================================== //==============================================================================
void componentMovedOrResized (Component&, bool, bool) override void componentMovedOrResized (Component&, bool, bool) override
{ {
const ScopedValueSetter<bool> scope (preventResizingEditor, true);
if (editor != nullptr) if (editor != nullptr)
{ {
auto rect = getSizeToContainEditor(); auto rect = getSizeToContainEditor();
@@ -1024,6 +1031,7 @@ private:
std::unique_ptr<AudioProcessorEditor> editor; std::unique_ptr<AudioProcessorEditor> editor;
Value inputMutedValue; Value inputMutedValue;
bool shouldShowNotification = false; bool shouldShowNotification = false;
bool preventResizingEditor = false;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainContentComponent)
}; };


Loading…
Cancel
Save