mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-17 00:44:19 +00:00
Minor fixes for LeakedObjectDetector, Slider, NamedValueSet.
This commit is contained in:
parent
5c1fda8261
commit
f1a0c50aeb
7 changed files with 122 additions and 135 deletions
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
Macros that will be set here are:
|
||||
|
||||
- One of JUCE_WINDOWS, JUCE_MAC or JUCE_LINUX.
|
||||
- One of JUCE_WINDOWS, JUCE_MAC JUCE_LINUX, JUCE_IOS, JUCE_ANDROID, etc.
|
||||
- Either JUCE_32BIT or JUCE_64BIT, depending on the architecture.
|
||||
- Either JUCE_LITTLE_ENDIAN or JUCE_BIG_ENDIAN.
|
||||
- Either JUCE_INTEL or JUCE_PPC
|
||||
|
|
@ -4760,7 +4760,7 @@ bool NamedValueSet::set (const Identifier& name, const var& newValue)
|
|||
|
||||
if (v->name == name)
|
||||
{
|
||||
if (v->value == newValue)
|
||||
if (v->value.equalsWithSameType (newValue))
|
||||
return false;
|
||||
|
||||
v->value = newValue;
|
||||
|
|
@ -27663,12 +27663,8 @@ void IIRFilter::copyCoefficientsFrom (const IIRFilter& other) throw()
|
|||
active = other.active;
|
||||
}
|
||||
|
||||
void IIRFilter::setCoefficients (double c1,
|
||||
double c2,
|
||||
double c3,
|
||||
double c4,
|
||||
double c5,
|
||||
double c6) throw()
|
||||
void IIRFilter::setCoefficients (double c1, double c2, double c3,
|
||||
double c4, double c5, double c6) throw()
|
||||
{
|
||||
const double a = 1.0 / c4;
|
||||
|
||||
|
|
@ -31784,7 +31780,8 @@ OSStatus AudioUnitPluginInstance::renderGetInput (AudioUnitRenderActionFlags* io
|
|||
}
|
||||
else
|
||||
{
|
||||
zeromem (ioData->mBuffers[i].mData, sizeof (float) * inNumberFrames);
|
||||
zeromem (ioData->mBuffers[i].mData,
|
||||
sizeof (float) * inNumberFrames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -39359,7 +39356,7 @@ private:
|
|||
|
||||
void addTimer (Timer* const t) throw()
|
||||
{
|
||||
#if JUCE_DEBUG
|
||||
#if JUCE_DEBUG
|
||||
Timer* tt = firstTimer;
|
||||
|
||||
while (tt != 0)
|
||||
|
|
@ -39372,7 +39369,7 @@ private:
|
|||
}
|
||||
|
||||
jassert (t->previous == 0 && t->next == 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Timer* i = firstTimer;
|
||||
|
||||
|
|
@ -39404,7 +39401,7 @@ private:
|
|||
|
||||
void removeTimer (Timer* const t) throw()
|
||||
{
|
||||
#if JUCE_DEBUG
|
||||
#if JUCE_DEBUG
|
||||
Timer* tt = firstTimer;
|
||||
bool found = false;
|
||||
|
||||
|
|
@ -39422,7 +39419,7 @@ private:
|
|||
// trying to remove a timer that's not here - shouldn't get to this point,
|
||||
// so if you get this assertion, let me know!
|
||||
jassert (found);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (t->previous != 0)
|
||||
{
|
||||
|
|
@ -39478,9 +39475,9 @@ Timer::Timer() throw()
|
|||
previous (0),
|
||||
next (0)
|
||||
{
|
||||
#if JUCE_DEBUG
|
||||
#if JUCE_DEBUG
|
||||
activeTimers.add (this);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
Timer::Timer (const Timer&) throw()
|
||||
|
|
@ -39489,28 +39486,28 @@ Timer::Timer (const Timer&) throw()
|
|||
previous (0),
|
||||
next (0)
|
||||
{
|
||||
#if JUCE_DEBUG
|
||||
#if JUCE_DEBUG
|
||||
activeTimers.add (this);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
Timer::~Timer()
|
||||
{
|
||||
stopTimer();
|
||||
|
||||
#if JUCE_DEBUG
|
||||
#if JUCE_DEBUG
|
||||
activeTimers.removeValue (this);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Timer::startTimer (const int interval) throw()
|
||||
{
|
||||
const ScopedLock sl (InternalTimerThread::lock);
|
||||
|
||||
#if JUCE_DEBUG
|
||||
#if JUCE_DEBUG
|
||||
// this isn't a valid object! Your timer might be a dangling pointer or something..
|
||||
jassert (activeTimers.contains (this));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (periodMs == 0)
|
||||
{
|
||||
|
|
@ -39528,10 +39525,10 @@ void Timer::stopTimer() throw()
|
|||
{
|
||||
const ScopedLock sl (InternalTimerThread::lock);
|
||||
|
||||
#if JUCE_DEBUG
|
||||
#if JUCE_DEBUG
|
||||
// this isn't a valid object! Your timer might be a dangling pointer or something..
|
||||
jassert (activeTimers.contains (this));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (periodMs > 0)
|
||||
{
|
||||
|
|
@ -49384,11 +49381,12 @@ END_JUCE_NAMESPACE
|
|||
/*** Start of inlined file: juce_Slider.cpp ***/
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
class SliderPopupDisplayComponent : public BubbleComponent
|
||||
class Slider::PopupDisplayComponent : public BubbleComponent,
|
||||
public Timer
|
||||
{
|
||||
public:
|
||||
|
||||
SliderPopupDisplayComponent (Slider* const owner_)
|
||||
PopupDisplayComponent (Slider& owner_)
|
||||
: owner (owner_),
|
||||
font (15.0f, Font::bold)
|
||||
{
|
||||
|
|
@ -49417,15 +49415,21 @@ public:
|
|||
repaint();
|
||||
}
|
||||
|
||||
BubbleComponent::setPosition (owner);
|
||||
BubbleComponent::setPosition (&owner);
|
||||
repaint();
|
||||
}
|
||||
|
||||
void timerCallback()
|
||||
{
|
||||
owner.popupDisplay = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
Slider* owner;
|
||||
Slider& owner;
|
||||
Font font;
|
||||
String text;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SliderPopupDisplayComponent);
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PopupDisplayComponent);
|
||||
};
|
||||
|
||||
Slider::Slider (const String& name)
|
||||
|
|
@ -49464,7 +49468,6 @@ Slider::Slider (const String& name)
|
|||
menuShown (false),
|
||||
scrollWheelEnabled (true),
|
||||
snapsToMousePos (true),
|
||||
popupDisplay (0),
|
||||
parentForPopupDisplay (0)
|
||||
{
|
||||
setWantsKeyboardFocus (false);
|
||||
|
|
@ -49832,12 +49835,7 @@ void Slider::setValue (double newValue,
|
|||
repaint();
|
||||
|
||||
if (popupDisplay != 0)
|
||||
{
|
||||
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
|
||||
->updatePosition (getTextFromValue (newValue));
|
||||
|
||||
popupDisplay->repaint();
|
||||
}
|
||||
popupDisplay->updatePosition (getTextFromValue (newValue));
|
||||
|
||||
if (sendUpdateMessage)
|
||||
triggerChangeMessage (sendMessageSynchronously);
|
||||
|
|
@ -49892,12 +49890,7 @@ void Slider::setMinValue (double newValue, const bool sendUpdateMessage, const b
|
|||
repaint();
|
||||
|
||||
if (popupDisplay != 0)
|
||||
{
|
||||
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
|
||||
->updatePosition (getTextFromValue (newValue));
|
||||
|
||||
popupDisplay->repaint();
|
||||
}
|
||||
popupDisplay->updatePosition (getTextFromValue (newValue));
|
||||
|
||||
if (sendUpdateMessage)
|
||||
triggerChangeMessage (sendMessageSynchronously);
|
||||
|
|
@ -49934,12 +49927,7 @@ void Slider::setMaxValue (double newValue, const bool sendUpdateMessage, const b
|
|||
repaint();
|
||||
|
||||
if (popupDisplay != 0)
|
||||
{
|
||||
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
|
||||
->updatePosition (getTextFromValue (valueMax.getValue()));
|
||||
|
||||
popupDisplay->repaint();
|
||||
}
|
||||
popupDisplay->updatePosition (getTextFromValue (valueMax.getValue()));
|
||||
|
||||
if (sendUpdateMessage)
|
||||
triggerChangeMessage (sendMessageSynchronously);
|
||||
|
|
@ -50447,17 +50435,13 @@ void Slider::mouseDown (const MouseEvent& e)
|
|||
|
||||
if (popupDisplayEnabled)
|
||||
{
|
||||
SliderPopupDisplayComponent* const popup = new SliderPopupDisplayComponent (this);
|
||||
PopupDisplayComponent* const popup = new PopupDisplayComponent (*this);
|
||||
popupDisplay = popup;
|
||||
|
||||
if (parentForPopupDisplay != 0)
|
||||
{
|
||||
parentForPopupDisplay->addChildComponent (popup);
|
||||
}
|
||||
else
|
||||
{
|
||||
popup->addToDesktop (0);
|
||||
}
|
||||
|
||||
popup->setVisible (true);
|
||||
}
|
||||
|
|
@ -50482,6 +50466,7 @@ void Slider::mouseUp (const MouseEvent&)
|
|||
triggerChangeMessage (false);
|
||||
|
||||
sendDragEnd();
|
||||
popupDisplay = 0;
|
||||
|
||||
if (style == IncDecButtons)
|
||||
{
|
||||
|
|
@ -50489,8 +50474,10 @@ void Slider::mouseUp (const MouseEvent&)
|
|||
decButton->setState (Button::buttonNormal);
|
||||
}
|
||||
}
|
||||
|
||||
popupDisplay = 0;
|
||||
else if (popupDisplay != 0)
|
||||
{
|
||||
popupDisplay->startTimer (2000);
|
||||
}
|
||||
}
|
||||
|
||||
void Slider::restoreMouseIfHidden()
|
||||
|
|
@ -84034,8 +84021,10 @@ private:
|
|||
class LinearGradientPixelGenerator
|
||||
{
|
||||
public:
|
||||
LinearGradientPixelGenerator (const ColourGradient& gradient, const AffineTransform& transform, const PixelARGB* const lookupTable_, const int numEntries_)
|
||||
: lookupTable (lookupTable_), numEntries (numEntries_)
|
||||
LinearGradientPixelGenerator (const ColourGradient& gradient, const AffineTransform& transform,
|
||||
const PixelARGB* const lookupTable_, const int numEntries_)
|
||||
: lookupTable (lookupTable_),
|
||||
numEntries (numEntries_)
|
||||
{
|
||||
jassert (numEntries_ >= 0);
|
||||
Point<float> p1 (gradient.point1);
|
||||
|
|
@ -89540,16 +89529,11 @@ private:
|
|||
const juce_wchar n1 = s [len - 2];
|
||||
const juce_wchar n2 = s [len - 1];
|
||||
|
||||
if (n1 == 'i' && n2 == 'n')
|
||||
n *= dpi;
|
||||
else if (n1 == 'm' && n2 == 'm')
|
||||
n *= dpi / 25.4f;
|
||||
else if (n1 == 'c' && n2 == 'm')
|
||||
n *= dpi / 2.54f;
|
||||
else if (n1 == 'p' && n2 == 'c')
|
||||
n *= 15.0f;
|
||||
else if (n2 == '%')
|
||||
n *= 0.01f * sizeForProportions;
|
||||
if (n1 == 'i' && n2 == 'n') n *= dpi;
|
||||
else if (n1 == 'm' && n2 == 'm') n *= dpi / 25.4f;
|
||||
else if (n1 == 'c' && n2 == 'm') n *= dpi / 2.54f;
|
||||
else if (n1 == 'p' && n2 == 'c') n *= 15.0f;
|
||||
else if (n2 == '%') n *= 0.01f * sizeForProportions;
|
||||
}
|
||||
|
||||
return n;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
|
|||
*/
|
||||
#define JUCE_MAJOR_VERSION 1
|
||||
#define JUCE_MINOR_VERSION 53
|
||||
#define JUCE_BUILDNUMBER 40
|
||||
#define JUCE_BUILDNUMBER 41
|
||||
|
||||
/** Current Juce version number.
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ namespace JuceDummyNamespace {}
|
|||
|
||||
Macros that will be set here are:
|
||||
|
||||
- One of JUCE_WINDOWS, JUCE_MAC or JUCE_LINUX.
|
||||
- One of JUCE_WINDOWS, JUCE_MAC JUCE_LINUX, JUCE_IOS, JUCE_ANDROID, etc.
|
||||
- Either JUCE_32BIT or JUCE_64BIT, depending on the architecture.
|
||||
- Either JUCE_LITTLE_ENDIAN or JUCE_BIG_ENDIAN.
|
||||
- Either JUCE_INTEL or JUCE_PPC
|
||||
|
|
@ -5565,7 +5565,7 @@ public:
|
|||
{
|
||||
if (--(getCounter().numObjects) < 0)
|
||||
{
|
||||
DBG ("*** Dangling pointer deletion! Class: " << OwnerClass::getLeakedObjectClassName());
|
||||
DBG ("*** Dangling pointer deletion! Class: " << getLeakedObjectClassName());
|
||||
|
||||
/** If you hit this, then you've managed to delete more instances of this class than you've
|
||||
created.. That indicates that you're deleting some dangling pointers.
|
||||
|
|
@ -5587,13 +5587,13 @@ private:
|
|||
class LeakCounter
|
||||
{
|
||||
public:
|
||||
LeakCounter() {}
|
||||
LeakCounter() throw() {}
|
||||
|
||||
~LeakCounter()
|
||||
{
|
||||
if (numObjects.value > 0)
|
||||
{
|
||||
DBG ("*** Leaked objects detected: " << numObjects.value << " instance(s) of class " << OwnerClass::getLeakedObjectClassName());
|
||||
DBG ("*** Leaked objects detected: " << numObjects.value << " instance(s) of class " << getLeakedObjectClassName());
|
||||
|
||||
/** If you hit this, then you've leaked one or more objects of the type specified by
|
||||
the 'OwnerClass' template parameter - the name should have been printed by the line above.
|
||||
|
|
@ -5609,6 +5609,11 @@ private:
|
|||
Atomic<int> numObjects;
|
||||
};
|
||||
|
||||
static const char* getLeakedObjectClassName()
|
||||
{
|
||||
return OwnerClass::getLeakedObjectClassName();
|
||||
}
|
||||
|
||||
static LeakCounter& getCounter() throw()
|
||||
{
|
||||
static LeakCounter counter;
|
||||
|
|
@ -20526,7 +20531,12 @@ private:
|
|||
#define __JUCE_RANDOM_JUCEHEADER__
|
||||
|
||||
/**
|
||||
A simple pseudo-random number generator.
|
||||
A random number generator.
|
||||
|
||||
You can create a Random object and use it to generate a sequence of random numbers.
|
||||
As a handy shortcut to avoid having to create and seed one yourself, you can call
|
||||
Random::getSystemRandom() to return a global RNG that is seeded randomly when the
|
||||
app launches.
|
||||
*/
|
||||
class JUCE_API Random
|
||||
{
|
||||
|
|
@ -25231,55 +25241,46 @@ public:
|
|||
horizontallyJustified = 64,
|
||||
|
||||
/** Indicates that the item should be centred vertically and horizontally.
|
||||
|
||||
This is equivalent to (horizontallyCentred | verticallyCentred)
|
||||
*/
|
||||
centred = 36,
|
||||
|
||||
/** Indicates that the item should be centred vertically but placed on the left hand side.
|
||||
|
||||
This is equivalent to (left | verticallyCentred)
|
||||
*/
|
||||
centredLeft = 33,
|
||||
|
||||
/** Indicates that the item should be centred vertically but placed on the right hand side.
|
||||
|
||||
This is equivalent to (right | verticallyCentred)
|
||||
*/
|
||||
centredRight = 34,
|
||||
|
||||
/** Indicates that the item should be centred horizontally and placed at the top.
|
||||
|
||||
This is equivalent to (horizontallyCentred | top)
|
||||
*/
|
||||
centredTop = 12,
|
||||
|
||||
/** Indicates that the item should be centred horizontally and placed at the bottom.
|
||||
|
||||
This is equivalent to (horizontallyCentred | bottom)
|
||||
*/
|
||||
centredBottom = 20,
|
||||
|
||||
/** Indicates that the item should be placed in the top-left corner.
|
||||
|
||||
This is equivalent to (left | top)
|
||||
*/
|
||||
topLeft = 9,
|
||||
|
||||
/** Indicates that the item should be placed in the top-right corner.
|
||||
|
||||
This is equivalent to (right | top)
|
||||
*/
|
||||
topRight = 10,
|
||||
|
||||
/** Indicates that the item should be placed in the bottom-left corner.
|
||||
|
||||
This is equivalent to (left | bottom)
|
||||
*/
|
||||
bottomLeft = 17,
|
||||
|
||||
/** Indicates that the item should be placed in the bottom-left corner.
|
||||
|
||||
This is equivalent to (right | bottom)
|
||||
*/
|
||||
bottomRight = 18
|
||||
|
|
@ -29356,7 +29357,7 @@ public:
|
|||
void setBottom (ValueType newBottomGap) throw() { bottom = newBottomGap; }
|
||||
|
||||
/** Changes the right gap. */
|
||||
void setRight (ValueType newRightGap) throw() { right = newRightGap; }
|
||||
void setRight (ValueType newRightGap) throw() { right = newRightGap; }
|
||||
|
||||
/** Returns a rectangle with these borders removed from it. */
|
||||
const Rectangle<ValueType> subtractedFrom (const Rectangle<ValueType>& original) const throw()
|
||||
|
|
@ -52249,7 +52250,11 @@ private:
|
|||
bool scrollWheelEnabled : 1, snapsToMousePos : 1;
|
||||
ScopedPointer<Label> valueBox;
|
||||
ScopedPointer<Button> incButton, decButton;
|
||||
ScopedPointer <Component> popupDisplay;
|
||||
|
||||
class PopupDisplayComponent;
|
||||
friend class PopupDisplayComponent;
|
||||
friend class ScopedPointer <PopupDisplayComponent>;
|
||||
ScopedPointer <PopupDisplayComponent> popupDisplay;
|
||||
Component* parentForPopupDisplay;
|
||||
|
||||
float getLinearSliderPos (double value);
|
||||
|
|
@ -63582,11 +63587,13 @@ private:
|
|||
class ComponentBoundsConstrainer;
|
||||
|
||||
/**
|
||||
The base class for window objects that wrap a component as a real operating
|
||||
system object.
|
||||
The Component class uses a ComponentPeer internally to create and manage a real
|
||||
operating-system window.
|
||||
|
||||
This is an abstract base class - the platform specific code contains default
|
||||
implementations of it that create and manage windows.
|
||||
This is an abstract base class - the platform specific code contains implementations of
|
||||
it for the various platforms.
|
||||
|
||||
User-code should very rarely need to have any involvement with this class.
|
||||
|
||||
@see Component::createNewPeer
|
||||
*/
|
||||
|
|
@ -64384,16 +64391,13 @@ public:
|
|||
const Path& pathToAdd,
|
||||
const AffineTransform& transform);
|
||||
|
||||
/** Creates an edge table containing a rectangle.
|
||||
*/
|
||||
/** Creates an edge table containing a rectangle. */
|
||||
EdgeTable (const Rectangle<int>& rectangleToAdd);
|
||||
|
||||
/** Creates an edge table containing a rectangle list.
|
||||
*/
|
||||
/** Creates an edge table containing a rectangle list. */
|
||||
EdgeTable (const RectangleList& rectanglesToAdd);
|
||||
|
||||
/** Creates an edge table containing a rectangle.
|
||||
*/
|
||||
/** Creates an edge table containing a rectangle. */
|
||||
EdgeTable (const Rectangle<float>& rectangleToAdd);
|
||||
|
||||
/** Creates a copy of another edge table. */
|
||||
|
|
@ -64557,6 +64561,7 @@ private:
|
|||
class JUCE_API FillType
|
||||
{
|
||||
public:
|
||||
|
||||
/** Creates a default fill type, of solid black. */
|
||||
FillType() throw();
|
||||
|
||||
|
|
@ -64620,9 +64625,6 @@ public:
|
|||
/** Returns true if this fill type is completely transparent. */
|
||||
bool isInvisible() const throw();
|
||||
|
||||
bool operator== (const FillType& other) const;
|
||||
bool operator!= (const FillType& other) const;
|
||||
|
||||
/** The solid colour being used.
|
||||
|
||||
If the fill type is not a solid colour, the alpha channel of this colour indicates
|
||||
|
|
@ -64643,10 +64645,12 @@ public:
|
|||
*/
|
||||
Image image;
|
||||
|
||||
/** The transform that should be applied to the image or gradient that's being drawn.
|
||||
*/
|
||||
/** The transform that should be applied to the image or gradient that's being drawn. */
|
||||
AffineTransform transform;
|
||||
|
||||
bool operator== (const FillType& other) const;
|
||||
bool operator!= (const FillType& other) const;
|
||||
|
||||
private:
|
||||
JUCE_LEAK_DETECTOR (FillType);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ bool NamedValueSet::set (const Identifier& name, const var& newValue)
|
|||
|
||||
if (v->name == name)
|
||||
{
|
||||
if (v->value == newValue)
|
||||
if (v->value.equalsWithSameType (newValue))
|
||||
return false;
|
||||
|
||||
v->value = newValue;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
#define JUCE_MAJOR_VERSION 1
|
||||
#define JUCE_MINOR_VERSION 53
|
||||
#define JUCE_BUILDNUMBER 40
|
||||
#define JUCE_BUILDNUMBER 41
|
||||
|
||||
/** Current Juce version number.
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,12 @@ BEGIN_JUCE_NAMESPACE
|
|||
|
||||
|
||||
//==============================================================================
|
||||
class SliderPopupDisplayComponent : public BubbleComponent
|
||||
class Slider::PopupDisplayComponent : public BubbleComponent,
|
||||
public Timer
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
SliderPopupDisplayComponent (Slider* const owner_)
|
||||
PopupDisplayComponent (Slider& owner_)
|
||||
: owner (owner_),
|
||||
font (15.0f, Font::bold)
|
||||
{
|
||||
|
|
@ -70,15 +71,21 @@ public:
|
|||
repaint();
|
||||
}
|
||||
|
||||
BubbleComponent::setPosition (owner);
|
||||
BubbleComponent::setPosition (&owner);
|
||||
repaint();
|
||||
}
|
||||
|
||||
void timerCallback()
|
||||
{
|
||||
owner.popupDisplay = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
Slider* owner;
|
||||
Slider& owner;
|
||||
Font font;
|
||||
String text;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SliderPopupDisplayComponent);
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PopupDisplayComponent);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -118,7 +125,6 @@ Slider::Slider (const String& name)
|
|||
menuShown (false),
|
||||
scrollWheelEnabled (true),
|
||||
snapsToMousePos (true),
|
||||
popupDisplay (0),
|
||||
parentForPopupDisplay (0)
|
||||
{
|
||||
setWantsKeyboardFocus (false);
|
||||
|
|
@ -491,12 +497,7 @@ void Slider::setValue (double newValue,
|
|||
repaint();
|
||||
|
||||
if (popupDisplay != 0)
|
||||
{
|
||||
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
|
||||
->updatePosition (getTextFromValue (newValue));
|
||||
|
||||
popupDisplay->repaint();
|
||||
}
|
||||
popupDisplay->updatePosition (getTextFromValue (newValue));
|
||||
|
||||
if (sendUpdateMessage)
|
||||
triggerChangeMessage (sendMessageSynchronously);
|
||||
|
|
@ -551,12 +552,7 @@ void Slider::setMinValue (double newValue, const bool sendUpdateMessage, const b
|
|||
repaint();
|
||||
|
||||
if (popupDisplay != 0)
|
||||
{
|
||||
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
|
||||
->updatePosition (getTextFromValue (newValue));
|
||||
|
||||
popupDisplay->repaint();
|
||||
}
|
||||
popupDisplay->updatePosition (getTextFromValue (newValue));
|
||||
|
||||
if (sendUpdateMessage)
|
||||
triggerChangeMessage (sendMessageSynchronously);
|
||||
|
|
@ -593,12 +589,7 @@ void Slider::setMaxValue (double newValue, const bool sendUpdateMessage, const b
|
|||
repaint();
|
||||
|
||||
if (popupDisplay != 0)
|
||||
{
|
||||
static_cast <SliderPopupDisplayComponent*> (static_cast <Component*> (popupDisplay))
|
||||
->updatePosition (getTextFromValue (valueMax.getValue()));
|
||||
|
||||
popupDisplay->repaint();
|
||||
}
|
||||
popupDisplay->updatePosition (getTextFromValue (valueMax.getValue()));
|
||||
|
||||
if (sendUpdateMessage)
|
||||
triggerChangeMessage (sendMessageSynchronously);
|
||||
|
|
@ -1111,17 +1102,13 @@ void Slider::mouseDown (const MouseEvent& e)
|
|||
|
||||
if (popupDisplayEnabled)
|
||||
{
|
||||
SliderPopupDisplayComponent* const popup = new SliderPopupDisplayComponent (this);
|
||||
PopupDisplayComponent* const popup = new PopupDisplayComponent (*this);
|
||||
popupDisplay = popup;
|
||||
|
||||
if (parentForPopupDisplay != 0)
|
||||
{
|
||||
parentForPopupDisplay->addChildComponent (popup);
|
||||
}
|
||||
else
|
||||
{
|
||||
popup->addToDesktop (0);
|
||||
}
|
||||
|
||||
popup->setVisible (true);
|
||||
}
|
||||
|
|
@ -1146,6 +1133,7 @@ void Slider::mouseUp (const MouseEvent&)
|
|||
triggerChangeMessage (false);
|
||||
|
||||
sendDragEnd();
|
||||
popupDisplay = 0;
|
||||
|
||||
if (style == IncDecButtons)
|
||||
{
|
||||
|
|
@ -1153,8 +1141,10 @@ void Slider::mouseUp (const MouseEvent&)
|
|||
decButton->setState (Button::buttonNormal);
|
||||
}
|
||||
}
|
||||
|
||||
popupDisplay = 0;
|
||||
else if (popupDisplay != 0)
|
||||
{
|
||||
popupDisplay->startTimer (2000);
|
||||
}
|
||||
}
|
||||
|
||||
void Slider::restoreMouseIfHidden()
|
||||
|
|
|
|||
|
|
@ -845,7 +845,11 @@ private:
|
|||
bool scrollWheelEnabled : 1, snapsToMousePos : 1;
|
||||
ScopedPointer<Label> valueBox;
|
||||
ScopedPointer<Button> incButton, decButton;
|
||||
ScopedPointer <Component> popupDisplay;
|
||||
|
||||
class PopupDisplayComponent;
|
||||
friend class PopupDisplayComponent;
|
||||
friend class ScopedPointer <PopupDisplayComponent>;
|
||||
ScopedPointer <PopupDisplayComponent> popupDisplay;
|
||||
Component* parentForPopupDisplay;
|
||||
|
||||
float getLinearSliderPos (double value);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
{
|
||||
if (--(getCounter().numObjects) < 0)
|
||||
{
|
||||
DBG ("*** Dangling pointer deletion! Class: " << OwnerClass::getLeakedObjectClassName());
|
||||
DBG ("*** Dangling pointer deletion! Class: " << getLeakedObjectClassName());
|
||||
|
||||
/** If you hit this, then you've managed to delete more instances of this class than you've
|
||||
created.. That indicates that you're deleting some dangling pointers.
|
||||
|
|
@ -77,13 +77,13 @@ private:
|
|||
class LeakCounter
|
||||
{
|
||||
public:
|
||||
LeakCounter() {}
|
||||
LeakCounter() throw() {}
|
||||
|
||||
~LeakCounter()
|
||||
{
|
||||
if (numObjects.value > 0)
|
||||
{
|
||||
DBG ("*** Leaked objects detected: " << numObjects.value << " instance(s) of class " << OwnerClass::getLeakedObjectClassName());
|
||||
DBG ("*** Leaked objects detected: " << numObjects.value << " instance(s) of class " << getLeakedObjectClassName());
|
||||
|
||||
/** If you hit this, then you've leaked one or more objects of the type specified by
|
||||
the 'OwnerClass' template parameter - the name should have been printed by the line above.
|
||||
|
|
@ -99,6 +99,11 @@ private:
|
|||
Atomic<int> numObjects;
|
||||
};
|
||||
|
||||
static const char* getLeakedObjectClassName()
|
||||
{
|
||||
return OwnerClass::getLeakedObjectClassName();
|
||||
}
|
||||
|
||||
static LeakCounter& getCounter() throw()
|
||||
{
|
||||
static LeakCounter counter;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue