Browse Source

Minor changes to drawables and SelectedItemSet. Made OpenGLComponent::deleteContext public.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
e777282966
9 changed files with 69 additions and 24 deletions
  1. +17
    -2
      juce_amalgamated.cpp
  2. +18
    -10
      juce_amalgamated.h
  3. +1
    -1
      src/core/juce_StandardHeader.h
  4. +6
    -1
      src/gui/components/special/juce_OpenGLComponent.h
  5. +7
    -2
      src/gui/graphics/drawables/juce_DrawableComposite.cpp
  6. +2
    -1
      src/gui/graphics/drawables/juce_DrawableComposite.h
  7. +9
    -0
      src/gui/graphics/drawables/juce_DrawablePath.cpp
  8. +1
    -0
      src/gui/graphics/drawables/juce_DrawablePath.h
  9. +8
    -7
      src/utilities/juce_SelectedItemSet.h

+ 17
- 2
juce_amalgamated.cpp View File

@@ -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) void DrawableComposite::ValueTreeWrapper::addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager)
{ {
getChildListCreating (undoManager).addChild (newDrawableState, index, undoManager); getChildListCreating (undoManager).addChild (newDrawableState, index, undoManager);
@@ -84327,9 +84332,9 @@ void DrawableComposite::ValueTreeWrapper::moveDrawableOrder (int currentIndex, i
getChildListCreating (undoManager).moveChild (currentIndex, newIndex, undoManager); 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 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); 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<float> DrawablePath::refreshFromValueTree (const ValueTree& tree, ImageProvider*) const Rectangle<float> DrawablePath::refreshFromValueTree (const ValueTree& tree, ImageProvider*)
{ {
Rectangle<float> damageRect; Rectangle<float> damageRect;


+ 18
- 10
juce_amalgamated.h View File

@@ -64,7 +64,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 8
#define JUCE_BUILDNUMBER 9


/** Current Juce version number. /** Current Juce version number.


@@ -53789,6 +53789,7 @@ class JUCE_API SelectedItemSet : public ChangeBroadcaster
public: public:


typedef SelectableItemType ItemType; typedef SelectableItemType ItemType;
typedef PARAMETER_TYPE (SelectableItemType) ParameterType;


/** Creates an empty set. */ /** Creates an empty set. */
SelectedItemSet() SelectedItemSet()
@@ -53831,7 +53832,7 @@ public:


@see addToSelection, addToSelectionBasedOnModifiers @see addToSelection, addToSelectionBasedOnModifiers
*/ */
void selectOnly (SelectableItemType item)
void selectOnly (ParameterType item)
{ {
if (isSelected (item)) if (isSelected (item))
{ {
@@ -53860,7 +53861,7 @@ public:


@see selectOnly, addToSelectionBasedOnModifiers @see selectOnly, addToSelectionBasedOnModifiers
*/ */
void addToSelection (SelectableItemType item)
void addToSelection (ParameterType item)
{ {
if (! isSelected (item)) if (! isSelected (item))
{ {
@@ -53892,7 +53893,7 @@ public:


@see selectOnly, addToSelection, addToSelectionOnMouseDown, addToSelectionOnMouseUp @see selectOnly, addToSelection, addToSelectionOnMouseDown, addToSelectionOnMouseUp
*/ */
void addToSelectionBasedOnModifiers (SelectableItemType item,
void addToSelectionBasedOnModifiers (ParameterType item,
const ModifierKeys& modifiers) const ModifierKeys& modifiers)
{ {
if (modifiers.isShiftDown()) if (modifiers.isShiftDown())
@@ -53929,7 +53930,7 @@ public:


@see addToSelectionOnMouseUp, addToSelectionBasedOnModifiers @see addToSelectionOnMouseUp, addToSelectionBasedOnModifiers
*/ */
bool addToSelectionOnMouseDown (SelectableItemType item,
bool addToSelectionOnMouseDown (ParameterType item,
const ModifierKeys& modifiers) const ModifierKeys& modifiers)
{ {
if (isSelected (item)) if (isSelected (item))
@@ -53957,7 +53958,7 @@ public:
back from the addToSelectionOnMouseDown() call that you back from the addToSelectionOnMouseDown() call that you
should have made during the matching mouseDown event should have made during the matching mouseDown event
*/ */
void addToSelectionOnMouseUp (SelectableItemType item,
void addToSelectionOnMouseUp (ParameterType item,
const ModifierKeys& modifiers, const ModifierKeys& modifiers,
const bool wasItemDragged, const bool wasItemDragged,
const bool resultOfMouseDownSelectMethod) const bool resultOfMouseDownSelectMethod)
@@ -53967,7 +53968,7 @@ public:
} }


/** Deselects an item. */ /** Deselects an item. */
void deselect (SelectableItemType item)
void deselect (ParameterType item)
{ {
const int i = selectedItems.indexOf (item); const int i = selectedItems.indexOf (item);


@@ -54014,7 +54015,7 @@ public:
} }


/** True if this item is currently selected. */ /** 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); return selectedItems.contains (item);
} }
@@ -56364,6 +56365,12 @@ public:
*/ */
void* getNativeWindowHandle() const; 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 juce_UseDebuggingNewOperator


private: private:
@@ -56381,7 +56388,6 @@ private:
bool needToUpdateViewport; bool needToUpdateViewport;


OpenGLContext* createContext(); OpenGLContext* createContext();
void deleteContext();
void updateContextPosition(); void updateContextPosition();
void internalRepaint (int x, int y, int w, int h); void internalRepaint (int x, int y, int w, int h);


@@ -58364,9 +58370,10 @@ public:
int getNumDrawables() const; int getNumDrawables() const;
ValueTree getDrawableState (int index) const; ValueTree getDrawableState (int index) const;
ValueTree getDrawableWithId (const String& objectId, bool recursive) 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 addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager);
void moveDrawableOrder (int currentIndex, int newIndex, 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; const RelativePoint getTargetPositionForOrigin() const;
void setTargetPositionForOrigin (const RelativePoint& newPoint, UndoManager* undoManager); void setTargetPositionForOrigin (const RelativePoint& newPoint, UndoManager* undoManager);
@@ -58683,6 +58690,7 @@ public:
int getNumControlPoints() const throw(); int getNumControlPoints() const throw();


const RelativePoint getControlPoint (int index) const; const RelativePoint getControlPoint (int index) const;
const RelativePoint getEndPoint() const;
void setControlPoint (int index, const RelativePoint& point, UndoManager* undoManager); void setControlPoint (int index, const RelativePoint& point, UndoManager* undoManager);


static const Identifier startSubPathElement, closeSubPathElement, static const Identifier startSubPathElement, closeSubPathElement,


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 8
#define JUCE_BUILDNUMBER 9
/** Current Juce version number. /** Current Juce version number.


+ 6
- 1
src/gui/components/special/juce_OpenGLComponent.h View File

@@ -330,6 +330,12 @@ public:
*/ */
void* getNativeWindowHandle() const; 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 juce_UseDebuggingNewOperator
private: private:
@@ -347,7 +353,6 @@ private:
bool needToUpdateViewport; bool needToUpdateViewport;
OpenGLContext* createContext(); OpenGLContext* createContext();
void deleteContext();
void updateContextPosition(); void updateContextPosition();
void internalRepaint (int x, int y, int w, int h); void internalRepaint (int x, int y, int w, int h);


+ 7
- 2
src/gui/graphics/drawables/juce_DrawableComposite.cpp View File

@@ -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) void DrawableComposite::ValueTreeWrapper::addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager)
{ {
getChildListCreating (undoManager).addChild (newDrawableState, index, undoManager); getChildListCreating (undoManager).addChild (newDrawableState, index, undoManager);
@@ -416,9 +421,9 @@ void DrawableComposite::ValueTreeWrapper::moveDrawableOrder (int currentIndex, i
getChildListCreating (undoManager).moveChild (currentIndex, newIndex, undoManager); 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 const RelativePoint DrawableComposite::ValueTreeWrapper::getTargetPositionForOrigin() const


+ 2
- 1
src/gui/graphics/drawables/juce_DrawableComposite.h View File

@@ -198,9 +198,10 @@ public:
int getNumDrawables() const; int getNumDrawables() const;
ValueTree getDrawableState (int index) const; ValueTree getDrawableState (int index) const;
ValueTree getDrawableWithId (const String& objectId, bool recursive) 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 addDrawable (const ValueTree& newDrawableState, int index, UndoManager* undoManager);
void moveDrawableOrder (int currentIndex, int newIndex, 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; const RelativePoint getTargetPositionForOrigin() const;
void setTargetPositionForOrigin (const RelativePoint& newPoint, UndoManager* undoManager); void setTargetPositionForOrigin (const RelativePoint& newPoint, UndoManager* undoManager);


+ 9
- 0
src/gui/graphics/drawables/juce_DrawablePath.cpp View File

@@ -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); 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<float> DrawablePath::refreshFromValueTree (const ValueTree& tree, ImageProvider*) const Rectangle<float> DrawablePath::refreshFromValueTree (const ValueTree& tree, ImageProvider*)


+ 1
- 0
src/gui/graphics/drawables/juce_DrawablePath.h View File

@@ -155,6 +155,7 @@ public:
int getNumControlPoints() const throw(); int getNumControlPoints() const throw();
const RelativePoint getControlPoint (int index) const; const RelativePoint getControlPoint (int index) const;
const RelativePoint getEndPoint() const;
void setControlPoint (int index, const RelativePoint& point, UndoManager* undoManager); void setControlPoint (int index, const RelativePoint& point, UndoManager* undoManager);
static const Identifier startSubPathElement, closeSubPathElement, static const Identifier startSubPathElement, closeSubPathElement,


+ 8
- 7
src/utilities/juce_SelectedItemSet.h View File

@@ -50,6 +50,7 @@ class JUCE_API SelectedItemSet : public ChangeBroadcaster
public: public:
//============================================================================== //==============================================================================
typedef SelectableItemType ItemType; typedef SelectableItemType ItemType;
typedef PARAMETER_TYPE (SelectableItemType) ParameterType;
//============================================================================== //==============================================================================
/** Creates an empty set. */ /** Creates an empty set. */
@@ -94,7 +95,7 @@ public:
@see addToSelection, addToSelectionBasedOnModifiers @see addToSelection, addToSelectionBasedOnModifiers
*/ */
void selectOnly (SelectableItemType item)
void selectOnly (ParameterType item)
{ {
if (isSelected (item)) if (isSelected (item))
{ {
@@ -123,7 +124,7 @@ public:
@see selectOnly, addToSelectionBasedOnModifiers @see selectOnly, addToSelectionBasedOnModifiers
*/ */
void addToSelection (SelectableItemType item)
void addToSelection (ParameterType item)
{ {
if (! isSelected (item)) if (! isSelected (item))
{ {
@@ -155,7 +156,7 @@ public:
@see selectOnly, addToSelection, addToSelectionOnMouseDown, addToSelectionOnMouseUp @see selectOnly, addToSelection, addToSelectionOnMouseDown, addToSelectionOnMouseUp
*/ */
void addToSelectionBasedOnModifiers (SelectableItemType item,
void addToSelectionBasedOnModifiers (ParameterType item,
const ModifierKeys& modifiers) const ModifierKeys& modifiers)
{ {
if (modifiers.isShiftDown()) if (modifiers.isShiftDown())
@@ -192,7 +193,7 @@ public:
@see addToSelectionOnMouseUp, addToSelectionBasedOnModifiers @see addToSelectionOnMouseUp, addToSelectionBasedOnModifiers
*/ */
bool addToSelectionOnMouseDown (SelectableItemType item,
bool addToSelectionOnMouseDown (ParameterType item,
const ModifierKeys& modifiers) const ModifierKeys& modifiers)
{ {
if (isSelected (item)) if (isSelected (item))
@@ -220,7 +221,7 @@ public:
back from the addToSelectionOnMouseDown() call that you back from the addToSelectionOnMouseDown() call that you
should have made during the matching mouseDown event should have made during the matching mouseDown event
*/ */
void addToSelectionOnMouseUp (SelectableItemType item,
void addToSelectionOnMouseUp (ParameterType item,
const ModifierKeys& modifiers, const ModifierKeys& modifiers,
const bool wasItemDragged, const bool wasItemDragged,
const bool resultOfMouseDownSelectMethod) const bool resultOfMouseDownSelectMethod)
@@ -230,7 +231,7 @@ public:
} }
/** Deselects an item. */ /** Deselects an item. */
void deselect (SelectableItemType item)
void deselect (ParameterType item)
{ {
const int i = selectedItems.indexOf (item); const int i = selectedItems.indexOf (item);
@@ -278,7 +279,7 @@ public:
} }
/** True if this item is currently selected. */ /** 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); return selectedItems.contains (item);
} }


Loading…
Cancel
Save