From 984fc9476f8beb999c66cf03f232eee43a03b1eb Mon Sep 17 00:00:00 2001 From: GavinFAW Date: Wed, 14 Feb 2024 18:49:33 +0000 Subject: [PATCH] adding bool to referTo if you want to notify listeners --- modules/juce_data_structures/values/juce_Value.cpp | 4 ++-- modules/juce_data_structures/values/juce_Value.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/juce_data_structures/values/juce_Value.cpp b/modules/juce_data_structures/values/juce_Value.cpp index 18f1124591..c3f6f5ce9c 100644 --- a/modules/juce_data_structures/values/juce_Value.cpp +++ b/modules/juce_data_structures/values/juce_Value.cpp @@ -174,7 +174,7 @@ Value& Value::operator= (const var& newValue) return *this; } -void Value::referTo (const Value& valueToReferTo) +void Value::referTo (const Value& valueToReferTo, bool notifyListeners) { if (valueToReferTo.value != value) { @@ -185,7 +185,7 @@ void Value::referTo (const Value& valueToReferTo) } value = valueToReferTo.value; - callListeners(); + if(notifyListeners) callListeners(); } } diff --git a/modules/juce_data_structures/values/juce_Value.h b/modules/juce_data_structures/values/juce_Value.h index 94f6d1eda1..7adae044e1 100644 --- a/modules/juce_data_structures/values/juce_Value.h +++ b/modules/juce_data_structures/values/juce_Value.h @@ -112,7 +112,7 @@ public: Existing listeners will still be registered after you call this method, and they'll continue to receive messages when the new value changes. */ - void referTo (const Value& valueToReferTo); + void referTo (const Value& valueToReferTo, bool notifyListeners = true); /** Returns true if this object and the other one use the same underlying ValueSource object.