mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-16 08:37:42 +02:00
Fix for bug #1191
This commit is contained in:
parent
a7a1e11668
commit
2d88ad63e0
@ -5300,9 +5300,9 @@ void TrackPanel::HandleSliders(wxMouseEvent &event, bool pan)
|
|||||||
WaveTrack *capturedTrack = (WaveTrack *) mCapturedTrack;
|
WaveTrack *capturedTrack = (WaveTrack *) mCapturedTrack;
|
||||||
|
|
||||||
if (pan)
|
if (pan)
|
||||||
slider = mTrackInfo.PanSlider(capturedTrack);
|
slider = mTrackInfo.PanSlider(capturedTrack, true);
|
||||||
else
|
else
|
||||||
slider = mTrackInfo.GainSlider(capturedTrack);
|
slider = mTrackInfo.GainSlider(capturedTrack, true);
|
||||||
|
|
||||||
slider->OnMouseEvent(event);
|
slider->OnMouseEvent(event);
|
||||||
|
|
||||||
@ -7718,7 +7718,7 @@ void TrackPanel::DrawOutside(Track * t, wxDC * dc, const wxRect & rec,
|
|||||||
mTrackInfo.DrawMuteSolo(dc, rect, t, (captured && mMouseCapture == IsMuting), false, HasSoloButton());
|
mTrackInfo.DrawMuteSolo(dc, rect, t, (captured && mMouseCapture == IsMuting), false, HasSoloButton());
|
||||||
mTrackInfo.DrawMuteSolo(dc, rect, t, (captured && mMouseCapture == IsSoloing), true, HasSoloButton());
|
mTrackInfo.DrawMuteSolo(dc, rect, t, (captured && mMouseCapture == IsSoloing), true, HasSoloButton());
|
||||||
|
|
||||||
mTrackInfo.DrawSliders(dc, (WaveTrack *)t, rect);
|
mTrackInfo.DrawSliders(dc, (WaveTrack *)t, rect, captured);
|
||||||
if (!t->GetMinimized()) {
|
if (!t->GetMinimized()) {
|
||||||
|
|
||||||
int offset = 8;
|
int offset = 8;
|
||||||
@ -9648,6 +9648,11 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn)
|
|||||||
wxSize(sliderRect.width, sliderRect.height),
|
wxSize(sliderRect.width, sliderRect.height),
|
||||||
DB_SLIDER);
|
DB_SLIDER);
|
||||||
mGain->SetDefaultValue(1.0);
|
mGain->SetDefaultValue(1.0);
|
||||||
|
mGainCaptured = new LWSlider(pParent, _("Gain"),
|
||||||
|
wxPoint(sliderRect.x, sliderRect.y),
|
||||||
|
wxSize(sliderRect.width, sliderRect.height),
|
||||||
|
DB_SLIDER);
|
||||||
|
mGainCaptured->SetDefaultValue(1.0);
|
||||||
|
|
||||||
GetPanRect(rect, sliderRect);
|
GetPanRect(rect, sliderRect);
|
||||||
|
|
||||||
@ -9657,6 +9662,11 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn)
|
|||||||
wxSize(sliderRect.width, sliderRect.height),
|
wxSize(sliderRect.width, sliderRect.height),
|
||||||
PAN_SLIDER);
|
PAN_SLIDER);
|
||||||
mPan->SetDefaultValue(0.0);
|
mPan->SetDefaultValue(0.0);
|
||||||
|
mPanCaptured = new LWSlider(pParent, _("Pan"),
|
||||||
|
wxPoint(sliderRect.x, sliderRect.y),
|
||||||
|
wxSize(sliderRect.width, sliderRect.height),
|
||||||
|
PAN_SLIDER);
|
||||||
|
mPanCaptured->SetDefaultValue(0.0);
|
||||||
|
|
||||||
int fontSize = 10;
|
int fontSize = 10;
|
||||||
mFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
mFont.Create(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
|
||||||
@ -9677,7 +9687,9 @@ TrackInfo::TrackInfo(TrackPanel * pParentIn)
|
|||||||
|
|
||||||
TrackInfo::~TrackInfo()
|
TrackInfo::~TrackInfo()
|
||||||
{
|
{
|
||||||
|
delete mGainCaptured;
|
||||||
delete mGain;
|
delete mGain;
|
||||||
|
delete mPanCaptured;
|
||||||
delete mPan;
|
delete mPan;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10000,43 +10012,53 @@ void TrackInfo::DrawVelocitySlider(wxDC *dc, NoteTrack *t, wxRect rect) const
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void TrackInfo::DrawSliders(wxDC *dc, WaveTrack *t, wxRect rect) const
|
void TrackInfo::DrawSliders(wxDC *dc, WaveTrack *t, wxRect rect, bool captured) const
|
||||||
{
|
{
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
|
|
||||||
GetGainRect(rect, sliderRect);
|
GetGainRect(rect, sliderRect);
|
||||||
if (sliderRect.y + sliderRect.height < rect.y + rect.height - 19) {
|
if (sliderRect.y + sliderRect.height < rect.y + rect.height - 19) {
|
||||||
GainSlider(t)->OnPaint(*dc);
|
GainSlider(t, captured)->OnPaint(*dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetPanRect(rect, sliderRect);
|
GetPanRect(rect, sliderRect);
|
||||||
if (sliderRect.y + sliderRect.height < rect.y + rect.height - 19) {
|
if (sliderRect.y + sliderRect.height < rect.y + rect.height - 19) {
|
||||||
PanSlider(t)->OnPaint(*dc);
|
PanSlider(t, captured)->OnPaint(*dc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LWSlider * TrackInfo::GainSlider(WaveTrack *t) const
|
LWSlider * TrackInfo::GainSlider(WaveTrack *t, bool captured) const
|
||||||
{
|
{
|
||||||
wxRect rect(kLeftInset, t->GetY() - pParent->GetViewInfo()->vpos + kTopInset, 1, t->GetHeight());
|
wxRect rect(kLeftInset, t->GetY() - pParent->GetViewInfo()->vpos + kTopInset, 1, t->GetHeight());
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
GetGainRect(rect, sliderRect);
|
GetGainRect(rect, sliderRect);
|
||||||
|
|
||||||
mGain->Move(wxPoint(sliderRect.x, sliderRect.y));
|
wxPoint pos = sliderRect.GetPosition();
|
||||||
mGain->Set(t->GetGain());
|
float gain = t->GetGain();
|
||||||
|
|
||||||
return mGain;
|
mGain->Move(pos);
|
||||||
|
mGain->Set(gain);
|
||||||
|
mGainCaptured->Move(pos);
|
||||||
|
mGainCaptured->Set(gain);
|
||||||
|
|
||||||
|
return captured ? mGainCaptured : mGain;
|
||||||
}
|
}
|
||||||
|
|
||||||
LWSlider * TrackInfo::PanSlider(WaveTrack *t) const
|
LWSlider * TrackInfo::PanSlider(WaveTrack *t, bool captured) const
|
||||||
{
|
{
|
||||||
wxRect rect(kLeftInset, t->GetY() - pParent->GetViewInfo()->vpos + kTopInset, 1, t->GetHeight());
|
wxRect rect(kLeftInset, t->GetY() - pParent->GetViewInfo()->vpos + kTopInset, 1, t->GetHeight());
|
||||||
wxRect sliderRect;
|
wxRect sliderRect;
|
||||||
GetPanRect(rect, sliderRect);
|
GetPanRect(rect, sliderRect);
|
||||||
|
|
||||||
mPan->Move(wxPoint(sliderRect.x, sliderRect.y));
|
wxPoint pos = sliderRect.GetPosition();
|
||||||
mPan->Set(t->GetPan());
|
float pan = t->GetPan();
|
||||||
|
|
||||||
return mPan;
|
mPan->Move(pos);
|
||||||
|
mPan->Set(pan);
|
||||||
|
mPanCaptured->Move(pos);
|
||||||
|
mPanCaptured->Set(pan);
|
||||||
|
|
||||||
|
return captured ? mPanCaptured : mPan;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TrackPanel * TrackPanelFactory(wxWindow * parent,
|
static TrackPanel * TrackPanelFactory(wxWindow * parent,
|
||||||
|
@ -90,7 +90,7 @@ private:
|
|||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
void DrawVelocitySlider(wxDC * dc, NoteTrack *t, wxRect rect) const ;
|
void DrawVelocitySlider(wxDC * dc, NoteTrack *t, wxRect rect) const ;
|
||||||
#endif
|
#endif
|
||||||
void DrawSliders(wxDC * dc, WaveTrack *t, wxRect rect) const;
|
void DrawSliders(wxDC * dc, WaveTrack *t, wxRect rect, bool captured) const;
|
||||||
|
|
||||||
// Draw the minimize button *and* the sync-lock track icon, if necessary.
|
// Draw the minimize button *and* the sync-lock track icon, if necessary.
|
||||||
void DrawMinimize(wxDC * dc, const wxRect & rect, Track * t, bool down) const;
|
void DrawMinimize(wxDC * dc, const wxRect & rect, Track * t, bool down) const;
|
||||||
@ -105,12 +105,14 @@ private:
|
|||||||
void GetSyncLockIconRect(const wxRect & rect, wxRect &dest) const;
|
void GetSyncLockIconRect(const wxRect & rect, wxRect &dest) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LWSlider * GainSlider(WaveTrack *t) const;
|
LWSlider * GainSlider(WaveTrack *t, bool captured = false) const;
|
||||||
LWSlider * PanSlider(WaveTrack *t) const;
|
LWSlider * PanSlider(WaveTrack *t, bool captured = false) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TrackPanel * pParent;
|
TrackPanel * pParent;
|
||||||
wxFont mFont;
|
wxFont mFont;
|
||||||
|
LWSlider *mGainCaptured;
|
||||||
|
LWSlider *mPanCaptured;
|
||||||
LWSlider *mGain;
|
LWSlider *mGain;
|
||||||
LWSlider *mPan;
|
LWSlider *mPan;
|
||||||
|
|
||||||
|
@ -493,8 +493,6 @@ void LWSlider::Init(wxWindow * parent,
|
|||||||
mStyle = style;
|
mStyle = style;
|
||||||
mOrientation = orientation;
|
mOrientation = orientation;
|
||||||
mIsDragging = false;
|
mIsDragging = false;
|
||||||
mWidth = size.x;
|
|
||||||
mHeight = size.y;
|
|
||||||
mParent = parent;
|
mParent = parent;
|
||||||
mHW = heavyweight;
|
mHW = heavyweight;
|
||||||
mPopup = popup;
|
mPopup = popup;
|
||||||
@ -513,6 +511,8 @@ void LWSlider::Init(wxWindow * parent,
|
|||||||
mScrollPage = 5.0f;
|
mScrollPage = 5.0f;
|
||||||
mTipPanel = NULL;
|
mTipPanel = NULL;
|
||||||
|
|
||||||
|
AdjustSize(size);
|
||||||
|
|
||||||
mpRuler = NULL; // Do this and Move() before Draw().
|
mpRuler = NULL; // Do this and Move() before Draw().
|
||||||
Move(pos);
|
Move(pos);
|
||||||
}
|
}
|
||||||
@ -577,6 +577,39 @@ void LWSlider::Move(const wxPoint &newpos)
|
|||||||
mTop = newpos.y;
|
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)
|
void LWSlider::OnPaint(wxDC &dc)
|
||||||
{
|
{
|
||||||
if (!mBitmap || !mThumbBitmap)
|
if (!mBitmap || !mThumbBitmap)
|
||||||
@ -617,8 +650,7 @@ void LWSlider::OnPaint(wxDC &dc)
|
|||||||
|
|
||||||
void LWSlider::OnSize( wxSizeEvent & event )
|
void LWSlider::OnSize( wxSizeEvent & event )
|
||||||
{
|
{
|
||||||
mWidth = event.GetSize().GetX();
|
AdjustSize(event.GetSize());
|
||||||
mHeight = event.GetSize().GetY();
|
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
@ -644,8 +676,6 @@ void LWSlider::Draw(wxDC & paintDC)
|
|||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
|
|
||||||
// Create the bitmap
|
// Create the bitmap
|
||||||
mThumbWidth = 14;
|
|
||||||
mThumbHeight = 14;
|
|
||||||
mThumbBitmap = new wxBitmap();
|
mThumbBitmap = new wxBitmap();
|
||||||
mThumbBitmap->Create(mThumbWidth, mThumbHeight, paintDC);
|
mThumbBitmap->Create(mThumbWidth, mThumbHeight, paintDC);
|
||||||
dc.SelectObject(*mThumbBitmap);
|
dc.SelectObject(*mThumbBitmap);
|
||||||
@ -711,28 +741,6 @@ void LWSlider::Draw(wxDC & paintDC)
|
|||||||
// Now the background bitmap
|
// 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 = new wxBitmap();
|
||||||
mBitmap->Create(mWidth, mHeight, paintDC);
|
mBitmap->Create(mWidth, mHeight, paintDC);
|
||||||
dc.SelectObject(*mBitmap);
|
dc.SelectObject(*mBitmap);
|
||||||
|
@ -142,6 +142,8 @@ class LWSlider
|
|||||||
|
|
||||||
void Move(const wxPoint &newpos);
|
void Move(const wxPoint &newpos);
|
||||||
|
|
||||||
|
void AdjustSize(const wxSize & sz);
|
||||||
|
|
||||||
void OnPaint(wxDC &dc);
|
void OnPaint(wxDC &dc);
|
||||||
void OnSize(wxSizeEvent & event);
|
void OnSize(wxSizeEvent & event);
|
||||||
void OnMouseEvent(wxMouseEvent & event);
|
void OnMouseEvent(wxMouseEvent & event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user