1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-23 15:50:05 +02:00

Bug 1496 - Mouse down while undoing in Envelope Tool corrupts Undo stack

The Ctrl-Z was interrupting the enveloping, making it finish, but it then got asked to finish again on a mouse up.  This change stops the second finish from happening.
This commit is contained in:
James Crook 2016-09-03 20:19:34 +01:00
parent 06b623bbb1
commit 2fb18e8961

View File

@ -1167,8 +1167,12 @@ void TrackPanel::HandleInterruptedDrag()
WasOverCutLine, WasOverCutLine,
IsStretching IsStretching
*/ */
// The bogus id isn't used anywhere, but may help with debugging.
// as this is sending a bogus mouse up. The mouse button is still actually down
// and may go up again.
const int idBogusUp = 2;
wxMouseEvent evt { wxEVT_LEFT_UP }; wxMouseEvent evt { wxEVT_LEFT_UP };
evt.SetId( idBogusUp );
evt.SetPosition(this->ScreenToClient(::wxGetMousePosition())); evt.SetPosition(this->ScreenToClient(::wxGetMousePosition()));
this->ProcessEvent(evt); this->ProcessEvent(evt);
} }
@ -3068,7 +3072,10 @@ void TrackPanel::HandleEnvelope(wxMouseEvent & event)
if (mCapturedTrack) if (mCapturedTrack)
ForwardEventToEnvelope(event); ForwardEventToEnvelope(event);
if (event.LeftUp()) { // We test for IsEnveloping, because we could have had our action stopped already,
// and already recorded and the second mouse up is bogus.
// e.g could be stopped by some key press. Bug 1496.
if ((mMouseCapture == IsEnveloping ) && event.LeftUp()) {
SetCapturedTrack( NULL ); SetCapturedTrack( NULL );
MakeParentPushState( MakeParentPushState(
/* i18n-hint: (verb) Audacity has just adjusted the envelope .*/ /* i18n-hint: (verb) Audacity has just adjusted the envelope .*/