Browse Source

Update juce

tags/2018-04-16
falkTX 10 years ago
parent
commit
5836a56b8f
23 changed files with 176 additions and 159 deletions
  1. +3
    -1
      libs/juce/source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  2. +6
    -4
      libs/juce/source/modules/juce_core/containers/juce_NamedValueSet.cpp
  3. +2
    -2
      libs/juce/source/modules/juce_core/containers/juce_NamedValueSet.h
  4. +9
    -9
      libs/juce/source/modules/juce_core/containers/juce_Variant.cpp
  5. +9
    -10
      libs/juce/source/modules/juce_core/containers/juce_Variant.h
  6. +9
    -9
      libs/juce/source/modules/juce_core/javascript/juce_Javascript.cpp
  7. +2
    -2
      libs/juce/source/modules/juce_core/javascript/juce_Javascript.h
  8. +12
    -0
      libs/juce/source/modules/juce_core/network/juce_URL.h
  9. +11
    -1
      libs/juce/source/modules/juce_core/text/juce_Identifier.cpp
  10. +11
    -3
      libs/juce/source/modules/juce_core/text/juce_Identifier.h
  11. +23
    -24
      libs/juce/source/modules/juce_data_structures/values/juce_ValueTree.cpp
  12. +13
    -13
      libs/juce/source/modules/juce_data_structures/values/juce_ValueTree.h
  13. +4
    -2
      libs/juce/source/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp
  14. +13
    -12
      libs/juce/source/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h
  15. +1
    -31
      libs/juce/source/modules/juce_gui_basics/layout/juce_Viewport.cpp
  16. +1
    -3
      libs/juce/source/modules/juce_gui_basics/layout/juce_Viewport.h
  17. +4
    -0
      libs/juce/source/modules/juce_gui_basics/mouse/juce_MouseEvent.h
  18. +12
    -4
      libs/juce/source/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp
  19. +7
    -6
      libs/juce/source/modules/juce_gui_basics/native/juce_linux_Windowing.cpp
  20. +8
    -4
      libs/juce/source/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm
  21. +1
    -0
      libs/juce/source/modules/juce_gui_basics/native/juce_win32_Windowing.cpp
  22. +13
    -17
      libs/juce/source/modules/juce_gui_extra/misc/juce_LiveConstantEditor.cpp
  23. +2
    -2
      libs/juce/source/modules/juce_gui_extra/misc/juce_LiveConstantEditor.h

+ 3
- 1
libs/juce/source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp View File

