1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-03-07 06:55:52 +01:00

Tidy up of code. Moved preferences menu to end of meter. Fixed memory leaks on some bitmaps.

This commit is contained in:
james.k.crook@gmail.com
2014-11-09 16:44:07 +00:00
parent 8bd3891561
commit 24a636d6ea
4 changed files with 43 additions and 54 deletions

View File

@@ -779,6 +779,18 @@ bool Meter::IsClipping()
return false;
}
void Meter::SetBarClip( int iBar )
{
mBar[iBar].vert = false;
ResetBar(&mBar[iBar], false);
if (!mClip)
return;
mBar[iBar].rClip = mBar[iBar].r;
mBar[iBar].rClip.x += mBar[iBar].rClip.width-3;
mBar[iBar].rClip.width = 3;
mBar[iBar].r.width -= 4;
}
void Meter::HandleLayout(wxDC &dc)
{
// Refresh to reflect any language changes
@@ -916,24 +928,11 @@ void Meter::HandleLayout(wxDC &dc)
barw = width - 4;
barh = (height-2)/2;
mNumBars = 2;
mBar[0].vert = false;
ResetBar(&mBar[0], false);
mBar[0].r = wxRect(left+2, height/2 - barh - 1, barw, barh);
if (mClip) {
mBar[0].rClip = mBar[0].r;
mBar[0].rClip.x += mBar[0].rClip.width-3;
mBar[0].rClip.width = 3;
mBar[0].r.width -= 4;
}
mBar[1].vert = false;
ResetBar(&mBar[1], false);
SetBarClip( 0 );
mBar[1].r = wxRect(left+2, height/2 + 1, barw, barh);
if (mClip) {
mBar[1].rClip = mBar[1].r;
mBar[1].rClip.x += mBar[1].rClip.width-3;
mBar[1].rClip.width = 3;
mBar[1].r.width -= 4;
}
SetBarClip( 1 );
mRuler.SetOrientation(wxHORIZONTAL);
mRuler.SetBounds(mBar[1].r.x,
mBar[1].r.y + mBar[1].r.height + 1,
@@ -952,52 +951,34 @@ void Meter::HandleLayout(wxDC &dc)
case HorizontalStereoCompact:
left = iSpacer;
mIconPos = wxPoint(left, (height-iconHeight)/2);
left += iconWidth + iSpacer;
mMenuRect = wxRect(left, (height-menuHeight)/2, menuWidth, menuHeight);
left += menuWidth + 2 * iSpacer;
left += iconWidth + 2 *iSpacer;
mLeftTextPos = wxPoint(left, (height)/4 - mLeftSize.y/2);
mRightTextPos = wxPoint(left, (height*3)/4 - mLeftSize.y/2);
left += intmax(mLeftSize.x, mRightSize.x) + iSpacer;
// The proportion to use for ruler is chosen to give a good ruler at
// two tb height.
rulerHeight = intmin( height*0.35, 24 );
// Below 12 pixels height, the ruler is pointless.
if( rulerHeight < 12 )
rulerHeight = 0;
rulerHeight = 0;
width -= left;
barw = width - 4;
barh = (height-2-rulerHeight)/2;
barw = width - 4 - menuWidth - 3* iSpacer;
barh = (height-2)/2;
mNumBars = 2;
mBar[0].vert = false;
ResetBar(&mBar[0], false);
mBar[0].r = wxRect(left+2, 0, barw, barh);
if (mClip) {
mBar[0].rClip = mBar[0].r;
mBar[0].rClip.x += mBar[0].rClip.width-3;
mBar[0].rClip.width = 3;
mBar[0].r.width -= 4;
}
mBar[1].vert = false;
ResetBar(&mBar[1], false);
mBar[1].r = wxRect(left+2, 2 + barh, barw, barh);
if (mClip) {
mBar[1].rClip = mBar[1].r;
mBar[1].rClip.x += mBar[1].rClip.width-3;
mBar[1].rClip.width = 3;
mBar[1].r.width -= 4;
}
mRuler.SetOrientation(wxHORIZONTAL);
mBar[0].r = wxRect(left, 0, barw, barh);
SetBarClip( 0 );
mBar[1].r = wxRect(left, 2 + barh, barw, barh);
SetBarClip( 1 );
left += barw + 2* iSpacer;
mMenuRect = wxRect(left, (height-menuHeight)/2, menuWidth, menuHeight);
left += menuWidth + 2* iSpacer;
mRuler.SetOrientation(wxHORIZONTAL);
{
int BarMid = (mBar[0].r.y + mBar[1].r.y + mBar[1].r.height ) / 2;
const int RulerHeight = 24;
const int TextDownBy = 2;
mRuler.SetBounds(mBar[0].r.x,
BarMid - RulerHeight / 2 +TextDownBy,
BarMid +TextDownBy,
mBar[1].r.x + mBar[1].r.width,
BarMid + RulerHeight / 2 +TextDownBy);
BarMid +TextDownBy);
}
if (mDB) {
mRuler.SetRange(-mDBRange, 0);