1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-22 01:34:21 +00:00

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

This commit is contained in:
Julian Storer 2010-06-02 14:49:03 +01:00
parent 4521e6ea84
commit e777282966
9 changed files with 69 additions and 24 deletions

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

View file

@ -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,

View file

@ -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.

View file

@ -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);

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)
{
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

View file

@ -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);

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);
}
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*)

View file

@ -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,

View file

@ -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);
}