==============================================================================
| 13 | |
| 14 | //============================================================================== |
| 15 | FreqTextLabel::FreqTextLabel(VerticalLine& v) : verticalLine(v) |
| 16 | { |
| 17 | mFrequency = -1; |
| 18 | |
| 19 | // Add and configure the child juce::Label component. |
| 20 | addAndMakeVisible(freqLabel); |
| 21 | freqLabel.setEditable(true); |
| 22 | |
| 23 | // --- One-time setup for the child Label --- |
| 24 | // These properties are set once here instead of inefficiently in paint(). |
| 25 | freqLabel.setColour(juce::Label::textColourId, juce::Colours::white); |
| 26 | freqLabel.setJustificationType(juce::Justification::centred); |
| 27 | |
| 28 | // Set the text editing callback once in the constructor. |
| 29 | freqLabel.onTextChange = [this] |
| 30 | { |
| 31 | mFrequency = freqLabel.getText().getIntValue(); |
| 32 | |
| 33 | // Update the associated VerticalLine component when the text changes. |
| 34 | verticalLine.setValue(mFrequency); |
| 35 | |
| 36 | // Assumes transformToLog is defined in AudioHelpers.h |
| 37 | float xPercent = static_cast<float>(transformToLog(mFrequency)); |
| 38 | verticalLine.setXPercent(xPercent); |
| 39 | }; |
| 40 | } |
| 41 | |
| 42 | FreqTextLabel::~FreqTextLabel() |
| 43 | { |
nothing calls this directly
no test coverage detected