When I enable binary data, the plugin starts out real small

and I get code exceptions. e.g. these assert failures:

void ResizableWindow::childBoundsChanged (Component* child)
{
    if ((child == contentComponent) && (child != nullptr) && resizeToFitContent)
    {
        // not going to look very good if this component has a zero size..
        jassert (child->getWidth() > 0);
        jassert (child->getHeight() > 0);

        auto borders = getContentComponentBorder();

        setSize (child->getWidth() + borders.getLeftAndRight(),
                 child->getHeight() + borders.getTopAndBottom());
    }
}

image

I can stretch it back to shape, but how can I prevent it?

Looks like “Height” and “Width” of the Root View are important (I added as shown below and now I can set the size of the panel). If these are not set it looks like min-height and min-width don’t do anything.

<?xml version="1.0" encoding="UTF-8"?>

<magic>
  <Styles>
    <Style name="default">
      <Nodes/>
      <Classes>
        <plot-view border="2" background-color="black" border-color="silver" display="contents"/>
        <nomargin margin="0" padding="0" border="3"/>
        <group margin="5" padding="5" border="2" flex-direction="column"/>
      </Classes>
      <Types>
        <Slider slider-type="rotary" border="3" slider-textbox="textbox-below"
                lookAndFeel="Skeuomorphic" flex-align-self="auto" caption-size="20"
                slider-track="FFDC3B3B" rotary-outline="FF1E91CF" rotary-fill="FFD2BD2A"/>
        <ToggleButton border="0" max-height="50" caption-size="0" text="Active"/>
        <TextButton border="0" max-height="50" caption-size="0"/>
        <ComboBox border="0" max-height="50" caption-size="0"/>
        <Plot border="0" margin="0" padding="0" background-color="00000000"
              radius="0"/>
        <XYDragComponent border="0" margin="0" padding="0" background-color="00000000"
                         radius="0"/>
      </Types>
      <Palettes>
        <default/>
      </Palettes>
    </Style>
  </Styles>
  <View id="root" background-color="FF000500" background-image="photos_2015_09_18_fst_357aoopbiym_jpg"
        image-placement="fill" border="5" border-color="FF83110E" background-alpha="0.2"
        flex-justify-content="space-around" flex-align-items="stretch"
        flex-align-content="start" display="flexbox" flex-align-self=""
        resizable="0" width="50" height="100" max-height="500" max-width="900"
        min-width="800" min-height="400" flex-grow="1" resize-corner="1"/>
</magic>

It’s not so surprising. Maybe the question is why doesn’t it do this when binary content is not enabled?

That is very weird. If you look at the code it uses a default of 600x400 if no width or hight in the magic.xml is defined.

https://github.com/ffAudio/foleys_gui_magic/blob/main/General/foleys_MagicPluginEditor.cpp#L83

However it will try to restore the previous size when reading from setStateInformation:

https://github.com/ffAudio/foleys_gui_magic/blob/main/State/foleys_MagicProcessorState.cpp#L170

This only happens when indeed a size was found. Now the interesting question, where did your 0x0 size come from?

Any chance to step into with the debugger? So far I had no luck reproducing this issue.

This line is hit, but editor is NULL>

then

image

Go through that twice, then I get this:

Then I get this about 9 times then it starts up. I never hit that line in MagicProcessorState.cpp.

Maybe it is something Faust-specific also.

I doubt it’s faust specific. I also doubt that it is directly linked to enabling the FOLEYS_ENABLE_BINARY_DATA macro.

I am at a loss as to why width and height end up being 0 in your example. That could only happen, if a width and height is provided in the XML. Otherwise the default of 600, 400 should be taken.

But it seems that if the editor creation happens after the setStateInformation that the last size isn’t taken into account.

I will have a closer look in the coming days.

If height=“” and width=“” it is the same as height=“0” and width=“0”.

If height and width are not defined at all in the XML then the window shows up at some default size (probably 640 x 400). If I set the height and width to specific values it follows those.

Ah ok, that totally explains it. So it seems to work as intended.