@@ -36,10 +36,7 @@ MuteButton::MuteButton()
36
36
offimage = ImageCache::getFromMemory (BinaryData::muteoff_png, BinaryData::muteoff_pngSize);
37
37
onimage = ImageCache::getFromMemory (BinaryData::muteon_png, BinaryData::muteon_pngSize);
38
38
39
- setImages (false , true , true , offimage, 1 .0f ,
40
- findColour (ThemeColours::controlPanelText), offimage, 0 .5f ,
41
- findColour (ThemeColours::controlPanelText).withAlpha (0 .5f ), onimage, 0 .7f ,
42
- findColour (ThemeColours::controlPanelText).withAlpha (0 .7f ));
39
+ setImages (false , true , true , offimage, 1 .0f , findColour (ThemeColours::controlPanelText), offimage, 0 .5f , findColour (ThemeColours::controlPanelText).withAlpha (0 .5f ), onimage, 0 .7f , findColour (ThemeColours::controlPanelText).withAlpha (0 .7f ));
43
40
44
41
setClickingTogglesState (true );
45
42
@@ -48,10 +45,7 @@ MuteButton::MuteButton()
48
45
49
46
void MuteButton::updateImages ()
50
47
{
51
- setImages (false , true , true , offimage, 1 .0f ,
52
- findColour (ThemeColours::controlPanelText), offimage, 0 .5f ,
53
- findColour (ThemeColours::controlPanelText).withAlpha (0 .5f ), onimage, 0 .7f ,
54
- findColour (ThemeColours::controlPanelText).withAlpha (0 .7f ));
48
+ setImages (false , true , true , offimage, 1 .0f , findColour (ThemeColours::controlPanelText), offimage, 0 .5f , findColour (ThemeColours::controlPanelText).withAlpha (0 .5f ), onimage, 0 .7f , findColour (ThemeColours::controlPanelText).withAlpha (0 .7f ));
55
49
}
56
50
57
51
AudioWindowButton::AudioWindowButton ()
@@ -61,19 +55,25 @@ AudioWindowButton::AudioWindowButton()
61
55
62
56
textString = " :AUDIO" ;
63
57
setTooltip (" Change the buffer size" );
58
+
59
+ String svgPathString = " M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0 M12 7v5l3 3" ;
60
+
61
+ latencySvgPath = Drawable::parseSVGPath (svgPathString);
64
62
}
65
63
66
64
void AudioWindowButton::paintButton (Graphics& g, bool isMouseOver, bool isButtonDown)
67
65
{
66
+ float alpha = isMouseOver ? 0 .6f : 1 .0f ;
67
+
68
68
if (getToggleState ())
69
- g.setColour (Colours::yellow);
69
+ g.setColour (Colours::yellow. withAlpha (alpha) );
70
70
else
71
- g.setColour (findColour (ThemeColours::controlPanelText));
71
+ g.setColour (findColour (ThemeColours::controlPanelText).withAlpha (alpha));
72
+
73
+ g.strokePath (latencySvgPath, PathStrokeType (1 .5f ), latencySvgPath.getTransformToScaleToFit (5 , 7 , 14 , 14 , true ));
72
74
73
- const bool isLatencyLabelVisible = getParentComponent ()->getWidth () >= 450 ;
74
- auto textToDraw = isLatencyLabelVisible ? textString : textString.fromLastOccurrenceOf (" :" , false , true );
75
75
g.setFont (FontOptions (" Silkscreen" , " Regular" , 14 ));
76
- g.drawSingleLineText (textToDraw, 0 , 15 );
76
+ g.drawFittedText (textString, 25 , 0 , getWidth () - 30 , getHeight (), Justification::centredLeft, 1 );
77
77
}
78
78
79
79
void AudioWindowButton::setText (const String& newText)
@@ -128,7 +128,7 @@ void AudioEditor::resized()
128
128
129
129
// Since width of the label on button is always the same, we should reserve it.
130
130
const bool isLatencyLabelVisible = width >= 450 ;
131
- const int audioWindowButtonWidth = isLatencyLabelVisible ? 110 : 60 ;
131
+ const int audioWindowButtonWidth = 68 ;
132
132
const int gateLabelWidth = 45 ;
133
133
134
134
const int availableWidth = width - audioWindowButtonWidth - gateLabelWidth;
@@ -140,13 +140,13 @@ void AudioEditor::resized()
140
140
muteButton->setBounds (margin, 5 , 20 , 20 );
141
141
volumeSlider->setBounds (margin + 30 , sliderY, sliderWidth, sliderHeight);
142
142
noiseGateSlider->setBounds (volumeSlider->getRight () + margin + gateLabelWidth, sliderY, sliderWidth, sliderHeight);
143
- audioWindowButton->setBounds (width - audioWindowButtonWidth + 2 , 5 , audioWindowButtonWidth, height);
143
+ audioWindowButton->setBounds (width - audioWindowButtonWidth + 2 , 2 , audioWindowButtonWidth - 4 , height - 4 );
144
144
}
145
145
146
146
void AudioEditor::updateBufferSizeText ()
147
147
{
148
148
String t = String (AccessClass::getAudioComponent ()->getBufferSizeMs ());
149
- t = " Latency: " + t + " ms" ;
149
+ t = t + " ms" ;
150
150
151
151
audioWindowButton->setText (t);
152
152
}
0 commit comments