mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Revamped the introjucer's settings page, making it easier to navigate than the old tabbed layout. Also, tweaked Viewport to be more resilient to changes in its content's size.
This commit is contained in:
parent
1b87d55ebb
commit
84d438aebc
13 changed files with 779 additions and 620 deletions
|
|
@ -32,8 +32,7 @@ RectangleList::RectangleList() noexcept
|
|||
|
||||
RectangleList::RectangleList (const Rectangle<int>& rect)
|
||||
{
|
||||
if (! rect.isEmpty())
|
||||
rects.add (rect);
|
||||
addWithoutMerging (rect);
|
||||
}
|
||||
|
||||
RectangleList::RectangleList (const RectangleList& other)
|
||||
|
|
@ -99,7 +98,7 @@ bool RectangleList::Iterator::next() noexcept
|
|||
{
|
||||
if (--index >= 0)
|
||||
{
|
||||
current = & (owner.rects.getReference (index));
|
||||
current = &(owner.rects.getReference (index));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -120,15 +119,14 @@ void RectangleList::add (const Rectangle<int>& rect)
|
|||
{
|
||||
bool anyOverlaps = false;
|
||||
|
||||
int i;
|
||||
for (i = rects.size(); --i >= 0;)
|
||||
for (int j = rects.size(); --j >= 0;)
|
||||
{
|
||||
Rectangle<int>& ourRect = rects.getReference (i);
|
||||
Rectangle<int>& ourRect = rects.getReference (j);
|
||||
|
||||
if (rect.intersects (ourRect))
|
||||
{
|
||||
if (rect.contains (ourRect))
|
||||
rects.remove (i);
|
||||
rects.remove (j);
|
||||
else if (! ourRect.reduceIfPartlyContainedIn (rect))
|
||||
anyOverlaps = true;
|
||||
}
|
||||
|
|
@ -138,7 +136,7 @@ void RectangleList::add (const Rectangle<int>& rect)
|
|||
{
|
||||
RectangleList r (rect);
|
||||
|
||||
for (i = rects.size(); --i >= 0;)
|
||||
for (int i = rects.size(); --i >= 0;)
|
||||
{
|
||||
const Rectangle<int>& ourRect = rects.getReference (i);
|
||||
|
||||
|
|
@ -151,8 +149,7 @@ void RectangleList::add (const Rectangle<int>& rect)
|
|||
}
|
||||
}
|
||||
|
||||
for (i = r.getNumRectangles(); --i >= 0;)
|
||||
rects.add (r.rects.getReference (i));
|
||||
rects.addArray (r.rects);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -170,15 +167,7 @@ void RectangleList::addWithoutMerging (const Rectangle<int>& rect)
|
|||
|
||||
void RectangleList::add (const int x, const int y, const int w, const int h)
|
||||
{
|
||||
if (rects.size() == 0)
|
||||
{
|
||||
if (w > 0 && h > 0)
|
||||
rects.add (Rectangle<int> (x, y, w, h));
|
||||
}
|
||||
else
|
||||
{
|
||||
add (Rectangle<int> (x, y, w, h));
|
||||
}
|
||||
add (Rectangle<int> (x, y, w, h));
|
||||
}
|
||||
|
||||
void RectangleList::add (const RectangleList& other)
|
||||
|
|
@ -220,8 +209,8 @@ void RectangleList::subtract (const Rectangle<int>& rect)
|
|||
r.x = x1;
|
||||
r.w = rx2 - x1;
|
||||
|
||||
rects.insert (i + 1, Rectangle<int> (rx1, ry1, x1 - rx1, ry2 - ry1));
|
||||
i += 2;
|
||||
rects.insert (++i, Rectangle<int> (rx1, ry1, x1 - rx1, ry2 - ry1));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if (x2 > rx1 && x2 < rx2)
|
||||
|
|
@ -231,8 +220,8 @@ void RectangleList::subtract (const Rectangle<int>& rect)
|
|||
|
||||
if (y1 > ry1 || y2 < ry2 || x1 > rx1)
|
||||
{
|
||||
rects.insert (i + 1, Rectangle<int> (rx1, ry1, x2 - rx1, ry2 - ry1));
|
||||
i += 2;
|
||||
rects.insert (++i, Rectangle<int> (rx1, ry1, x2 - rx1, ry2 - ry1));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if (y1 > ry1 && y1 < ry2)
|
||||
|
|
@ -246,8 +235,8 @@ void RectangleList::subtract (const Rectangle<int>& rect)
|
|||
r.y = y1;
|
||||
r.h = ry2 - y1;
|
||||
|
||||
rects.insert (i + 1, Rectangle<int> (rx1, ry1, rx2 - rx1, y1 - ry1));
|
||||
i += 2;
|
||||
rects.insert (++i, Rectangle<int> (rx1, ry1, rx2 - rx1, y1 - ry1));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else if (y2 > ry1 && y2 < ry2)
|
||||
|
|
@ -257,8 +246,8 @@ void RectangleList::subtract (const Rectangle<int>& rect)
|
|||
|
||||
if (x1 > rx1 || x2 < rx2 || y1 > ry1)
|
||||
{
|
||||
rects.insert (i + 1, Rectangle<int> (rx1, ry1, rx2 - rx1, y2 - ry1));
|
||||
i += 2;
|
||||
rects.insert (++i, Rectangle<int> (rx1, ry1, rx2 - rx1, y2 - ry1));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -522,15 +511,8 @@ Path RectangleList::toPath() const
|
|||
{
|
||||
Path p;
|
||||
|
||||
for (int i = rects.size(); --i >= 0;)
|
||||
{
|
||||
const Rectangle<int>& r = rects.getReference (i);
|
||||
|
||||
p.addRectangle ((float) r.x,
|
||||
(float) r.y,
|
||||
(float) r.w,
|
||||
(float) r.h);
|
||||
}
|
||||
for (int i = 0; i < rects.size(); ++i)
|
||||
p.addRectangle (rects.getReference (i));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ void Viewport::deleteContentComp()
|
|||
// This sets the content comp to a null pointer before deleting the old one, in case
|
||||
// anything tries to use the old one while it's in mid-deletion..
|
||||
ScopedPointer<Component> oldCompDeleter (contentComp);
|
||||
contentComp = nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -186,37 +185,50 @@ void Viewport::updateVisibleArea()
|
|||
const bool canShowHBar = showHScrollbar && canShowAnyBars;
|
||||
const bool canShowVBar = showVScrollbar && canShowAnyBars;
|
||||
|
||||
bool hBarVisible = canShowHBar && ! horizontalScrollBar.autoHides();
|
||||
bool vBarVisible = canShowVBar && ! verticalScrollBar.autoHides();
|
||||
bool hBarVisible, vBarVisible;
|
||||
Rectangle<int> contentArea;
|
||||
|
||||
Rectangle<int> contentArea (getLocalBounds());
|
||||
|
||||
if (contentComp != nullptr && ! contentArea.contains (contentComp->getBounds()))
|
||||
for (int i = 3; --i >= 0;)
|
||||
{
|
||||
hBarVisible = canShowHBar && (hBarVisible || contentComp->getX() < 0 || contentComp->getRight() > contentArea.getWidth());
|
||||
vBarVisible = canShowVBar && (vBarVisible || contentComp->getY() < 0 || contentComp->getBottom() > contentArea.getHeight());
|
||||
hBarVisible = canShowHBar && ! horizontalScrollBar.autoHides();
|
||||
vBarVisible = canShowVBar && ! verticalScrollBar.autoHides();
|
||||
contentArea = getLocalBounds();
|
||||
|
||||
if (vBarVisible)
|
||||
contentArea.setWidth (getWidth() - scrollbarWidth);
|
||||
|
||||
if (hBarVisible)
|
||||
contentArea.setHeight (getHeight() - scrollbarWidth);
|
||||
|
||||
if (! contentArea.contains (contentComp->getBounds()))
|
||||
if (contentComp != nullptr && ! contentArea.contains (contentComp->getBounds()))
|
||||
{
|
||||
hBarVisible = canShowHBar && (hBarVisible || contentComp->getRight() > contentArea.getWidth());
|
||||
vBarVisible = canShowVBar && (vBarVisible || contentComp->getBottom() > contentArea.getHeight());
|
||||
hBarVisible = canShowHBar && (hBarVisible || contentComp->getX() < 0 || contentComp->getRight() > contentArea.getWidth());
|
||||
vBarVisible = canShowVBar && (vBarVisible || contentComp->getY() < 0 || contentComp->getBottom() > contentArea.getHeight());
|
||||
|
||||
if (vBarVisible)
|
||||
contentArea.setWidth (getWidth() - scrollbarWidth);
|
||||
|
||||
if (hBarVisible)
|
||||
contentArea.setHeight (getHeight() - scrollbarWidth);
|
||||
|
||||
if (! contentArea.contains (contentComp->getBounds()))
|
||||
{
|
||||
hBarVisible = canShowHBar && (hBarVisible || contentComp->getRight() > contentArea.getWidth());
|
||||
vBarVisible = canShowVBar && (vBarVisible || contentComp->getBottom() > contentArea.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
if (vBarVisible) contentArea.setWidth (getWidth() - scrollbarWidth);
|
||||
if (hBarVisible) contentArea.setHeight (getHeight() - scrollbarWidth);
|
||||
|
||||
if (contentComp == nullptr)
|
||||
{
|
||||
contentHolder.setBounds (contentArea);
|
||||
break;
|
||||
}
|
||||
|
||||
const Rectangle<int> oldContentBounds (contentComp->getBounds());
|
||||
contentHolder.setBounds (contentArea);
|
||||
|
||||
// If the content has changed its size, that might affect our scrollbars, so go round again and re-caclulate..
|
||||
if (oldContentBounds == contentComp->getBounds())
|
||||
break;
|
||||
}
|
||||
|
||||
if (vBarVisible)
|
||||
contentArea.setWidth (getWidth() - scrollbarWidth);
|
||||
|
||||
if (hBarVisible)
|
||||
contentArea.setHeight (getHeight() - scrollbarWidth);
|
||||
|
||||
contentHolder.setBounds (contentArea);
|
||||
|
||||
Rectangle<int> contentBounds;
|
||||
if (contentComp != nullptr)
|
||||
contentBounds = contentHolder.getLocalArea (contentComp, contentComp->getLocalBounds());
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public:
|
|||
getComponent().setBounds (newBounds);
|
||||
}
|
||||
|
||||
jassertfalse; // must be a recursive reference!
|
||||
jassertfalse; // Seems to be a recursive reference!
|
||||
}
|
||||
|
||||
void applyNewBounds (const Rectangle<int>& newBounds)
|
||||
|
|
|
|||
|
|
@ -611,7 +611,7 @@ public:
|
|||
|
||||
void setColour (const float alpha) noexcept
|
||||
{
|
||||
const uint8 v = jmin (255, (int) (alpha * 255.0f));
|
||||
const uint8 v = (uint8) jmin (255, (int) (alpha * 255.0f));
|
||||
setColour (PixelARGB (v, v, v, v));
|
||||
}
|
||||
|
||||
|
|
@ -727,7 +727,7 @@ public:
|
|||
{
|
||||
GLint t = 0;
|
||||
glGetIntegerv (GL_TEXTURE_BINDING_2D, &t);
|
||||
jassert (t == textureID);
|
||||
jassert (t == (GLint) textureID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue