| @@ -715,7 +715,7 @@ public: | |||
| @param indexToRemove the index of the element to remove | |||
| @returns the element that has been removed | |||
| @see removeValue, removeRange | |||
| @see removeFirstMatchingValue, removeAllInstancesOf, removeRange | |||
| */ | |||
| ElementType remove (const int indexToRemove) | |||
| { | |||
| @@ -782,7 +782,7 @@ public: | |||
| @param startIndex the index of the first element to remove | |||
| @param numberToRemove how many elements should be removed | |||
| @see remove, removeValue | |||
| @see remove, removeFirstMatchingValue, removeAllInstancesOf | |||
| */ | |||
| void removeRange (int startIndex, int numberToRemove) | |||
| { | |||
| @@ -810,7 +810,7 @@ public: | |||
| /** Removes the last n elements from the array. | |||
| @param howManyToRemove how many elements to remove from the end of the array | |||
| @see remove, removeValue, removeRange | |||
| @see remove, removeFirstMatchingValue, removeAllInstancesOf, removeRange | |||
| */ | |||
| void removeLast (int howManyToRemove = 1) | |||
| { | |||
| @@ -829,7 +829,7 @@ public: | |||
| /** Removes any elements which are also in another array. | |||
| @param otherArray the other array in which to look for elements to remove | |||
| @see removeValuesNotIn, remove, removeValue, removeRange | |||
| @see removeValuesNotIn, remove, removeFirstMatchingValue, removeAllInstancesOf, removeRange | |||
| */ | |||
| template <class OtherArrayType> | |||
| void removeValuesIn (const OtherArrayType& otherArray) | |||
| @@ -857,7 +857,7 @@ public: | |||
| Only elements which occur in this other array will be retained. | |||
| @param otherArray the array in which to look for elements NOT to remove | |||
| @see removeValuesIn, remove, removeValue, removeRange | |||
| @see removeValuesIn, remove, removeFirstMatchingValue, removeAllInstancesOf, removeRange | |||
| */ | |||
| template <class OtherArrayType> | |||
| void removeValuesNotIn (const OtherArrayType& otherArray) | |||
| @@ -312,7 +312,8 @@ void XmlDocument::skipNextWhiteSpace() | |||
| input += closeComment + 3; | |||
| continue; | |||
| } | |||
| else if (input[1] == '?') | |||
| if (input[1] == '?') | |||
| { | |||
| input += 2; | |||
| const int closeBracket = input.indexOf (CharPointer_ASCII ("?>")); | |||
| @@ -52,13 +52,13 @@ public: | |||
| AffineTransform getTransform() const noexcept | |||
| { | |||
| return isOnlyTranslated ? AffineTransform::translation ((float) offset.x, (float) offset.y) | |||
| return isOnlyTranslated ? AffineTransform::translation (offset) | |||
| : complexTransform; | |||
| } | |||
| AffineTransform getTransformWith (const AffineTransform& userTransform) const noexcept | |||
| { | |||
| return isOnlyTranslated ? userTransform.translated ((float) offset.x, (float) offset.y) | |||
| return isOnlyTranslated ? userTransform.translated (offset) | |||
| : userTransform.followedBy (complexTransform); | |||
| } | |||
| @@ -67,7 +67,7 @@ public: | |||
| if (isOnlyTranslated) | |||
| offset += delta; | |||
| else | |||
| complexTransform = AffineTransform::translation ((float) delta.x, (float) delta.y) | |||
| complexTransform = AffineTransform::translation (delta) | |||
| .followedBy (complexTransform); | |||
| } | |||
| @@ -75,15 +75,19 @@ public: | |||
| { | |||
| if (isOnlyTranslated && t.isOnlyTranslation()) | |||
| { | |||
| offset += Point<int> ((int) t.getTranslationX(), | |||
| (int) t.getTranslationY()); | |||
| } | |||
| else | |||
| { | |||
| complexTransform = getTransformWith (t); | |||
| isOnlyTranslated = false; | |||
| isRotated = (complexTransform.mat01 != 0 || complexTransform.mat10 != 0); | |||
| const int tx = (int) (t.getTranslationX() * 256.0f); | |||
| const int ty = (int) (t.getTranslationY() * 256.0f); | |||
| if (((tx | ty) & 0xf8) == 0) | |||
| { | |||
| offset += Point<int> (tx >> 8, ty >> 8); | |||
| return; | |||
| } | |||
| } | |||
| complexTransform = getTransformWith (t); | |||
| isOnlyTranslated = false; | |||
| isRotated = (complexTransform.mat01 != 0 || complexTransform.mat10 != 0); | |||
| } | |||
| float getPhysicalPixelScaleFactor() const noexcept | |||
| @@ -96,7 +100,7 @@ public: | |||
| if (isOnlyTranslated) | |||
| offset += delta; | |||
| else | |||
| complexTransform = complexTransform.translated ((float) delta.x, (float) delta.y); | |||
| complexTransform = complexTransform.translated (delta); | |||
| } | |||
| Rectangle<int> translated (const Rectangle<int>& r) const noexcept | |||
| @@ -1004,7 +1008,8 @@ namespace EdgeTableFillers | |||
| ++dest; | |||
| continue; | |||
| } | |||
| else if (! repeatPattern) | |||
| if (! repeatPattern) | |||
| { | |||
| // At a top or bottom edge.. | |||
| if (loResY < 0) | |||
| @@ -1284,9 +1289,9 @@ namespace EdgeTableFillers | |||
| public: | |||
| BresenhamInterpolator() noexcept {} | |||
| void set (const int n1, const int n2, const int numSteps_, const int offsetInt) noexcept | |||
| void set (const int n1, const int n2, const int steps, const int offsetInt) noexcept | |||
| { | |||
| numSteps = numSteps_; | |||
| numSteps = steps; | |||
| step = (n2 - n1) / numSteps; | |||
| remainder = modulo = (n2 - n1) % numSteps; | |||
| n = n1 + offsetInt; | |||
| @@ -1767,11 +1772,7 @@ struct ClipRegions | |||
| return toEdgeTable()->clipToImageAlpha (image, transform, quality); | |||
| } | |||
| void translate (Point<int> delta) | |||
| { | |||
| clip.offsetAll (delta.x, delta.y); | |||
| } | |||
| void translate (Point<int> delta) { clip.offsetAll (delta); } | |||
| bool clipRegionIntersects (const Rectangle<int>& r) const { return clip.intersects (r); } | |||
| Rectangle<int> getClipBounds() const { return clip.getBounds(); } | |||
| @@ -2399,7 +2400,6 @@ public: | |||
| s->image = Image (Image::ARGB, layerBounds.getWidth(), layerBounds.getHeight(), true); | |||
| s->transparencyLayerAlpha = opacity; | |||
| s->transform.moveOriginInDeviceSpace (-layerBounds.getPosition()); | |||
| s->cloneClipIfMultiplyReferenced(); | |||
| s->clip->translate (-layerBounds.getPosition()); | |||
| } | |||
| @@ -2415,8 +2415,7 @@ public: | |||
| const ScopedPointer<LowLevelGraphicsContext> g (image.createLowLevelContext()); | |||
| g->setOpacity (finishedLayerState.transparencyLayerAlpha); | |||
| g->drawImage (finishedLayerState.image, AffineTransform::translation ((float) layerBounds.getX(), | |||
| (float) layerBounds.getY())); | |||
| g->drawImage (finishedLayerState.image, AffineTransform::translation (layerBounds.getPosition())); | |||
| } | |||
| } | |||
| @@ -63,15 +63,14 @@ bool ApplicationCommandTarget::tryToInvoke (const InvocationInfo& info, const bo | |||
| (new CommandMessage (this, info))->post(); | |||
| return true; | |||
| } | |||
| else | |||
| { | |||
| const bool success = perform (info); | |||
| jassert (success); // Hmm.. your target claimed that it could perform this command, but failed to do so. | |||
| // If it can't do it at the moment for some reason, it should clear the 'isActive' flag | |||
| // when it returns the command's info. | |||
| return success; | |||
| } | |||
| if (perform (info)) | |||
| return true; | |||
| // Hmm.. your target claimed that it could perform this command, but failed to do so. | |||
| // If it can't do it at the moment for some reason, it should clear the 'isActive' flag | |||
| // when it returns the command's info. | |||
| jassertfalse; | |||
| } | |||
| return false; | |||
| @@ -61,7 +61,7 @@ public: | |||
| the set so that your UI objects will know when the selection changes and | |||
| be able to update themselves appropriately. | |||
| */ | |||
| virtual SelectedItemSet <SelectableItemType>& getLassoSelection() = 0; | |||
| virtual SelectedItemSet<SelectableItemType>& getLassoSelection() = 0; | |||
| }; | |||
| @@ -102,11 +102,6 @@ public: | |||
| { | |||
| } | |||
| /** Destructor. */ | |||
| ~LassoComponent() | |||
| { | |||
| } | |||
| //============================================================================== | |||
| /** Call this in your mouseDown event, to initialise a drag. | |||
| @@ -118,8 +113,7 @@ public: | |||
| @see dragLasso, endLasso, LassoSource | |||
| */ | |||
| void beginLasso (const MouseEvent& e, | |||
| LassoSource <SelectableItemType>* const lassoSource) | |||
| void beginLasso (const MouseEvent& e, LassoSource<SelectableItemType>* lassoSource) | |||
| { | |||
| jassert (source == nullptr); // this suggests that you didn't call endLasso() after the last drag... | |||
| jassert (lassoSource != nullptr); // the source can't be null! | |||
| @@ -153,7 +147,7 @@ public: | |||
| setBounds (Rectangle<int> (dragStartPos, e.getPosition())); | |||
| setVisible (true); | |||
| Array <SelectableItemType> itemsInLasso; | |||
| Array<SelectableItemType> itemsInLasso; | |||
| source->findLassoItemsInArea (itemsInLasso, getBounds()); | |||
| if (e.mods.isShiftDown()) | |||
| @@ -163,19 +157,18 @@ public: | |||
| } | |||
| else if (e.mods.isCommandDown() || e.mods.isAltDown()) | |||
| { | |||
| Array <SelectableItemType> originalMinusNew (originalSelection); | |||
| Array<SelectableItemType> originalMinusNew (originalSelection); | |||
| originalMinusNew.removeValuesIn (itemsInLasso); | |||
| itemsInLasso.removeValuesIn (originalSelection); | |||
| itemsInLasso.addArray (originalMinusNew); | |||
| } | |||
| source->getLassoSelection() = SelectedItemSet <SelectableItemType> (itemsInLasso); | |||
| source->getLassoSelection() = SelectedItemSet<SelectableItemType> (itemsInLasso); | |||
| } | |||
| } | |||
| /** Call this in your mouseUp event, after the lasso has been dragged. | |||
| @see beginLasso, dragLasso | |||
| */ | |||
| void endLasso() | |||
| @@ -219,8 +212,8 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| Array <SelectableItemType> originalSelection; | |||
| LassoSource <SelectableItemType>* source; | |||
| Array<SelectableItemType> originalSelection; | |||
| LassoSource<SelectableItemType>* source; | |||
| Point<int> dragStartPos; | |||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LassoComponent) | |||
| @@ -47,6 +47,7 @@ class SelectedItemSet : public ChangeBroadcaster | |||
| public: | |||
| //============================================================================== | |||
| typedef SelectableItemType ItemType; | |||
| typedef Array<SelectableItemType> ItemArray; | |||
| typedef PARAMETER_TYPE (SelectableItemType) ParameterType; | |||
| //============================================================================== | |||
| @@ -56,7 +57,7 @@ public: | |||
| } | |||
| /** Creates a set based on an array of items. */ | |||
| explicit SelectedItemSet (const Array <SelectableItemType>& items) | |||
| explicit SelectedItemSet (const ItemArray& items) | |||
| : selectedItems (items) | |||
| { | |||
| } | |||
| @@ -247,30 +248,25 @@ public: | |||
| /** Returns the number of currently selected items. | |||
| @see getSelectedItem | |||
| */ | |||
| int getNumSelected() const noexcept | |||
| { | |||
| return selectedItems.size(); | |||
| } | |||
| int getNumSelected() const noexcept { return selectedItems.size(); } | |||
| /** Returns one of the currently selected items. | |||
| Returns 0 if the index is out-of-range. | |||
| If the index is out-of-range, this returns a default-constructed SelectableItemType. | |||
| @see getNumSelected | |||
| */ | |||
| SelectableItemType getSelectedItem (const int index) const noexcept | |||
| { | |||
| return selectedItems [index]; | |||
| } | |||
| SelectableItemType getSelectedItem (const int index) const { return selectedItems [index]; } | |||
| /** True if this item is currently selected. */ | |||
| bool isSelected (ParameterType item) const noexcept | |||
| { | |||
| return selectedItems.contains (item); | |||
| } | |||
| bool isSelected (ParameterType item) const noexcept { return selectedItems.contains (item); } | |||
| const Array <SelectableItemType>& getItemArray() const noexcept { return selectedItems; } | |||
| /** Provides access to the array of items. */ | |||
| const ItemArray& getItemArray() const noexcept { return selectedItems; } | |||
| SelectableItemType* begin() const noexcept { return selectedItems.begin(); } | |||
| SelectableItemType* end() const noexcept { return selectedItems.end(); } | |||
| /** Provides iterator access to the array of items. */ | |||
| SelectableItemType* begin() const noexcept { return selectedItems.begin(); } | |||
| /** Provides iterator access to the array of items. */ | |||
| SelectableItemType* end() const noexcept { return selectedItems.end(); } | |||
| //============================================================================== | |||
| /** Can be overridden to do special handling when an item is selected. | |||
| @@ -278,17 +274,27 @@ public: | |||
| For example, if the item is an object, you might want to call it and tell | |||
| it that it's being selected. | |||
| */ | |||
| virtual void itemSelected (SelectableItemType item) { (void) item; } | |||
| virtual void itemSelected (SelectableItemType) {} | |||
| /** Can be overridden to do special handling when an item is deselected. | |||
| For example, if the item is an object, you might want to call it and tell | |||
| it that it's being deselected. | |||
| */ | |||
| virtual void itemDeselected (SelectableItemType item) { (void) item; } | |||
| virtual void itemDeselected (SelectableItemType) {} | |||
| /** Used internally, but can be called to force a change message to be sent | |||
| to the ChangeListeners. | |||
| */ | |||
| void changed() | |||
| { | |||
| sendChangeMessage(); | |||
| } | |||
| /** Used internally, but can be called to force a change message to be sent to the ChangeListeners. */ | |||
| void changed (const bool synchronous = false) | |||
| /** Used internally, but can be called to force a change message to be sent | |||
| to the ChangeListeners. | |||
| */ | |||
| void changed (const bool synchronous) | |||
| { | |||
| if (synchronous) | |||
| sendSynchronousChangeMessage(); | |||
| @@ -298,9 +304,9 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| Array <SelectableItemType> selectedItems; | |||
| ItemArray selectedItems; | |||
| JUCE_LEAK_DETECTOR (SelectedItemSet <SelectableItemType>) | |||
| JUCE_LEAK_DETECTOR (SelectedItemSet<SelectableItemType>) | |||
| }; | |||