1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-04 22:49:07 +02:00

Bug 855 - Data loss sample editing (Do/Undo)

I've added code that now treats sample editing as another kind of mouse capturing activity (IsAdjustingSample).  We will now not undo or redo whilst mouse is captured.  Does not depend on what key binding is used for redo/undo.
This commit is contained in:
James Crook 2015-04-24 09:55:03 +01:00
parent dcef32f312
commit 593cc6ee5e
3 changed files with 8 additions and 1 deletions

View File

@ -3503,6 +3503,10 @@ void AudacityProject::OnRedo()
wxMessageBox(_("Nothing to redo")); wxMessageBox(_("Nothing to redo"));
return; return;
} }
// Can't redo whilst dragging
if (mTrackPanel->IsMouseCaptured()) {
return;
}
TrackList *l = mUndoManager.Redo(&mViewInfo.selectedRegion); TrackList *l = mUndoManager.Redo(&mViewInfo.selectedRegion);
PopState(l); PopState(l);

View File

@ -1578,6 +1578,7 @@ void TrackPanel::HandleEscapeKey()
break; break;
case IsZooming: case IsZooming:
case IsVZooming: case IsVZooming:
case IsAdjustingSample:
break; break;
case IsResizing: case IsResizing:
mCapturedTrack->SetHeight(mInitialActualHeight); mCapturedTrack->SetHeight(mInitialActualHeight);
@ -4906,6 +4907,7 @@ void TrackPanel::HandleSampleEditingClick( wxMouseEvent & event )
ReleaseMouse(); ReleaseMouse();
return; return;
} }
SetCapturedTrack( t, IsAdjustingSample);
/// \todo Should mCapturedTrack take the place of mDrawingTrack?? /// \todo Should mCapturedTrack take the place of mDrawingTrack??
mDrawingTrack = t; mDrawingTrack = t;
@ -5149,7 +5151,7 @@ void TrackPanel::HandleSampleEditingButtonUp( wxMouseEvent & WXUNUSED(event))
//************************************************* //*************************************************
//*** UP-CLICK (Finish drawing) *** //*** UP-CLICK (Finish drawing) ***
//************************************************* //*************************************************
SetCapturedTrack( NULL );
//On up-click, send the state to the undo stack //On up-click, send the state to the undo stack
mDrawingTrack=NULL; //Set this to NULL so it will catch improper drag events. mDrawingTrack=NULL; //Set this to NULL so it will catch improper drag events.
MakeParentPushState(_("Moved Sample"), MakeParentPushState(_("Moved Sample"),

View File

@ -746,6 +746,7 @@ protected:
IsClosing, IsClosing,
IsSelecting, IsSelecting,
IsAdjustingLabel, IsAdjustingLabel,
IsAdjustingSample,
IsResizing, IsResizing,
IsResizingBetweenLinkedTracks, IsResizingBetweenLinkedTracks,
IsResizingBelowLinkedTracks, IsResizingBelowLinkedTracks,