mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-24 16:38:07 +02:00
Fix buts in click and drag on track control panel
Bug1134: Click and drag to move a track should make only one undo item Bugs1133, 1135: Only left click in track control panel should select track...
This commit is contained in:
commit
ac6f40dcab
@ -5533,9 +5533,10 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event)
|
|||||||
}
|
}
|
||||||
#endif // USE_MIDI
|
#endif // USE_MIDI
|
||||||
|
|
||||||
if (!isleft) {
|
}
|
||||||
return;
|
|
||||||
}
|
if (!isleft) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DM: If they weren't clicking on a particular part of a track label,
|
// DM: If they weren't clicking on a particular part of a track label,
|
||||||
@ -5544,6 +5545,7 @@ void TrackPanel::HandleLabelClick(wxMouseEvent & event)
|
|||||||
// JH: also, capture the current track for rearranging, so the user
|
// JH: also, capture the current track for rearranging, so the user
|
||||||
// can drag the track up or down to swap it with others
|
// can drag the track up or down to swap it with others
|
||||||
if (!unsafe) {
|
if (!unsafe) {
|
||||||
|
mRearrangeCount = 0;
|
||||||
SetCapturedTrack( t, IsRearranging );
|
SetCapturedTrack( t, IsRearranging );
|
||||||
TrackPanel::CalculateRearrangingThresholds(event);
|
TrackPanel::CalculateRearrangingThresholds(event);
|
||||||
}
|
}
|
||||||
@ -5579,7 +5581,16 @@ void TrackPanel::HandleRearrange(wxMouseEvent & event)
|
|||||||
{
|
{
|
||||||
// are we finishing the drag?
|
// are we finishing the drag?
|
||||||
if (event.LeftUp()) {
|
if (event.LeftUp()) {
|
||||||
SetCapturedTrack( NULL );
|
if (mRearrangeCount != 0) {
|
||||||
|
wxString dir;
|
||||||
|
dir = mRearrangeCount < 0 ? _("up") : _("down");
|
||||||
|
MakeParentPushState(wxString::Format(_("Moved '%s' %s"),
|
||||||
|
mCapturedTrack->GetName().c_str(),
|
||||||
|
dir.c_str()),
|
||||||
|
_("Move Track"));
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCapturedTrack(NULL);
|
||||||
SetCursor(*mArrowCursor);
|
SetCursor(*mArrowCursor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -5590,10 +5601,9 @@ void TrackPanel::HandleRearrange(wxMouseEvent & event)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
MixerBoard* pMixerBoard = this->GetMixerBoard(); // Update mixer board, too.
|
MixerBoard* pMixerBoard = this->GetMixerBoard(); // Update mixer board, too.
|
||||||
wxString dir;
|
|
||||||
if (event.m_y < mMoveUpThreshold || event.m_y < 0) {
|
if (event.m_y < mMoveUpThreshold || event.m_y < 0) {
|
||||||
mTracks->MoveUp(mCapturedTrack);
|
mTracks->MoveUp(mCapturedTrack);
|
||||||
dir = _("up");
|
--mRearrangeCount;
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
if (pMixerBoard && (mCapturedTrack->GetKind() == Track::Wave ||
|
if (pMixerBoard && (mCapturedTrack->GetKind() == Track::Wave ||
|
||||||
mCapturedTrack->GetKind() == Track::Note))
|
mCapturedTrack->GetKind() == Track::Note))
|
||||||
@ -5605,8 +5615,8 @@ void TrackPanel::HandleRearrange(wxMouseEvent & event)
|
|||||||
}
|
}
|
||||||
else if (event.m_y > mMoveDownThreshold || event.m_y > GetRect().GetHeight()) {
|
else if (event.m_y > mMoveDownThreshold || event.m_y > GetRect().GetHeight()) {
|
||||||
mTracks->MoveDown(mCapturedTrack);
|
mTracks->MoveDown(mCapturedTrack);
|
||||||
|
++mRearrangeCount;
|
||||||
/* i18n-hint: a direction as in up or down.*/
|
/* i18n-hint: a direction as in up or down.*/
|
||||||
dir = _("down");
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
if (pMixerBoard && (mCapturedTrack->GetKind() == Track::Wave ||
|
if (pMixerBoard && (mCapturedTrack->GetKind() == Track::Wave ||
|
||||||
mCapturedTrack->GetKind() == Track::Note))
|
mCapturedTrack->GetKind() == Track::Note))
|
||||||
@ -5621,11 +5631,6 @@ void TrackPanel::HandleRearrange(wxMouseEvent & event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeParentPushState(wxString::Format(_("Moved '%s' %s"),
|
|
||||||
mCapturedTrack->GetName().c_str(),
|
|
||||||
dir.c_str()),
|
|
||||||
_("Move Track"));
|
|
||||||
|
|
||||||
// JH: if we moved up or down, recalculate the thresholds and make sure the
|
// JH: if we moved up or down, recalculate the thresholds and make sure the
|
||||||
// track is fully on-screen.
|
// track is fully on-screen.
|
||||||
TrackPanel::CalculateRearrangingThresholds(event);
|
TrackPanel::CalculateRearrangingThresholds(event);
|
||||||
|
@ -773,6 +773,7 @@ protected:
|
|||||||
// coordinate should the dragging track move up or down?
|
// coordinate should the dragging track move up or down?
|
||||||
int mMoveUpThreshold;
|
int mMoveUpThreshold;
|
||||||
int mMoveDownThreshold;
|
int mMoveDownThreshold;
|
||||||
|
int mRearrangeCount;
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
#ifdef EXPERIMENTAL_SCRUBBING_BASIC
|
||||||
int mScrubToken;
|
int mScrubToken;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user