Browse Source

Re-attach ResizableCornerComponent when calling AudioProcessorEditor::setContrainer() so the new constrainer is respected

tags/2021-05-28
ed 5 years ago
parent
commit
dde8f4b68c
2 changed files with 13 additions and 7 deletions
  1. +12
    -7
      modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp
  2. +1
    -0
      modules/juce_audio_processors/processors/juce_AudioProcessorEditor.h

+ 12
- 7
modules/juce_audio_processors/processors/juce_AudioProcessorEditor.cpp View File

@@ -103,15 +103,9 @@ void AudioProcessorEditor::setResizable (const bool shouldBeResizable, const boo
if (shouldHaveCornerResizer != (resizableCorner != nullptr)) if (shouldHaveCornerResizer != (resizableCorner != nullptr))
{ {
if (shouldHaveCornerResizer) if (shouldHaveCornerResizer)
{
resizableCorner.reset (new ResizableCornerComponent (this, constrainer));
Component::addChildComponent (resizableCorner.get());
resizableCorner->setAlwaysOnTop (true);
}
attachResizableCornerComponent();
else else
{
resizableCorner.reset(); resizableCorner.reset();
}
} }
} }
@@ -146,6 +140,9 @@ void AudioProcessorEditor::setConstrainer (ComponentBoundsConstrainer* newConstr
|| newConstrainer->getMinimumHeight() != newConstrainer->getMaximumHeight()); || newConstrainer->getMinimumHeight() != newConstrainer->getMaximumHeight());
attachConstrainer (newConstrainer); attachConstrainer (newConstrainer);
if (resizableCorner != nullptr)
attachResizableCornerComponent();
} }
} }
@@ -158,6 +155,14 @@ void AudioProcessorEditor::attachConstrainer (ComponentBoundsConstrainer* newCon
} }
} }
void AudioProcessorEditor::attachResizableCornerComponent()
{
resizableCorner.reset (new ResizableCornerComponent (this, constrainer));
Component::addChildComponent (resizableCorner.get());
resizableCorner->setAlwaysOnTop (true);
editorResized (true);
}
void AudioProcessorEditor::setBoundsConstrained (Rectangle<int> newBounds) void AudioProcessorEditor::setBoundsConstrained (Rectangle<int> newBounds)
{ {
if (constrainer != nullptr) if (constrainer != nullptr)


+ 1
- 0
modules/juce_audio_processors/processors/juce_AudioProcessorEditor.h View File

@@ -200,6 +200,7 @@ private:
void editorResized (bool wasResized); void editorResized (bool wasResized);
void updatePeer(); void updatePeer();
void attachConstrainer (ComponentBoundsConstrainer*); void attachConstrainer (ComponentBoundsConstrainer*);
void attachResizableCornerComponent();
//============================================================================== //==============================================================================
std::unique_ptr<AudioProcessorEditorListener> resizeListener; std::unique_ptr<AudioProcessorEditorListener> resizeListener;


Loading…
Cancel
Save