mirror of
https://github.com/cookiengineer/audacity
synced 2026-01-09 22:27:07 +01:00
Style MixerBoard Mute/Solo as on TCP.
This commit is contained in:
@@ -129,7 +129,7 @@ void MixerTrackSlider::OnCaptureKey(wxCommandEvent &event)
|
|||||||
|
|
||||||
#define TRACK_NAME_HEIGHT 18
|
#define TRACK_NAME_HEIGHT 18
|
||||||
#define MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH 48
|
#define MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH 48
|
||||||
#define MUTE_SOLO_HEIGHT 16
|
#define MUTE_SOLO_HEIGHT 19
|
||||||
#define PAN_HEIGHT 24
|
#define PAN_HEIGHT 24
|
||||||
|
|
||||||
#define kLeftSideStackWidth MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH - kDoubleInset //vvv Change when numbers shown on slider scale.
|
#define kLeftSideStackWidth MUSICAL_INSTRUMENT_HEIGHT_AND_WIDTH - kDoubleInset //vvv Change when numbers shown on slider scale.
|
||||||
@@ -1324,11 +1324,10 @@ void MixerBoard::UpdateWidth()
|
|||||||
// private methods
|
// private methods
|
||||||
//
|
//
|
||||||
|
|
||||||
void MixerBoard::CreateMuteSoloImages()
|
|
||||||
|
void MixerBoard::MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & bitmap, wxRect & bev, const wxString & str, bool up )
|
||||||
{
|
{
|
||||||
// Much of this is similar to TrackInfo::MuteOrSoloDrawFunction.
|
|
||||||
wxMemoryDC dc;
|
|
||||||
wxString str = _("Mute");
|
|
||||||
int textWidth, textHeight;
|
int textWidth, textHeight;
|
||||||
|
|
||||||
int fontSize = 10;
|
int fontSize = 10;
|
||||||
@@ -1336,64 +1335,58 @@ void MixerBoard::CreateMuteSoloImages()
|
|||||||
fontSize = 8;
|
fontSize = 8;
|
||||||
#endif
|
#endif
|
||||||
wxFont font(fontSize, wxSWISS, wxNORMAL, wxNORMAL);
|
wxFont font(fontSize, wxSWISS, wxNORMAL, wxNORMAL);
|
||||||
this->GetTextExtent(str, &textWidth, &textHeight, NULL, NULL, &font);
|
GetTextExtent(str, &textWidth, &textHeight, NULL, NULL, &font);
|
||||||
mMuteSoloWidth = textWidth + kQuadrupleInset;
|
|
||||||
if (mMuteSoloWidth < kRightSideStackWidth - kInset)
|
|
||||||
mMuteSoloWidth = kRightSideStackWidth - kInset;
|
|
||||||
|
|
||||||
wxBitmap bitmap(mMuteSoloWidth, MUTE_SOLO_HEIGHT);
|
AColor::UseThemeColour( &dc, clrMedium );
|
||||||
dc.SelectObject(bitmap);
|
|
||||||
wxRect bev(0, 0, mMuteSoloWidth - 1, MUTE_SOLO_HEIGHT - 1);
|
|
||||||
|
|
||||||
// mute button images
|
|
||||||
AColor::Mute(&dc, false, false, false);
|
|
||||||
dc.DrawRectangle(bev);
|
dc.DrawRectangle(bev);
|
||||||
|
|
||||||
|
AColor::Bevel2( dc, up, bev, false );
|
||||||
|
|
||||||
wxCoord x = bev.x + (bev.width - textWidth) / 2;
|
wxCoord x = bev.x + (bev.width - textWidth) / 2;
|
||||||
wxCoord y = bev.y + (bev.height - textHeight) / 2;
|
wxCoord y = bev.y + (bev.height - textHeight) / 2;
|
||||||
dc.SetFont(font);
|
dc.SetFont(font);
|
||||||
dc.SetTextForeground(theTheme.Colour(clrTrackPanelText));
|
dc.SetTextForeground(theTheme.Colour(clrTrackPanelText));
|
||||||
|
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||||
dc.DrawText(str, x, y);
|
dc.DrawText(str, x, y);
|
||||||
|
// dc.DrawText(str, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
AColor::Bevel(dc, true, bev);
|
void MixerBoard::CreateMuteSoloImages()
|
||||||
|
{
|
||||||
|
// Much of this is similar to TrackInfo::MuteOrSoloDrawFunction.
|
||||||
|
wxMemoryDC dc;
|
||||||
|
wxString str = _("Mute");
|
||||||
|
|
||||||
|
//mMuteSoloWidth = textWidth + kQuadrupleInset;
|
||||||
|
//if (mMuteSoloWidth < kRightSideStackWidth - kInset)
|
||||||
|
mMuteSoloWidth = kRightSideStackWidth - kInset;
|
||||||
|
|
||||||
|
wxBitmap bitmap(mMuteSoloWidth, MUTE_SOLO_HEIGHT,24);
|
||||||
|
dc.SelectObject(bitmap);
|
||||||
|
wxRect bev(0, 0, mMuteSoloWidth, MUTE_SOLO_HEIGHT);
|
||||||
|
|
||||||
|
const bool up=true;
|
||||||
|
const bool down=false;
|
||||||
|
|
||||||
|
MakeButtonBitmap( dc, bitmap, bev, str, up );
|
||||||
mImageMuteUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
mImageMuteUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
||||||
mImageMuteOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
|
mImageMuteOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
|
||||||
|
|
||||||
AColor::Mute(&dc, true, true, false);
|
MakeButtonBitmap( dc, bitmap, bev, str, down );
|
||||||
dc.DrawRectangle(bev);
|
//AColor::Bevel(dc, false, bev);
|
||||||
dc.DrawText(str, x, y);
|
|
||||||
AColor::Bevel(dc, false, bev);
|
|
||||||
mImageMuteDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
mImageMuteDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
||||||
|
|
||||||
AColor::Mute(&dc, true, true, true);
|
MakeButtonBitmap( dc, bitmap, bev, str, down );
|
||||||
dc.DrawRectangle(bev);
|
|
||||||
dc.DrawText(str, x, y);
|
|
||||||
AColor::Bevel(dc, false, bev);
|
|
||||||
mImageMuteDownWhileSolo = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
mImageMuteDownWhileSolo = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
||||||
|
|
||||||
mImageMuteDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
|
mImageMuteDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
|
||||||
|
|
||||||
|
|
||||||
// solo button images
|
|
||||||
AColor::Solo(&dc, false, false);
|
|
||||||
dc.DrawRectangle(bev);
|
|
||||||
|
|
||||||
str = _("Solo");
|
str = _("Solo");
|
||||||
dc.GetTextExtent(str, &textWidth, &textHeight);
|
MakeButtonBitmap( dc, bitmap, bev, str, up );
|
||||||
x = bev.x + (bev.width - textWidth) / 2;
|
|
||||||
y = bev.y + (bev.height - textHeight) / 2;
|
|
||||||
dc.DrawText(str, x, y);
|
|
||||||
|
|
||||||
AColor::Bevel(dc, true, bev);
|
|
||||||
|
|
||||||
mImageSoloUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
mImageSoloUp = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
||||||
mImageSoloOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
|
mImageSoloOver = std::make_unique<wxImage>(bitmap.ConvertToImage()); // Same as up, for now.
|
||||||
|
|
||||||
AColor::Solo(&dc, true, true);
|
MakeButtonBitmap( dc, bitmap, bev, str, down );
|
||||||
dc.DrawRectangle(bev);
|
|
||||||
dc.DrawText(str, x, y);
|
|
||||||
AColor::Bevel(dc, false, bev);
|
|
||||||
mImageSoloDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
mImageSoloDown = std::make_unique<wxImage>(bitmap.ConvertToImage());
|
||||||
|
|
||||||
mImageSoloDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
|
mImageSoloDisabled = std::make_unique<wxImage>(mMuteSoloWidth, MUTE_SOLO_HEIGHT); // Leave empty because unused.
|
||||||
|
|||||||
@@ -247,6 +247,8 @@ public:
|
|||||||
void UpdateWidth();
|
void UpdateWidth();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void MakeButtonBitmap( wxMemoryDC & dc, wxBitmap & bitmap,
|
||||||
|
wxRect & bev, const wxString & str, bool up );
|
||||||
void CreateMuteSoloImages();
|
void CreateMuteSoloImages();
|
||||||
int FindMixerTrackCluster(const PlayableTrack* pTrack,
|
int FindMixerTrackCluster(const PlayableTrack* pTrack,
|
||||||
MixerTrackCluster** hMixerTrackCluster) const;
|
MixerTrackCluster** hMixerTrackCluster) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user