@@ -318,6 +318,8 @@ namespace
static void translateJuceToXMouseWheelModifiers (const MouseEvent& e, const float increment, XEvent& ev) noexcept
{
ignoreUnused (e);
if (increment < 0)
{
ev.xbutton.button = Button5;
@@ -1633,7 +1635,7 @@ public:
void* data = nullptr;
const size_t bytes = (size_t) dispatch (effGetChunk, isPreset ? 1 : 0, 0, &data, 0.0f);
if (data != nullptr && bytes <= maxSizeMB * 1024 * 1024)
if (data != nullptr && bytes <= (size_t) maxSizeMB * 1024 * 1024)
{
mb.setSize (bytes);
mb.copyFrom (data, 0, bytes);


+ 6
- 4
libs/juce/source/modules/juce_core/containers/juce_NamedValueSet.cpp View File

@@ -29,7 +29,7 @@
struct NamedValueSet::NamedValue
{
NamedValue() noexcept {}
NamedValue (Identifier n, const var& v) : name (n), value (v) {}
NamedValue (const Identifier& n, const var& v) : name (n), value (v) {}
NamedValue (const NamedValue& other) : name (other.name), value (other.value) {}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
@@ -39,7 +39,9 @@ struct NamedValueSet::NamedValue
{
}
NamedValue (Identifier n, var&& v) : name (n), value (static_cast<var&&> (v))
NamedValue (Identifier&& n, var&& v)
: name (static_cast<Identifier&&> (n)),
value (static_cast<var&&> (v))
{
}
@@ -138,7 +140,7 @@ var* NamedValueSet::getVarPointer (const Identifier& name) const noexcept
}
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
bool NamedValueSet::set (Identifier name, var&& newValue)
bool NamedValueSet::set (const Identifier& name, var&& newValue)
{
if (var* const v = getVarPointer (name))
{
@@ -154,7 +156,7 @@ bool NamedValueSet::set (Identifier name, var&& newValue)
}
#endif
bool NamedValueSet::set (Identifier name, const var& newValue)
bool NamedValueSet::set (const Identifier& name, const var& newValue)
{
if (var* const v = getVarPointer (name))
{


+ 2
- 2
libs/juce/source/modules/juce_core/containers/juce_NamedValueSet.h View File

@@ -78,14 +78,14 @@ public:
@returns true if a value was changed or added; false if the
value was already set the value passed-in.
*/
bool set (Identifier name, const var& newValue);
bool set (const Identifier& name, const var& newValue);
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Changes or adds a named value.
@returns true if a value was changed or added; false if the
value was already set the value passed-in.
*/
bool set (Identifier name, var&& newValue);
bool set (const Identifier& name, var&& newValue);
#endif
/** Returns true if the set contains an item with the specified name. */


+ 9
- 9
libs/juce/source/modules/juce_core/containers/juce_Variant.cpp View File

@@ -576,7 +576,7 @@ var var::clone() const noexcept
}
//==============================================================================
const var& var::operator[] (Identifier propertyName) const
const var& var::operator[] (const Identifier& propertyName) const
{
if (DynamicObject* const o = getDynamicObject())
return o->getProperty (propertyName);
@@ -589,7 +589,7 @@ const var& var::operator[] (const char* const propertyName) const
return operator[] (Identifier (propertyName));
}
var var::getProperty (const Identifier propertyName, const var& defaultReturnValue) const
var var::getProperty (const Identifier& propertyName, const var& defaultReturnValue) const
{
if (DynamicObject* const o = getDynamicObject())
return o->getProperties().getWithDefault (propertyName, defaultReturnValue);
@@ -602,7 +602,7 @@ var::NativeFunction var::getNativeFunction() const
return isMethod() ? value.methodValue : nullptr;
}
var var::invoke (Identifier method, const var* arguments, int numArguments) const
var var::invoke (const Identifier& method, const var* arguments, int numArguments) const
{
if (DynamicObject* const o = getDynamicObject())
return o->invokeMethod (method, var::NativeFunctionArgs (*this, arguments, numArguments));
@@ -610,35 +610,35 @@ var var::invoke (Identifier method, const var* arguments, int numArguments) cons
return var();
}
var var::call (const Identifier method) const
var var::call (const Identifier& method) const
{
return invoke (method, nullptr, 0);
}
var var::call (const Identifier method, const var& arg1) const
var var::call (const Identifier& method, const var& arg1) const
{
return invoke (method, &arg1, 1);
}
var var::call (const Identifier method, const var& arg1, const var& arg2) const
var var::call (const Identifier& method, const var& arg1, const var& arg2) const
{
var args[] = { arg1, arg2 };
return invoke (method, args, 2);
}
var var::call (const Identifier method, const var& arg1, const var& arg2, const var& arg3)
var var::call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3)
{
var args[] = { arg1, arg2, arg3 };
return invoke (method, args, 3);
}
var var::call (const Identifier method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const
var var::call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const
{
var args[] = { arg1, arg2, arg3, arg4 };
return invoke (method, args, 4);
}
var var::call (const Identifier method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const
var var::call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const
{
var args[] = { arg1, arg2, arg3, arg4, arg5 };
return invoke (method, args, 5);


+ 9
- 10
libs/juce/source/modules/juce_core/containers/juce_Variant.h View File

@@ -62,7 +62,6 @@ public:
};
typedef var (*NativeFunction) (const NativeFunctionArgs&);
typedef Identifier identifier;
//==============================================================================
/** Creates a void variant. */
@@ -242,27 +241,27 @@ public:
//==============================================================================
/** If this variant is an object, this returns one of its properties. */
const var& operator[] (Identifier propertyName) const;
const var& operator[] (const Identifier& propertyName) const;
/** If this variant is an object, this returns one of its properties. */
const var& operator[] (const char* propertyName) const;
/** If this variant is an object, this returns one of its properties, or a default
fallback value if the property is not set. */
var getProperty (Identifier propertyName, const var& defaultReturnValue) const;
var getProperty (const Identifier& propertyName, const var& defaultReturnValue) const;
/** Invokes a named method call with no arguments. */
var call (Identifier method) const;
var call (const Identifier& method) const;
/** Invokes a named method call with one argument. */
var call (Identifier method, const var& arg1) const;
var call (const Identifier& method, const var& arg1) const;
/** Invokes a named method call with 2 arguments. */
var call (Identifier method, const var& arg1, const var& arg2) const;
var call (const Identifier& method, const var& arg1, const var& arg2) const;
/** Invokes a named method call with 3 arguments. */
var call (Identifier method, const var& arg1, const var& arg2, const var& arg3);
var call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3);
/** Invokes a named method call with 4 arguments. */
var call (Identifier method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
var call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4) const;
/** Invokes a named method call with 5 arguments. */
var call (Identifier method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
var call (const Identifier& method, const var& arg1, const var& arg2, const var& arg3, const var& arg4, const var& arg5) const;
/** Invokes a named method call with a list of arguments. */
var invoke (Identifier method, const var* arguments, int numArguments) const;
var invoke (const Identifier& method, const var* arguments, int numArguments) const;
/** If this object is a method, this returns the function pointer. */
NativeFunction getNativeFunction() const;


+ 9
- 9
libs/juce/source/modules/juce_core/javascript/juce_Javascript.cpp View File

@@ -102,7 +102,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
static bool isNumericOrUndefined (const var& v) { return v.isInt() || v.isDouble() || v.isInt64() || v.isBool() || v.isUndefined(); }
static int64 getOctalValue (const String& s) { BigInteger b; b.parseString (s, 8); return b.toInt64(); }
static Identifier getPrototypeIdentifier() { static const Identifier i ("prototype"); return i; }
static var* getPropertyPointer (DynamicObject* o, Identifier i) { return o->getProperties().getVarPointer (i); }
static var* getPropertyPointer (DynamicObject* o, const Identifier& i) { return o->getProperties().getVarPointer (i); }
//==============================================================================
struct CodeLocation
@@ -136,7 +136,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
ReferenceCountedObjectPtr<RootObject> root;
DynamicObject::Ptr scope;
var findFunctionCall (const CodeLocation& location, const var& targetObject, Identifier functionName) const
var findFunctionCall (const CodeLocation& location, const var& targetObject, const Identifier& functionName) const
{
if (DynamicObject* o = targetObject.getDynamicObject())
{
@@ -170,7 +170,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
return var();
}
var* findRootClassProperty (Identifier className, Identifier propName) const
var* findRootClassProperty (const Identifier& className, const Identifier& propName) const
{
if (DynamicObject* cls = root->getProperty (className).getDynamicObject())
return getPropertyPointer (cls, propName);
@@ -178,7 +178,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
return nullptr;
}
var findSymbolInParentScopes (Identifier name) const
var findSymbolInParentScopes (const Identifier& name) const
{
if (const var* v = getPropertyPointer (scope, name))
return *v;
@@ -187,7 +187,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
: var::undefined();
}
bool findAndInvokeMethod (Identifier function, const var::NativeFunctionArgs& args, var& result) const
bool findAndInvokeMethod (const Identifier& function, const var::NativeFunctionArgs& args, var& result) const
{
DynamicObject* target = args.thisObject.getDynamicObject();
@@ -352,7 +352,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
struct UnqualifiedName : public Expression
{
UnqualifiedName (const CodeLocation& l, Identifier n) noexcept : Expression (l), name (n) {}
UnqualifiedName (const CodeLocation& l, const Identifier& n) noexcept : Expression (l), name (n) {}
var getResult (const Scope& s) const override { return s.findSymbolInParentScopes (name); }
@@ -369,7 +369,7 @@ struct JavascriptEngine::RootObject : public DynamicObject
struct DotOperator : public Expression
{
DotOperator (const CodeLocation& l, ExpPtr& p, Identifier c) noexcept : Expression (l), parent (p), child (c) {}
DotOperator (const CodeLocation& l, ExpPtr& p, const Identifier& c) noexcept : Expression (l), parent (p), child (c) {}
var getResult (const Scope& s) const override
{
@@ -1670,7 +1670,7 @@ JavascriptEngine::~JavascriptEngine() {}
void JavascriptEngine::prepareTimeout() const noexcept { root->timeout = Time::getCurrentTime() + maximumExecutionTime; }
void JavascriptEngine::registerNativeObject (Identifier name, DynamicObject* object)
void JavascriptEngine::registerNativeObject (const Identifier& name, DynamicObject* object)
{
root->setProperty (name, object);
}
@@ -1706,7 +1706,7 @@ var JavascriptEngine::evaluate (const String& code, Result* result)
return var::undefined();
}
var JavascriptEngine::callFunction (Identifier function, const var::NativeFunctionArgs& args, Result* result)
var JavascriptEngine::callFunction (const Identifier& function, const var::NativeFunctionArgs& args, Result* result)
{
var returnVal (var::undefined());


+ 2
- 2
libs/juce/source/modules/juce_core/javascript/juce_Javascript.h View File

@@ -78,7 +78,7 @@ public:
The function arguments are passed in the same format as used by native
methods in the var class.
*/
var callFunction (Identifier function,
var callFunction (const Identifier& function,
const var::NativeFunctionArgs& args,
Result* errorMessage = nullptr);
@@ -87,7 +87,7 @@ public:
engine until the engine is deleted. The name must be a simple JS identifier,
without any dots.
*/
void registerNativeObject (Identifier objectName, DynamicObject* object);
void registerNativeObject (const Identifier& objectName, DynamicObject* object);
/** This value indicates how long a call to one of the evaluate methods is permitted
to run before timing-out and failing.


+ 12
- 0
libs/juce/source/modules/juce_core/network/juce_URL.h View File

@@ -248,6 +248,9 @@ public:
/** Attempts to open a stream that can read from this URL.
Note that on some platforms (Android, for example) it's not permitted to do any network
action from the message thread, so you must only call it from a background thread.
@param usePostCommand if true, it will try to do use a http 'POST' to pass
the parameters, otherwise it'll encode them into the
URL and do a 'GET'.
@@ -287,6 +290,9 @@ public:
If it succeeds, this will return true and append the data it read onto the end
of the memory block.
Note that on some platforms (Android, for example) it's not permitted to do any network
action from the message thread, so you must only call it from a background thread.
@param destData the memory block to append the new data to
@param usePostCommand whether to use a POST command to get the data (uses
a GET command if this is false)
@@ -302,6 +308,9 @@ public:
operation that fails and one that returns an empty string, you'll need to use
a different method, such as readEntireBinaryStream().
Note that on some platforms (Android, for example) it's not permitted to do any network
action from the message thread, so you must only call it from a background thread.
@param usePostCommand whether to use a POST command to get the data (uses
a GET command if this is false)
@see readEntireBinaryStream, readEntireXmlStream
@@ -316,6 +325,9 @@ public:
When it returns a valid XmlElement object, the caller is responsibile for deleting
this object when no longer needed.
Note that on some platforms (Android, for example) it's not permitted to do any network
action from the message thread, so you must only call it from a background thread.
@param usePostCommand whether to use a POST command to get the data (uses
a GET command if this is false)


+ 11
- 1
libs/juce/source/modules/juce_core/text/juce_Identifier.cpp View File

@@ -31,7 +31,17 @@ Identifier::~Identifier() noexcept {}
Identifier::Identifier (const Identifier& other) noexcept : name (other.name) {}
Identifier& Identifier::operator= (const Identifier other) noexcept
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
Identifier::Identifier (Identifier&& other) noexcept : name (static_cast<String&&> (other.name)) {}
Identifier& Identifier::operator= (Identifier&& other) noexcept
{
name = static_cast<String&&> (other.name);
return *this;
}
#endif
Identifier& Identifier::operator= (const Identifier& other) noexcept
{
name = other.name;
return *this;


+ 11
- 3
libs/juce/source/modules/juce_core/text/juce_Identifier.h View File

@@ -68,16 +68,24 @@ public:
Identifier (const Identifier& other) noexcept;
/** Creates a copy of another identifier. */
Identifier& operator= (const Identifier other) noexcept;
Identifier& operator= (const Identifier& other) noexcept;
#if JUCE_COMPILER_SUPPORTS_MOVE_SEMANTICS
/** Creates a copy of another identifier. */
Identifier (Identifier&& other) noexcept;
/** Creates a copy of another identifier. */
Identifier& operator= (Identifier&& other) noexcept;
#endif
/** Destructor */
~Identifier() noexcept;
/** Compares two identifiers. This is a very fast operation. */
inline bool operator== (Identifier other) const noexcept { return name.getCharPointer() == other.name.getCharPointer(); }
inline bool operator== (const Identifier& other) const noexcept { return name.getCharPointer() == other.name.getCharPointer(); }
/** Compares two identifiers. This is a very fast operation. */
inline bool operator!= (Identifier other) const noexcept { return name.getCharPointer() != other.name.getCharPointer(); }
inline bool operator!= (const Identifier& other) const noexcept { return name.getCharPointer() != other.name.getCharPointer(); }
/** Compares the identifier with a string. */
inline bool operator== (StringRef other) const noexcept { return name == other; }


+ 23
- 24
libs/juce/source/modules/juce_data_structures/values/juce_ValueTree.cpp View File

@@ -27,7 +27,7 @@ class ValueTree::SharedObject : public ReferenceCountedObject
public:
typedef ReferenceCountedObjectPtr<SharedObject> Ptr;
explicit SharedObject (Identifier t) noexcept
explicit SharedObject (const Identifier& t) noexcept
: type (t), parent (nullptr)
{
}
@@ -126,7 +126,7 @@ public:
}
}
void sendPropertyChangeMessage (const Identifier property)
void sendPropertyChangeMessage (const Identifier& property)
{
ValueTree tree (this);
@@ -169,7 +169,7 @@ public:
callListeners (&ValueTree::Listener::valueTreeParentChanged, tree);
}
void setProperty (const Identifier name, const var& newValue, UndoManager* const undoManager)
void setProperty (const Identifier& name, const var& newValue, UndoManager* const undoManager)
{
if (undoManager == nullptr)
{
@@ -190,12 +190,12 @@ public:
}
}
bool hasProperty (const Identifier name) const noexcept
bool hasProperty (const Identifier& name) const noexcept
{
return properties.contains (name);
}
void removeProperty (const Identifier name, UndoManager* const undoManager)
void removeProperty (const Identifier& name, UndoManager* const undoManager)
{
if (undoManager == nullptr)
{
@@ -238,7 +238,7 @@ public:
setProperty (source.properties.getName(i), source.properties.getValueAt(i), undoManager);
}
ValueTree getChildWithName (const Identifier typeToMatch) const
ValueTree getChildWithName (const Identifier& typeToMatch) const
{
for (int i = 0; i < children.size(); ++i)
{
@@ -250,7 +250,7 @@ public:
return ValueTree();
}
ValueTree getOrCreateChildWithName (const Identifier typeToMatch, UndoManager* undoManager)
ValueTree getOrCreateChildWithName (const Identifier& typeToMatch, UndoManager* undoManager)
{
for (int i = 0; i < children.size(); ++i)
{
@@ -265,7 +265,7 @@ public:
}
ValueTree getChildWithProperty (const Identifier propertyName, const var& propertyValue) const
ValueTree getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const
{
for (int i = 0; i < children.size(); ++i)
{
@@ -458,7 +458,7 @@ public:
class SetPropertyAction : public UndoableAction
{
public:
SetPropertyAction (SharedObject* const so, const Identifier propertyName,
SetPropertyAction (SharedObject* const so, const Identifier& propertyName,
const var& newVal, const var& oldVal, bool isAdding, bool isDeleting)
: target (so), name (propertyName), newValue (newVal), oldValue (oldVal),
isAddingNewProperty (isAdding), isDeletingProperty (isDeleting)
@@ -629,7 +629,7 @@ ValueTree::ValueTree() noexcept
const ValueTree ValueTree::invalid;
ValueTree::ValueTree (Identifier type) : object (new ValueTree::SharedObject (type))
ValueTree::ValueTree (const Identifier& type) : object (new ValueTree::SharedObject (type))
{
jassert (type.toString().isNotEmpty()); // All objects must be given a sensible type name!
}
@@ -702,7 +702,7 @@ ValueTree ValueTree::createCopy() const
return ValueTree (createCopyIfNotNull (object.get()));
}
bool ValueTree::hasType (const Identifier typeName) const
bool ValueTree::hasType (const Identifier& typeName) const
{
return object != nullptr && object->type == typeName;
}
@@ -727,24 +727,23 @@ ValueTree ValueTree::getSibling (const int delta) const
return ValueTree (object->parent->children.getObjectPointer (index));
}
const var& ValueTree::operator[] (const Identifier name) const
const var& ValueTree::operator[] (const Identifier& name) const
{
return object == nullptr ? var::null : object->properties[name];
}
const var& ValueTree::getProperty (const Identifier name) const
const var& ValueTree::getProperty (const Identifier& name) const
{
return object == nullptr ? var::null : object->properties[name];
}
var ValueTree::getProperty (const Identifier name, const var& defaultReturnValue) const
var ValueTree::getProperty (const Identifier& name, const var& defaultReturnValue) const
{
return object == nullptr ? defaultReturnValue
: object->properties.getWithDefault (name, defaultReturnValue);
}
ValueTree& ValueTree::setProperty (const Identifier name, const var& newValue,
UndoManager* const undoManager)
ValueTree& ValueTree::setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager)
{
jassert (name.toString().isNotEmpty()); // Must have a valid property name!
jassert (object != nullptr); // Trying to add a property to a null ValueTree will fail!
@@ -755,12 +754,12 @@ ValueTree& ValueTree::setProperty (const Identifier name, const var& newValue,
return *this;
}
bool ValueTree::hasProperty (const Identifier name) const
bool ValueTree::hasProperty (const Identifier& name) const
{
return object != nullptr && object->hasProperty (name);
}
void ValueTree::removeProperty (const Identifier name, UndoManager* const undoManager)
void ValueTree::removeProperty (const Identifier& name, UndoManager* const undoManager)
{
if (object != nullptr)
object->removeProperty (name, undoManager);
@@ -803,7 +802,7 @@ class ValueTreePropertyValueSource : public Value::ValueSource,
private ValueTree::Listener
{
public:
ValueTreePropertyValueSource (const ValueTree& vt, const Identifier prop, UndoManager* um)
ValueTreePropertyValueSource (const ValueTree& vt, const Identifier& prop, UndoManager* um)
: tree (vt), property (prop), undoManager (um)
{
tree.addListener (this);
@@ -836,7 +835,7 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ValueTreePropertyValueSource)
};
Value ValueTree::getPropertyAsValue (const Identifier name, UndoManager* const undoManager)
Value ValueTree::getPropertyAsValue (const Identifier& name, UndoManager* const undoManager)
{
return Value (new ValueTreePropertyValueSource (*this, name, undoManager));
}
@@ -853,17 +852,17 @@ ValueTree ValueTree::getChild (int index) const
: static_cast<SharedObject*> (nullptr));
}
ValueTree ValueTree::getChildWithName (const Identifier type) const
ValueTree ValueTree::getChildWithName (const Identifier& type) const
{
return object != nullptr ? object->getChildWithName (type) : ValueTree();
}
ValueTree ValueTree::getOrCreateChildWithName (const Identifier type, UndoManager* undoManager)
ValueTree ValueTree::getOrCreateChildWithName (const Identifier& type, UndoManager* undoManager)
{
return object != nullptr ? object->getOrCreateChildWithName (type, undoManager) : ValueTree();
}
ValueTree ValueTree::getChildWithProperty (const Identifier propertyName, const var& propertyValue) const
ValueTree ValueTree::getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const
{
return object != nullptr ? object->getChildWithProperty (propertyName, propertyValue) : ValueTree();
}
@@ -945,7 +944,7 @@ void ValueTree::removeListener (Listener* listener)
object->valueTreesWithListeners.removeValue (this);
}
void ValueTree::sendPropertyChangeMessage (const Identifier property)
void ValueTree::sendPropertyChangeMessage (const Identifier& property)
{
if (object != nullptr)
object->sendPropertyChangeMessage (property);


+ 13
- 13
libs/juce/source/modules/juce_data_structures/values/juce_ValueTree.h View File

@@ -79,7 +79,7 @@ public:
Like an XmlElement, each ValueTree node has a type, which you can access with
getType() and hasType().
*/
explicit ValueTree (Identifier type);
explicit ValueTree (const Identifier& type);
/** Creates a reference to another ValueTree. */
ValueTree (const ValueTree&);
@@ -134,7 +134,7 @@ public:
/** Returns true if the node has this type.
The comparison is case-sensitive.
*/
bool hasType (const Identifier typeName) const;
bool hasType (const Identifier& typeName) const;
//==============================================================================
/** Returns the value of a named property.
@@ -142,21 +142,21 @@ public:
You can also use operator[] to get a property.
@see var, setProperty, hasProperty
*/
const var& getProperty (const Identifier name) const;
const var& getProperty (const Identifier& name) const;
/** Returns the value of a named property, or a user-specified default if the property doesn't exist.
If no such property has been set, this will return the value of defaultReturnValue.
You can also use operator[] and getProperty to get a property.
@see var, getProperty, setProperty, hasProperty
*/
var getProperty (const Identifier name, const var& defaultReturnValue) const;
var getProperty (const Identifier& name, const var& defaultReturnValue) const;
/** Returns the value of a named property.
If no such property has been set, this will return a void variant. This is the same as
calling getProperty().
@see getProperty
*/
const var& operator[] (const Identifier name) const;
const var& operator[] (const Identifier& name) const;
/** Changes a named property of the node.
The name identifier must not be an empty string.
@@ -165,16 +165,16 @@ public:
@see var, getProperty, removeProperty
@returns a reference to the value tree, so that you can daisy-chain calls to this method.
*/
ValueTree& setProperty (const Identifier name, const var& newValue, UndoManager* undoManager);
ValueTree& setProperty (const Identifier& name, const var& newValue, UndoManager* undoManager);
/** Returns true if the node contains a named property. */
bool hasProperty (const Identifier name) const;
bool hasProperty (const Identifier& name) const;
/** Removes a property from the node.
If the undoManager parameter is non-null, its UndoManager::perform() method will be used,
so that this change can be undone.
*/
void removeProperty (const Identifier name, UndoManager* undoManager);
void removeProperty (const Identifier& name, UndoManager* undoManager);
/** Removes all properties from the node.
If the undoManager parameter is non-null, its UndoManager::perform() method will be used,
@@ -198,7 +198,7 @@ public:
it needs to change the value. Attaching a Value::Listener to the value object will provide
callbacks whenever the property changes.
*/
Value getPropertyAsValue (const Identifier name, UndoManager* undoManager);
Value getPropertyAsValue (const Identifier& name, UndoManager* undoManager);
/** Overwrites all the properties in this tree with the properties of the source tree.
Any properties that already exist will be updated; and new ones will be added, and
@@ -223,7 +223,7 @@ public:
whether a node is valid).
@see getOrCreateChildWithName
*/
ValueTree getChildWithName (const Identifier type) const;
ValueTree getChildWithName (const Identifier& type) const;
/** Returns the first child node with the speficied type name, creating and adding
a child with this name if there wasn't already one there.
@@ -232,7 +232,7 @@ public:
the method on is itself invalid.
@see getChildWithName
*/
ValueTree getOrCreateChildWithName (const Identifier type, UndoManager* undoManager);
ValueTree getOrCreateChildWithName (const Identifier& type, UndoManager* undoManager);
/** Looks for the first child node that has the speficied property value.
@@ -242,7 +242,7 @@ public:
If no such node is found, it'll return an invalid node. (See isValid() to find out
whether a node is valid).
*/
ValueTree getChildWithProperty (const Identifier propertyName, const var& propertyValue) const;
ValueTree getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const;
/** Adds a child to this node.
@@ -453,7 +453,7 @@ public:
/** Causes a property-change callback to be triggered for the specified property,
calling any listeners that are registered.
*/
void sendPropertyChangeMessage (const Identifier property);
void sendPropertyChangeMessage (const Identifier& property);
//==============================================================================
/** This method uses a comparator object to sort the tree's children into order.


+ 4
- 2
libs/juce/source/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp View File

@@ -387,7 +387,7 @@ void FileBrowserComponent::fileDoubleClicked (const File& f)
{
setRoot (f);
if ((flags & canSelectDirectories) != 0)
if ((flags & canSelectDirectories) != 0 && (flags & doNotClearFileNameOnRootChange) == 0)
filenameBox.setText (String::empty);
}
else
@@ -432,7 +432,9 @@ void FileBrowserComponent::textEditorReturnKeyPressed (TextEditor&)
{
setRoot (f);
chosenFiles.clear();
filenameBox.setText (String::empty);
if ((flags & doNotClearFileNameOnRootChange) == 0)
filenameBox.setText (String());
}
else
{


+ 13
- 12
libs/juce/source/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h View File

@@ -51,18 +51,19 @@ public:
*/
enum FileChooserFlags
{
openMode = 1, /**< specifies that the component should allow the user to
choose an existing file with the intention of opening it. */
saveMode = 2, /**< specifies that the component should allow the user to specify
the name of a file that will be used to save something. */
canSelectFiles = 4, /**< specifies that the user can select files (can be used in
conjunction with canSelectDirectories). */
canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
conjuction with canSelectFiles). */
canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
filenameBoxIsReadOnly = 64, /**< specifies that the user can't type directly into the filename box. */
warnAboutOverwriting = 128 /**< specifies that the dialog should warn about overwriting existing files (if possible). */
openMode = 1, /**< specifies that the component should allow the user to
choose an existing file with the intention of opening it. */
saveMode = 2, /**< specifies that the component should allow the user to specify
the name of a file that will be used to save something. */
canSelectFiles = 4, /**< specifies that the user can select files (can be used in
conjunction with canSelectDirectories). */
canSelectDirectories = 8, /**< specifies that the user can select directories (can be used in
conjuction with canSelectFiles). */
canSelectMultipleItems = 16, /**< specifies that the user can select multiple items. */
useTreeView = 32, /**< specifies that a tree-view should be shown instead of a file list. */
filenameBoxIsReadOnly = 64, /**< specifies that the user can't type directly into the filename box. */
warnAboutOverwriting = 128, /**< specifies that the dialog should warn about overwriting existing files (if possible). */
doNotClearFileNameOnRootChange = 256 /**< specifies that the file name should not be cleared upon root change. */
};
//==============================================================================


+ 1
- 31
libs/juce/source/modules/juce_gui_basics/layout/juce_Viewport.cpp View File

@@ -24,13 +24,13 @@
Viewport::Viewport (const String& name)
: Component (name),
customScrollBarThickness(false),
scrollBarThickness (0),
singleStepX (16),
singleStepY (16),
showHScrollbar (true),
showVScrollbar (true),
deleteContent (true),
customScrollBarThickness (false),
allowScrollingWithoutScrollbarV (false),
allowScrollingWithoutScrollbarH (false),
verticalScrollBar (true),
@@ -55,7 +55,6 @@ Viewport::Viewport (const String& name)
Viewport::~Viewport()
{
deleteContentComp();
mouseWheelTimer = nullptr;
}
//==============================================================================
@@ -382,30 +381,6 @@ static int rescaleMouseWheelDistance (float distance, int singleStepSize) noexce
: jmax (distance, 1.0f));
}
// This puts a temporary component overlay over the content component, to prevent
// wheel events from reaching components inside it, so that while spinning a wheel
// with momentum, it won't accidentally scroll any subcomponents of the viewport.
struct Viewport::MouseWheelTimer : public Timer
{
MouseWheelTimer (Viewport& v) : viewport (v)
{
viewport.contentHolder.addAndMakeVisible (dummyOverlay);
dummyOverlay.setAlwaysOnTop (true);
dummyOverlay.setPaintingIsUnclipped (true);
dummyOverlay.setBounds (viewport.contentHolder.getLocalBounds());
}
void timerCallback() override
{
viewport.mouseWheelTimer = nullptr;
}
Component dummyOverlay;
Viewport& viewport;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MouseWheelTimer)
};
bool Viewport::useMouseWheelMoveIfNeeded (const MouseEvent& e, const MouseWheelDetails& wheel)
{
if (! (e.mods.isAltDown() || e.mods.isCtrlDown() || e.mods.isCommandDown()))
@@ -436,11 +411,6 @@ bool Viewport::useMouseWheelMoveIfNeeded (const MouseEvent& e, const MouseWheelD
if (pos != getViewPosition())
{
if (mouseWheelTimer == nullptr)
mouseWheelTimer = new MouseWheelTimer (*this);
mouseWheelTimer->startTimer (300);
setViewPosition (pos);
return true;
}


+ 1
- 3
libs/juce/source/modules/juce_gui_basics/layout/juce_Viewport.h View File

@@ -263,15 +263,13 @@ private:
//==============================================================================
WeakReference<Component> contentComp;
Rectangle<int> lastVisibleArea;
bool customScrollBarThickness;
int scrollBarThickness;
int singleStepX, singleStepY;
bool showHScrollbar, showVScrollbar, deleteContent;
bool customScrollBarThickness;
bool allowScrollingWithoutScrollbarV, allowScrollingWithoutScrollbarH;
Component contentHolder;
ScrollBar verticalScrollBar, horizontalScrollBar;
struct MouseWheelTimer;
ScopedPointer<Timer> mouseWheelTimer;
Point<int> viewportPosToCompPos (Point<int>) const;


+ 4
- 0
libs/juce/source/modules/juce_gui_basics/mouse/juce_MouseEvent.h View File

@@ -354,6 +354,10 @@ struct MouseWheelDetails
/** If true, then the wheel has continuous, un-stepped motion. */
bool isSmooth;
/** If true, then this event is part of the intertial momentum phase that follows
the wheel being released. */
bool isInertial;
};


+ 12
- 4
libs/juce/source/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp View File

@@ -331,10 +331,17 @@ public:
Time time, const MouseWheelDetails& wheel)
{
Desktop::getInstance().incrementMouseWheelCounter();
Point<float> screenPos;
if (Component* current = getTargetForGesture (peer, positionWithinPeer, time, screenPos))
sendMouseWheel (*current, screenPos, time, wheel);
// This will make sure that when the wheel spins in its inertial phase, any events
// continue to be sent to the last component that the mouse was over when it was being
// actively controlled by the user. This avoids confusion when scrolling through nested
// scrollable components.
if (lastNonInertialWheelTarget == nullptr || ! wheel.isInertial)
lastNonInertialWheelTarget = getTargetForGesture (peer, positionWithinPeer, time, screenPos);
if (Component* target = lastNonInertialWheelTarget)
sendMouseWheel (*target, screenPos, time, wheel);
}
void handleMagnifyGesture (ComponentPeer& peer, Point<float> positionWithinPeer,
@@ -467,7 +474,7 @@ public:
bool isUnboundedMouseModeOn, isCursorVisibleUntilOffscreen;
private:
WeakReference<Component> componentUnderMouse;
WeakReference<Component> componentUnderMouse, lastNonInertialWheelTarget;
ComponentPeer* lastPeer;
void* currentCursorHandle;
@@ -512,6 +519,7 @@ private:
mouseDowns[0].peerID = 0;
mouseMovedSignificantlySincePressed = false;
lastNonInertialWheelTarget = nullptr;
}
void registerMouseDrag (Point<float> screenPos) noexcept


+ 7
- 6
libs/juce/source/modules/juce_gui_basics/native/juce_linux_Windowing.cpp View File

@@ -978,9 +978,9 @@ private:
//==============================================================================
#if JUCE_USE_XRANDR
friend class ContainerDeletePolicy<XRRScreenResources>;
friend class ContainerDeletePolicy<XRROutputInfo>;
friend class ContainerDeletePolicy<XRRCrtcInfo>;
friend struct ContainerDeletePolicy<XRRScreenResources>;
friend struct ContainerDeletePolicy<XRROutputInfo>;
friend struct ContainerDeletePolicy<XRRCrtcInfo>;
class XRandrWrapper
{
@@ -1062,9 +1062,9 @@ private:
private:
//==============================================================================
friend class ContainerDeletePolicy<XRRScreenResources>;
friend class ContainerDeletePolicy<XRROutputInfo>;
friend class ContainerDeletePolicy<XRRCrtcInfo>;
friend struct ContainerDeletePolicy<XRRScreenResources>;
friend struct ContainerDeletePolicy<XRROutputInfo>;
friend struct ContainerDeletePolicy<XRRCrtcInfo>;
void freeScreenResources (XRRScreenResources* ptr)
{
@@ -2209,6 +2209,7 @@ public:
wheel.deltaY = amount;
wheel.isReversed = false;
wheel.isSmooth = false;
wheel.isInertial = false;
handleMouseWheel (0, getMousePos (buttonPressEvent), getEventTime (buttonPressEvent), wheel);
}


+ 8
- 4
libs/juce/source/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -497,10 +497,7 @@ public:
void toBehind (ComponentPeer* other) override
{
NSViewComponentPeer* const otherPeer = dynamic_cast<NSViewComponentPeer*> (other);
jassert (otherPeer != nullptr); // wrong type of window?
if (otherPeer != nullptr)
if (NSViewComponentPeer* const otherPeer = dynamic_cast<NSViewComponentPeer*> (other))
{
if (isSharedWindow)
{
@@ -514,6 +511,10 @@ public:
relativeTo: [otherPeer->window windowNumber]];
}
}
else
{
jassertfalse; // wrong type of window?
}
}
void setIcon (const Image&) override
@@ -620,6 +621,7 @@ public:
wheel.deltaY = 0;
wheel.isReversed = false;
wheel.isSmooth = false;
wheel.isInertial = false;
#if ! JUCE_PPC
@try
@@ -628,6 +630,8 @@ public:
if ([ev respondsToSelector: @selector (isDirectionInvertedFromDevice)])
wheel.isReversed = [ev isDirectionInvertedFromDevice];
wheel.isInertial = ([ev momentumPhase] != NSEventPhaseNone);
if ([ev respondsToSelector: @selector (hasPreciseScrollingDeltas)])
{
if ([ev hasPreciseScrollingDeltas])


+ 1
- 0
libs/juce/source/modules/juce_gui_basics/native/juce_win32_Windowing.cpp View File

@@ -1820,6 +1820,7 @@ private:
wheel.deltaY = isVertical ? amount / 256.0f : 0.0f;
wheel.isReversed = false;
wheel.isSmooth = false;
wheel.isInertial = false;
Point<float> localPos;
if (ComponentPeer* const peer = findPeerUnderMouse (localPos))


+ 13
- 17
libs/juce/source/modules/juce_gui_extra/misc/juce_LiveConstantEditor.cpp View File

@@ -32,13 +32,10 @@ class AllComponentRepainter : private Timer,
private DeletedAtShutdown
{
public:
AllComponentRepainter() {}
AllComponentRepainter() {}
~AllComponentRepainter() { clearSingletonInstance(); }
static AllComponentRepainter& getInstance()
{
static AllComponentRepainter* instance = new AllComponentRepainter();
return *instance;
}
juce_DeclareSingleton (AllComponentRepainter, false)
void trigger()
{
@@ -57,8 +54,10 @@ private:
if (Component* c = TopLevelWindow::getTopLevelWindow(i))
repaintAndResizeAllComps (c, alreadyDone);
for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
if (Component* c = Desktop::getInstance().getComponent(i))
Desktop& desktop = Desktop::getInstance();
for (int i = desktop.getNumComponents(); --i >= 0;)
if (Component* c = desktop.getComponent(i))
repaintAndResizeAllComps (c, alreadyDone);
}
@@ -85,6 +84,9 @@ private:
}
};
juce_ImplementSingleton (AllComponentRepainter)
juce_ImplementSingleton (ValueList)
//==============================================================================
int64 parseInt (String s)
{
@@ -189,7 +191,7 @@ void LivePropertyEditorBase::applyNewValue (const String& s)
selectOriginalValue();
valueEditor.setText (s, dontSendNotification);
AllComponentRepainter::getInstance().trigger();
AllComponentRepainter::getInstance()->trigger();
}
void LivePropertyEditorBase::selectOriginalValue()
@@ -347,14 +349,8 @@ public:
};
//==============================================================================
ValueList::ValueList() {}
ValueList::~ValueList() {}
ValueList& ValueList::getInstance()
{
static ValueList* i = new ValueList();
return *i;
}
ValueList::ValueList() {}
ValueList::~ValueList() { clearSingletonInstance(); }
void ValueList::addValue (LiveValueBase* v)
{


+ 2
- 2
libs/juce/source/modules/juce_gui_extra/misc/juce_LiveConstantEditor.h View File

@@ -194,7 +194,7 @@ namespace LiveConstantEditor
ValueList();
~ValueList();
static ValueList& getInstance();
juce_DeclareSingleton (ValueList, false)
template <typename Type>
LiveValue<Type>& getValue (const char* file, int line, const Type& initialValue)
@@ -233,7 +233,7 @@ namespace LiveConstantEditor
template <typename Type>
inline LiveValue<Type>& getValue (const char* file, int line, const Type& initialValue)
{
return ValueList::getInstance().getValue (file, line, initialValue);
return ValueList::getInstance()->getValue (file, line, initialValue);
}
inline LiveValue<String>& getValue (const char* file, int line, const char* initialValue)


Loading…
Cancel
Save