Build error with latest tip


#1

Hello,

I’ve downloaded version 1.52.81, and I am getting a warning in xCode that prevents the programs from opening the Jucer(experimental) build.

/********************************************************************************************************************************************

/Developer/juce/extras/Jucer (experimental)/Builds/MacOSX/…/…/JuceLibraryCode/…/…/…/amalgamation/…/src/native/mac/juce_mac_NSViewComponentPeer.mm:1075:

warning: ‘NSWindow’ may not respond to ‘-inLiveResize’
(Messages without a matching method signature will be assumed to return ‘id’ and accept ‘…’ as arguments.)

/********************************************************************************************************************************************

I also have the same error with the Demo project, but not with the basic juce->Builds->MacOSX->Juce.xcodeproj… ? I tried updating my xCode to 3.1.4, using both GCC 4.0 and 4.2, being specific about compiling for 10.5, i386, Debug/Release. Additionally, I downloaded 1.51 and that seems to compile and build just fine.

Keeps pointing me to -inLiveResize inside this function in juce_mac_NSViewComponentPeer.mm

NSRect NSViewComponentPeer::constrainRect (NSRect r)
{
    if (constrainer != 0)
    {
        NSRect current = [window frame];
        current.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - current.origin.y - current.size.height;

        r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - r.origin.y - r.size.height;

        Rectangle<int> pos (convertToRectInt (r));
        Rectangle<int> original (convertToRectInt (current));

        if ([window inLiveResize])
        {
            constrainer->checkBounds (pos, original,
                                      Desktop::getInstance().getAllMonitorDisplayAreas().getBounds(),
                                      false, false, true, true);
        }
        else
        {
            constrainer->checkBounds (pos, original,
                                      Desktop::getInstance().getAllMonitorDisplayAreas().getBounds(),
                                      pos.getY() != original.getY() && pos.getBottom() == original.getBottom(),
                                      pos.getX() != original.getX() && pos.getRight() == original.getRight(),
                                      pos.getY() == original.getY() && pos.getBottom() != original.getBottom(),
                                      pos.getX() == original.getX() && pos.getRight() != original.getRight());
        }

        r.origin.x = pos.getX();
        r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - r.size.height - pos.getY();
        r.size.width = pos.getWidth();
        r.size.height = pos.getHeight();
    }

    return r;
}

Any thoughts?

Owen


#2

Ah, I didn’t notice that that method is only available in 10.6 - I guess I’ll need to invoke it indirectly, e.g.

That does mean that it won’t be possible to correctly handle fixed-proportion resizing in older OSes, but c’est la vie…


#3

Hi Jules,

I downloaded the new tip, and although the Jucer(experimental) builds without any warnings, it still crashes when trying to start up. Looks like the same error.

/*********************************************************************************************************

JUCE v1.52.82
2010-10-25 11:32:20.508 Jucer[12849:10b] *** -[JuceNSWindow_1_52_82_3 inLiveResize]: unrecognized selector sent to instance 0xa32e80
2010-10-25 11:32:20.510 Jucer[12849:10b] An uncaught exception was raised
2010-10-25 11:32:20.511 Jucer[12849:10b] *** -[JuceNSWindow_1_52_82_3 inLiveResize]: unrecognized selector sent to instance 0xa32e80
2010-10-25 11:32:20.512 Jucer[12849:10b] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[JuceNSWindow_1_52_82_3 inLiveResize]: unrecognized selector sent to instance 0xa32e80’

(gdb) continue
objc[12849]: objc_exception_throw failed
Program received signal: “EXC_BAD_INSTRUCTION”.

/*********************************************************************************************************

looks like its coming from line 1078 in juce_mac_NSViewComponentPeer.mm

if ([window performSelector: @selector (inLiveResize)])


#4

hey guys,

just want to confirm Owen’s error-- I too just updated from the latest git and am getting the same error. My program seems to work alright in Debug mode, occasionally crashing with this error, but no longer working at all in Release.

As well, did something change with ReduceOpacityEffect? That seems to have stopped working as well…

Best,
J


#5

Took a few minutes looking into ReduceOpacityEffect, and It seems that ReduceOpacityEffect is nowhere to be found in juce_amalgamated… I grabbed it from a slightly older version I pulled not too long ago. Is there a reason it was no longer included?

If you want to pop it back in, here’s what I did:

juce_amalgamated.h - from line 61097

#ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__

/*** Start of inlined file: juce_ReduceOpacityEffect.h ***/
#ifndef __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
#define __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__

/**
	An effect filter that reduces the image's opacity.

	This can be used to make a component (and its child components) more
	transparent.

	@see Component::setComponentEffect
*/
class JUCE_API  ReduceOpacityEffect  : public ImageEffectFilter
{
public:

	/** Creates the effect object.

		The opacity of the component to which the effect is applied will be
		scaled by the given factor (in the range 0 to 1.0f).
	*/
	ReduceOpacityEffect (float opacity = 1.0f);

	/** Destructor. */
	~ReduceOpacityEffect();

	/** Sets how much to scale the component's opacity.

		@param newOpacity   should be between 0 and 1.0f
	*/
	void setOpacity (float newOpacity);

	/** @internal */
	void applyEffect (Image& sourceImage, Graphics& destContext);

	juce_UseDebuggingNewOperator

private:
	float opacity;
};

#endif   // __JUCE_REDUCEOPACITYEFFECT_JUCEHEADER__
/*** End of inlined file: juce_ReduceOpacityEffect.h ***/

juce_amalgamated.cpp - from line 89619

/*** Start of inlined file: juce_ReduceOpacityEffect.cpp ***/
BEGIN_JUCE_NAMESPACE

ReduceOpacityEffect::ReduceOpacityEffect (const float opacity_)
	: opacity (opacity_)
{
}

ReduceOpacityEffect::~ReduceOpacityEffect()
{
}

void ReduceOpacityEffect::setOpacity (const float newOpacity)
{
	opacity = jlimit (0.0f, 1.0f, newOpacity);
}

void ReduceOpacityEffect::applyEffect (Image& image, Graphics& g)
{
	g.setOpacity (opacity);
	g.drawImageAt (image, 0, 0);
}

END_JUCE_NAMESPACE
/*** End of inlined file: juce_ReduceOpacityEffect.cpp ***/

and lastly, juce_amalgamated_template.cpp - line 353 add

#include "../src/gui/graphics/effects/juce_ReduceOpacityEffect.cpp"


#6

Doh! Sorry, I should have made it check that the selector exists before calling it. Have checked in a fix now.

Like it said in the check-in notes, ReduceOpacityEffect is no longer needed - use Component::setAlpha instead.


#7

Ah yes! Thanks Jules-- seems to be working great so far. Sorry I hadn’t caught the removal of ReduceOpacityEffect, as I was pulling/updating using the JUCER and didn’t see commit notes. But alas, checking the git repo I see that change in a commit from two days ago. The new method is very handy :slight_smile:

cheers


#8

Thanks for the update, the jucer(experimental) builds and runs perfectly with the new tip.