@@ -26,17 +26,17 @@ | |||||
BEGIN_JUCE_NAMESPACE | BEGIN_JUCE_NAMESPACE | ||||
//============================================================================== | //============================================================================== | ||||
struct DefaultImageFormats | |||||
ImageFileFormat* ImageFileFormat::findImageFormatForStream (InputStream& input) | |||||
{ | { | ||||
PNGImageFormat png; | |||||
JPEGImageFormat jpg; | |||||
GIFImageFormat gif; | |||||
}; | |||||
struct DefaultImageFormats | |||||
{ | |||||
PNGImageFormat png; | |||||
JPEGImageFormat jpg; | |||||
GIFImageFormat gif; | |||||
}; | |||||
static DefaultImageFormats defaultImageFormats; | |||||
static DefaultImageFormats defaultImageFormats; | |||||
ImageFileFormat* ImageFileFormat::findImageFormatForStream (InputStream& input) | |||||
{ | |||||
ImageFileFormat* formats[] = { &defaultImageFormats.png, | ImageFileFormat* formats[] = { &defaultImageFormats.png, | ||||
&defaultImageFormats.jpg, | &defaultImageFormats.jpg, | ||||
&defaultImageFormats.gif }; | &defaultImageFormats.gif }; | ||||
@@ -68,11 +68,11 @@ Image ImageFileFormat::loadFrom (InputStream& input) | |||||
Image ImageFileFormat::loadFrom (const File& file) | Image ImageFileFormat::loadFrom (const File& file) | ||||
{ | { | ||||
InputStream* const in = file.createInputStream(); | |||||
FileInputStream stream (file); | |||||
if (in != nullptr) | |||||
if (stream.openedOk()) | |||||
{ | { | ||||
BufferedInputStream b (in, 8192, true); | |||||
BufferedInputStream b (stream, 8192); | |||||
return loadFrom (b); | return loadFrom (b); | ||||
} | } | ||||
@@ -201,17 +201,14 @@ void ComponentBoundsConstrainer::checkBounds (Rectangle<int>& bounds, | |||||
const bool isStretchingBottom, | const bool isStretchingBottom, | ||||
const bool isStretchingRight) | const bool isStretchingRight) | ||||
{ | { | ||||
// constrain the size if it's being stretched.. | |||||
if (isStretchingLeft) | if (isStretchingLeft) | ||||
bounds.setLeft (jlimit (old.getRight() - maxW, old.getRight() - minW, bounds.getX())); | bounds.setLeft (jlimit (old.getRight() - maxW, old.getRight() - minW, bounds.getX())); | ||||
if (isStretchingRight) | |||||
else | |||||
bounds.setWidth (jlimit (minW, maxW, bounds.getWidth())); | bounds.setWidth (jlimit (minW, maxW, bounds.getWidth())); | ||||
if (isStretchingTop) | if (isStretchingTop) | ||||
bounds.setTop (jlimit (old.getBottom() - maxH, old.getBottom() - minH, bounds.getY())); | bounds.setTop (jlimit (old.getBottom() - maxH, old.getBottom() - minH, bounds.getY())); | ||||
if (isStretchingBottom) | |||||
else | |||||
bounds.setHeight (jlimit (minH, maxH, bounds.getHeight())); | bounds.setHeight (jlimit (minH, maxH, bounds.getHeight())); | ||||
if (bounds.isEmpty()) | if (bounds.isEmpty()) | ||||
@@ -181,7 +181,7 @@ public: | |||||
/** Called by setBoundsForComponent() to apply a new constrained size to a | /** Called by setBoundsForComponent() to apply a new constrained size to a | ||||
component. | component. | ||||
By default this just calls setBounds(), but it virtual in case it's needed for | |||||
By default this just calls setBounds(), but is virtual in case it's needed for | |||||
extremely cunning purposes. | extremely cunning purposes. | ||||
*/ | */ | ||||
virtual void applyBoundsToComponent (Component* component, | virtual void applyBoundsToComponent (Component* component, | ||||
@@ -388,12 +388,15 @@ UIViewComponentPeer::UIViewComponentPeer (Component* const component, | |||||
view = [[JuceUIView alloc] initWithOwner: this withFrame: r]; | view = [[JuceUIView alloc] initWithOwner: this withFrame: r]; | ||||
view.multipleTouchEnabled = YES; | |||||
view.hidden = ! component->isVisible(); | |||||
view.opaque = component->isOpaque(); | |||||
view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0]; | |||||
if (isSharedWindow) | if (isSharedWindow) | ||||
{ | { | ||||
window = [viewToAttachTo window]; | window = [viewToAttachTo window]; | ||||
[viewToAttachTo addSubview: view]; | [viewToAttachTo addSubview: view]; | ||||
setVisible (component->isVisible()); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -405,11 +408,8 @@ UIViewComponentPeer::UIViewComponentPeer (Component* const component, | |||||
window = [[JuceUIWindow alloc] init]; | window = [[JuceUIWindow alloc] init]; | ||||
window.frame = r; | window.frame = r; | ||||
window.opaque = component->isOpaque(); | window.opaque = component->isOpaque(); | ||||
view.opaque = component->isOpaque(); | |||||
window.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0]; | window.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0]; | ||||
view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent: 0]; | |||||
[((JuceUIWindow*) window) setOwner: this]; | [((JuceUIWindow*) window) setOwner: this]; | ||||
@@ -419,10 +419,7 @@ UIViewComponentPeer::UIViewComponentPeer (Component* const component, | |||||
[window addSubview: view]; | [window addSubview: view]; | ||||
view.frame = CGRectMake (0, 0, r.size.width, r.size.height); | view.frame = CGRectMake (0, 0, r.size.width, r.size.height); | ||||
view.hidden = ! component->isVisible(); | |||||
window.hidden = ! component->isVisible(); | |||||
view.multipleTouchEnabled = YES; | |||||
window.hidden = view.hidden; | |||||
} | } | ||||
setTitle (component->getName()); | setTitle (component->getName()); | ||||
@@ -441,7 +438,7 @@ UIViewComponentPeer::~UIViewComponentPeer() | |||||
if (! isSharedWindow) | if (! isSharedWindow) | ||||
{ | { | ||||
[((JuceUIWindow*) window) setOwner: 0]; | |||||
[((JuceUIWindow*) window) setOwner: nil]; | |||||
[window release]; | [window release]; | ||||
} | } | ||||
} | } | ||||
@@ -377,7 +377,7 @@ private: | |||||
void initialise (bool addToDesktop); | void initialise (bool addToDesktop); | ||||
void updateLastPos(); | void updateLastPos(); | ||||
void setContent (Component* newComp, bool takeOwnership, bool resizeToFit); | |||||
void setContent (Component*, bool takeOwnership, bool resizeToFit); | |||||
#if JUCE_CATCH_DEPRECATED_CODE_MISUSE | #if JUCE_CATCH_DEPRECATED_CODE_MISUSE | ||||
// The parameters for these methods have changed - please update your code! | // The parameters for these methods have changed - please update your code! | ||||