From 03af77387e4821d90f36b35ac757acc41a786b41 Mon Sep 17 00:00:00 2001 From: James Crook Date: Mon, 24 Apr 2017 20:06:40 +0100 Subject: [PATCH] Button and hover effect for microphone/speaker on meter bar. Also fixed capitalisation of "Blend system and Audacity theme" --- src/prefs/GUIPrefs.cpp | 2 +- src/widgets/Meter.cpp | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/prefs/GUIPrefs.cpp b/src/prefs/GUIPrefs.cpp index 59f80f1aa..b851ec8b9 100644 --- a/src/prefs/GUIPrefs.cpp +++ b/src/prefs/GUIPrefs.cpp @@ -188,7 +188,7 @@ void GUIPrefs::PopulateOrExchange(ShuttleGui & S) S.TieCheckBox(_("Re&tain labels if selection snaps to a label edge"), wxT("/GUI/RetainLabels"), false); - S.TieCheckBox(_("B&lend System and Audacity Theme"), + S.TieCheckBox(_("B&lend system and Audacity theme"), wxT("/GUI/BlendThemes"), true); #ifdef EXPERIMENTAL_OUTPUT_DISPLAY diff --git a/src/widgets/Meter.cpp b/src/widgets/Meter.cpp index b63adce82..89234b20f 100644 --- a/src/widgets/Meter.cpp +++ b/src/widgets/Meter.cpp @@ -462,14 +462,9 @@ void Meter::OnPaint(wxPaintEvent & WXUNUSED(event)) if (mStyle != MixerTrackCluster) { bool highlight = InIcon(); - if (highlight) { - auto rect = mIconRect; - rect.Inflate(gap, gap); - wxColour colour(247, 247, 247); - dc.SetBrush(colour); - dc.SetPen(colour ); - dc.DrawRectangle(rect); - } + dc.DrawBitmap( theTheme.Bitmap( highlight ? bmpHiliteButtonSmall : bmpUpButtonSmall ), + mIconRect.GetPosition(), false ); + dc.DrawBitmap(*mIcon, mIconRect.GetPosition(), true); dc.SetFont(GetFont()); dc.SetTextForeground( clrText ); @@ -1411,8 +1406,8 @@ void Meter::HandleLayout(wxDC &dc) mRuler.OfflimitsPixels(0, 0); break; case HorizontalStereo: - // Ensure there's a margin between left edge of window and items - left = gap; + // Button right next to dragger. + left = 0; // Add a gap between bottom of icon and bottom of window height -= gap; @@ -1422,6 +1417,7 @@ void Meter::HandleLayout(wxDC &dc) mIconRect.SetY(height - iconHeight); mIconRect.SetWidth(iconWidth); mIconRect.SetHeight(iconHeight); + left = gap; // Make sure there's room for icon and gap between the bottom of the meter and icon height -= iconHeight + gap; @@ -1466,15 +1462,16 @@ void Meter::HandleLayout(wxDC &dc) mRuler.OfflimitsPixels(0, mIconRect.GetRight() - 4); break; case HorizontalStereoCompact: - // Ensure there's a margin between left edge of window and items - left = gap; + // Button right next to dragger. + left = 0; // Create icon rectangle mIconRect.SetX(left); - mIconRect.SetY((height - iconHeight) / 2); + mIconRect.SetY((height - iconHeight) / 2 -1); mIconRect.SetWidth(iconWidth); mIconRect.SetHeight(iconHeight); + left = gap; // Add width of icon and gap between icon and L/R left += iconWidth + gap;