DocumentWindow resizing with Constrainer issues


#1

I’m having a tough time solving an issue with resizing my MainContentComponent, seemingly due to the title bar height.

here is a 0:42 video showing the unexpected behavior:

Here’s how I’m handling resizing the MCC when a component is popped out of my window into their own separate window:

                auto ph = pianoRollModule.getHeight();
                auto newW = dw->getContentComponent()->getWidth(); //keep the current window width
                auto newH = dw->getContentComponent()->getHeight() - ph; //lose the piano roll height
                double newRatio = double(newW) / double(newH);
                //dw->getConstrainer()->setFixedAspectRatio(0);
                //dw->setContentComponentSize(newW, newH);
                auto newBounds = dw->getScreenBounds().withWidth(newW).withHeight(newH);
                DBG( "new Bounds: " + newBounds.toString() );
                dw->getConstrainer()->setFixedAspectRatio( newRatio );
                dw->setBoundsConstrained(newBounds);

and here is how I reattach the popped out window:

            if( auto dw = getDW() ) {
                auto newH = double(getHeight()) / (1.0 / 1.35) + dw->getTitleBarHeight();
//                double newRatio = double(getWidth()) / double(newH);
                dw->getConstrainer()->setFixedAspectRatio(0);
                dw->setContentComponentSize(getWidth(), newH);
                dw->getConstrainer()->setFixedAspectRatio( 2.0 );
//                DBG( "new ratio: " + String(newRatio) );
                addAndMakeVisible(pianoRollModule);
            }

a question I haven’t found the answer to: is setFixedAspectRatio() expecting the title bar of the window to be included in the height?


ContentComponentConstrainer