Browse Source

Drawable fixes.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
e5c4ecc670
8 changed files with 46 additions and 42 deletions
  1. +13
    -14
      juce_amalgamated.cpp
  2. +10
    -7
      juce_amalgamated.h
  3. +4
    -4
      src/gui/components/positioning/juce_RelativeCoordinatePositioner.h
  4. +6
    -7
      src/gui/components/positioning/juce_RelativePointPath.cpp
  5. +1
    -1
      src/gui/components/positioning/juce_RelativePointPath.h
  6. +1
    -1
      src/gui/graphics/drawables/juce_DrawableComposite.cpp
  7. +6
    -6
      src/gui/graphics/drawables/juce_DrawablePath.cpp
  8. +5
    -2
      src/gui/graphics/drawables/juce_DrawablePath.h

+ 13
- 14
juce_amalgamated.cpp View File

@@ -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);
}
}



+ 10
- 7
juce_amalgamated.h View File

@@ -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;


+ 4
- 4
src/gui/components/positioning/juce_RelativeCoordinatePositioner.h View File

@@ -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_);


+ 6
- 7
src/gui/components/positioning/juce_RelativePointPath.cpp View File

@@ -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


+ 1
- 1
src/gui/components/positioning/juce_RelativePointPath.h View File

@@ -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();


+ 1
- 1
src/gui/graphics/drawables/juce_DrawableComposite.cpp View File

@@ -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());


+ 6
- 6
src/gui/graphics/drawables/juce_DrawablePath.cpp View File

@@ -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);
}
}


+ 5
- 2
src/gui/graphics/drawables/juce_DrawablePath.h View File

@@ -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…
Cancel
Save