1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 17:10:05 +02:00

ESC key aborts resizing of mono track, stereo track, or channels of stereo track

Resizing may un-minimize a track; I was careful to be sure ESC restores
minimized state too and then that un-minimizing restores correct height
This commit is contained in:
Paul-Licameli 2015-04-11 23:45:46 -04:00
parent 662d42178c
commit db1cb406e0
2 changed files with 47 additions and 5 deletions

View File

@ -1474,14 +1474,41 @@ void TrackPanel::HandleEscapeKey()
{ {
case IsZooming: case IsZooming:
case IsVZooming: case IsVZooming:
SetCapturedTrack(NULL, IsUncaptured); break;
if (HasCapture()) case IsResizing:
ReleaseMouse(); mCapturedTrack->SetHeight(mInitialActualHeight);
Refresh(false); mCapturedTrack->SetMinimized(mInitialMinimized);
return; break;
case IsResizingBetweenLinkedTracks:
{
Track *const next = mTracks->GetNext(mCapturedTrack);
mCapturedTrack->SetHeight(mInitialUpperActualHeight);
mCapturedTrack->SetMinimized(mInitialMinimized);
next->SetHeight(mInitialActualHeight);
next->SetMinimized(mInitialMinimized);
}
break;
case IsResizingBelowLinkedTracks:
{
Track *const prev = mTracks->GetPrev(mCapturedTrack);
mCapturedTrack->SetHeight(mInitialActualHeight);
mCapturedTrack->SetMinimized(mInitialMinimized);
prev->SetHeight(mInitialUpperActualHeight);
prev->SetMinimized(mInitialMinimized);
}
break;
default: default:
return; return;
;
} }
// Common part in all cases that do anything
SetCapturedTrack(NULL, IsUncaptured);
if (HasCapture())
ReleaseMouse();
wxMouseEvent dummy;
HandleCursor(dummy);
Refresh(false);
} }
void TrackPanel::HandleAltKey(bool down) void TrackPanel::HandleAltKey(bool down)
@ -5591,6 +5618,7 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
mMouseClickY = event.m_y; mMouseClickY = event.m_y;
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY #ifdef EXPERIMENTAL_OUTPUT_DISPLAY
// To do: escape key
if(MONO_WAVE_PAN(t)){ if(MONO_WAVE_PAN(t)){
//STM: Determine whether we should rescale one or two tracks //STM: Determine whether we should rescale one or two tracks
if (t->GetVirtualStereo()) { if (t->GetVirtualStereo()) {
@ -5613,18 +5641,21 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
if (prev && prev->GetLink() == t) { if (prev && prev->GetLink() == t) {
// mCapturedTrack is the lower track // mCapturedTrack is the lower track
mInitialTrackHeight = t->GetHeight(); mInitialTrackHeight = t->GetHeight();
mInitialMinimized = t->GetMinimized();
mInitialUpperTrackHeight = prev->GetHeight(); mInitialUpperTrackHeight = prev->GetHeight();
SetCapturedTrack(t, IsResizingBelowLinkedTracks); SetCapturedTrack(t, IsResizingBelowLinkedTracks);
} }
else if (next && t->GetLink() == next) { else if (next && t->GetLink() == next) {
// mCapturedTrack is the upper track // mCapturedTrack is the upper track
mInitialTrackHeight = next->GetHeight(); mInitialTrackHeight = next->GetHeight();
mInitialMinimized = next->GetMinimized();
mInitialUpperTrackHeight = t->GetHeight(); mInitialUpperTrackHeight = t->GetHeight();
SetCapturedTrack(t, IsResizingBetweenLinkedTracks); SetCapturedTrack(t, IsResizingBetweenLinkedTracks);
} }
else { else {
// DM: Save the initial mouse location and the initial height // DM: Save the initial mouse location and the initial height
mInitialTrackHeight = t->GetHeight(); mInitialTrackHeight = t->GetHeight();
mInitialMinimized = t->GetMinimized();
SetCapturedTrack(t, IsResizing); SetCapturedTrack(t, IsResizing);
} }
} }
@ -5636,18 +5667,26 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
if (prev && prev->GetLink() == t) { if (prev && prev->GetLink() == t) {
// mCapturedTrack is the lower track // mCapturedTrack is the lower track
mInitialTrackHeight = t->GetHeight(); mInitialTrackHeight = t->GetHeight();
mInitialActualHeight = t->GetActualHeight();
mInitialMinimized = t->GetMinimized();
mInitialUpperTrackHeight = prev->GetHeight(); mInitialUpperTrackHeight = prev->GetHeight();
mInitialUpperActualHeight = prev->GetActualHeight();
SetCapturedTrack(t, IsResizingBelowLinkedTracks); SetCapturedTrack(t, IsResizingBelowLinkedTracks);
} }
else if (next && t->GetLink() == next) { else if (next && t->GetLink() == next) {
// mCapturedTrack is the upper track // mCapturedTrack is the upper track
mInitialTrackHeight = next->GetHeight(); mInitialTrackHeight = next->GetHeight();
mInitialActualHeight = next->GetActualHeight();
mInitialMinimized = next->GetMinimized();
mInitialUpperTrackHeight = t->GetHeight(); mInitialUpperTrackHeight = t->GetHeight();
mInitialUpperActualHeight = t->GetActualHeight();
SetCapturedTrack(t, IsResizingBetweenLinkedTracks); SetCapturedTrack(t, IsResizingBetweenLinkedTracks);
} }
else { else {
// DM: Save the initial mouse location and the initial height // DM: Save the initial mouse location and the initial height
mInitialTrackHeight = t->GetHeight(); mInitialTrackHeight = t->GetHeight();
mInitialActualHeight = t->GetActualHeight();
mInitialMinimized = t->GetMinimized();
SetCapturedTrack(t, IsResizing); SetCapturedTrack(t, IsResizing);
} }
#endif // EXPERIMENTAL_OUTPUT_DISPLAY #endif // EXPERIMENTAL_OUTPUT_DISPLAY

View File

@ -712,8 +712,11 @@ protected:
bool onlyWithinSnapDistance, bool onlyWithinSnapDistance,
double *pPinValue = NULL) const; double *pPinValue = NULL) const;
bool mInitialMinimized;
int mInitialTrackHeight; int mInitialTrackHeight;
int mInitialActualHeight;
int mInitialUpperTrackHeight; int mInitialUpperTrackHeight;
int mInitialUpperActualHeight;
bool mAutoScrolling; bool mAutoScrolling;
enum MouseCaptureEnum enum MouseCaptureEnum