diff --git a/build/macosx/platform_specific_code/juce_mac_Files.mm b/build/macosx/platform_specific_code/juce_mac_Files.mm index 85c4381f56..1d1be48c4f 100644 --- a/build/macosx/platform_specific_code/juce_mac_Files.mm +++ b/build/macosx/platform_specific_code/juce_mac_Files.mm @@ -243,7 +243,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) { const ScopedAutoReleasePool pool; - const char* resultPath = 0; + String resultPath; switch (type) { diff --git a/build/macosx/platform_specific_code/juce_mac_MainMenu.mm b/build/macosx/platform_specific_code/juce_mac_MainMenu.mm index 3ce120cd2d..6d17317390 100644 --- a/build/macosx/platform_specific_code/juce_mac_MainMenu.mm +++ b/build/macosx/platform_specific_code/juce_mac_MainMenu.mm @@ -182,9 +182,28 @@ public: [menu removeItem: item]; } + static NSMenuItem* findMenuItem (NSMenu* const menu, const ApplicationCommandTarget::InvocationInfo& info) + { + for (int i = [menu numberOfItems]; --i >= 0;) + { + NSMenuItem* m = [menu itemAtIndex: i]; + if ([m tag] == info.commandID) + return m; + + if ([m submenu] != 0) + { + NSMenuItem* found = findMenuItem ([m submenu], info); + if (found != 0) + return found; + } + } + + return 0; + } + void menuCommandInvoked (MenuBarModel*, const ApplicationCommandTarget::InvocationInfo& info) { - NSMenuItem* item = [[NSApp mainMenu] itemWithTag: info.commandID]; + NSMenuItem* item = findMenuItem ([NSApp mainMenu], info); if (item != 0) flashMenuBar ([item menu]); @@ -234,7 +253,6 @@ public: keyEquivalent: @""]; [item setEnabled: false]; - [item setIndentationLevel: 5]; } else if (iter.subMenu != 0) { @@ -247,7 +265,6 @@ public: NSMenu* sub = createMenu (*iter.subMenu, iter.itemName, topLevelMenuId, topLevelIndex); [menuToAddTo setSubmenu: sub forItem: item]; - [sub release]; } else { diff --git a/build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm b/build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm index 9ef9ff9ed9..e40c19dd73 100644 --- a/build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm +++ b/build/macosx/platform_specific_code/juce_mac_NSViewComponentPeer.mm @@ -821,13 +821,7 @@ void NSViewComponentPeer::setBounds (int x, int y, int w, int h, const bool isNo { r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - (r.origin.y + r.size.height); - const BorderSize border (getFrameSize()); - r.origin.x -= border.getLeft(); - r.origin.y -= border.getTop(); - r.size.width += border.getLeftAndRight(); - r.size.height += border.getTopAndBottom(); - - [window setFrame: r + [window setFrame: [window frameRectForContentRect: r] display: true]; } } diff --git a/build/win32/vc8/JUCE.vcproj b/build/win32/vc8/JUCE.vcproj index 2dbf114c5d..9a04f22e8a 100644 --- a/build/win32/vc8/JUCE.vcproj +++ b/build/win32/vc8/JUCE.vcproj @@ -1,7 +1,7 @@ isClipEmpty()) && ! transform.isSingularity()) { - if (fillAlphaChannelWithCurrentBrush) + if (transform.isIdentity()) + { + drawImage (imageToDraw, + sourceClipX, sourceClipY, sourceClipWidth, sourceClipHeight, + sourceClipX, sourceClipY, sourceClipWidth, sourceClipHeight, + fillAlphaChannelWithCurrentBrush); + } + else if (fillAlphaChannelWithCurrentBrush) { Path p; p.addRectangle ((float) sourceClipX, (float) sourceClipY, @@ -85391,15 +85398,13 @@ const AffineTransform Path::getTransformToScaleToFit (const float x, const float } } -static const float collisionDetectionTolerence = 20.0f; - -bool Path::contains (const float x, const float y) const throw() +bool Path::contains (const float x, const float y, const float tolerence) const throw() { if (x <= pathXMin || x >= pathXMax || y <= pathYMin || y >= pathYMax) return false; - PathFlatteningIterator i (*this, AffineTransform::identity, collisionDetectionTolerence); + PathFlatteningIterator i (*this, AffineTransform::identity, tolerence); int positiveCrossings = 0; int negativeCrossings = 0; @@ -85426,9 +85431,10 @@ bool Path::contains (const float x, const float y) const throw() } bool Path::intersectsLine (const float x1, const float y1, - const float x2, const float y2) throw() + const float x2, const float y2, + const float tolerence) throw() { - PathFlatteningIterator i (*this, AffineTransform::identity, collisionDetectionTolerence); + PathFlatteningIterator i (*this, AffineTransform::identity, tolerence); const Line line1 (x1, y1, x2, y2); @@ -265243,7 +265249,7 @@ const File File::getSpecialLocation (const SpecialLocationType type) { const ScopedAutoReleasePool pool; - const char* resultPath = 0; + String resultPath; switch (type) { @@ -266631,13 +266637,7 @@ void NSViewComponentPeer::setBounds (int x, int y, int w, int h, const bool isNo { r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - (r.origin.y + r.size.height); - const BorderSize border (getFrameSize()); - r.origin.x -= border.getLeft(); - r.origin.y -= border.getTop(); - r.size.width += border.getLeftAndRight(); - r.size.height += border.getTopAndBottom(); - - [window setFrame: r + [window setFrame: [window frameRectForContentRect: r] display: true]; } } @@ -268177,9 +268177,28 @@ public: [menu removeItem: item]; } + static NSMenuItem* findMenuItem (NSMenu* const menu, const ApplicationCommandTarget::InvocationInfo& info) + { + for (int i = [menu numberOfItems]; --i >= 0;) + { + NSMenuItem* m = [menu itemAtIndex: i]; + if ([m tag] == info.commandID) + return m; + + if ([m submenu] != 0) + { + NSMenuItem* found = findMenuItem ([m submenu], info); + if (found != 0) + return found; + } + } + + return 0; + } + void menuCommandInvoked (MenuBarModel*, const ApplicationCommandTarget::InvocationInfo& info) { - NSMenuItem* item = [[NSApp mainMenu] itemWithTag: info.commandID]; + NSMenuItem* item = findMenuItem ([NSApp mainMenu], info); if (item != 0) flashMenuBar ([item menu]); @@ -268229,7 +268248,6 @@ public: keyEquivalent: @""]; [item setEnabled: false]; - [item setIndentationLevel: 5]; } else if (iter.subMenu != 0) { @@ -268242,7 +268260,6 @@ public: NSMenu* sub = createMenu (*iter.subMenu, iter.itemName, topLevelMenuId, topLevelIndex); [menuToAddTo setSubmenu: sub forItem: item]; - [sub release]; } else { diff --git a/juce_amalgamated.h b/juce_amalgamated.h index ef85cfd563..f75b4fafca 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -16541,19 +16541,29 @@ public: The path's winding rule is taken into account by this method. + The tolerence parameter is passed to the PathFlatteningIterator that + is used to trace the path - for more info about it, see the notes for + the PathFlatteningIterator constructor. + @see closeSubPath, setUsingNonZeroWinding */ bool contains (const float x, - const float y) const throw(); + const float y, + const float tolerence = 10.0f) const throw(); /** Checks whether a line crosses the path. This will return positive if the line crosses any of the paths constituent lines or curves. It doesn't take into account whether the line is inside or outside the path, or whether the path is open or closed. + + The tolerence parameter is passed to the PathFlatteningIterator that + is used to trace the path - for more info about it, see the notes for + the PathFlatteningIterator constructor. */ bool intersectsLine (const float x1, const float y1, - const float x2, const float y2) throw(); + const float x2, const float y2, + const float tolerence = 10.0f) throw(); /** Removes all lines and curves, resetting the path completely. */ void clear() throw(); diff --git a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp index 7cc5ff035e..7ea2bd01a1 100644 --- a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp +++ b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp @@ -917,7 +917,14 @@ void Graphics::drawImageTransformed (const Image* const imageToDraw, && (! context->isClipEmpty()) && ! transform.isSingularity()) { - if (fillAlphaChannelWithCurrentBrush) + if (transform.isIdentity()) + { + drawImage (imageToDraw, + sourceClipX, sourceClipY, sourceClipWidth, sourceClipHeight, + sourceClipX, sourceClipY, sourceClipWidth, sourceClipHeight, + fillAlphaChannelWithCurrentBrush); + } + else if (fillAlphaChannelWithCurrentBrush) { Path p; p.addRectangle ((float) sourceClipX, (float) sourceClipY, diff --git a/src/juce_appframework/gui/graphics/geometry/juce_Path.cpp b/src/juce_appframework/gui/graphics/geometry/juce_Path.cpp index 46984e92b3..6e0d2f8467 100644 --- a/src/juce_appframework/gui/graphics/geometry/juce_Path.cpp +++ b/src/juce_appframework/gui/graphics/geometry/juce_Path.cpp @@ -999,15 +999,13 @@ const AffineTransform Path::getTransformToScaleToFit (const float x, const float } //============================================================================== -static const float collisionDetectionTolerence = 20.0f; - -bool Path::contains (const float x, const float y) const throw() +bool Path::contains (const float x, const float y, const float tolerence) const throw() { if (x <= pathXMin || x >= pathXMax || y <= pathYMin || y >= pathYMax) return false; - PathFlatteningIterator i (*this, AffineTransform::identity, collisionDetectionTolerence); + PathFlatteningIterator i (*this, AffineTransform::identity, tolerence); int positiveCrossings = 0; int negativeCrossings = 0; @@ -1034,9 +1032,10 @@ bool Path::contains (const float x, const float y) const throw() } bool Path::intersectsLine (const float x1, const float y1, - const float x2, const float y2) throw() + const float x2, const float y2, + const float tolerence) throw() { - PathFlatteningIterator i (*this, AffineTransform::identity, collisionDetectionTolerence); + PathFlatteningIterator i (*this, AffineTransform::identity, tolerence); const Line line1 (x1, y1, x2, y2); diff --git a/src/juce_appframework/gui/graphics/geometry/juce_Path.h b/src/juce_appframework/gui/graphics/geometry/juce_Path.h index b1b85d90a8..5b07dc0445 100644 --- a/src/juce_appframework/gui/graphics/geometry/juce_Path.h +++ b/src/juce_appframework/gui/graphics/geometry/juce_Path.h @@ -112,19 +112,29 @@ public: The path's winding rule is taken into account by this method. + The tolerence parameter is passed to the PathFlatteningIterator that + is used to trace the path - for more info about it, see the notes for + the PathFlatteningIterator constructor. + @see closeSubPath, setUsingNonZeroWinding */ bool contains (const float x, - const float y) const throw(); + const float y, + const float tolerence = 10.0f) const throw(); /** Checks whether a line crosses the path. This will return positive if the line crosses any of the paths constituent lines or curves. It doesn't take into account whether the line is inside or outside the path, or whether the path is open or closed. + + The tolerence parameter is passed to the PathFlatteningIterator that + is used to trace the path - for more info about it, see the notes for + the PathFlatteningIterator constructor. */ bool intersectsLine (const float x1, const float y1, - const float x2, const float y2) throw(); + const float x2, const float y2, + const float tolerence = 10.0f) throw(); //============================================================================== /** Removes all lines and curves, resetting the path completely. */