| @@ -596,9 +596,8 @@ private: | |||
| void setAllLookAndFeels (LookAndFeel* laf) | |||
| { | |||
| for (int i = 0; i < demoComp.getNumChildComponents(); ++i) | |||
| if (Component* c = demoComp.getChildComponent (i)) | |||
| c->setLookAndFeel (laf); | |||
| for (auto* child : demoComp.getChildren()) | |||
| child->setLookAndFeel (laf); | |||
| } | |||
| void comboBoxChanged (ComboBox* comboBoxThatHasChanged) override | |||
| @@ -411,8 +411,8 @@ struct FilterComponent : public Component | |||
| bool hitTest (int x, int y) override | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| if (getChildComponent(i)->getBounds().contains (x, y)) | |||
| for (auto* child : getChildren()) | |||
| if (child->getBounds().contains (x, y)) | |||
| return true; | |||
| return x >= 3 && x < getWidth() - 6 && y >= pinSize && y < getHeight() - pinSize; | |||
| @@ -440,9 +440,9 @@ struct FilterComponent : public Component | |||
| { | |||
| if (auto* processor = f->getProcessor()) | |||
| { | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| for (auto* child : getChildren()) | |||
| { | |||
| if (auto* pin = dynamic_cast<PinComponent*> (getChildComponent(i))) | |||
| if (auto* pin = dynamic_cast<PinComponent*> (child)) | |||
| { | |||
| const bool isInput = pin->isInput; | |||
| int busIdx = 0; | |||
| @@ -465,8 +465,8 @@ struct FilterComponent : public Component | |||
| Point<float> getPinPos (int index, bool isInput) const | |||
| { | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| if (auto* pin = dynamic_cast<PinComponent*> (getChildComponent(i))) | |||
| for (auto* child : getChildren()) | |||
| if (auto* pin = dynamic_cast<PinComponent*> (child)) | |||
| if (pin->index == index && isInput == pin->isInput) | |||
| return getPosition().toFloat() + pin->getBounds().getCentre().toFloat(); | |||
| @@ -804,21 +804,19 @@ void GraphEditorPanel::createNewPlugin (const PluginDescription& desc, Point<int | |||
| FilterComponent* GraphEditorPanel::getComponentForFilter (const uint32 filterID) const | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| if (auto* fc = dynamic_cast<FilterComponent*> (getChildComponent (i))) | |||
| for (auto* child : getChildren()) | |||
| if (auto* fc = dynamic_cast<FilterComponent*> (child)) | |||
| if (fc->pluginID == filterID) | |||
| return fc; | |||
| } | |||
| return nullptr; | |||
| } | |||
| ConnectorComponent* GraphEditorPanel::getComponentForConnection (const AudioProcessorGraph::Connection& conn) const | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| for (auto* child : getChildren()) | |||
| { | |||
| if (auto* c = dynamic_cast<ConnectorComponent*> (getChildComponent (i))) | |||
| if (auto* c = dynamic_cast<ConnectorComponent*> (child)) | |||
| if (c->sourceFilterID == conn.sourceNodeId | |||
| && c->destFilterID == conn.destNodeId | |||
| && c->sourceFilterChannel == conn.sourceChannelIndex | |||
| @@ -831,8 +829,8 @@ ConnectorComponent* GraphEditorPanel::getComponentForConnection (const AudioProc | |||
| PinComponent* GraphEditorPanel::findPinAt (Point<float> pos) const | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| if (auto* fc = dynamic_cast<FilterComponent*> (getChildComponent (i))) | |||
| for (auto* child : getChildren()) | |||
| if (auto* fc = dynamic_cast<FilterComponent*> (child)) | |||
| if (auto* pin = dynamic_cast<PinComponent*> (fc->getComponentAt (pos.toInt() - fc->getPosition()))) | |||
| return pin; | |||
| @@ -851,11 +849,9 @@ void GraphEditorPanel::changeListenerCallback (ChangeBroadcaster*) | |||
| void GraphEditorPanel::updateComponents() | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| if (auto* fc = dynamic_cast<FilterComponent*> (getChildComponent (i))) | |||
| for (auto* child : getChildren()) | |||
| if (auto* fc = dynamic_cast<FilterComponent*> (child)) | |||
| fc->update(); | |||
| } | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| { | |||
| @@ -563,8 +563,8 @@ private: | |||
| { | |||
| int y = 0; | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| y = jmax (y, getChildComponent (i)->getBottom()); | |||
| for (auto* c : getChildren()) | |||
| y = jmax (y, c->getBottom()); | |||
| return y; | |||
| } | |||
| @@ -242,19 +242,17 @@ void Button::setRadioGroupId (const int newGroupId, NotificationType notificatio | |||
| void Button::turnOffOtherButtonsInGroup (const NotificationType notification) | |||
| { | |||
| if (Component* const p = getParentComponent()) | |||
| if (auto* p = getParentComponent()) | |||
| { | |||
| if (radioGroupId != 0) | |||
| { | |||
| WeakReference<Component> deletionWatcher (this); | |||
| for (int i = p->getNumChildComponents(); --i >= 0;) | |||
| for (auto* c : p->getChildren()) | |||
| { | |||
| Component* const c = p->getChildComponent (i); | |||
| if (c != this) | |||
| { | |||
| if (Button* const b = dynamic_cast<Button*> (c)) | |||
| if (auto b = dynamic_cast<Button*> (c)) | |||
| { | |||
| if (b->getRadioGroupId() == radioGroupId) | |||
| { | |||
| @@ -406,7 +406,7 @@ struct Component::ComponentHelpers | |||
| for (int i = comp.childComponentList.size(); --i >= 0;) | |||
| { | |||
| const Component& child = *comp.childComponentList.getUnchecked(i); | |||
| auto& child = *comp.childComponentList.getUnchecked(i); | |||
| if (child.isVisible() && ! child.isTransformed()) | |||
| { | |||
| @@ -421,7 +421,8 @@ struct Component::ComponentHelpers | |||
| } | |||
| else | |||
| { | |||
| const Point<int> childPos (child.getPosition()); | |||
| auto childPos = child.getPosition(); | |||
| if (clipObscuredRegions (child, g, newClip - childPos, childPos + delta)) | |||
| wasClipped = true; | |||
| } | |||
| @@ -434,7 +435,7 @@ struct Component::ComponentHelpers | |||
| static Rectangle<int> getParentOrMainMonitorBounds (const Component& comp) | |||
| { | |||
| if (Component* p = comp.getParentComponent()) | |||
| if (auto* p = comp.getParentComponent()) | |||
| return p->getLocalBounds(); | |||
| return Desktop::getInstance().getDisplays().getMainDisplay().userArea; | |||
| @@ -442,31 +443,22 @@ struct Component::ComponentHelpers | |||
| static void releaseAllCachedImageResources (Component& c) | |||
| { | |||
| if (CachedComponentImage* cached = c.getCachedComponentImage()) | |||
| if (auto* cached = c.getCachedComponentImage()) | |||
| cached->releaseResources(); | |||
| for (int i = c.getNumChildComponents(); --i >= 0;) | |||
| releaseAllCachedImageResources (*c.getChildComponent (i)); | |||
| for (auto* child : c.childComponentList) | |||
| releaseAllCachedImageResources (*child); | |||
| } | |||
| }; | |||
| //============================================================================== | |||
| Component::Component() noexcept | |||
| : parentComponent (nullptr), | |||
| lookAndFeel (nullptr), | |||
| effect (nullptr), | |||
| componentFlags (0), | |||
| componentTransparency (0) | |||
| : componentFlags (0) | |||
| { | |||
| } | |||
| Component::Component (const String& name) noexcept | |||
| : componentName (name), | |||
| parentComponent (nullptr), | |||
| lookAndFeel (nullptr), | |||
| effect (nullptr), | |||
| componentFlags (0), | |||
| componentTransparency (0) | |||
| : componentName (name), componentFlags (0) | |||
| { | |||
| } | |||
| @@ -895,11 +887,11 @@ void Component::toFront (const bool setAsForeground) | |||
| } | |||
| else if (parentComponent != nullptr) | |||
| { | |||
| const Array<Component*>& childList = parentComponent->childComponentList; | |||
| auto& childList = parentComponent->childComponentList; | |||
| if (childList.getLast() != this) | |||
| { | |||
| const int index = childList.indexOf (this); | |||
| auto index = childList.indexOf (this); | |||
| if (index >= 0) | |||
| { | |||
| @@ -936,8 +928,8 @@ void Component::toBehind (Component* const other) | |||
| if (parentComponent != nullptr) | |||
| { | |||
| const Array<Component*>& childList = parentComponent->childComponentList; | |||
| const int index = childList.indexOf (this); | |||
| auto& childList = parentComponent->childComponentList; | |||
| auto index = childList.indexOf (this); | |||
| if (index >= 0 && childList [index + 1] != other) | |||
| { | |||
| @@ -977,11 +969,11 @@ void Component::toBack() | |||
| } | |||
| else if (parentComponent != nullptr) | |||
| { | |||
| const Array<Component*>& childList = parentComponent->childComponentList; | |||
| auto& childList = parentComponent->childComponentList; | |||
| if (childList.getFirst() != this) | |||
| { | |||
| const int index = childList.indexOf (this); | |||
| auto index = childList.indexOf (this); | |||
| if (index > 0) | |||
| { | |||
| @@ -1380,7 +1372,7 @@ bool Component::hitTest (int x, int y) | |||
| { | |||
| for (int i = childComponentList.size(); --i >= 0;) | |||
| { | |||
| Component& child = *childComponentList.getUnchecked (i); | |||
| auto& child = *childComponentList.getUnchecked (i); | |||
| if (child.isVisible() | |||
| && ComponentHelpers::hitTest (child, ComponentHelpers::convertFromParentSpace (child, Point<int> (x, y)))) | |||
| @@ -1437,7 +1429,8 @@ Component* Component::getComponentAt (Point<int> position) | |||
| { | |||
| for (int i = childComponentList.size(); --i >= 0;) | |||
| { | |||
| Component* child = childComponentList.getUnchecked(i); | |||
| auto* child = childComponentList.getUnchecked(i); | |||
| child = child->getComponentAt (ComponentHelpers::convertFromParentSpace (*child, position)); | |||
| if (child != nullptr) | |||
| @@ -1607,7 +1600,7 @@ int Component::getNumChildComponents() const noexcept | |||
| Component* Component::getChildComponent (const int index) const noexcept | |||
| { | |||
| return childComponentList [index]; | |||
| return childComponentList[index]; | |||
| } | |||
| int Component::getIndexOfChildComponent (const Component* const child) const noexcept | |||
| @@ -1617,12 +1610,9 @@ int Component::getIndexOfChildComponent (const Component* const child) const noe | |||
| Component* Component::findChildWithID (StringRef targetID) const noexcept | |||
| { | |||
| for (int i = childComponentList.size(); --i >= 0;) | |||
| { | |||
| auto* c = childComponentList.getUnchecked(i); | |||
| for (auto* c : childComponentList) | |||
| if (c->componentID == targetID) | |||
| return c; | |||
| } | |||
| return nullptr; | |||
| } | |||
| @@ -1979,7 +1969,7 @@ void Component::paintComponentAndChildren (Graphics& g) | |||
| for (int i = 0; i < childComponentList.size(); ++i) | |||
| { | |||
| Component& child = *childComponentList.getUnchecked (i); | |||
| auto& child = *childComponentList.getUnchecked (i); | |||
| if (child.isVisible()) | |||
| { | |||
| @@ -2007,7 +1997,7 @@ void Component::paintComponentAndChildren (Graphics& g) | |||
| for (int j = i + 1; j < childComponentList.size(); ++j) | |||
| { | |||
| const Component& sibling = *childComponentList.getUnchecked (j); | |||
| auto& sibling = *childComponentList.getUnchecked (j); | |||
| if (sibling.flags.opaqueFlag && sibling.isVisible() && sibling.affineTransform == nullptr) | |||
| { | |||
| @@ -613,7 +613,7 @@ public: | |||
| //============================================================================== | |||
| /** Returns the number of child components that this component contains. | |||
| @see getChildComponent, getIndexOfChildComponent | |||
| @see getChildren, getChildComponent, getIndexOfChildComponent | |||
| */ | |||
| int getNumChildComponents() const noexcept; | |||
| @@ -624,7 +624,7 @@ public: | |||
| If the index is out-of-range, this will return a null pointer. | |||
| @see getNumChildComponents, getIndexOfChildComponent | |||
| @see getChildren, getNumChildComponents, getIndexOfChildComponent | |||
| */ | |||
| Component* getChildComponent (int index) const noexcept; | |||
| @@ -635,10 +635,15 @@ public: | |||
| Returns -1 if the component passed-in is not a child of this component. | |||
| @see getNumChildComponents, getChildComponent, addChildComponent, toFront, toBack, toBehind | |||
| @see getChildren, getNumChildComponents, getChildComponent, addChildComponent, toFront, toBack, toBehind | |||
| */ | |||
| int getIndexOfChildComponent (const Component* child) const noexcept; | |||
| /** Provides access to the underlying array of child components. | |||
| The most likely reason you may want to use this is for iteration in a range-based for loop. | |||
| */ | |||
| const Array<Component*>& getChildren() const noexcept { return childComponentList; } | |||
| /** Looks for a child component with the specified ID. | |||
| @see setComponentID, getComponentID | |||
| */ | |||
| @@ -2251,14 +2256,14 @@ private: | |||
| //============================================================================== | |||
| String componentName, componentID; | |||
| Component* parentComponent; | |||
| Component* parentComponent = nullptr; | |||
| Rectangle<int> boundsRelativeToParent; | |||
| ScopedPointer<Positioner> positioner; | |||
| ScopedPointer<AffineTransform> affineTransform; | |||
| Array<Component*> childComponentList; | |||
| LookAndFeel* lookAndFeel; | |||
| LookAndFeel* lookAndFeel = nullptr; | |||
| MouseCursor cursor; | |||
| ImageEffectFilter* effect; | |||
| ImageEffectFilter* effect = nullptr; | |||
| ScopedPointer<CachedComponentImage> cachedImage; | |||
| class MouseListenerList; | |||
| @@ -2304,7 +2309,7 @@ private: | |||
| ComponentFlags flags; | |||
| }; | |||
| uint8 componentTransparency; | |||
| uint8 componentTransparency = 0; | |||
| //============================================================================== | |||
| void internalMouseEnter (MouseInputSource, Point<float>, Time); | |||
| @@ -140,8 +140,8 @@ bool Drawable::replaceColour (Colour original, Colour replacement) | |||
| { | |||
| bool changed = false; | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| if (auto* d = dynamic_cast<Drawable*> (getChildComponent(i))) | |||
| for (auto* c : getChildren()) | |||
| if (auto* d = dynamic_cast<Drawable*> (c)) | |||
| changed = d->replaceColour (original, replacement) || changed; | |||
| return changed; | |||
| @@ -25,8 +25,7 @@ | |||
| */ | |||
| DrawableComposite::DrawableComposite() | |||
| : bounds (Point<float>(), Point<float> (100.0f, 0.0f), Point<float> (0.0f, 100.0f)), | |||
| updateBoundsReentrant (false) | |||
| : bounds (Point<float>(), Point<float> (100.0f, 0.0f), Point<float> (0.0f, 100.0f)) | |||
| { | |||
| setContentArea (RelativeRectangle (Rectangle<float> (0.0f, 0.0f, 100.0f, 100.0f))); | |||
| } | |||
| @@ -35,11 +34,10 @@ DrawableComposite::DrawableComposite (const DrawableComposite& other) | |||
| : Drawable (other), | |||
| bounds (other.bounds), | |||
| markersX (other.markersX), | |||
| markersY (other.markersY), | |||
| updateBoundsReentrant (false) | |||
| markersY (other.markersY) | |||
| { | |||
| for (int i = 0; i < other.getNumChildComponents(); ++i) | |||
| if (const Drawable* const d = dynamic_cast<const Drawable*> (other.getChildComponent(i))) | |||
| for (auto* c : other.getChildren()) | |||
| if (auto* d = dynamic_cast<const Drawable*> (c)) | |||
| addAndMakeVisible (d->createCopy()); | |||
| } | |||
| @@ -58,8 +56,8 @@ Rectangle<float> DrawableComposite::getDrawableBounds() const | |||
| { | |||
| Rectangle<float> r; | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| if (const Drawable* const d = dynamic_cast<const Drawable*> (getChildComponent(i))) | |||
| for (auto* c : getChildren()) | |||
| if (auto* d = dynamic_cast<const Drawable*> (c)) | |||
| r = r.getUnion (d->isTransformed() ? d->getDrawableBounds().transformedBy (d->getTransform()) | |||
| : d->getDrawableBounds()); | |||
| @@ -96,7 +94,7 @@ void DrawableComposite::setBoundingBox (const RelativeParallelogram& newBounds) | |||
| if (bounds.isDynamic()) | |||
| { | |||
| Drawable::Positioner<DrawableComposite>* const p = new Drawable::Positioner<DrawableComposite> (*this); | |||
| auto p = new Drawable::Positioner<DrawableComposite> (*this); | |||
| setPositioner (p); | |||
| p->apply(); | |||
| } | |||
| @@ -135,11 +133,11 @@ void DrawableComposite::recalculateCoordinates (Expression::Scope* scope) | |||
| Point<float> resolved[3]; | |||
| bounds.resolveThreePoints (resolved, scope); | |||
| const Rectangle<float> content (getContentArea().resolve (scope)); | |||
| auto content = getContentArea().resolve (scope); | |||
| AffineTransform t (AffineTransform::fromTargetPoints (content.getX(), content.getY(), resolved[0].x, resolved[0].y, | |||
| content.getRight(), content.getY(), resolved[1].x, resolved[1].y, | |||
| content.getX(), content.getBottom(), resolved[2].x, resolved[2].y)); | |||
| auto t = AffineTransform::fromTargetPoints (content.getX(), content.getY(), resolved[0].x, resolved[0].y, | |||
| content.getRight(), content.getY(), resolved[1].x, resolved[1].y, | |||
| content.getX(), content.getBottom(), resolved[2].x, resolved[2].y); | |||
| if (t.isSingularity()) | |||
| t = AffineTransform(); | |||
| @@ -149,8 +147,7 @@ void DrawableComposite::recalculateCoordinates (Expression::Scope* scope) | |||
| void DrawableComposite::parentHierarchyChanged() | |||
| { | |||
| DrawableComposite* parent = getParent(); | |||
| if (parent != nullptr) | |||
| if (auto* parent = getParent()) | |||
| originRelativeToComponent = parent->originRelativeToComponent - getPosition(); | |||
| } | |||
| @@ -172,10 +169,10 @@ void DrawableComposite::updateBoundsToFitChildren() | |||
| Rectangle<int> childArea; | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| childArea = childArea.getUnion (getChildComponent(i)->getBoundsInParent()); | |||
| for (auto* c : getChildren()) | |||
| childArea = childArea.getUnion (c->getBoundsInParent()); | |||
| const Point<int> delta (childArea.getPosition()); | |||
| auto delta = childArea.getPosition(); | |||
| childArea += getPosition(); | |||
| if (childArea != getBounds()) | |||
| @@ -184,9 +181,8 @@ void DrawableComposite::updateBoundsToFitChildren() | |||
| { | |||
| originRelativeToComponent -= delta; | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| if (Component* const c = getChildComponent(i)) | |||
| c->setBounds (c->getBounds() - delta); | |||
| for (auto* c : getChildren()) | |||
| c->setBounds (c->getBounds() - delta); | |||
| } | |||
| setBounds (childArea); | |||
| @@ -306,9 +302,9 @@ ValueTree DrawableComposite::createValueTree (ComponentBuilder::ImageProvider* i | |||
| ValueTree childList (v.getChildListCreating (nullptr)); | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| for (auto* c : getChildren()) | |||
| { | |||
| const Drawable* const d = dynamic_cast<const Drawable*> (getChildComponent(i)); | |||
| auto* d = dynamic_cast<const Drawable*> (c); | |||
| jassert (d != nullptr); // You can't save a mix of Drawables and normal components! | |||
| childList.addChild (d->createValueTree (imageProvider), -1, nullptr); | |||
| @@ -324,11 +320,10 @@ Path DrawableComposite::getOutlineAsPath() const | |||
| { | |||
| Path p; | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| if (auto* childDrawable = dynamic_cast<Drawable*> (getChildComponent (i))) | |||
| p.addPath (childDrawable->getOutlineAsPath()); | |||
| for (auto* c : getChildren()) | |||
| if (auto* d = dynamic_cast<Drawable*> (c)) | |||
| p.addPath (d->getOutlineAsPath()); | |||
| p.applyTransform (getTransform()); | |||
| return p; | |||
| } | |||
| @@ -148,7 +148,7 @@ private: | |||
| //============================================================================== | |||
| RelativeParallelogram bounds; | |||
| MarkerList markersX, markersY; | |||
| bool updateBoundsReentrant; | |||
| bool updateBoundsReentrant = false; | |||
| friend class Drawable::Positioner<DrawableComposite>; | |||
| bool registerCoordinates (RelativeCoordinatePositionerBase&); | |||
| @@ -30,46 +30,40 @@ namespace KeyboardFocusHelpers | |||
| // left-to-right and then top-to-bottom. | |||
| struct ScreenPositionComparator | |||
| { | |||
| static int compareElements (const Component* const first, const Component* const second) | |||
| static int compareElements (const Component* first, const Component* second) | |||
| { | |||
| const int explicitOrder1 = getOrder (first); | |||
| const int explicitOrder2 = getOrder (second); | |||
| auto explicitOrder1 = getOrder (first); | |||
| auto explicitOrder2 = getOrder (second); | |||
| if (explicitOrder1 != explicitOrder2) | |||
| return explicitOrder1 - explicitOrder2; | |||
| const int yDiff = first->getY() - second->getY(); | |||
| auto yDiff = first->getY() - second->getY(); | |||
| return yDiff == 0 ? first->getX() - second->getX() | |||
| : yDiff; | |||
| } | |||
| static int getOrder (const Component* const c) | |||
| static int getOrder (const Component* c) | |||
| { | |||
| const int order = c->getExplicitFocusOrder(); | |||
| auto order = c->getExplicitFocusOrder(); | |||
| return order > 0 ? order : (std::numeric_limits<int>::max() / 2); | |||
| } | |||
| }; | |||
| static void findAllFocusableComponents (Component* const parent, Array <Component*>& comps) | |||
| static void findAllFocusableComponents (Component* parent, Array<Component*>& comps) | |||
| { | |||
| if (parent->getNumChildComponents() > 0) | |||
| if (parent->getNumChildComponents() != 0) | |||
| { | |||
| Array <Component*> localComps; | |||
| Array<Component*> localComps; | |||
| ScreenPositionComparator comparator; | |||
| for (int i = parent->getNumChildComponents(); --i >= 0;) | |||
| { | |||
| Component* const c = parent->getChildComponent (i); | |||
| for (auto* c : parent->getChildren()) | |||
| if (c->isVisible() && c->isEnabled()) | |||
| localComps.addSorted (comparator, c); | |||
| } | |||
| for (int i = 0; i < localComps.size(); ++i) | |||
| for (auto* c : localComps) | |||
| { | |||
| Component* const c = localComps.getUnchecked (i); | |||
| if (c->getWantsKeyboardFocus()) | |||
| comps.add (c); | |||
| @@ -90,18 +84,16 @@ namespace KeyboardFocusHelpers | |||
| return c; | |||
| } | |||
| static Component* getIncrementedComponent (Component* const current, const int delta) | |||
| static Component* getIncrementedComponent (Component* current, int delta) | |||
| { | |||
| Component* focusContainer = findFocusContainer (current); | |||
| if (focusContainer != nullptr) | |||
| if (auto* focusContainer = findFocusContainer (current)) | |||
| { | |||
| Array <Component*> comps; | |||
| Array<Component*> comps; | |||
| KeyboardFocusHelpers::findAllFocusableComponents (focusContainer, comps); | |||
| if (comps.size() > 0) | |||
| if (! comps.isEmpty()) | |||
| { | |||
| const int index = comps.indexOf (current); | |||
| auto index = comps.indexOf (current); | |||
| return comps [(index + comps.size() + delta) % comps.size()]; | |||
| } | |||
| } | |||
| @@ -128,7 +120,7 @@ Component* KeyboardFocusTraverser::getPreviousComponent (Component* current) | |||
| Component* KeyboardFocusTraverser::getDefaultComponent (Component* parentComponent) | |||
| { | |||
| Array <Component*> comps; | |||
| Array<Component*> comps; | |||
| if (parentComponent != nullptr) | |||
| KeyboardFocusHelpers::findAllFocusableComponents (parentComponent, comps); | |||
| @@ -52,9 +52,9 @@ namespace ComponentBuilderHelpers | |||
| if (c.getComponentID() == compId) | |||
| return &c; | |||
| for (int i = c.getNumChildComponents(); --i >= 0;) | |||
| if (Component* const child = findComponentWithID (*c.getChildComponent (i), compId)) | |||
| return child; | |||
| for (auto* child : c.getChildren()) | |||
| if (auto* found = findComponentWithID (*child, compId)) | |||
| return found; | |||
| return nullptr; | |||
| } | |||
| @@ -238,7 +238,7 @@ void ComponentBuilder::updateChildComponents (Component& parent, const ValueTree | |||
| { | |||
| using namespace ComponentBuilderHelpers; | |||
| const int numExistingChildComps = parent.getNumChildComponents(); | |||
| auto numExistingChildComps = parent.getNumChildComponents(); | |||
| Array<Component*> componentsInOrder; | |||
| componentsInOrder.ensureStorageAllocated (numExistingChildComps); | |||
| @@ -250,15 +250,16 @@ void ComponentBuilder::updateChildComponents (Component& parent, const ValueTree | |||
| for (int i = 0; i < numExistingChildComps; ++i) | |||
| existingComponents.add (parent.getChildComponent (i)); | |||
| const int newNumChildren = children.getNumChildren(); | |||
| auto newNumChildren = children.getNumChildren(); | |||
| for (int i = 0; i < newNumChildren; ++i) | |||
| { | |||
| const ValueTree childState (children.getChild (i)); | |||
| Component* c = removeComponentWithID (existingComponents, getStateId (childState)); | |||
| auto childState = children.getChild (i); | |||
| auto* c = removeComponentWithID (existingComponents, getStateId (childState)); | |||
| if (c == nullptr) | |||
| { | |||
| if (TypeHandler* const type = getHandlerForState (childState)) | |||
| if (auto* type = getHandlerForState (childState)) | |||
| c = ComponentBuilderHelpers::createNewComponent (*type, childState, &parent); | |||
| else | |||
| jassertfalse; | |||
| @@ -143,7 +143,7 @@ void MultiDocumentPanel::addWindow (Component* component) | |||
| int x = 4; | |||
| if (Component* const topComp = getChildComponent (getNumChildComponents() - 1)) | |||
| if (auto* topComp = getChildren().getLast()) | |||
| if (topComp->getX() == x && topComp->getY() == x) | |||
| x += 16; | |||
| @@ -200,7 +200,7 @@ bool MultiDocumentPanel::addDocument (Component* const component, | |||
| { | |||
| addAndMakeVisible (tabComponent = new TabbedComponentInternal()); | |||
| Array <Component*> temp (components); | |||
| Array<Component*> temp (components); | |||
| for (int i = 0; i < temp.size(); ++i) | |||
| tabComponent->addTab (temp[i]->getName(), docColour, temp[i], false); | |||
| @@ -239,9 +239,9 @@ bool MultiDocumentPanel::closeDocument (Component* component, | |||
| if (mode == FloatingWindows) | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| for (auto* child : getChildren()) | |||
| { | |||
| if (MultiDocumentPanelWindow* const dw = dynamic_cast<MultiDocumentPanelWindow*> (getChildComponent (i))) | |||
| if (auto* dw = dynamic_cast<MultiDocumentPanelWindow*> (child)) | |||
| { | |||
| if (dw->getContentComponent() == component) | |||
| { | |||
| @@ -326,8 +326,8 @@ Component* MultiDocumentPanel::getActiveDocument() const noexcept | |||
| { | |||
| if (mode == FloatingWindows) | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| if (MultiDocumentPanelWindow* const dw = dynamic_cast<MultiDocumentPanelWindow*> (getChildComponent (i))) | |||
| for (auto* child : getChildren()) | |||
| if (auto* dw = dynamic_cast<MultiDocumentPanelWindow*> (child)) | |||
| if (dw->isActiveWindow()) | |||
| return dw->getContentComponent(); | |||
| } | |||
| @@ -411,7 +411,7 @@ void MultiDocumentPanel::setLayoutMode (const LayoutMode newLayoutMode) | |||
| resized(); | |||
| const Array <Component*> tempComps (components); | |||
| const Array<Component*> tempComps (components); | |||
| components.clear(); | |||
| for (int i = 0; i < tempComps.size(); ++i) | |||
| @@ -445,8 +445,8 @@ void MultiDocumentPanel::resized() | |||
| { | |||
| if (mode == MaximisedWindowsWithTabs || components.size() == numDocsBeforeTabsUsed) | |||
| { | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| getChildComponent (i)->setBounds (getLocalBounds()); | |||
| for (auto* child : getChildren()) | |||
| child->setBounds (getLocalBounds()); | |||
| } | |||
| setWantsKeyboardFocus (components.size() == 0); | |||
| @@ -456,8 +456,8 @@ Component* MultiDocumentPanel::getContainerComp (Component* c) const | |||
| { | |||
| if (mode == FloatingWindows) | |||
| { | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| if (MultiDocumentPanelWindow* const dw = dynamic_cast<MultiDocumentPanelWindow*> (getChildComponent (i))) | |||
| for (auto* child : getChildren()) | |||
| if (auto* dw = dynamic_cast<MultiDocumentPanelWindow*> (child)) | |||
| if (dw->getContentComponent() == c) | |||
| return dw; | |||
| } | |||
| @@ -469,8 +469,8 @@ void MultiDocumentPanel::componentNameChanged (Component&) | |||
| { | |||
| if (mode == FloatingWindows) | |||
| { | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| if (MultiDocumentPanelWindow* const dw = dynamic_cast<MultiDocumentPanelWindow*> (getChildComponent (i))) | |||
| for (auto* child : getChildren()) | |||
| if (auto* dw = dynamic_cast<MultiDocumentPanelWindow*> (child)) | |||
| dw->setName (dw->getContentComponent()->getName()); | |||
| } | |||
| else if (tabComponent != nullptr) | |||
| @@ -482,21 +482,21 @@ void MultiDocumentPanel::componentNameChanged (Component&) | |||
| void MultiDocumentPanel::updateOrder() | |||
| { | |||
| const Array <Component*> oldList (components); | |||
| auto oldList = components; | |||
| if (mode == FloatingWindows) | |||
| { | |||
| components.clear(); | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| if (MultiDocumentPanelWindow* const dw = dynamic_cast<MultiDocumentPanelWindow*> (getChildComponent (i))) | |||
| for (auto* child : getChildren()) | |||
| if (auto* dw = dynamic_cast<MultiDocumentPanelWindow*> (child)) | |||
| components.add (dw->getContentComponent()); | |||
| } | |||
| else | |||
| { | |||
| if (tabComponent != nullptr) | |||
| { | |||
| if (Component* const current = tabComponent->getCurrentContentComponent()) | |||
| if (auto* current = tabComponent->getCurrentContentComponent()) | |||
| { | |||
| components.removeFirstMatchingValue (current); | |||
| components.add (current); | |||
| @@ -221,8 +221,8 @@ void TabbedButtonBar::setOrientation (const Orientation newOrientation) | |||
| { | |||
| orientation = newOrientation; | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| getChildComponent (i)->resized(); | |||
| for (auto* child : getChildren()) | |||
| child->resized(); | |||
| resized(); | |||
| } | |||
| @@ -378,9 +378,9 @@ AlertWindow* LookAndFeel_V4::createAlertWindow (const String& title, const Strin | |||
| bounds = bounds.withSizeKeepingCentre (bounds.getWidth() + boundsOffset, bounds.getHeight() + boundsOffset); | |||
| aw->setBounds (bounds); | |||
| for (int i = 0, maxI = aw->getNumChildComponents(); i < maxI; ++i) | |||
| if (auto button = dynamic_cast<TextButton*> (aw->getChildComponent(i))) | |||
| button->setBounds (button->getBounds().withPosition (button->getX() + 25, button->getY() + 40)); | |||
| for (auto* child : aw->getChildren()) | |||
| if (auto button = dynamic_cast<TextButton*> (child)) | |||
| button->setBounds (button->getBounds() + Point<int> (25, 40)); | |||
| return aw; | |||
| } | |||
| @@ -61,7 +61,7 @@ static NSRect flippedScreenRect (NSRect r) noexcept | |||
| } | |||
| #if JUCE_MODULE_AVAILABLE_juce_opengl | |||
| void componentPeerAboutToChange (ComponentPeer&, bool); | |||
| void componentPeerAboutToChange (Component&, bool); | |||
| #endif | |||
| //============================================================================== | |||
| @@ -672,7 +672,7 @@ public: | |||
| { | |||
| #if JUCE_MODULE_AVAILABLE_juce_opengl | |||
| if ([view window] == window) | |||
| componentPeerAboutToChange (*this, (newWindow == nullptr)); | |||
| componentPeerAboutToChange (getComponent(), newWindow == nullptr); | |||
| #else | |||
| ignoreUnused (newWindow); | |||
| #endif | |||
| @@ -177,7 +177,7 @@ public: | |||
| { | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| { | |||
| if (ToolbarItemComponent* const tc = dynamic_cast<ToolbarItemComponent*> (getChildComponent (i))) | |||
| if (auto* tc = dynamic_cast<ToolbarItemComponent*> (getChildComponent (i))) | |||
| { | |||
| tc->setVisible (false); | |||
| const int index = oldIndexes.removeAndReturn (i); | |||
| @@ -197,9 +197,9 @@ public: | |||
| int y = indent; | |||
| int maxX = 0; | |||
| for (int i = 0; i < getNumChildComponents(); ++i) | |||
| for (auto* c : getChildren()) | |||
| { | |||
| if (ToolbarItemComponent* const tc = dynamic_cast<ToolbarItemComponent*> (getChildComponent (i))) | |||
| if (auto* tc = dynamic_cast<ToolbarItemComponent*> (c)) | |||
| { | |||
| int preferredSize = 1, minSize = 1, maxSize = 1; | |||
| @@ -101,8 +101,8 @@ public: | |||
| addButton (TRANS("Cancel"), 0); | |||
| // (avoid return + escape keys getting processed by the buttons..) | |||
| for (int i = getNumChildComponents(); --i >= 0;) | |||
| getChildComponent (i)->setWantsKeyboardFocus (false); | |||
| for (auto* child : getChildren()) | |||
| child->setWantsKeyboardFocus (false); | |||
| setWantsKeyboardFocus (true); | |||
| grabKeyboardFocus(); | |||
| @@ -113,7 +113,7 @@ public: | |||
| lastPress = key; | |||
| String message (TRANS("Key") + ": " + owner.getDescriptionForKeyPress (key)); | |||
| const CommandID previousCommand = owner.getMappings().findCommandForKeyPress (key); | |||
| auto previousCommand = owner.getMappings().findCommandForKeyPress (key); | |||
| if (previousCommand != 0) | |||
| message << "\n\n(" | |||
| @@ -148,7 +148,7 @@ public: | |||
| { | |||
| if (newKey.isValid()) | |||
| { | |||
| const CommandID previousCommand = owner.getMappings().findCommandForKeyPress (newKey); | |||
| auto previousCommand = owner.getMappings().findCommandForKeyPress (newKey); | |||
| if (previousCommand == 0 || dontAskUser) | |||
| { | |||
| @@ -209,14 +209,14 @@ private: | |||
| class KeyMappingEditorComponent::ItemComponent : public Component | |||
| { | |||
| public: | |||
| ItemComponent (KeyMappingEditorComponent& kec, const CommandID command) | |||
| ItemComponent (KeyMappingEditorComponent& kec, CommandID command) | |||
| : owner (kec), commandID (command) | |||
| { | |||
| setInterceptsMouseClicks (false, true); | |||
| const bool isReadOnly = owner.isCommandReadOnly (commandID); | |||
| const Array<KeyPress> keyPresses (owner.getMappings().getKeyPressesAssignedToCommand (commandID)); | |||
| auto keyPresses = owner.getMappings().getKeyPressesAssignedToCommand (commandID); | |||
| for (int i = 0; i < jmin ((int) maxNumAssignments, keyPresses.size()); ++i) | |||
| addKeyPressButton (owner.getDescriptionForKeyPress (keyPresses.getReference (i)), i, isReadOnly); | |||
| @@ -226,7 +226,7 @@ public: | |||
| void addKeyPressButton (const String& desc, const int index, const bool isReadOnly) | |||
| { | |||
| ChangeKeyButton* const b = new ChangeKeyButton (owner, commandID, desc, index); | |||
| auto* b = new ChangeKeyButton (owner, commandID, desc, index); | |||
| keyChangeButtons.add (b); | |||
| b->setEnabled (! isReadOnly); | |||
| @@ -250,7 +250,7 @@ public: | |||
| for (int i = keyChangeButtons.size(); --i >= 0;) | |||
| { | |||
| ChangeKeyButton* const b = keyChangeButtons.getUnchecked(i); | |||
| auto* b = keyChangeButtons.getUnchecked(i); | |||
| b->fitToContent (getHeight() - 2); | |||
| b->setTopRightPosition (x, 1); | |||
| @@ -272,7 +272,7 @@ private: | |||
| class KeyMappingEditorComponent::MappingItem : public TreeViewItem | |||
| { | |||
| public: | |||
| MappingItem (KeyMappingEditorComponent& kec, const CommandID command) | |||
| MappingItem (KeyMappingEditorComponent& kec, CommandID command) | |||
| : owner (kec), commandID (command) | |||
| {} | |||
| @@ -314,13 +314,9 @@ public: | |||
| if (isNowOpen) | |||
| { | |||
| if (getNumSubItems() == 0) | |||
| { | |||
| const Array<CommandID> commands (owner.getCommandManager().getCommandsInCategory (categoryName)); | |||
| for (int i = 0; i < commands.size(); ++i) | |||
| if (owner.shouldCommandBeIncluded (commands.getUnchecked(i))) | |||
| addSubItem (new MappingItem (owner, commands.getUnchecked(i))); | |||
| } | |||
| for (auto command : owner.getCommandManager().getCommandsInCategory (categoryName)) | |||
| if (owner.shouldCommandBeIncluded (command)) | |||
| addSubItem (new MappingItem (owner, command)); | |||
| } | |||
| else | |||
| { | |||
| @@ -360,19 +356,16 @@ public: | |||
| const OpennessRestorer opennessRestorer (*this); | |||
| clearSubItems(); | |||
| const StringArray categories (owner.getCommandManager().getCommandCategories()); | |||
| for (int i = 0; i < categories.size(); ++i) | |||
| for (auto category : owner.getCommandManager().getCommandCategories()) | |||
| { | |||
| const Array<CommandID> commands (owner.getCommandManager().getCommandsInCategory (categories[i])); | |||
| int count = 0; | |||
| for (int j = 0; j < commands.size(); ++j) | |||
| if (owner.shouldCommandBeIncluded (commands.getUnchecked(j))) | |||
| for (auto command : owner.getCommandManager().getCommandsInCategory (category)) | |||
| if (owner.shouldCommandBeIncluded (command)) | |||
| ++count; | |||
| if (count > 0) | |||
| addSubItem (new CategoryItem (owner, categories[i])); | |||
| addSubItem (new CategoryItem (owner, category)); | |||
| } | |||
| } | |||
| @@ -459,14 +452,14 @@ void KeyMappingEditorComponent::resized() | |||
| //============================================================================== | |||
| bool KeyMappingEditorComponent::shouldCommandBeIncluded (const CommandID commandID) | |||
| { | |||
| const ApplicationCommandInfo* const ci = mappings.getCommandManager().getCommandForID (commandID); | |||
| auto* ci = mappings.getCommandManager().getCommandForID (commandID); | |||
| return ci != nullptr && (ci->flags & ApplicationCommandInfo::hiddenFromKeyEditor) == 0; | |||
| } | |||
| bool KeyMappingEditorComponent::isCommandReadOnly (const CommandID commandID) | |||
| { | |||
| const ApplicationCommandInfo* const ci = mappings.getCommandManager().getCommandForID (commandID); | |||
| auto* ci = mappings.getCommandManager().getCommandForID (commandID); | |||
| return ci != nullptr && (ci->flags & ApplicationCommandInfo::readOnlyInKeyEditor) != 0; | |||
| } | |||
| @@ -53,13 +53,13 @@ private: | |||
| Array<Component*> alreadyDone; | |||
| for (int i = TopLevelWindow::getNumTopLevelWindows(); --i >= 0;) | |||
| if (Component* c = TopLevelWindow::getTopLevelWindow(i)) | |||
| if (auto* c = TopLevelWindow::getTopLevelWindow(i)) | |||
| repaintAndResizeAllComps (c, alreadyDone); | |||
| Desktop& desktop = Desktop::getInstance(); | |||
| auto& desktop = Desktop::getInstance(); | |||
| for (int i = desktop.getNumComponents(); --i >= 0;) | |||
| if (Component* c = desktop.getComponent(i)) | |||
| if (auto* c = desktop.getComponent(i)) | |||
| repaintAndResizeAllComps (c, alreadyDone); | |||
| } | |||
| @@ -73,7 +73,7 @@ private: | |||
| for (int i = c->getNumChildComponents(); --i >= 0;) | |||
| { | |||
| if (Component* child = c->getChildComponent(i)) | |||
| if (auto* child = c->getChildComponent(i)) | |||
| { | |||
| repaintAndResizeAllComps (child, alreadyDone); | |||
| alreadyDone.add (child); | |||
| @@ -124,7 +124,7 @@ LiveValueBase::~LiveValueBase() | |||
| //============================================================================== | |||
| LivePropertyEditorBase::LivePropertyEditorBase (LiveValueBase& v, CodeDocument& d) | |||
| : value (v), resetButton ("reset"), document (d), sourceEditor (document, &tokeniser), wasHex (false) | |||
| : value (v), document (d), sourceEditor (document, &tokeniser) | |||
| { | |||
| setSize (600, 100); | |||
| @@ -155,11 +155,11 @@ void LivePropertyEditorBase::paint (Graphics& g) | |||
| void LivePropertyEditorBase::resized() | |||
| { | |||
| Rectangle<int> r (getLocalBounds().reduced (0, 3).withTrimmedBottom (1)); | |||
| auto r = getLocalBounds().reduced (0, 3).withTrimmedBottom (1); | |||
| Rectangle<int> left (r.removeFromLeft (jmax (200, r.getWidth() / 3))); | |||
| auto left = r.removeFromLeft (jmax (200, r.getWidth() / 3)); | |||
| Rectangle<int> top (left.removeFromTop (25)); | |||
| auto top = left.removeFromTop (25); | |||
| resetButton.setBounds (top.removeFromRight (35).reduced (0, 3)); | |||
| name.setBounds (top); | |||
| @@ -208,8 +208,8 @@ void LivePropertyEditorBase::selectOriginalValue() | |||
| void LivePropertyEditorBase::findOriginalValueInCode() | |||
| { | |||
| CodeDocument::Position pos (document, value.sourceLine, 0); | |||
| String line (pos.getLineText()); | |||
| String::CharPointerType p (line.getCharPointer()); | |||
| auto line = pos.getLineText(); | |||
| auto p = line.getCharPointer(); | |||
| p = CharacterFunctions::find (p, CharPointer_ASCII ("JUCE_LIVE_CONSTANT")); | |||
| @@ -233,13 +233,13 @@ void LivePropertyEditorBase::findOriginalValueInCode() | |||
| if (p.getAndAdvance() == '(') | |||
| { | |||
| String::CharPointerType start (p), end (p); | |||
| auto start = p, end = p; | |||
| int depth = 1; | |||
| while (! end.isEmpty()) | |||
| { | |||
| const juce_wchar c = end.getAndAdvance(); | |||
| auto c = end.getAndAdvance(); | |||
| if (c == '(') ++depth; | |||
| if (c == ')') --depth; | |||
| @@ -328,11 +328,11 @@ public: | |||
| void updateItems (ValueList& list) | |||
| { | |||
| if (ValueListHolderComponent* l = dynamic_cast<ValueListHolderComponent*> (viewport.getViewedComponent())) | |||
| if (auto* l = dynamic_cast<ValueListHolderComponent*> (viewport.getViewedComponent())) | |||
| { | |||
| while (l->getNumChildComponents() < list.values.size()) | |||
| { | |||
| if (LiveValueBase* v = list.values [l->getNumChildComponents()]) | |||
| if (auto* v = list.values [l->getNumChildComponents()]) | |||
| l->addItem (viewport.getMaximumVisibleWidth(), *v, list.getDocument (v->sourceFile)); | |||
| else | |||
| break; | |||
| @@ -346,7 +346,7 @@ public: | |||
| { | |||
| DocumentWindow::resized(); | |||
| if (ValueListHolderComponent* l = dynamic_cast<ValueListHolderComponent*> (viewport.getViewedComponent())) | |||
| if (auto* l = dynamic_cast<ValueListHolderComponent*> (viewport.getViewedComponent())) | |||
| l->layout (viewport.getMaximumVisibleWidth()); | |||
| } | |||
| @@ -379,7 +379,7 @@ CodeDocument& ValueList::getDocument (const File& file) | |||
| if (index >= 0) | |||
| return *documents.getUnchecked (index); | |||
| CodeDocument* doc = documents.add (new CodeDocument()); | |||
| auto* doc = documents.add (new CodeDocument()); | |||
| documentFiles.add (file); | |||
| doc->replaceAllContent (file.loadFileAsString()); | |||
| doc->clearUndoHistory(); | |||
| @@ -409,7 +409,7 @@ struct ColourEditorComp : public Component, | |||
| void mouseDown (const MouseEvent&) override | |||
| { | |||
| ColourSelector* colourSelector = new ColourSelector(); | |||
| auto* colourSelector = new ColourSelector(); | |||
| colourSelector->setName ("Colour"); | |||
| colourSelector->setCurrentColour (getColour()); | |||
| colourSelector->addChangeListener (this); | |||
| @@ -421,7 +421,7 @@ struct ColourEditorComp : public Component, | |||
| void changeListenerCallback (ChangeBroadcaster* source) override | |||
| { | |||
| if (ColourSelector* cs = dynamic_cast<ColourSelector*> (source)) | |||
| if (auto* cs = dynamic_cast<ColourSelector*> (source)) | |||
| editor.applyNewValue (getAsString (cs->getCurrentColour(), true)); | |||
| repaint(); | |||
| @@ -493,9 +493,9 @@ struct BoolSliderComp : public SliderComp | |||
| void sliderValueChanged (Slider*) override { editor.applyNewValue (slider.getValue() > 0.5 ? "true" : "false"); } | |||
| }; | |||
| Component* createIntegerSlider (LivePropertyEditorBase& editor) { return new SliderComp (editor, false); } | |||
| Component* createFloatSlider (LivePropertyEditorBase& editor) { return new SliderComp (editor, true); } | |||
| Component* createBoolSlider (LivePropertyEditorBase& editor) { return new BoolSliderComp (editor); } | |||
| Component* createIntegerSlider (LivePropertyEditorBase& editor) { return new SliderComp (editor, false); } | |||
| Component* createFloatSlider (LivePropertyEditorBase& editor) { return new SliderComp (editor, true); } | |||
| Component* createBoolSlider (LivePropertyEditorBase& editor) { return new BoolSliderComp (editor); } | |||
| } | |||
| @@ -123,13 +123,13 @@ namespace LiveConstantEditor | |||
| LiveValueBase& value; | |||
| Label name; | |||
| TextEditor valueEditor; | |||
| TextButton resetButton; | |||
| TextButton resetButton { "reset" }; | |||
| CodeDocument& document; | |||
| CPlusPlusCodeTokeniser tokeniser; | |||
| CodeEditorComponent sourceEditor; | |||
| CodeDocument::Position valueStart, valueEnd; | |||
| ScopedPointer<Component> customComp; | |||
| bool wasHex; | |||
| bool wasHex = false; | |||
| JUCE_DECLARE_NON_COPYABLE (LivePropertyEditorBase) | |||
| }; | |||
| @@ -247,21 +247,11 @@ bool OpenGLHelpers::isContextActive() | |||
| } | |||
| //============================================================================== | |||
| void componentPeerAboutToChange (ComponentPeer& peer, bool shouldSuspend) | |||
| void componentPeerAboutToChange (Component& comp, bool shouldSuspend) | |||
| { | |||
| Array<Component*> stack; | |||
| stack.add (&peer.getComponent()); | |||
| if (auto* context = OpenGLContext::getContextAttachedTo (comp)) | |||
| context->overrideCanBeAttached (shouldSuspend); | |||
| while (stack.size() != 0) | |||
| { | |||
| Component& comp = *stack.removeAndReturn (0); | |||
| const int n = comp.getNumChildComponents(); | |||
| for (int i = 0; i < n; ++i) | |||
| if (Component* child = comp.getChildComponent (i)) | |||
| stack.add (child); | |||
| if (OpenGLContext* context = OpenGLContext::getContextAttachedTo (comp)) | |||
| context->overrideCanBeAttached (shouldSuspend); | |||
| } | |||
| for (auto* child : comp.getChildren()) | |||
| componentPeerAboutToChange (*child, shouldSuspend); | |||
| } | |||
| @@ -322,14 +322,14 @@ private: | |||
| struct AsyncWorkerFunctor : AsyncWorker | |||
| { | |||
| AsyncWorkerFunctor (T functorToUse) : functor (functorToUse) {} | |||
| void operator() (OpenGLContext& callerContext) override { functor (callerContext); } | |||
| void operator() (OpenGLContext& callerContext) override { functor (callerContext); } | |||
| T functor; | |||
| JUCE_DECLARE_NON_COPYABLE(AsyncWorkerFunctor) | |||
| JUCE_DECLARE_NON_COPYABLE (AsyncWorkerFunctor) | |||
| }; | |||
| //============================================================================== | |||
| friend void componentPeerAboutToChange (ComponentPeer&, bool); | |||
| friend void componentPeerAboutToChange (Component&, bool); | |||
| void overrideCanBeAttached (bool); | |||
| //============================================================================== | |||