void PluginListComponent::paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected) { if (rowIsSelected) g.fillAll (findColour (TextEditor::highlightColourId)); String name, desc; bool isBlacklisted = false; if (row >= list.getNumTypes()) { isBlacklisted = true; name = list.getBlacklistedFiles() [row - list.getNumTypes()]; desc = TRANS("Deactivated after failing to initialise correctly"); } else if (const PluginDescription* const pd = list.getType (row)) { name = pd->name; desc << pd->pluginFormatName << (pd->isInstrument ? " instrument" : " effect") << " - " << pd->numInputChannels << (pd->numInputChannels == 1 ? " in" : " ins") << " / " << pd->numOutputChannels << (pd->numOutputChannels == 1 ? " out" : " outs"); if (pd->manufacturerName.isNotEmpty()) desc << " - " << pd->manufacturerName; if (pd->version.isNotEmpty()) desc << " - " << pd->version; if (pd->category.isNotEmpty()) desc << " - category: '" << pd->category << '\''; } if (name.isNotEmpty()) { GlyphArrangement ga; ga.addCurtailedLineOfText (Font (height * 0.7f, Font::bold), name, 8.0f, height * 0.8f, width - 10.0f, true); g.setColour (isBlacklisted ? Colours::red : Colours::black); ga.draw (g); const Rectangle<float> bb (ga.getBoundingBox (0, -1, false)); ga.clear(); ga.addCurtailedLineOfText (Font (height * 0.6f), desc, jmax (bb.getRight() + 10.0f, width / 3.0f), height * 0.8f, width - bb.getRight() - 12.0f, true); g.setColour (isBlacklisted ? Colours::red : Colours::grey); ga.draw (g); } }
void PluginListComponent::paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected) { if (rowIsSelected) g.fillAll (findColour (TextEditor::highlightColourId)); const PluginDescription* const pd = list.getType (row); if (pd != 0) { GlyphArrangement ga; ga.addCurtailedLineOfText (Font (height * 0.7f, Font::bold), pd->name, 8.0f, height * 0.8f, width - 10.0f, true); g.setColour (Colours::black); ga.draw (g); float x, y, r, b; ga.getBoundingBox (0, -1, x, y, r, b, false); String desc; desc << pd->pluginFormatName << (pd->isInstrument ? " instrument" : " effect") << " - " << pd->numInputChannels << (pd->numInputChannels == 1 ? " in" : " ins") << " / " << pd->numOutputChannels << (pd->numOutputChannels == 1 ? " out" : " outs"); if (pd->manufacturerName.isNotEmpty()) desc << " - " << pd->manufacturerName; if (pd->version.isNotEmpty()) desc << " - " << pd->version; if (pd->category.isNotEmpty()) desc << " - category: '" << pd->category << '\''; g.setColour (Colours::grey); ga.clear(); ga.addCurtailedLineOfText (Font (height * 0.6f), desc, r + 10.0f, height * 0.8f, width - r - 12.0f, true); ga.draw (g); } }
void Graphics::drawText (const String& text, const Rectangle<float>& area, Justification justificationType, bool useEllipsesIfTooBig) const { if (text.isNotEmpty() && context.clipRegionIntersects (area.getSmallestIntegerContainer())) { GlyphArrangement arr; arr.addCurtailedLineOfText (context.getFont(), text, 0.0f, 0.0f, area.getWidth(), useEllipsesIfTooBig); arr.justifyGlyphs (0, arr.getNumGlyphs(), area.getX(), area.getY(), area.getWidth(), area.getHeight(), justificationType); arr.draw (*this); } }
void Graphics::drawText (const String& text, const int x, const int y, const int width, const int height, const Justification& justificationType, const bool useEllipsesIfTooBig) const { if (text.isNotEmpty() && context->clipRegionIntersects (Rectangle<int> (x, y, width, height))) { GlyphArrangement arr; arr.addCurtailedLineOfText (context->getFont(), text, 0.0f, 0.0f, (float) width, useEllipsesIfTooBig); arr.justifyGlyphs (0, arr.getNumGlyphs(), (float) x, (float) y, (float) width, (float) height, justificationType); arr.draw (*this); } }