| @@ -102,6 +102,7 @@ public: | |||
| void swapWith (var& other) noexcept; | |||
| //============================================================================== | |||
| operator int() const noexcept; | |||
| operator int64() const noexcept; | |||
| operator bool() const noexcept; | |||
| @@ -109,11 +110,27 @@ public: | |||
| operator double() const noexcept; | |||
| operator String() const; | |||
| String toString() const; | |||
| /** If this variant holds an array, this provides access to it. | |||
| NOTE: Beware when you use this - the array pointer is only valid for the lifetime | |||
| of the variant that returned it, so be very careful not to call this method on temporary | |||
| var objects that are the return-value of a function, and which may go out of scope before | |||
| you use the array! | |||
| */ | |||
| Array<var>* getArray() const noexcept; | |||
| /** If this variant holds a memory block, this provides access to it. | |||
| NOTE: Beware when you use this - the MemoryBlock pointer is only valid for the lifetime | |||
| of the variant that returned it, so be very careful not to call this method on temporary | |||
| var objects that are the return-value of a function, and which may go out of scope before | |||
| you use the MemoryBlock! | |||
| */ | |||
| MemoryBlock* getBinaryData() const noexcept; | |||
| ReferenceCountedObject* getObject() const noexcept; | |||
| DynamicObject* getDynamicObject() const noexcept; | |||
| //============================================================================== | |||
| bool isVoid() const noexcept; | |||
| bool isInt() const noexcept; | |||
| bool isInt64() const noexcept; | |||
| @@ -398,12 +398,12 @@ Colour Colour::contrasting (const Colour& target, float minContrast) const noexc | |||
| const ColourHelpers::YIQ bg (*this); | |||
| ColourHelpers::YIQ fg (target); | |||
| if (fabs (bg.y - fg.y) >= minContrast) | |||
| if (std::abs (bg.y - fg.y) >= minContrast) | |||
| return target; | |||
| const float y1 = jmax (0.0f, bg.y - minContrast); | |||
| const float y2 = jmin (1.0f, bg.y + minContrast); | |||
| fg.y = (fabs (y1 - bg.y) > fabs (y2 - bg.y)) ? y1 : y2; | |||
| fg.y = (std::abs (y1 - bg.y) > std::abs (y2 - bg.y)) ? y1 : y2; | |||
| return fg.toColour(); | |||
| } | |||
| @@ -27,8 +27,7 @@ class ImageCache::Pimpl : private Timer, | |||
| private DeletedAtShutdown | |||
| { | |||
| public: | |||
| Pimpl() | |||
| : cacheTimeout (5000) | |||
| Pimpl() : cacheTimeout (5000) | |||
| { | |||
| } | |||
| @@ -43,7 +42,7 @@ public: | |||
| for (int i = images.size(); --i >= 0;) | |||
| { | |||
| Item* const item = images.getUnchecked(i); | |||
| const Item* const item = images.getUnchecked(i); | |||
| if (item->hashCode == hashCode) | |||
| return item->image; | |||
| @@ -94,10 +93,13 @@ public: | |||
| stopTimer(); | |||
| } | |||
| void clear() | |||
| void releaseUnusedImages() | |||
| { | |||
| const ScopedLock sl (lock); | |||
| images.clear(); | |||
| for (int i = images.size(); --i >= 0;) | |||
| if (images.getUnchecked(i)->image.getReferenceCount() <= 1) | |||
| images.remove (i); | |||
| } | |||
| struct Item | |||
| @@ -169,7 +171,7 @@ void ImageCache::setCacheTimeout (const int millisecs) | |||
| Pimpl::getInstance()->cacheTimeout = (unsigned int) millisecs; | |||
| } | |||
| void ImageCache::clear() | |||
| void ImageCache::releaseUnusedImages() | |||
| { | |||
| Pimpl::getInstance()->clear(); | |||
| Pimpl::getInstance()->releaseUnusedImages(); | |||
| } | |||
| @@ -109,8 +109,10 @@ public: | |||
| */ | |||
| static void setCacheTimeout (int millisecs); | |||
| /** Clears the cache immediately. */ | |||
| static void clear(); | |||
| /** Releases any images in the cache that aren't being referenced by active | |||
| Image objects. | |||
| */ | |||
| static void releaseUnusedImages(); | |||
| private: | |||
| //============================================================================== | |||
| @@ -181,9 +181,8 @@ private: | |||
| //============================================================================== | |||
| PropertyPanel::PropertyPanel() | |||
| : messageWhenEmpty (TRANS("(nothing selected)")) | |||
| { | |||
| messageWhenEmpty = TRANS("(nothing selected)"); | |||
| addAndMakeVisible (&viewport); | |||
| viewport.setViewedComponent (propertyHolderComponent = new PropertyHolderComponent()); | |||
| viewport.setFocusContainer (true); | |||
| @@ -227,6 +226,11 @@ bool PropertyPanel::isEmpty() const | |||
| return propertyHolderComponent->getNumSections() == 0; | |||
| } | |||
| int PropertyPanel::getTotalContentHeight() const | |||
| { | |||
| return propertyHolderComponent->getHeight(); | |||
| } | |||
| void PropertyPanel::addProperties (const Array <PropertyComponent*>& newProperties) | |||
| { | |||
| if (isEmpty()) | |||
| @@ -53,8 +53,7 @@ public: | |||
| ~PropertyPanel(); | |||
| //============================================================================== | |||
| /** Deletes all property components from the panel. | |||
| */ | |||
| /** Deletes all property components from the panel. */ | |||
| void clear(); | |||
| /** Adds a set of properties to the panel. | |||
| @@ -87,27 +86,28 @@ public: | |||
| /** Returns true if there no properties have been added. */ | |||
| bool isEmpty() const; | |||
| /** Returns the height that the panel needs in order to display all of its content | |||
| without scrolling. | |||
| */ | |||
| int getTotalContentHeight() const; | |||
| //============================================================================== | |||
| /** Returns a list of all the names of sections in the panel. | |||
| These are the sections that have been added with addSection(). | |||
| */ | |||
| StringArray getSectionNames() const; | |||
| /** Returns true if the section at this index is currently open. | |||
| The index is from 0 up to the number of items returned by getSectionNames(). | |||
| */ | |||
| bool isSectionOpen (int sectionIndex) const; | |||
| /** Opens or closes one of the sections. | |||
| The index is from 0 up to the number of items returned by getSectionNames(). | |||
| */ | |||
| void setSectionOpen (int sectionIndex, bool shouldBeOpen); | |||
| /** Enables or disables one of the sections. | |||
| The index is from 0 up to the number of items returned by getSectionNames(). | |||
| */ | |||
| void setSectionEnabled (int sectionIndex, bool shouldBeEnabled); | |||
| @@ -116,7 +116,6 @@ public: | |||
| /** Saves the current state of open/closed sections so it can be restored later. | |||
| The caller is responsible for deleting the object that is returned. | |||
| To restore this state, use restoreOpennessState(). | |||
| @see restoreOpennessState | |||
| @@ -135,7 +134,6 @@ public: | |||
| //============================================================================== | |||
| /** Sets a message to be displayed when there are no properties in the panel. | |||
| The default message is "nothing selected". | |||
| */ | |||
| void setMessageWhenEmpty (const String& newMessage); | |||
| @@ -147,7 +145,7 @@ public: | |||
| //============================================================================== | |||
| /** @internal */ | |||
| void paint (Graphics& g); | |||
| void paint (Graphics&); | |||
| /** @internal */ | |||
| void resized(); | |||