コード例 #1
0
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);
    }
}
コード例 #2
0
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);
    }
}
コード例 #3
0
const int EdoChatWindowMessage::getMessageHeight(const int parentWidth, const Justification justification)
{
	GlyphArrangement messageGlyphs;
	float top,left,right,bottom;

	applyOptions();
	messageGlyphs.clear();

	messageGlyphs.addJustifiedText (
										EdoRestoreFont (getPropertyString(EWND_MESSAGE_FONT), Font(14)), 
										messageLabel->getText(), 
										0, 
										0, 
										(float)parentWidth, 
										justification
									);

	messageGlyphs.getBoundingBox (0, -1, left, top, right, bottom, true);

	messageHeight = roundFloatToInt ((bottom - top) + SPACER);

	// Log (String::formatted (T("EdoChatWindowMessage::getMessageHeight parentWidth: %d height: %d"), parentWidth, messageHeight));

	if (avatar->isVisible())
	{
		if (messageHeight < (avatar->getHeight()+16))
		{
			messageHeight = avatar->getHeight()+16;
			return (messageHeight+SPACER);
		}
		else
		{
			return (messageHeight+SPACER);
		}
	}
	else
	{
		return (messageHeight+SPACER);
	}
}