hmmm,
i tried it, and it crashed live 8 (carbon) and reaper (cocoa). I think this is some code that schwa didn't fully implement. It isn't implemented at all for AudioUnits.
I made some progress though...
first i checked IGraphics::Resize() and saw this:
Code:
void IGraphics::Resize(int w, int h)
{
// The OS implementation class has to do all the work, then call up to here. ...
so i hade a look at IGraphicsMac and noticed that in fact IGraphics::Resize() was being called before the OS implementation did any work. So i hacked it, and now it doesn't crash and does resize the window in reaper and live. IGraphics::Resize() deletes the plugin's controls, which left me with a blank window - i commented this out and added a SetAllControlsDirty().
Code:
void IGraphicsMac::Resize(int w, int h)
{
// was here
if (mDrawBitmap) {
mDrawBitmap->resize(w, h);
}
#ifndef IPLUG_NO_CARBON_SUPPORT
if (mGraphicsCarbon) {
mGraphicsCarbon->Resize(w, h);
}
else
#endif
if (mGraphicsCocoa) {
NSSize size = { w, h };
[(IGRAPHICS_COCOA*) mGraphicsCocoa setFrameSize: size ];
}
IGraphics::Resize(w, h); // < - this was at the top of the method
}
Code:
void IGraphics::Resize(int w, int h)
{
// The OS implementation class has to do all the work, then call up to here.
mWidth = w;
mHeight = h;
ReleaseMouseCapture();
//mControls.Empty(true);
mPlug->ResizeGraphics(w, h);
SetAllControlsDirty();
}
This needs a bit of thought though because at the moment I am just testing with a simple small->bigger gui. If it goes the other way i guess there might be problems with the way i have hacked it. In which case maybe its good to recreate the entire gui, which is what was maybe intended by calling mControls.Empty(true); ... but i couldn't see how they would be created again... I guess it should be up to the programmer - in which case maybe we need a virtual IPlugBase method that triggers when a resize occurs... or something like that .
Also I noticed IGraphicsWin::Resize calls IGraphics::Resize(w, h); straight away too... i wonder if it's working on windows?