diff --git a/src/juce_appframework/gui/components/layout/juce_StretchableLayoutManager.cpp b/src/juce_appframework/gui/components/layout/juce_StretchableLayoutManager.cpp index 4945486b51..a5989953a8 100644 --- a/src/juce_appframework/gui/components/layout/juce_StretchableLayoutManager.cpp +++ b/src/juce_appframework/gui/components/layout/juce_StretchableLayoutManager.cpp @@ -187,19 +187,40 @@ void StretchableLayoutManager::layOutComponents (Component** const components, if (c != 0) { - if (resizeOtherDimension) + if (i == numComponents - 1) { - if (vertically) - c->setBounds (x, pos, w, layout->currentSize); + // if it's the last item, crop it to exactly fit the available space.. + if (resizeOtherDimension) + { + if (vertically) + c->setBounds (x, pos, w, jmax (layout->currentSize, h - pos)); + else + c->setBounds (pos, y, jmax (layout->currentSize, w - pos), h); + } else - c->setBounds (pos, y, layout->currentSize, h); + { + if (vertically) + c->setBounds (c->getX(), pos, c->getWidth(), jmax (layout->currentSize, h - pos)); + else + c->setBounds (pos, c->getY(), jmax (layout->currentSize, w - pos), c->getHeight()); + } } else { - if (vertically) - c->setBounds (c->getX(), pos, c->getWidth(), layout->currentSize); + if (resizeOtherDimension) + { + if (vertically) + c->setBounds (x, pos, w, layout->currentSize); + else + c->setBounds (pos, y, layout->currentSize, h); + } else - c->setBounds (pos, c->getY(), layout->currentSize, c->getHeight()); + { + if (vertically) + c->setBounds (c->getX(), pos, c->getWidth(), layout->currentSize); + else + c->setBounds (pos, c->getY(), layout->currentSize, c->getHeight()); + } } } diff --git a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp index 0f856656a3..33ed7b88a9 100644 --- a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp +++ b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp @@ -455,6 +455,23 @@ void Graphics::drawRect (const int x, b.paintRectangle (*context, x, y + height - lineThickness, width, lineThickness); } +void Graphics::drawRect (const float x, + const float y, + const float width, + const float height, + const float lineThickness) const throw() +{ + // passing in a silly number can cause maths problems in rendering! + ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height); + + Path p; + p.addRectangle (x, y, width, lineThickness); + p.addRectangle (x, y + lineThickness, lineThickness, height - lineThickness * 2.0f); + p.addRectangle (x + width - lineThickness, y + lineThickness, lineThickness, height - lineThickness * 2.0f); + p.addRectangle (x, y + height - lineThickness, width, lineThickness); + fillPath (p); +} + void Graphics::drawRect (const Rectangle& r, const int lineThickness) const throw() { diff --git a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.h b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.h index 02995cb19e..0dfa8daa28 100644 --- a/src/juce_appframework/gui/graphics/contexts/juce_Graphics.h +++ b/src/juce_appframework/gui/graphics/contexts/juce_Graphics.h @@ -304,6 +304,19 @@ public: const int height, const int lineThickness = 1) const throw(); + /** Draws four lines to form a rectangular outline, using the current colour or brush. + + The lines are drawn inside the given rectangle, and greater line thicknesses + extend inwards. + + @see fillRect + */ + void drawRect (const float x, + const float y, + const float width, + const float height, + const float lineThickness = 1.0f) const throw(); + /** Draws four lines to form a rectangular outline, using the current colour or brush. The lines are drawn inside the given rectangle, and greater line thicknesses diff --git a/src/juce_core/text/juce_String.cpp b/src/juce_core/text/juce_String.cpp index f50b60bc1d..8082959bbe 100644 --- a/src/juce_core/text/juce_String.cpp +++ b/src/juce_core/text/juce_String.cpp @@ -993,9 +993,13 @@ int String::indexOfAnyOf (const tchar* const charactersToLookFor, const tchar* t = text->text + jmax (0, startIndex); while (*t != 0) - if (CharacterFunctions::indexOfChar (charactersToLookFor, *t++, ignoreCase) >= 0) + { + if (CharacterFunctions::indexOfChar (charactersToLookFor, *t, ignoreCase) >= 0) return (int) (t - text->text); + ++t; + } + return -1; }