コード例 #1
0
//==============================================================================
void LufsPluginEditor::paint (juce::Graphics& g)
{
    DEBUGPLUGIN_output("LufsPluginEditor::paint");

    g.fillAll( LUFS_COLOR_BACKGROUND );

    juce::Font lufsFont( 36.f );
    lufsFont.setBold(true);
    g.setFont( lufsFont );
    g.setColour( LUFS_COLOR_FONT );

    int x = 10;
    const int width = 120;
    const int height = 60;
    g.setColour( COLOR_LUFSTIME );
    g.drawFittedText( juce::String( "LUFS" ), x, 10, width, 40, juce::Justification::centred, 1, 0.01f );
    x += width;

    juce::Font font( 18.f );
    font.setBold(true);
    g.setFont( font );

    g.setColour( COLOR_MOMENTARY );
    g.drawFittedText( juce::String( "Momentary" ), x, height, width, 20, juce::Justification::centred, 1, 0.01f );
    x += width;
    g.setColour( COLOR_SHORTTERM );
    g.drawFittedText( juce::String( "Short term" ), x, height, width, 20, juce::Justification::centred, 1, 0.01f );
    x += width;
    g.setColour( COLOR_INTEGRATED );
    g.drawFittedText( juce::String( "Integrated" ), x, height, width, 20, juce::Justification::centred, 1, 0.01f );
    x += width;
    g.setColour( COLOR_RANGE );
    g.drawFittedText( juce::String( "Range" ), x, height, width, 20, juce::Justification::centred, 1, 0.01f );
}
コード例 #2
0
void NTLookAndFeel::drawLabel(juce::Graphics &g, juce::Label &label){
    g.fillAll (label.findColour (Label::backgroundColourId));
    
    if (! label.isBeingEdited())
    {
        const float alpha = label.isEnabled() ? 1.0f : 0.5f;
        const Font font (getLabelFont (label));
        
        g.setColour (label.findColour (Label::textColourId).withMultipliedAlpha (alpha));
        g.setFont (font);
        
        Rectangle<int> textArea (label.getBorderSize().subtractedFrom (label.getLocalBounds()));
        
        g.drawFittedText (label.getText(), textArea, label.getJustificationType(),
                          jmax (1, (int) (textArea.getHeight() / font.getHeight())),
                          label.getMinimumHorizontalScale());
        
        g.setColour (label.findColour (Label::outlineColourId).withMultipliedAlpha (alpha));
    }
    else if (label.isEnabled())
    {
        g.setColour (label.findColour (Label::outlineColourId));
    }
    
    g.drawRect (label.getLocalBounds(),2);
}