mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-25 07:31:14 +01:00
Fix for bug #1191
This commit is contained in:
@@ -493,8 +493,6 @@ void LWSlider::Init(wxWindow * parent,
|
||||
mStyle = style;
|
||||
mOrientation = orientation;
|
||||
mIsDragging = false;
|
||||
mWidth = size.x;
|
||||
mHeight = size.y;
|
||||
mParent = parent;
|
||||
mHW = heavyweight;
|
||||
mPopup = popup;
|
||||
@@ -513,6 +511,8 @@ void LWSlider::Init(wxWindow * parent,
|
||||
mScrollPage = 5.0f;
|
||||
mTipPanel = NULL;
|
||||
|
||||
AdjustSize(size);
|
||||
|
||||
mpRuler = NULL; // Do this and Move() before Draw().
|
||||
Move(pos);
|
||||
}
|
||||
@@ -577,6 +577,39 @@ void LWSlider::Move(const wxPoint &newpos)
|
||||
mTop = newpos.y;
|
||||
}
|
||||
|
||||
void LWSlider::AdjustSize(const wxSize & sz)
|
||||
{
|
||||
mWidth = sz.GetWidth();
|
||||
mHeight = sz.GetHeight();
|
||||
|
||||
mThumbWidth = 14;
|
||||
mThumbHeight = 14;
|
||||
|
||||
if (mOrientation == wxHORIZONTAL)
|
||||
{
|
||||
mCenterY = mHeight - 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCenterX = mWidth - 9;
|
||||
}
|
||||
|
||||
if (mOrientation == wxHORIZONTAL)
|
||||
{
|
||||
mLeftX = mThumbWidth/2;
|
||||
mRightX = mWidth - mThumbWidth/2 - 1;
|
||||
mWidthX = mRightX - mLeftX;
|
||||
}
|
||||
else
|
||||
{
|
||||
mTopY = mThumbWidth/2;
|
||||
mBottomY = mHeight - mThumbWidth/2 - 1;
|
||||
mHeightY = mBottomY - mTopY;
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void LWSlider::OnPaint(wxDC &dc)
|
||||
{
|
||||
if (!mBitmap || !mThumbBitmap)
|
||||
@@ -617,8 +650,7 @@ void LWSlider::OnPaint(wxDC &dc)
|
||||
|
||||
void LWSlider::OnSize( wxSizeEvent & event )
|
||||
{
|
||||
mWidth = event.GetSize().GetX();
|
||||
mHeight = event.GetSize().GetY();
|
||||
AdjustSize(event.GetSize());
|
||||
|
||||
Refresh();
|
||||
}
|
||||
@@ -644,8 +676,6 @@ void LWSlider::Draw(wxDC & paintDC)
|
||||
wxMemoryDC dc;
|
||||
|
||||
// Create the bitmap
|
||||
mThumbWidth = 14;
|
||||
mThumbHeight = 14;
|
||||
mThumbBitmap = new wxBitmap();
|
||||
mThumbBitmap->Create(mThumbWidth, mThumbHeight, paintDC);
|
||||
dc.SelectObject(*mThumbBitmap);
|
||||
@@ -711,28 +741,6 @@ void LWSlider::Draw(wxDC & paintDC)
|
||||
// Now the background bitmap
|
||||
//
|
||||
|
||||
if (mOrientation == wxHORIZONTAL)
|
||||
{
|
||||
mCenterY = mHeight - 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
mCenterX = mWidth - 9;
|
||||
}
|
||||
|
||||
if (mOrientation == wxHORIZONTAL)
|
||||
{
|
||||
mLeftX = mThumbWidth/2;
|
||||
mRightX = mWidth - mThumbWidth/2 - 1;
|
||||
mWidthX = mRightX - mLeftX;
|
||||
}
|
||||
else
|
||||
{
|
||||
mTopY = mThumbWidth/2;
|
||||
mBottomY = mHeight - mThumbWidth/2 - 1;
|
||||
mHeightY = mBottomY - mTopY;
|
||||
}
|
||||
|
||||
mBitmap = new wxBitmap();
|
||||
mBitmap->Create(mWidth, mHeight, paintDC);
|
||||
dc.SelectObject(*mBitmap);
|
||||
|
||||
@@ -142,6 +142,8 @@ class LWSlider
|
||||
|
||||
void Move(const wxPoint &newpos);
|
||||
|
||||
void AdjustSize(const wxSize & sz);
|
||||
|
||||
void OnPaint(wxDC &dc);
|
||||
void OnSize(wxSizeEvent & event);
|
||||
void OnMouseEvent(wxMouseEvent & event);
|
||||
|
||||
Reference in New Issue
Block a user