HI,
These are little modifications I made in the AU/VST wrappers to fix resizing issues.
The plugin I am developing can have diffrent sizes and in some cases the plugin was not properly displayed with the new size.
- With Cubase 64 MAC, the problem was weird. the plugin was shifted down from the difference of height between the two sizes. So I modified the top left postition in childBoundsChanged () (in the VST wrapper) to display it right.
Juce_vst_wrapper.cpp
[code] void childBoundsChanged (Component* child)
{
child->setTopLeftPosition (0, 0);
const int cw = child->getWidth();
const int ch = child->getHeight();
// ----RL [
// Height shift problem in Cubase Mac 64
#if JUCE_MAC
#ifdef LP64
child->getParentComponent()->setTopLeftPosition (0, child->getParentComponent()->getHeight() - ch);
#endif
#endif
// ----RL ]
wrapper.resizeHostWindow (cw, ch);
#if ! JUCE_LINUX // setSize() on linux causes renoise and energyxt to fail.
setSize (cw, ch);
#else
XResizeWindow (display, (Window) getWindowHandle(), cw, ch);
#endif
#if JUCE_MAC
wrapper.resizeHostWindow (cw, ch); // (doing this a second time seems to be necessary in tracktion)
#endif
}[/code]
- In Reaper Mac (32/64 bit), there was also a problem with the AU resizing.
The plugin window was not taking into account the new size of the plugin. So I updated windowRect.size in childBoundsChanged () in Juce_AU_wrapper.mm:
Juce_AU_wrapper.mm
[code] void childBoundsChanged (Component*)
{
Component* editor = getChildComponent(0);
if (editor != nullptr)
{
const int w = jmax (32, editor->getWidth());
const int h = jmax (32, editor->getHeight());
if (getWidth() != w || getHeight() != h)
setSize (w, h);
NSView* view = (NSView*) getWindowHandle();
NSRect r = [[view superview] frame];
// ----RL [
NSRect windowRect = [[view window] frame];
windowRect.size.width += editor->getWidth() - r.size.width;
windowRect.size.height += editor->getHeight() - r.size.height;
[[view window] setFrame: windowRect display: YES ];
// ----RL ]
r.size.width = editor->getWidth();
r.size.height = editor->getHeight();
[[view superview] setFrame: r];
[view setFrame: NSMakeRect (0, 0, editor->getWidth(), editor->getHeight())];
[view setNeedsDisplay: YES];
}
}[/code]
May be that would be worth adding these fixes to the library. What do you think about it Jules?