The jucer


#1

Hi all,

First, thank you for the jucer, it is a really really good piece of gold.
I’ve converted the project to vs6.0 if you want it (and fixed the 19 errors, mostly for(int i <= redefinition and findSomethingComponent changed to findSomethingComponent((MainWindow*)0))
However there is a small programming mistake in Font’s getTypefaceName which tries to access private typefaceName of element. I’ve added element->getTypefaceName

Good luck…
PS: I have a compiled Win32 binary if you want it…


#2

Thanks, I’ve not had chance to try it under VC6 yet, but will do soon. I’ll also try to post a binary in the next few days.


#3
  • ‘subtracted from parent width’ appears to not work when anchored to the centre of the component- the width given is just the value intended for subtraction

#4

I think that’s how it’s supposed to work. Can you explain better what you mean?


#5

Hi I can’t get the Jucer to open in VC++.net


#6

there’s a bug in one of the utility functions for code generation that causes the thing i vaguely mentioned above (i’d have posted this yesterday but the internet has only just come back to life for me!)

static void positionToCode (const PositionedRectangle& position,
                            String& x, String& y, String& w, String& h)
{
    // width
    if (position.getWidthMode() == PositionedRectangle::proportionalSize)
        w << "proportionOfWidth (" << valueToFloat (position.getWidth()) << ")";
// -----------------------------------------------------------------
// This part isn't in the original version at all
	else if (position.getWidthMode() == PositionedRectangle::parentSizeMinusAbsolute)
        w << "getWidth () - " << roundDoubleToInt (position.getWidth());
// -----------------------------------------------------------------
	else	
        w << roundDoubleToInt (position.getWidth());

    // height
    if (position.getHeightMode() == PositionedRectangle::proportionalSize)
        h << "proportionOfHeight (" << valueToFloat (position.getHeight()) << ")";
// -----------------------------------------------------------------
// This part isn't in the original version at all
	else if (position.getHeightMode() == PositionedRectangle::parentSizeMinusAbsolute)
        h << "getHeight () - " << roundDoubleToInt (position.getHeight());
// -----------------------------------------------------------------
    else
        h << roundDoubleToInt (position.getHeight());

    // x-pos
    if (position.getPositionModeX() == PositionedRectangle::proportionOfParentSize)
        x << "proportionOfWidth (" << valueToFloat (position.getX()) << ")";
    else if (position.getPositionModeX() == PositionedRectangle::absoluteFromParentTopLeft)
        x << roundDoubleToInt (position.getX());
    else if (position.getPositionModeX() == PositionedRectangle::absoluteFromParentBottomRight)
    {
        x << "getWidth()";

        const int d = roundDoubleToInt (position.getX());
        if (d != 0)
            x << " - " << d;
    }
    else if (position.getPositionModeX() == PositionedRectangle::absoluteFromParentCentre)
    {
        x << "(getWidth() / 2)";

        const int d = roundDoubleToInt (position.getX());
        if (d != 0)
            x << " + " << d;
    }

    if (w != T("0"))
    {
        if (position.getAnchorPointX() == PositionedRectangle::anchorAtRightOrBottom)
            x << " - " << w;
        else if (position.getAnchorPointX() == PositionedRectangle::anchorAtCentre)
//----------------------------------------------------
// The extra brackets protect stuff like 'getWidth()-20' from the '/2' 
            x << " - ((" << w << ") / 2)";
//----------------------------------------------------
    }

    // y-pos
    if (position.getPositionModeY() == PositionedRectangle::proportionOfParentSize)
        y << "proportionOfHeight (" << valueToFloat (position.getY()) << ")";
    else if (position.getPositionModeY() == PositionedRectangle::absoluteFromParentTopLeft)
        y << roundDoubleToInt (position.getY());
    else if (position.getPositionModeY() == PositionedRectangle::absoluteFromParentBottomRight)
    {
        y << "getHeight()";

        const int d = roundDoubleToInt (position.getY());
        if (d != 0)
            y << " - " << d;
    }
    else if (position.getPositionModeY() == PositionedRectangle::absoluteFromParentCentre)
    {
        y << "(getHeight() / 2)";

        const int d = roundDoubleToInt (position.getY());
        if (d != 0)
            y << " + " << d;
    }

    if (h != T("0"))
    {
        if (position.getAnchorPointY() == PositionedRectangle::anchorAtRightOrBottom)
            y << " - " << h;
        else if (position.getAnchorPointY() == PositionedRectangle::anchorAtCentre)
//----------------------------------------------------
// The extra brackets protect stuff like 'getHeight()-20' from the '/2' 
            y << " - ((" << h << ") / 2)";
//----------------------------------------------------
    }
}

i’ve highlighted the bits that i’ve changed


#7

ah - I see - it seemed to work ok in the editor but not when you compiled the code. Cheers for the fix!


#8

It’s a vcexpress project, but I’d expect it to work. If not, there’ll be a VC6 project in the next version, and I’ll post a binary soon.


#9