Exemplo n.º 1
0
void TrackInfoComponent::paint (Graphics& g)
{
    const int w = getWidth();
    const int h = getHeight();
    const int m = 5;

    g.setColour (Colours::white);
    g.setFont (20);
    
    ValueTree trackInfo (audioFilePlayer.getLibraryEntry());
    
    if (trackInfo.isValid())
    {
        String infoText;
        infoText << trackInfo[MusicColumns::columnNames[MusicColumns::Artist]].toString() << "\n";
        infoText << trackInfo[MusicColumns::columnNames[MusicColumns::Song]].toString() << "\n";
        infoText << trackInfo[MusicColumns::columnNames[MusicColumns::Album]].toString() << "\n";
        infoText << trackInfo[MusicColumns::columnNames[MusicColumns::BPM]].toString();
        
        g.setFont (16);
        g.drawText (trackInfo[MusicColumns::columnNames[MusicColumns::Artist]].toString(),
                    m, m, w - (2 * m), 16,
                    Justification::centredLeft,
                    true);

        g.setFont (20);
        g.drawText (trackInfo[MusicColumns::columnNames[MusicColumns::Song]].toString(),
                          m, 16 + (2 * m), w - (2 * m), 20,
                          Justification::centredLeft,
                          true);
        
        g.setColour (Colours::lightgrey);
        g.setFont (12);
        g.drawText (trackInfo[MusicColumns::columnNames[MusicColumns::Album]].toString(),
                    m, 36 + (3 * m), w - (2 * m), 12,
                    Justification::centredLeft,
                    true);
        
    }
    else
    {
        String displayText;
        if (audioFilePlayer.getTotalLength() > 0)
            displayText = "No Track Info Available";
        else
            displayText = "Drop Tracks Here to Begin...";
        
        g.drawFittedText (displayText,
                          0, 0, w, h,
                          Justification (Justification::centred),
                          2);
    }
}
Exemplo n.º 2
0
//==============================================================================
void TrackBox::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]

    g.fillAll (Colours::white);

    //[UserPaint] Add your own custom painting code here..
    g.fillAll(trackColour);
    g.setColour(Colours::black);
    g.setFont(5*getHeight()/12);
    g.drawText(trackName, Rectangle<int>(0, 0, getWidth(), getHeight()), Justification(4), true);
    //[/UserPaint]
}
Exemplo n.º 3
0
void CtrlrValueTreeEditorItem::paintItem (Graphics &g, int width, int height)
{
	Image icon = provider.getIconForItem (treeToEdit);
	if (isSelected())
	{
		drawSelectionRectangle (g,width,height);
	}

	g.setColour (Colours::black);

	AttributedString as = provider.getDisplayString(treeToEdit);
	as.setJustification (Justification (Justification::centredLeft));
	as.draw (g, Rectangle <float> (24.0, 0.0, width - 24.0, height));
	g.drawImageWithin (icon, 4, 0, 16, height, RectanglePlacement (RectanglePlacement::centred));
}
Exemplo n.º 4
0
void BCMLabel::applyProperties(LabelProperties& props) 
{
    applyWidgetProperties(props);
    
	maxTextLines = props.maxTextLines;

    String labelText = getText();
    String tooltip   = getText();
    
    mapsToParameter = false;
    
    if (getName().equalsIgnoreCase("configurationfilepath"))
        labelText = scopeSyncGUI.getScopeSync().getConfigurationFile().getFullPathName();
    else if (getName().equalsIgnoreCase("configurationname"))
        labelText = scopeSyncGUI.getScopeSync().getConfigurationName(true);
    else
    {
        setupMapping(Ids::label, getName(), props.mappingParentType, props.mappingParent);

        if (mapsToParameter)
        {
            String shortDescription;
            String fullDescription;
            
            parameter->getDescriptions(shortDescription, fullDescription);
            tooltip = fullDescription;
            
            if (props.parameterTextDisplay == LabelProperties::parameterName)
                labelText = parameter->getName();
            else if (props.parameterTextDisplay == LabelProperties::shortDescription)
                labelText = shortDescription;
            else if (props.parameterTextDisplay == LabelProperties::fullDescription)
                labelText = fullDescription;
            else if (props.parameterTextDisplay == LabelProperties::scopeCode)
                labelText = parameter->getScopeCode();
        }
    }

    // Only relevant if label is editable. Not currently supported
    setEditable(false, false, false);
      
    setText(labelText, dontSendNotification);
    setTooltip(tooltip);
    
    setFont(Font(props.fontHeight, props.fontStyleFlags));
    setJustificationType(Justification(props.justificationFlags));
}
Exemplo n.º 5
0
Justification DrawableText::ValueTreeWrapper::getJustification() const
{
    return Justification ((int) state [justification]);
}
Exemplo n.º 6
0
void HoaMapComponent::draw_sources(Graphics& g)
{
    float source_thickness = 1.;
    float center = getWidth() * 0.5;
    for(int i = 0; i < m_sources->getNumberOfSources(); i++)
    {
        if(!m_sources->sourceGetMute(i))
        {
            g.setColour(Colour(0xff444444));
            float source_x = m_sources->sourceGetAbscissa(i) * m_sources->getZoom() * center + center;
            float source_y = -m_sources->sourceGetOrdinate(i) * m_sources->getZoom() * center + center;
            
            g.fillEllipse(source_x - m_sources_size * 0.35, source_y - m_sources_size * 0.35, m_sources_size * 0.7, m_sources_size * 0.7);
            
            if(i == m_source_selected)
            {
                source_thickness *= 1.5;
                for(int j = 0; j < m_sources->sourceGetNumberOfGroups(i); j++)
                {
                    int group_index = m_sources->sourceGetGroupIndex(i, j);
                    float group_x = m_sources->groupGetAbscissa(group_index) * m_sources->getZoom() * center + center;
                    float group_y = -m_sources->groupGetOrdinate(group_index) * m_sources->getZoom() * center + center;
                    g.drawLine(source_x, source_y, group_x, group_y);
                }
                
                g.setColour(Colour(0xff444444).withAlpha(0.5f));
                g.fillEllipse(source_x - m_sources_size * 0.5, source_y - m_sources_size * 0.5, m_sources_size, m_sources_size);
            }
            else
            {
                source_thickness = 1.;
            }
            
            g.drawEllipse(source_x - m_sources_size * 0.5, source_y - m_sources_size * 0.5, m_sources_size , m_sources_size, source_thickness);
            
            g.setFont(11);
            g.setColour(Colours::black);
            g.drawText(String(i+1), source_x - m_sources_size * 0.35, source_y - m_sources_size * 1.5,  m_sources_size, m_sources_size, Justification(4), false);
        }
    }
}
Exemplo n.º 7
0
void HoaMap::draw_source(Graphics& g, int _sourceIndex)
{
    Path source;
    float sourceSize = m_sourceSize;
    m_sources[_sourceIndex].doSmoothValue();
    //float sourceX = m_sources[_sourceIndex].getSmoothX();
    //float sourceY = m_sources[_sourceIndex].getSmoothY();
    float sourceX = m_sources[_sourceIndex].getX();
    float sourceY = m_sources[_sourceIndex].getY();
    float sourceThickness = sourceSize*0.1;
    if (_sourceIndex == m_sourceOver) sourceThickness *= 1.5;
    
    g.beginTransparencyLayer(1);
    
    //g.addTransform(AffineTransform::translation(m_padding, m_padding));
    g.addTransform(AffineTransform::fromTargetPoints(-1, 1, 0, 0,
                                                     1, 1, getPadWidth(), 0,
                                                     1, -1, getPadWidth(), getPadWidth()));

    //g.setColour ( (Colour((float)fmod( (float)_sourceIndex * 1.61803398875, 1), (float)0.5, (float)0.8, (float)0.9 )).withAlpha((float)0.9) );
    
    g.setColour( Colour(0xff444444) );
    
    source.addCentredArc(sourceX, sourceY, sourceSize*0.35, sourceSize*0.35, 0, 0, CICM_2PI);
    g.fillPath(source);
    source.clear();
    
    //g.setColour ( Colour(0xff444444) );
    source.startNewSubPath(sourceX, sourceY-sourceSize*0.5);
    source.addCentredArc(sourceX, sourceY, sourceSize*0.5, sourceSize*0.5, 0, 0, CICM_2PI);
    g.strokePath(source, sourceThickness);
    
    g.endTransparencyLayer();
    
    // add text to the source :
    g.setFont(11);
    g.setColour ( Colour(0xff444444) );
    g.drawText(String(_sourceIndex+1), getSourcePixRect(m_sources[_sourceIndex]).translated(-sourceSize*0.35*getPadWidth(), -sourceSize*0.35*getPadWidth()), Justification(4), FALSE);
}