Sound Meter 0.9.0
Fully resizing logarithmic JUCE meter module.
|
Class responsible for the meter's 'header' part. More...
#include <sd_MeterHeader.h>
Public Member Functions | |
Header (juce::Font &font) noexcept | |
Constructor. More... | |
Header (juce::String name, const juce::AudioChannelSet::ChannelType &type, juce::Font &font) noexcept | |
Constructor with channel identification. More... | |
void | setType (const juce::AudioChannelSet::ChannelType &type) |
Set the channel type. More... | |
const juce::AudioChannelSet::ChannelType & | getType () const noexcept |
Get the channel type. More... | |
void | setName (const juce::String &name) |
Set the channel name. More... | |
juce::String | getName () const noexcept |
Get the channel name. More... | |
float | getNameWidth () const noexcept |
Get the width (in pixels) of the channel name. More... | |
float | getTypeWidth () const noexcept |
Get the width (in pixels) of the channel description. More... | |
juce::String | getInfo () const noexcept |
Get the info text displayed in the 'header'. More... | |
bool | textFits (const juce::String &text, int widthAvailable) const |
Check whether a certain text will fit the width available using the meter's specified font. More... | |
void | setFont (const juce::Font &font) |
Set the font used to display the info (and other text in the meter). More... | |
void | setBounds (const juce::Rectangle< int > &bounds) noexcept |
Set the bounds of the 'header' part of the meter. More... | |
juce::Rectangle< int > | getBounds () const noexcept |
Get the bounds of the 'header' part of the meter. More... | |
bool | isMouseOver (int y) noexcept |
Check if the mouse is over the 'header' part of the meter. More... | |
bool | isMouseOver () const noexcept |
Check if the mouse is over the 'header' part of the meter. More... | |
void | resetMouseOver () noexcept |
Reset 'mouse over' status of the 'header' part of the meter. More... | |
void | setReferredWidth (float referredWidth) noexcept |
Set the referred width (from other meters) used to decide what info to display. More... | |
void | draw (juce::Graphics &g, bool meterActive, bool faderEnabled, const MeterColours &meterColours) |
Draw the 'header' part of the meter. More... | |
Class responsible for the meter's 'header' part.
The 'header' part, is the part above the meter displaying the name (when supplied by the user), the type (left, right) or the abbreviated type if the other two do not fit.
The 'header' also doubles as a button which can de-activate (mute) or activate the meter.
|
explicitnoexcept |
Constructor.
font | The font to use in the header. |
|
noexcept |
Constructor with channel identification.
name | Channel name to display in the header. |
type | Channel type to display in the header. |
font | The font to use in the header. |
void sd::SoundMeter::Header::setType | ( | const juce::AudioChannelSet::ChannelType & | type | ) |
Set the channel type.
For instance: left, right, center, etc..
type | The channel type assigned to the meter. |
Referenced by sd::SoundMeter::MeterChannel::setChannelType().
|
noexcept |
Get the channel type.
For instance: left, right, center, etc..
void sd::SoundMeter::Header::setName | ( | const juce::String & | name | ) |
Set the channel name.
Can be anything the user sets (mid, side, etc..).
name | The channel name assigned to the meter. |
Referenced by sd::SoundMeter::MeterChannel::setChannelName().
|
noexcept |
Get the channel name.
Can be anything the user sets (mid, side, etc..).
|
noexcept |
Get the width (in pixels) of the channel name.
Referenced by sd::SoundMeter::MeterChannel::getChannelNameWidth().
|
noexcept |
Get the width (in pixels) of the channel description.
Referenced by sd::SoundMeter::MeterChannel::getChannelTypeWidth().
|
noexcept |
Get the info text displayed in the 'header'.
This can be either the channel name (when set by the user), the channel type description (left, right, etc..) or the abbreviated channel type description when the other two do not fit.
Referenced by draw().
bool sd::SoundMeter::Header::textFits | ( | const juce::String & | text, |
int | widthAvailable | ||
) | const |
Check whether a certain text will fit the width available using the meter's specified font.
text | The info text to check the width of. |
widthAvailable | The width available in the 'header' part. |
Referenced by sd::SoundMeter::MeterChannel::nameFits().
void sd::SoundMeter::Header::setFont | ( | const juce::Font & | font | ) |
Set the font used to display the info (and other text in the meter).
Font to be used for the header, value and label strip.
font | The font to use. |
Referenced by sd::SoundMeter::MeterChannel::setFont().
|
noexcept |
Set the bounds of the 'header' part of the meter.
bounds | The bounds to use for the 'header' part of the meter. |
Referenced by sd::SoundMeter::MeterChannel::resized().
|
noexcept |
Get the bounds of the 'header' part of the meter.
Referenced by sd::SoundMeter::MeterChannel::getLabelStripBounds(), sd::SoundMeter::MeterChannel::paint(), sd::SoundMeter::MeterChannel::setChannelName(), and sd::SoundMeter::MeterChannel::showHeader().
|
noexcept |
Check if the mouse is over the 'header' part of the meter.
y | The coordinate to use to check whether the mouse is over the 'header' part. |
|
noexcept |
Check if the mouse is over the 'header' part of the meter.
|
noexcept |
Reset 'mouse over' status of the 'header' part of the meter.
|
noexcept |
Set the referred width (from other meters) used to decide what info to display.
When this is set to zero, each meter uses his own bounds to decide what to display. When set to a non zero value (for instance from another meter) this meter will use that value to decide what to display. When there is not enough room (width) to display the full description or name, display the abbreviated type description.
referredWidth | The width (in pixels) to use when deciding what to display in the header. |
Referenced by sd::SoundMeter::MeterChannel::setReferredTypeWidth().
void sd::SoundMeter::Header::draw | ( | juce::Graphics & | g, |
bool | meterActive, | ||
bool | faderEnabled, | ||
const MeterColours & | meterColours | ||
) |
Draw the 'header' part of the meter.
[in,out] | g | The juce graphics context to use. |
meterActive | True, when the meter is active (not muted). | |
faderEnabled | True, when the fader overlay is enabled. | |
meterColours | The colours to draw the header with. |
References getInfo(), sd::SoundMeter::MeterColours::inactiveColour, sd::SoundMeter::Constants::kDefaultHeaderFontHeight, sd::SoundMeter::MeterColours::muteColour, sd::SoundMeter::MeterColours::muteMouseOverColour, and sd::SoundMeter::MeterColours::textColour.
Referenced by sd::SoundMeter::MeterChannel::paint().