From d710ed98e4bf07038f07c413e4a340b121a0e45f Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Thu, 16 Sep 2010 17:55:11 +0100 Subject: [PATCH] Fixed some documentation. Added a frequency to MidiMessage::getMidiNoteInHertz(). Tweaked some Expression and RelativeCoordinate methods. --- juce_amalgamated.cpp | 64 ++++++++----------- juce_amalgamated.h | 64 +++++++++---------- src/audio/midi/juce_MidiMessage.cpp | 8 +-- src/audio/midi/juce_MidiMessage.h | 3 +- .../processors/juce_AudioProcessorListener.h | 2 +- src/containers/juce_Expression.cpp | 14 ++-- src/containers/juce_Expression.h | 7 +- src/core/juce_StandardHeader.h | 2 +- src/gui/components/controls/juce_Slider.h | 29 +++++---- .../geometry/juce_RelativeCoordinate.cpp | 33 ++++------ .../geometry/juce_RelativeCoordinate.h | 21 ++---- src/native/mac/juce_mac_Files.mm | 6 +- src/native/windows/juce_win32_Windowing.cpp | 3 +- 13 files changed, 114 insertions(+), 142 deletions(-) diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index b0d55c6030..d86b6cd3c7 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -4628,7 +4628,7 @@ public: : mainSymbol + "." + member; } - bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const + bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const { if (s == mainSymbol) return true; @@ -4638,7 +4638,7 @@ public: try { - return c.getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth); + return c != 0 && c->getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth); } catch (EvaluationError&) { @@ -4673,7 +4673,7 @@ public: Term* getInput (int i) const { return parameters [i]; } const String getFunctionName() const { return functionName; } - bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const + bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const { for (int i = 0; i < parameters.size(); ++i) if (parameters.getUnchecked(i)->referencesSymbol (s, c, recursionDepth)) @@ -4744,7 +4744,7 @@ public: return "-" + input->toString(); } - bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const + bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const { return input->referencesSymbol (s, c, recursionDepth); } @@ -4771,7 +4771,7 @@ public: int getNumInputs() const { return 2; } Term* getInput (int index) const { return index == 0 ? static_cast (left) : (index == 1 ? static_cast (right) : 0); } - bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const + bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const { return left->referencesSymbol (s, c, recursionDepth) || right->referencesSymbol (s, c, recursionDepth); @@ -5391,7 +5391,7 @@ const Expression Expression::withRenamedSymbol (const String& oldSymbol, const S return newExpression; } -bool Expression::referencesSymbol (const String& symbol, const EvaluationContext& context) const +bool Expression::referencesSymbol (const String& symbol, const EvaluationContext* context) const { return term->referencesSymbol (symbol, context, 0); } @@ -5436,7 +5436,7 @@ int Expression::Term::getOperatorPrecedence() const return 0; } -bool Expression::Term::referencesSymbol (const String&, const EvaluationContext&, int) const +bool Expression::Term::referencesSymbol (const String&, const EvaluationContext*, int) const { return false; } @@ -29857,15 +29857,15 @@ const String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includ return String::empty; } -const double MidiMessage::getMidiNoteInHertz (int noteNumber) throw() +const double MidiMessage::getMidiNoteInHertz (int noteNumber, const double frequencyOfA) throw() { - noteNumber -= 12 * 6 + 9; // now 0 = A440 - return 440.0 * pow (2.0, noteNumber / 12.0); + noteNumber -= 12 * 6 + 9; // now 0 = A + return frequencyOfA * pow (2.0, noteNumber / 12.0); } const String MidiMessage::getGMInstrumentName (const int n) { - const char *names[] = + const char* names[] = { "Acoustic Grand Piano", "Bright Acoustic Piano", "Electric Grand Piano", "Honky-tonk Piano", "Electric Piano 1", "Electric Piano 2", "Harpsichord", "Clavinet", "Celesta", "Glockenspiel", @@ -80260,11 +80260,7 @@ bool RelativeCoordinate::references (const String& coordName, const Expression:: { try { - if (context != 0) - return term.referencesSymbol (coordName, *context); - - Expression::EvaluationContext defaultContext; - return term.referencesSymbol (coordName, defaultContext); + return term.referencesSymbol (coordName, context); } catch (...) {} @@ -80282,18 +80278,12 @@ const String RelativeCoordinate::toString() const return term.toString(); } -void RelativeCoordinate::renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* context) +void RelativeCoordinate::renameSymbolIfUsed (const String& oldName, const String& newName) { jassert (newName.isNotEmpty() && newName.toLowerCase().containsOnly ("abcdefghijklmnopqrstuvwxyz0123456789_")); - if (term.referencesSymbol (oldName, *context)) - { - const double oldValue = resolve (context); - + if (term.referencesSymbol (oldName, 0)) term = term.withRenamedSymbol (oldName, newName); - moveToAbsolute (oldValue, context); - } } RelativePoint::RelativePoint() @@ -80350,10 +80340,10 @@ const String RelativePoint::toString() const return x.toString() + ", " + y.toString(); } -void RelativePoint::renameSymbolIfUsed (const String& oldName, const String& newName, const Expression::EvaluationContext* context) +void RelativePoint::renameSymbolIfUsed (const String& oldName, const String& newName) { - x.renameSymbolIfUsed (oldName, newName, context); - y.renameSymbolIfUsed (oldName, newName, context); + x.renameSymbolIfUsed (oldName, newName); + y.renameSymbolIfUsed (oldName, newName); } bool RelativePoint::isDynamic() const @@ -80424,13 +80414,12 @@ const String RelativeRectangle::toString() const return left.toString() + ", " + top.toString() + ", " + right.toString() + ", " + bottom.toString(); } -void RelativeRectangle::renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* context) +void RelativeRectangle::renameSymbolIfUsed (const String& oldName, const String& newName) { - left.renameSymbolIfUsed (oldName, newName, context); - right.renameSymbolIfUsed (oldName, newName, context); - top.renameSymbolIfUsed (oldName, newName, context); - bottom.renameSymbolIfUsed (oldName, newName, context); + left.renameSymbolIfUsed (oldName, newName); + right.renameSymbolIfUsed (oldName, newName); + top.renameSymbolIfUsed (oldName, newName); + bottom.renameSymbolIfUsed (oldName, newName); } RelativePointPath::RelativePointPath() @@ -242719,8 +242708,7 @@ private: { if (rects->right <= x + w && rects->bottom <= y + h) { - // (need to move this one pixel to the left because of a win32 bug) - const int cx = jmax (x, (int) rects->left - 1); + const int cx = jmax (x, (int) rects->left); contextClip.addWithoutMerging (Rectangle (cx - x, rects->top - y, rects->right - cx, rects->bottom - rects->top) .getIntersection (clipBounds)); } @@ -265473,7 +265461,8 @@ const File File::getLinkedTarget() const NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; #else - NSString* dest = [[NSFileManager defaultManager] pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())]; + // (the cast here avoids a deprecation warning) + NSString* dest = [((id) [NSFileManager defaultManager]) pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())]; #endif if (dest != nil) @@ -265684,7 +265673,8 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename) #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; #else - NSDictionary* fileDict = [[NSFileManager defaultManager] fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; + // (the cast here avoids a deprecation warning) + NSDictionary* fileDict = [((id) [NSFileManager defaultManager]) fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; #endif return [fileDict fileHFSTypeCode]; diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 16d2502a03..23f47a64cd 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -64,7 +64,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 64 +#define JUCE_BUILDNUMBER 65 /** Current Juce version number. @@ -6692,11 +6692,12 @@ public: /** Returns true if this expression makes use of the specified symbol. If a suitable context is supplied, the search will dereference and recursively check all symbols, so that it can be determined whether this expression relies on the given - symbol at any level in its evaluation. + symbol at any level in its evaluation. If the context parameter is null, this just checks + whether the expression contains any direct references to the symbol. @throws Expression::EvaluationError */ - bool referencesSymbol (const String& symbol, const EvaluationContext& context) const; + bool referencesSymbol (const String& symbol, const EvaluationContext* context) const; /** Returns true if this expression contains any symbols. */ bool usesAnySymbols() const; @@ -6773,7 +6774,7 @@ private: virtual int getInputIndexFor (const Term* possibleInput) const; virtual const String toString() const = 0; virtual int getOperatorPrecedence() const; - virtual bool referencesSymbol (const String& symbol, const EvaluationContext&, int recursionDepth) const; + virtual bool referencesSymbol (const String& symbol, const EvaluationContext*, int recursionDepth) const; virtual const ReferenceCountedObjectPtr createTermToEvaluateInput (const EvaluationContext&, const Term* inputTerm, double overallTarget, Term* topLevelTerm) const; virtual const ReferenceCountedObjectPtr negated(); @@ -33821,9 +33822,10 @@ public: /** Returns the frequency of a midi note number. + The frequencyOfA parameter is an optional frequency for 'A', normally 440-444Hz for concert pitch. @see getMidiNoteName */ - static const double getMidiNoteInHertz (int noteNumber) throw(); + static const double getMidiNoteInHertz (int noteNumber, const double frequencyOfA = 440.0) throw(); /** Returns the standard name of a GM instrument. @@ -38647,7 +38649,7 @@ public: to trigger an AsyncUpdater or ChangeBroadcaster which you can respond to later on the message thread. - @see audioPluginParameterChangeGestureStart + @see audioProcessorParameterChangeGestureBegin */ virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor, int parameterIndex); @@ -43219,15 +43221,8 @@ public: */ void moveToAbsolute (double absoluteTargetPosition, const Expression::EvaluationContext* evaluationContext); - /** Tells the coordinate that an object is changing its name or being deleted. - - If either of this coordinates anchor points match this name, they will be replaced. - If the newName string is empty, it indicates that the object is being removed, so if - this coordinate was using it, the coordinate is changed to be relative to the origin - instead. - */ - void renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* evaluationContext); + /** Changes the name of a symbol if it is used as part of the coordinate's expression. */ + void renameSymbolIfUsed (const String& oldName, const String& newName); /** Returns the expression that defines this coordinate. */ const Expression& getExpression() const { return term; } @@ -43314,11 +43309,10 @@ public: */ const String toString() const; - /** Tells the point that an object is changing its name or being deleted. + /** Renames a symbol if it is used by any of the coordinates. This calls RelativeCoordinate::renameAnchorIfUsed() on its X and Y coordinates. */ - void renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* evaluationContext); + void renameSymbolIfUsed (const String& oldName, const String& newName); /** Returns true if this point depends on any other coordinates for its position. */ bool isDynamic() const; @@ -43381,11 +43375,10 @@ public: */ const String toString() const; - /** Tells the rectangle that an object is changing its name or being deleted. + /** Renames a symbol if it is used by any of the coordinates. This calls RelativeCoordinate::renameSymbolIfUsed() on the rectangle's coordinates. */ - void renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* evaluationContext); + void renameSymbolIfUsed (const String& oldName, const String& newName); // The actual rectangle coords... RelativeCoordinate left, right, top, bottom; @@ -46188,7 +46181,7 @@ public: @see setSliderStyle */ - SliderStyle getSliderStyle() const { return style; } + SliderStyle getSliderStyle() const throw() { return style; } /** Changes the properties of a rotary slider. @@ -46213,6 +46206,9 @@ public: */ void setMouseDragSensitivity (int distanceForFullScaleDrag); + /** Returns the current sensitivity value set by setMouseDragSensitivity(). */ + int getMouseDragSensitivity() const throw() { return pixelsForFullDragExtent; } + /** Changes the way the the mouse is used when dragging the slider. If true, this will turn on velocity-sensitive dragging, so that @@ -46226,7 +46222,7 @@ public: /** Returns true if velocity-based mode is active. @see setVelocityBasedMode */ - bool getVelocityBasedMode() const { return isVelocityBased; } + bool getVelocityBasedMode() const throw() { return isVelocityBased; } /** Changes aspects of the scaling used when in velocity-sensitive mode. @@ -46249,22 +46245,22 @@ public: /** Returns the velocity sensitivity setting. @see setVelocityModeParameters */ - double getVelocitySensitivity() const { return velocityModeSensitivity; } + double getVelocitySensitivity() const throw() { return velocityModeSensitivity; } /** Returns the velocity threshold setting. @see setVelocityModeParameters */ - int getVelocityThreshold() const { return velocityModeThreshold; } + int getVelocityThreshold() const throw() { return velocityModeThreshold; } /** Returns the velocity offset setting. @see setVelocityModeParameters */ - double getVelocityOffset() const { return velocityModeOffset; } + double getVelocityOffset() const throw() { return velocityModeOffset; } /** Returns the velocity user key setting. @see setVelocityModeParameters */ - bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; } + bool getVelocityModeIsSwappable() const throw() { return userKeyOverridesVelocity; } /** Sets up a skew factor to alter the way values are distributed. @@ -46298,7 +46294,7 @@ public: @see setSkewFactor, setSkewFactorFromMidPoint */ - double getSkewFactor() const { return skewFactor; } + double getSkewFactor() const throw() { return skewFactor; } /** Used by setIncDecButtonsMode(). */ @@ -46354,17 +46350,17 @@ public: /** Returns the status of the text-box. @see setTextBoxStyle */ - const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; } + const TextEntryBoxPosition getTextBoxPosition() const throw() { return textBoxPos; } /** Returns the width used for the text-box. @see setTextBoxStyle */ - int getTextBoxWidth() const { return textBoxWidth; } + int getTextBoxWidth() const throw() { return textBoxWidth; } /** Returns the height used for the text-box. @see setTextBoxStyle */ - int getTextBoxHeight() const { return textBoxHeight; } + int getTextBoxHeight() const throw() { return textBoxHeight; } /** Makes the text-box editable. @@ -46468,7 +46464,7 @@ public: your own Value object. @see Value, getMinValue, getMaxValueObject */ - Value& getMinValueObject() { return valueMin; } + Value& getMinValueObject() throw() { return valueMin; } /** For a slider with two or three thumbs, this sets the lower of its values. @@ -46510,7 +46506,7 @@ public: your own Value object. @see Value, getMaxValue, getMinValueObject */ - Value& getMaxValueObject() { return valueMax; } + Value& getMaxValueObject() throw() { return valueMax; } /** For a slider with two or three thumbs, this sets the lower of its values. @@ -46661,7 +46657,7 @@ public: This will return 0 for the main thumb, 1 for the minimum-value thumb, 2 for the maximum-value thumb, or -1 if none is currently down. */ - int getThumbBeingDragged() const { return sliderBeingDragged; } + int getThumbBeingDragged() const throw() { return sliderBeingDragged; } /** Callback to indicate that the user is about to start dragging the slider. diff --git a/src/audio/midi/juce_MidiMessage.cpp b/src/audio/midi/juce_MidiMessage.cpp index ff002b8a40..faf91ea3f6 100644 --- a/src/audio/midi/juce_MidiMessage.cpp +++ b/src/audio/midi/juce_MidiMessage.cpp @@ -991,15 +991,15 @@ const String MidiMessage::getMidiNoteName (int note, bool useSharps, bool includ return String::empty; } -const double MidiMessage::getMidiNoteInHertz (int noteNumber) throw() +const double MidiMessage::getMidiNoteInHertz (int noteNumber, const double frequencyOfA) throw() { - noteNumber -= 12 * 6 + 9; // now 0 = A440 - return 440.0 * pow (2.0, noteNumber / 12.0); + noteNumber -= 12 * 6 + 9; // now 0 = A + return frequencyOfA * pow (2.0, noteNumber / 12.0); } const String MidiMessage::getGMInstrumentName (const int n) { - const char *names[] = + const char* names[] = { "Acoustic Grand Piano", "Bright Acoustic Piano", "Electric Grand Piano", "Honky-tonk Piano", "Electric Piano 1", "Electric Piano 2", "Harpsichord", "Clavinet", "Celesta", "Glockenspiel", diff --git a/src/audio/midi/juce_MidiMessage.h b/src/audio/midi/juce_MidiMessage.h index 23450618f6..f3e754bc47 100644 --- a/src/audio/midi/juce_MidiMessage.h +++ b/src/audio/midi/juce_MidiMessage.h @@ -860,9 +860,10 @@ public: /** Returns the frequency of a midi note number. + The frequencyOfA parameter is an optional frequency for 'A', normally 440-444Hz for concert pitch. @see getMidiNoteName */ - static const double getMidiNoteInHertz (int noteNumber) throw(); + static const double getMidiNoteInHertz (int noteNumber, const double frequencyOfA = 440.0) throw(); /** Returns the standard name of a GM instrument. diff --git a/src/audio/processors/juce_AudioProcessorListener.h b/src/audio/processors/juce_AudioProcessorListener.h index 8befe186bb..2dd06fec2c 100644 --- a/src/audio/processors/juce_AudioProcessorListener.h +++ b/src/audio/processors/juce_AudioProcessorListener.h @@ -99,7 +99,7 @@ public: to trigger an AsyncUpdater or ChangeBroadcaster which you can respond to later on the message thread. - @see audioPluginParameterChangeGestureStart + @see audioProcessorParameterChangeGestureBegin */ virtual void audioProcessorParameterChangeGestureEnd (AudioProcessor* processor, int parameterIndex); diff --git a/src/containers/juce_Expression.cpp b/src/containers/juce_Expression.cpp index 72e2eceb1e..c685b13e9c 100644 --- a/src/containers/juce_Expression.cpp +++ b/src/containers/juce_Expression.cpp @@ -108,7 +108,7 @@ public: : mainSymbol + "." + member; } - bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const + bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const { if (s == mainSymbol) return true; @@ -118,7 +118,7 @@ public: try { - return c.getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth); + return c != 0 && c->getSymbolValue (mainSymbol, member).term->referencesSymbol (s, c, recursionDepth); } catch (EvaluationError&) { @@ -154,7 +154,7 @@ public: Term* getInput (int i) const { return parameters [i]; } const String getFunctionName() const { return functionName; } - bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const + bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const { for (int i = 0; i < parameters.size(); ++i) if (parameters.getUnchecked(i)->referencesSymbol (s, c, recursionDepth)) @@ -226,7 +226,7 @@ public: return "-" + input->toString(); } - bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const + bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const { return input->referencesSymbol (s, c, recursionDepth); } @@ -254,7 +254,7 @@ public: int getNumInputs() const { return 2; } Term* getInput (int index) const { return index == 0 ? static_cast (left) : (index == 1 ? static_cast (right) : 0); } - bool referencesSymbol (const String& s, const EvaluationContext& c, int recursionDepth) const + bool referencesSymbol (const String& s, const EvaluationContext* c, int recursionDepth) const { return left->referencesSymbol (s, c, recursionDepth) || right->referencesSymbol (s, c, recursionDepth); @@ -882,7 +882,7 @@ const Expression Expression::withRenamedSymbol (const String& oldSymbol, const S return newExpression; } -bool Expression::referencesSymbol (const String& symbol, const EvaluationContext& context) const +bool Expression::referencesSymbol (const String& symbol, const EvaluationContext* context) const { return term->referencesSymbol (symbol, context, 0); } @@ -928,7 +928,7 @@ int Expression::Term::getOperatorPrecedence() const return 0; } -bool Expression::Term::referencesSymbol (const String&, const EvaluationContext&, int) const +bool Expression::Term::referencesSymbol (const String&, const EvaluationContext*, int) const { return false; } diff --git a/src/containers/juce_Expression.h b/src/containers/juce_Expression.h index 01fa87ac52..07f50127b0 100644 --- a/src/containers/juce_Expression.h +++ b/src/containers/juce_Expression.h @@ -156,11 +156,12 @@ public: /** Returns true if this expression makes use of the specified symbol. If a suitable context is supplied, the search will dereference and recursively check all symbols, so that it can be determined whether this expression relies on the given - symbol at any level in its evaluation. + symbol at any level in its evaluation. If the context parameter is null, this just checks + whether the expression contains any direct references to the symbol. @throws Expression::EvaluationError */ - bool referencesSymbol (const String& symbol, const EvaluationContext& context) const; + bool referencesSymbol (const String& symbol, const EvaluationContext* context) const; /** Returns true if this expression contains any symbols. */ bool usesAnySymbols() const; @@ -241,7 +242,7 @@ private: virtual int getInputIndexFor (const Term* possibleInput) const; virtual const String toString() const = 0; virtual int getOperatorPrecedence() const; - virtual bool referencesSymbol (const String& symbol, const EvaluationContext&, int recursionDepth) const; + virtual bool referencesSymbol (const String& symbol, const EvaluationContext*, int recursionDepth) const; virtual const ReferenceCountedObjectPtr createTermToEvaluateInput (const EvaluationContext&, const Term* inputTerm, double overallTarget, Term* topLevelTerm) const; virtual const ReferenceCountedObjectPtr negated(); diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index 3094ef198b..c009d02103 100644 --- a/src/core/juce_StandardHeader.h +++ b/src/core/juce_StandardHeader.h @@ -33,7 +33,7 @@ */ #define JUCE_MAJOR_VERSION 1 #define JUCE_MINOR_VERSION 52 -#define JUCE_BUILDNUMBER 64 +#define JUCE_BUILDNUMBER 65 /** Current Juce version number. diff --git a/src/gui/components/controls/juce_Slider.h b/src/gui/components/controls/juce_Slider.h index a526e4d566..130acabb90 100644 --- a/src/gui/components/controls/juce_Slider.h +++ b/src/gui/components/controls/juce_Slider.h @@ -114,7 +114,7 @@ public: @see setSliderStyle */ - SliderStyle getSliderStyle() const { return style; } + SliderStyle getSliderStyle() const throw() { return style; } //============================================================================== /** Changes the properties of a rotary slider. @@ -140,6 +140,9 @@ public: */ void setMouseDragSensitivity (int distanceForFullScaleDrag); + /** Returns the current sensitivity value set by setMouseDragSensitivity(). */ + int getMouseDragSensitivity() const throw() { return pixelsForFullDragExtent; } + //============================================================================== /** Changes the way the the mouse is used when dragging the slider. @@ -154,7 +157,7 @@ public: /** Returns true if velocity-based mode is active. @see setVelocityBasedMode */ - bool getVelocityBasedMode() const { return isVelocityBased; } + bool getVelocityBasedMode() const throw() { return isVelocityBased; } /** Changes aspects of the scaling used when in velocity-sensitive mode. @@ -177,22 +180,22 @@ public: /** Returns the velocity sensitivity setting. @see setVelocityModeParameters */ - double getVelocitySensitivity() const { return velocityModeSensitivity; } + double getVelocitySensitivity() const throw() { return velocityModeSensitivity; } /** Returns the velocity threshold setting. @see setVelocityModeParameters */ - int getVelocityThreshold() const { return velocityModeThreshold; } + int getVelocityThreshold() const throw() { return velocityModeThreshold; } /** Returns the velocity offset setting. @see setVelocityModeParameters */ - double getVelocityOffset() const { return velocityModeOffset; } + double getVelocityOffset() const throw() { return velocityModeOffset; } /** Returns the velocity user key setting. @see setVelocityModeParameters */ - bool getVelocityModeIsSwappable() const { return userKeyOverridesVelocity; } + bool getVelocityModeIsSwappable() const throw() { return userKeyOverridesVelocity; } //============================================================================== /** Sets up a skew factor to alter the way values are distributed. @@ -227,7 +230,7 @@ public: @see setSkewFactor, setSkewFactorFromMidPoint */ - double getSkewFactor() const { return skewFactor; } + double getSkewFactor() const throw() { return skewFactor; } //============================================================================== /** Used by setIncDecButtonsMode(). @@ -285,17 +288,17 @@ public: /** Returns the status of the text-box. @see setTextBoxStyle */ - const TextEntryBoxPosition getTextBoxPosition() const { return textBoxPos; } + const TextEntryBoxPosition getTextBoxPosition() const throw() { return textBoxPos; } /** Returns the width used for the text-box. @see setTextBoxStyle */ - int getTextBoxWidth() const { return textBoxWidth; } + int getTextBoxWidth() const throw() { return textBoxWidth; } /** Returns the height used for the text-box. @see setTextBoxStyle */ - int getTextBoxHeight() const { return textBoxHeight; } + int getTextBoxHeight() const throw() { return textBoxHeight; } /** Makes the text-box editable. @@ -403,7 +406,7 @@ public: your own Value object. @see Value, getMinValue, getMaxValueObject */ - Value& getMinValueObject() { return valueMin; } + Value& getMinValueObject() throw() { return valueMin; } /** For a slider with two or three thumbs, this sets the lower of its values. @@ -445,7 +448,7 @@ public: your own Value object. @see Value, getMaxValue, getMinValueObject */ - Value& getMaxValueObject() { return valueMax; } + Value& getMaxValueObject() throw() { return valueMax; } /** For a slider with two or three thumbs, this sets the lower of its values. @@ -601,7 +604,7 @@ public: This will return 0 for the main thumb, 1 for the minimum-value thumb, 2 for the maximum-value thumb, or -1 if none is currently down. */ - int getThumbBeingDragged() const { return sliderBeingDragged; } + int getThumbBeingDragged() const throw() { return sliderBeingDragged; } //============================================================================== /** Callback to indicate that the user is about to start dragging the slider. diff --git a/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp b/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp index 339e3d38fb..73edc2ba2f 100644 --- a/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp +++ b/src/gui/graphics/geometry/juce_RelativeCoordinate.cpp @@ -160,11 +160,7 @@ bool RelativeCoordinate::references (const String& coordName, const Expression:: { try { - if (context != 0) - return term.referencesSymbol (coordName, *context); - - Expression::EvaluationContext defaultContext; - return term.referencesSymbol (coordName, defaultContext); + return term.referencesSymbol (coordName, context); } catch (...) {} @@ -182,18 +178,12 @@ const String RelativeCoordinate::toString() const return term.toString(); } -void RelativeCoordinate::renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* context) +void RelativeCoordinate::renameSymbolIfUsed (const String& oldName, const String& newName) { jassert (newName.isNotEmpty() && newName.toLowerCase().containsOnly ("abcdefghijklmnopqrstuvwxyz0123456789_")); - if (term.referencesSymbol (oldName, *context)) - { - const double oldValue = resolve (context); - + if (term.referencesSymbol (oldName, 0)) term = term.withRenamedSymbol (oldName, newName); - moveToAbsolute (oldValue, context); - } } //============================================================================== @@ -251,10 +241,10 @@ const String RelativePoint::toString() const return x.toString() + ", " + y.toString(); } -void RelativePoint::renameSymbolIfUsed (const String& oldName, const String& newName, const Expression::EvaluationContext* context) +void RelativePoint::renameSymbolIfUsed (const String& oldName, const String& newName) { - x.renameSymbolIfUsed (oldName, newName, context); - y.renameSymbolIfUsed (oldName, newName, context); + x.renameSymbolIfUsed (oldName, newName); + y.renameSymbolIfUsed (oldName, newName); } bool RelativePoint::isDynamic() const @@ -327,13 +317,12 @@ const String RelativeRectangle::toString() const return left.toString() + ", " + top.toString() + ", " + right.toString() + ", " + bottom.toString(); } -void RelativeRectangle::renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* context) +void RelativeRectangle::renameSymbolIfUsed (const String& oldName, const String& newName) { - left.renameSymbolIfUsed (oldName, newName, context); - right.renameSymbolIfUsed (oldName, newName, context); - top.renameSymbolIfUsed (oldName, newName, context); - bottom.renameSymbolIfUsed (oldName, newName, context); + left.renameSymbolIfUsed (oldName, newName); + right.renameSymbolIfUsed (oldName, newName); + top.renameSymbolIfUsed (oldName, newName); + bottom.renameSymbolIfUsed (oldName, newName); } diff --git a/src/gui/graphics/geometry/juce_RelativeCoordinate.h b/src/gui/graphics/geometry/juce_RelativeCoordinate.h index 8636c50ac7..da97322c9e 100644 --- a/src/gui/graphics/geometry/juce_RelativeCoordinate.h +++ b/src/gui/graphics/geometry/juce_RelativeCoordinate.h @@ -100,15 +100,8 @@ public: */ void moveToAbsolute (double absoluteTargetPosition, const Expression::EvaluationContext* evaluationContext); - /** Tells the coordinate that an object is changing its name or being deleted. - - If either of this coordinates anchor points match this name, they will be replaced. - If the newName string is empty, it indicates that the object is being removed, so if - this coordinate was using it, the coordinate is changed to be relative to the origin - instead. - */ - void renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* evaluationContext); + /** Changes the name of a symbol if it is used as part of the coordinate's expression. */ + void renameSymbolIfUsed (const String& oldName, const String& newName); /** Returns the expression that defines this coordinate. */ const Expression& getExpression() const { return term; } @@ -200,11 +193,10 @@ public: */ const String toString() const; - /** Tells the point that an object is changing its name or being deleted. + /** Renames a symbol if it is used by any of the coordinates. This calls RelativeCoordinate::renameAnchorIfUsed() on its X and Y coordinates. */ - void renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* evaluationContext); + void renameSymbolIfUsed (const String& oldName, const String& newName); /** Returns true if this point depends on any other coordinates for its position. */ bool isDynamic() const; @@ -270,11 +262,10 @@ public: */ const String toString() const; - /** Tells the rectangle that an object is changing its name or being deleted. + /** Renames a symbol if it is used by any of the coordinates. This calls RelativeCoordinate::renameSymbolIfUsed() on the rectangle's coordinates. */ - void renameSymbolIfUsed (const String& oldName, const String& newName, - const Expression::EvaluationContext* evaluationContext); + void renameSymbolIfUsed (const String& oldName, const String& newName); // The actual rectangle coords... RelativeCoordinate left, right, top, bottom; diff --git a/src/native/mac/juce_mac_Files.mm b/src/native/mac/juce_mac_Files.mm index cad85817f1..1a1780786d 100644 --- a/src/native/mac/juce_mac_Files.mm +++ b/src/native/mac/juce_mac_Files.mm @@ -234,7 +234,8 @@ const File File::getLinkedTarget() const NSString* dest = [[NSFileManager defaultManager] destinationOfSymbolicLinkAtPath: juceStringToNS (getFullPathName()) error: nil]; #else - NSString* dest = [[NSFileManager defaultManager] pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())]; + // (the cast here avoids a deprecation warning) + NSString* dest = [((id) [NSFileManager defaultManager]) pathContentOfSymbolicLinkAtPath: juceStringToNS (getFullPathName())]; #endif if (dest != nil) @@ -451,7 +452,8 @@ OSType PlatformUtilities::getTypeOfFile (const String& filename) #if JUCE_IOS || (defined (MAC_OS_X_VERSION_10_5) && MAC_OS_X_VERSION_MIN_ALLOWED >= MAC_OS_X_VERSION_10_5) NSDictionary* fileDict = [[NSFileManager defaultManager] attributesOfItemAtPath: juceStringToNS (filename) error: nil]; #else - NSDictionary* fileDict = [[NSFileManager defaultManager] fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; + // (the cast here avoids a deprecation warning) + NSDictionary* fileDict = [((id) [NSFileManager defaultManager]) fileAttributesAtPath: juceStringToNS (filename) traverseLink: NO]; #endif return [fileDict fileHFSTypeCode]; diff --git a/src/native/windows/juce_win32_Windowing.cpp b/src/native/windows/juce_win32_Windowing.cpp index 0a8bb9e26c..b5b1f6331e 100644 --- a/src/native/windows/juce_win32_Windowing.cpp +++ b/src/native/windows/juce_win32_Windowing.cpp @@ -1211,8 +1211,7 @@ private: { if (rects->right <= x + w && rects->bottom <= y + h) { - // (need to move this one pixel to the left because of a win32 bug) - const int cx = jmax (x, (int) rects->left - 1); + const int cx = jmax (x, (int) rects->left); contextClip.addWithoutMerging (Rectangle (cx - x, rects->top - y, rects->right - cx, rects->bottom - rects->top) .getIntersection (clipBounds)); }