| @@ -294,7 +294,8 @@ public: | |||||
| pp->setBounds (40, height, width - 50, propertyHeight); | pp->setBounds (40, height, width - 50, propertyHeight); | ||||
| resizePropertyComponent (pp); | |||||
| if (shouldResizePropertyComponent (pp)) | |||||
| resizePropertyComponent (pp); | |||||
| height += pp->getHeight() + 10; | height += pp->getHeight() + 10; | ||||
| } | } | ||||
| @@ -318,24 +319,28 @@ public: | |||||
| descriptionLayout.draw (g, textArea); | descriptionLayout.draw (g, textArea); | ||||
| } | } | ||||
| int getHeightMultiplier (PropertyComponent* pp) | |||||
| { | |||||
| auto availableTextWidth = ProjucerLookAndFeel::getTextWidthForPropertyComponent (pp); | |||||
| OwnedArray<PropertyComponent> properties; | |||||
| auto font = ProjucerLookAndFeel::getPropertyComponentFont(); | |||||
| auto nameWidth = font.getStringWidthFloat (pp->getName()); | |||||
| private: | |||||
| OwnedArray<InfoButton> infoButtons; | |||||
| ContentViewHeader header; | |||||
| AttributedString description; | |||||
| TextLayout descriptionLayout; | |||||
| int headerSize = 40; | |||||
| if (availableTextWidth == 0) | |||||
| return 0; | |||||
| //============================================================================== | |||||
| bool shouldResizePropertyComponent (PropertyComponent* p) | |||||
| { | |||||
| if (auto* textComp = dynamic_cast<TextPropertyComponent*> (p)) | |||||
| return ! textComp->isTextEditorMultiLine(); | |||||
| return static_cast<int> (nameWidth / availableTextWidth); | |||||
| return (dynamic_cast<ChoicePropertyComponent*> (p) != nullptr | |||||
| || dynamic_cast<ButtonPropertyComponent*> (p) != nullptr | |||||
| || dynamic_cast<BooleanPropertyComponent*> (p) != nullptr); | |||||
| } | } | ||||
| void resizePropertyComponent (PropertyComponent* pp) | void resizePropertyComponent (PropertyComponent* pp) | ||||
| { | { | ||||
| if (pp->getName() == "Dependencies") | |||||
| return; | |||||
| for (auto i = pp->getNumChildComponents() - 1; i >= 0; --i) | for (auto i = pp->getNumChildComponents() - 1; i >= 0; --i) | ||||
| { | { | ||||
| auto* child = pp->getChildComponent (i); | auto* child = pp->getChildComponent (i); | ||||
| @@ -345,14 +350,19 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| OwnedArray<PropertyComponent> properties; | |||||
| int getHeightMultiplier (PropertyComponent* pp) | |||||
| { | |||||
| auto availableTextWidth = ProjucerLookAndFeel::getTextWidthForPropertyComponent (pp); | |||||
| private: | |||||
| OwnedArray<InfoButton> infoButtons; | |||||
| ContentViewHeader header; | |||||
| AttributedString description; | |||||
| TextLayout descriptionLayout; | |||||
| int headerSize = 40; | |||||
| auto font = ProjucerLookAndFeel::getPropertyComponentFont(); | |||||
| auto nameWidth = font.getStringWidthFloat (pp->getName()); | |||||
| if (availableTextWidth == 0) | |||||
| return 0; | |||||
| return static_cast<int> (nameWidth / availableTextWidth); | |||||
| } | |||||
| //============================================================================== | |||||
| JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PropertyGroupComponent) | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PropertyGroupComponent) | ||||
| }; | }; | ||||