diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 604708f9c5..75f4db1e23 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -84317,6 +84317,11 @@ ValueTree DrawableComposite::ValueTreeWrapper::getDrawableWithId (const String& } } +int DrawableComposite::ValueTreeWrapper::indexOfDrawable (const ValueTree& item) const +{ + return getChildList().indexOf (item); +} + void DrawableComposite::ValueTreeWrapper::addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager) { getChildListCreating (undoManager).addChild (newDrawableState, index, undoManager); @@ -84327,9 +84332,9 @@ void DrawableComposite::ValueTreeWrapper::moveDrawableOrder (int currentIndex, i getChildListCreating (undoManager).moveChild (currentIndex, newIndex, undoManager); } -void DrawableComposite::ValueTreeWrapper::removeDrawable (int index, UndoManager* undoManager) +void DrawableComposite::ValueTreeWrapper::removeDrawable (const ValueTree& child, UndoManager* undoManager) { - getChildList().removeChild (index, undoManager); + getChildList().removeChild (child, undoManager); } const RelativePoint DrawableComposite::ValueTreeWrapper::getTargetPositionForOrigin() const @@ -85156,6 +85161,16 @@ void DrawablePath::ValueTreeWrapper::Element::setControlPoint (const int index, return state.setProperty (index == 0 ? point1 : (index == 1 ? point2 : point3), point.toString(), undoManager); } +const RelativePoint DrawablePath::ValueTreeWrapper::Element::getEndPoint() const +{ + const Identifier i (state.getType()); + if (i == startSubPathElement || i == lineToElement) return getControlPoint (0); + if (i == quadraticToElement) return getControlPoint (1); + if (i == cubicToElement) return getControlPoint (2); + + return RelativePoint(); +} + const Rectangle DrawablePath::refreshFromValueTree (const ValueTree& tree, ImageProvider*) { Rectangle damageRect; diff --git a/juce_amalgamated.h b/juce_amalgamated.h index d9ca0dc8c8..3ac9fc3fa6 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 8 +#define JUCE_BUILDNUMBER 9 /** Current Juce version number. @@ -53789,6 +53789,7 @@ class JUCE_API SelectedItemSet : public ChangeBroadcaster public: typedef SelectableItemType ItemType; + typedef PARAMETER_TYPE (SelectableItemType) ParameterType; /** Creates an empty set. */ SelectedItemSet() @@ -53831,7 +53832,7 @@ public: @see addToSelection, addToSelectionBasedOnModifiers */ - void selectOnly (SelectableItemType item) + void selectOnly (ParameterType item) { if (isSelected (item)) { @@ -53860,7 +53861,7 @@ public: @see selectOnly, addToSelectionBasedOnModifiers */ - void addToSelection (SelectableItemType item) + void addToSelection (ParameterType item) { if (! isSelected (item)) { @@ -53892,7 +53893,7 @@ public: @see selectOnly, addToSelection, addToSelectionOnMouseDown, addToSelectionOnMouseUp */ - void addToSelectionBasedOnModifiers (SelectableItemType item, + void addToSelectionBasedOnModifiers (ParameterType item, const ModifierKeys& modifiers) { if (modifiers.isShiftDown()) @@ -53929,7 +53930,7 @@ public: @see addToSelectionOnMouseUp, addToSelectionBasedOnModifiers */ - bool addToSelectionOnMouseDown (SelectableItemType item, + bool addToSelectionOnMouseDown (ParameterType item, const ModifierKeys& modifiers) { if (isSelected (item)) @@ -53957,7 +53958,7 @@ public: back from the addToSelectionOnMouseDown() call that you should have made during the matching mouseDown event */ - void addToSelectionOnMouseUp (SelectableItemType item, + void addToSelectionOnMouseUp (ParameterType item, const ModifierKeys& modifiers, const bool wasItemDragged, const bool resultOfMouseDownSelectMethod) @@ -53967,7 +53968,7 @@ public: } /** Deselects an item. */ - void deselect (SelectableItemType item) + void deselect (ParameterType item) { const int i = selectedItems.indexOf (item); @@ -54014,7 +54015,7 @@ public: } /** True if this item is currently selected. */ - bool isSelected (const SelectableItemType item) const throw() + bool isSelected (const ParameterType item) const throw() { return selectedItems.contains (item); } @@ -56364,6 +56365,12 @@ public: */ void* getNativeWindowHandle() const; + /** Call this to manually delete the current GL context, if there is one. + This can be useful to cause a clear-out of the context, which will be automatically + re-created when it's needed. + */ + void deleteContext(); + juce_UseDebuggingNewOperator private: @@ -56381,7 +56388,6 @@ private: bool needToUpdateViewport; OpenGLContext* createContext(); - void deleteContext(); void updateContextPosition(); void internalRepaint (int x, int y, int w, int h); @@ -58364,9 +58370,10 @@ public: int getNumDrawables() const; ValueTree getDrawableState (int index) const; ValueTree getDrawableWithId (const String& objectId, bool recursive) const; + int indexOfDrawable (const ValueTree& item) const; void addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager); void moveDrawableOrder (int currentIndex, int newIndex, UndoManager* undoManager); - void removeDrawable (int index, UndoManager* undoManager); + void removeDrawable (const ValueTree& child, UndoManager* undoManager); const RelativePoint getTargetPositionForOrigin() const; void setTargetPositionForOrigin (const RelativePoint& newPoint, UndoManager* undoManager); @@ -58683,6 +58690,7 @@ public: int getNumControlPoints() const throw(); const RelativePoint getControlPoint (int index) const; + const RelativePoint getEndPoint() const; void setControlPoint (int index, const RelativePoint& point, UndoManager* undoManager); static const Identifier startSubPathElement, closeSubPathElement, diff --git a/src/core/juce_StandardHeader.h b/src/core/juce_StandardHeader.h index 2f8550bc1c..345a715a00 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 8 +#define JUCE_BUILDNUMBER 9 /** Current Juce version number. diff --git a/src/gui/components/special/juce_OpenGLComponent.h b/src/gui/components/special/juce_OpenGLComponent.h index 084a8019ee..8a68a72d21 100644 --- a/src/gui/components/special/juce_OpenGLComponent.h +++ b/src/gui/components/special/juce_OpenGLComponent.h @@ -330,6 +330,12 @@ public: */ void* getNativeWindowHandle() const; + /** Call this to manually delete the current GL context, if there is one. + This can be useful to cause a clear-out of the context, which will be automatically + re-created when it's needed. + */ + void deleteContext(); + juce_UseDebuggingNewOperator private: @@ -347,7 +353,6 @@ private: bool needToUpdateViewport; OpenGLContext* createContext(); - void deleteContext(); void updateContextPosition(); void internalRepaint (int x, int y, int w, int h); diff --git a/src/gui/graphics/drawables/juce_DrawableComposite.cpp b/src/gui/graphics/drawables/juce_DrawableComposite.cpp index 12a14290f5..e16f2967f8 100644 --- a/src/gui/graphics/drawables/juce_DrawableComposite.cpp +++ b/src/gui/graphics/drawables/juce_DrawableComposite.cpp @@ -406,6 +406,11 @@ ValueTree DrawableComposite::ValueTreeWrapper::getDrawableWithId (const String& } } +int DrawableComposite::ValueTreeWrapper::indexOfDrawable (const ValueTree& item) const +{ + return getChildList().indexOf (item); +} + void DrawableComposite::ValueTreeWrapper::addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager) { getChildListCreating (undoManager).addChild (newDrawableState, index, undoManager); @@ -416,9 +421,9 @@ void DrawableComposite::ValueTreeWrapper::moveDrawableOrder (int currentIndex, i getChildListCreating (undoManager).moveChild (currentIndex, newIndex, undoManager); } -void DrawableComposite::ValueTreeWrapper::removeDrawable (int index, UndoManager* undoManager) +void DrawableComposite::ValueTreeWrapper::removeDrawable (const ValueTree& child, UndoManager* undoManager) { - getChildList().removeChild (index, undoManager); + getChildList().removeChild (child, undoManager); } const RelativePoint DrawableComposite::ValueTreeWrapper::getTargetPositionForOrigin() const diff --git a/src/gui/graphics/drawables/juce_DrawableComposite.h b/src/gui/graphics/drawables/juce_DrawableComposite.h index 76b2099988..940424ebd5 100644 --- a/src/gui/graphics/drawables/juce_DrawableComposite.h +++ b/src/gui/graphics/drawables/juce_DrawableComposite.h @@ -198,9 +198,10 @@ public: int getNumDrawables() const; ValueTree getDrawableState (int index) const; ValueTree getDrawableWithId (const String& objectId, bool recursive) const; + int indexOfDrawable (const ValueTree& item) const; void addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager); void moveDrawableOrder (int currentIndex, int newIndex, UndoManager* undoManager); - void removeDrawable (int index, UndoManager* undoManager); + void removeDrawable (const ValueTree& child, UndoManager* undoManager); const RelativePoint getTargetPositionForOrigin() const; void setTargetPositionForOrigin (const RelativePoint& newPoint, UndoManager* undoManager); diff --git a/src/gui/graphics/drawables/juce_DrawablePath.cpp b/src/gui/graphics/drawables/juce_DrawablePath.cpp index a8f3caf60e..fcc1b69d30 100644 --- a/src/gui/graphics/drawables/juce_DrawablePath.cpp +++ b/src/gui/graphics/drawables/juce_DrawablePath.cpp @@ -319,6 +319,15 @@ void DrawablePath::ValueTreeWrapper::Element::setControlPoint (const int index, return state.setProperty (index == 0 ? point1 : (index == 1 ? point2 : point3), point.toString(), undoManager); } +const RelativePoint DrawablePath::ValueTreeWrapper::Element::getEndPoint() const +{ + const Identifier i (state.getType()); + if (i == startSubPathElement || i == lineToElement) return getControlPoint (0); + if (i == quadraticToElement) return getControlPoint (1); + if (i == cubicToElement) return getControlPoint (2); + + return RelativePoint(); +} //============================================================================== const Rectangle DrawablePath::refreshFromValueTree (const ValueTree& tree, ImageProvider*) diff --git a/src/gui/graphics/drawables/juce_DrawablePath.h b/src/gui/graphics/drawables/juce_DrawablePath.h index 0f15d06c24..b95f00a6b8 100644 --- a/src/gui/graphics/drawables/juce_DrawablePath.h +++ b/src/gui/graphics/drawables/juce_DrawablePath.h @@ -155,6 +155,7 @@ public: int getNumControlPoints() const throw(); const RelativePoint getControlPoint (int index) const; + const RelativePoint getEndPoint() const; void setControlPoint (int index, const RelativePoint& point, UndoManager* undoManager); static const Identifier startSubPathElement, closeSubPathElement, diff --git a/src/utilities/juce_SelectedItemSet.h b/src/utilities/juce_SelectedItemSet.h index 5226f5bae1..3cd7551962 100644 --- a/src/utilities/juce_SelectedItemSet.h +++ b/src/utilities/juce_SelectedItemSet.h @@ -50,6 +50,7 @@ class JUCE_API SelectedItemSet : public ChangeBroadcaster public: //============================================================================== typedef SelectableItemType ItemType; + typedef PARAMETER_TYPE (SelectableItemType) ParameterType; //============================================================================== /** Creates an empty set. */ @@ -94,7 +95,7 @@ public: @see addToSelection, addToSelectionBasedOnModifiers */ - void selectOnly (SelectableItemType item) + void selectOnly (ParameterType item) { if (isSelected (item)) { @@ -123,7 +124,7 @@ public: @see selectOnly, addToSelectionBasedOnModifiers */ - void addToSelection (SelectableItemType item) + void addToSelection (ParameterType item) { if (! isSelected (item)) { @@ -155,7 +156,7 @@ public: @see selectOnly, addToSelection, addToSelectionOnMouseDown, addToSelectionOnMouseUp */ - void addToSelectionBasedOnModifiers (SelectableItemType item, + void addToSelectionBasedOnModifiers (ParameterType item, const ModifierKeys& modifiers) { if (modifiers.isShiftDown()) @@ -192,7 +193,7 @@ public: @see addToSelectionOnMouseUp, addToSelectionBasedOnModifiers */ - bool addToSelectionOnMouseDown (SelectableItemType item, + bool addToSelectionOnMouseDown (ParameterType item, const ModifierKeys& modifiers) { if (isSelected (item)) @@ -220,7 +221,7 @@ public: back from the addToSelectionOnMouseDown() call that you should have made during the matching mouseDown event */ - void addToSelectionOnMouseUp (SelectableItemType item, + void addToSelectionOnMouseUp (ParameterType item, const ModifierKeys& modifiers, const bool wasItemDragged, const bool resultOfMouseDownSelectMethod) @@ -230,7 +231,7 @@ public: } /** Deselects an item. */ - void deselect (SelectableItemType item) + void deselect (ParameterType item) { const int i = selectedItems.indexOf (item); @@ -278,7 +279,7 @@ public: } /** True if this item is currently selected. */ - bool isSelected (const SelectableItemType item) const throw() + bool isSelected (const ParameterType item) const throw() { return selectedItems.contains (item); }