mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-18 00:54:19 +00:00
Drawable fixes.
This commit is contained in:
parent
e0ca6d6ca4
commit
e5c4ecc670
8 changed files with 46 additions and 42 deletions
|
|
@ -80109,12 +80109,10 @@ RelativePointPath::RelativePointPath (const RelativePointPath& other)
|
|||
}
|
||||
|
||||
RelativePointPath::RelativePointPath (const Path& path)
|
||||
: usesNonZeroWinding (path.isUsingNonZeroWinding()),
|
||||
containsDynamicPoints (false)
|
||||
{
|
||||
usesNonZeroWinding = path.isUsingNonZeroWinding();
|
||||
|
||||
Path::Iterator i (path);
|
||||
|
||||
while (i.next())
|
||||
for (Path::Iterator i (path); i.next();)
|
||||
{
|
||||
switch (i.elementType)
|
||||
{
|
||||
|
|
@ -80148,8 +80146,8 @@ bool RelativePointPath::operator== (const RelativePointPath& other) const throw(
|
|||
return false;
|
||||
|
||||
int numPoints1, numPoints2;
|
||||
RelativePoint* const points1 = e1->getControlPoints (numPoints1);
|
||||
RelativePoint* const points2 = e2->getControlPoints (numPoints2);
|
||||
const RelativePoint* const points1 = e1->getControlPoints (numPoints1);
|
||||
const RelativePoint* const points2 = e2->getControlPoints (numPoints2);
|
||||
|
||||
jassert (numPoints1 == numPoints2);
|
||||
|
||||
|
|
@ -80170,6 +80168,7 @@ void RelativePointPath::swapWith (RelativePointPath& other) throw()
|
|||
{
|
||||
elements.swapWithArray (other.elements);
|
||||
swapVariables (usesNonZeroWinding, other.usesNonZeroWinding);
|
||||
swapVariables (containsDynamicPoints, other.containsDynamicPoints);
|
||||
}
|
||||
|
||||
void RelativePointPath::createPath (Path& path, Expression::EvaluationContext* coordFinder) const
|
||||
|
|
@ -86955,7 +86954,7 @@ DrawableComposite::DrawableComposite (const DrawableComposite& other)
|
|||
{
|
||||
for (int i = 0; i < other.getNumChildComponents(); ++i)
|
||||
{
|
||||
const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i));
|
||||
const Drawable* const d = dynamic_cast <const Drawable*> (other.getChildComponent(i));
|
||||
|
||||
if (d != 0)
|
||||
addAndMakeVisible (d->createCopy());
|
||||
|
|
@ -87551,7 +87550,7 @@ const Path& DrawablePath::getStrokePath() const
|
|||
return strokePath;
|
||||
}
|
||||
|
||||
bool DrawablePath::rebuildPath (Path& path) const
|
||||
bool DrawablePath::rebuildPath (Path&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -87618,22 +87617,22 @@ const RelativePointPath* DrawablePath::getRelativePath() const
|
|||
return current != 0 ? &(current->path) : 0;
|
||||
}
|
||||
|
||||
void DrawablePath::setPath (const RelativePointPath& source)
|
||||
void DrawablePath::setPath (const RelativePointPath& newRelativePath)
|
||||
{
|
||||
if (source.containsAnyDynamicPoints())
|
||||
if (newRelativePath.containsAnyDynamicPoints())
|
||||
{
|
||||
const RelativePointPath* current = getRelativePath();
|
||||
|
||||
if (current == 0 || source != *current)
|
||||
if (current == 0 || newRelativePath != *current)
|
||||
{
|
||||
RelativePositioner* const p = new RelativePositioner (*this, source);
|
||||
RelativePositioner* const p = new RelativePositioner (*this, newRelativePath);
|
||||
setPositioner (p);
|
||||
p->apply();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
applyRelativePath (source);
|
||||
applyRelativePath (newRelativePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57571,10 +57571,10 @@ private:
|
|||
/**
|
||||
Base class for Component::Positioners that are based upon relative coordinates.
|
||||
*/
|
||||
class RelativeCoordinatePositionerBase : public Component::Positioner,
|
||||
public ComponentListener,
|
||||
public MarkerList::Listener,
|
||||
public Expression::EvaluationContext
|
||||
class JUCE_API RelativeCoordinatePositionerBase : public Component::Positioner,
|
||||
public ComponentListener,
|
||||
public MarkerList::Listener,
|
||||
public Expression::EvaluationContext
|
||||
{
|
||||
public:
|
||||
RelativeCoordinatePositionerBase (Component& component_);
|
||||
|
|
@ -57758,7 +57758,7 @@ public:
|
|||
|
||||
RelativePointPath();
|
||||
RelativePointPath (const RelativePointPath& other);
|
||||
RelativePointPath (const Path& path);
|
||||
explicit RelativePointPath (const Path& path);
|
||||
~RelativePointPath();
|
||||
|
||||
bool operator== (const RelativePointPath& other) const throw();
|
||||
|
|
@ -62144,8 +62144,11 @@ public:
|
|||
*/
|
||||
void setPath (const Path& newPath);
|
||||
|
||||
/** */
|
||||
void setPath (const RelativePointPath& source);
|
||||
/** Sets the path using a RelativePointPath.
|
||||
Calling this will set up a Component::Positioner to automatically update the path
|
||||
if any of the points in the source path are dynamic.
|
||||
*/
|
||||
void setPath (const RelativePointPath& newPath);
|
||||
|
||||
/** Returns the current path. */
|
||||
const Path& getPath() const;
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@
|
|||
/**
|
||||
Base class for Component::Positioners that are based upon relative coordinates.
|
||||
*/
|
||||
class RelativeCoordinatePositionerBase : public Component::Positioner,
|
||||
public ComponentListener,
|
||||
public MarkerList::Listener,
|
||||
public Expression::EvaluationContext
|
||||
class JUCE_API RelativeCoordinatePositionerBase : public Component::Positioner,
|
||||
public ComponentListener,
|
||||
public MarkerList::Listener,
|
||||
public Expression::EvaluationContext
|
||||
{
|
||||
public:
|
||||
RelativeCoordinatePositionerBase (Component& component_);
|
||||
|
|
|
|||
|
|
@ -47,12 +47,10 @@ RelativePointPath::RelativePointPath (const RelativePointPath& other)
|
|||
}
|
||||
|
||||
RelativePointPath::RelativePointPath (const Path& path)
|
||||
: usesNonZeroWinding (path.isUsingNonZeroWinding()),
|
||||
containsDynamicPoints (false)
|
||||
{
|
||||
usesNonZeroWinding = path.isUsingNonZeroWinding();
|
||||
|
||||
Path::Iterator i (path);
|
||||
|
||||
while (i.next())
|
||||
for (Path::Iterator i (path); i.next();)
|
||||
{
|
||||
switch (i.elementType)
|
||||
{
|
||||
|
|
@ -86,8 +84,8 @@ bool RelativePointPath::operator== (const RelativePointPath& other) const throw(
|
|||
return false;
|
||||
|
||||
int numPoints1, numPoints2;
|
||||
RelativePoint* const points1 = e1->getControlPoints (numPoints1);
|
||||
RelativePoint* const points2 = e2->getControlPoints (numPoints2);
|
||||
const RelativePoint* const points1 = e1->getControlPoints (numPoints1);
|
||||
const RelativePoint* const points2 = e2->getControlPoints (numPoints2);
|
||||
|
||||
jassert (numPoints1 == numPoints2);
|
||||
|
||||
|
|
@ -108,6 +106,7 @@ void RelativePointPath::swapWith (RelativePointPath& other) throw()
|
|||
{
|
||||
elements.swapWithArray (other.elements);
|
||||
swapVariables (usesNonZeroWinding, other.usesNonZeroWinding);
|
||||
swapVariables (containsDynamicPoints, other.containsDynamicPoints);
|
||||
}
|
||||
|
||||
void RelativePointPath::createPath (Path& path, Expression::EvaluationContext* coordFinder) const
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
//==============================================================================
|
||||
RelativePointPath();
|
||||
RelativePointPath (const RelativePointPath& other);
|
||||
RelativePointPath (const Path& path);
|
||||
explicit RelativePointPath (const Path& path);
|
||||
~RelativePointPath();
|
||||
|
||||
bool operator== (const RelativePointPath& other) const throw();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ DrawableComposite::DrawableComposite (const DrawableComposite& other)
|
|||
{
|
||||
for (int i = 0; i < other.getNumChildComponents(); ++i)
|
||||
{
|
||||
const Drawable* const d = dynamic_cast <const Drawable*> (getChildComponent(i));
|
||||
const Drawable* const d = dynamic_cast <const Drawable*> (other.getChildComponent(i));
|
||||
|
||||
if (d != 0)
|
||||
addAndMakeVisible (d->createCopy());
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ const Path& DrawablePath::getStrokePath() const
|
|||
return strokePath;
|
||||
}
|
||||
|
||||
bool DrawablePath::rebuildPath (Path& path) const
|
||||
bool DrawablePath::rebuildPath (Path&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -142,22 +142,22 @@ const RelativePointPath* DrawablePath::getRelativePath() const
|
|||
return current != 0 ? &(current->path) : 0;
|
||||
}
|
||||
|
||||
void DrawablePath::setPath (const RelativePointPath& source)
|
||||
void DrawablePath::setPath (const RelativePointPath& newRelativePath)
|
||||
{
|
||||
if (source.containsAnyDynamicPoints())
|
||||
if (newRelativePath.containsAnyDynamicPoints())
|
||||
{
|
||||
const RelativePointPath* current = getRelativePath();
|
||||
|
||||
if (current == 0 || source != *current)
|
||||
if (current == 0 || newRelativePath != *current)
|
||||
{
|
||||
RelativePositioner* const p = new RelativePositioner (*this, source);
|
||||
RelativePositioner* const p = new RelativePositioner (*this, newRelativePath);
|
||||
setPositioner (p);
|
||||
p->apply();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
applyRelativePath (source);
|
||||
applyRelativePath (newRelativePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,8 +55,11 @@ public:
|
|||
*/
|
||||
void setPath (const Path& newPath);
|
||||
|
||||
/** */
|
||||
void setPath (const RelativePointPath& source);
|
||||
/** Sets the path using a RelativePointPath.
|
||||
Calling this will set up a Component::Positioner to automatically update the path
|
||||
if any of the points in the source path are dynamic.
|
||||
*/
|
||||
void setPath (const RelativePointPath& newPath);
|
||||
|
||||
/** Returns the current path. */
|
||||
const Path& getPath() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue