1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-18 09:00:07 +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 IsVZooming:
SetCapturedTrack(NULL, IsUncaptured);
if (HasCapture())
ReleaseMouse();
Refresh(false);
return;
break;
case IsResizing:
mCapturedTrack->SetHeight(mInitialActualHeight);
mCapturedTrack->SetMinimized(mInitialMinimized);
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:
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)
@ -5591,6 +5618,7 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
mMouseClickY = event.m_y;
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
// To do: escape key
if(MONO_WAVE_PAN(t)){
//STM: Determine whether we should rescale one or two tracks
if (t->GetVirtualStereo()) {
@ -5613,18 +5641,21 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
if (prev && prev->GetLink() == t) {
// mCapturedTrack is the lower track
mInitialTrackHeight = t->GetHeight();
mInitialMinimized = t->GetMinimized();
mInitialUpperTrackHeight = prev->GetHeight();
SetCapturedTrack(t, IsResizingBelowLinkedTracks);
}
else if (next && t->GetLink() == next) {
// mCapturedTrack is the upper track
mInitialTrackHeight = next->GetHeight();
mInitialMinimized = next->GetMinimized();
mInitialUpperTrackHeight = t->GetHeight();
SetCapturedTrack(t, IsResizingBetweenLinkedTracks);
}
else {
// DM: Save the initial mouse location and the initial height
mInitialTrackHeight = t->GetHeight();
mInitialMinimized = t->GetMinimized();
SetCapturedTrack(t, IsResizing);
}
}
@ -5636,18 +5667,26 @@ void TrackPanel::HandleResizeClick( wxMouseEvent & event )
if (prev && prev->GetLink() == t) {
// mCapturedTrack is the lower track
mInitialTrackHeight = t->GetHeight();
mInitialActualHeight = t->GetActualHeight();
mInitialMinimized = t->GetMinimized();
mInitialUpperTrackHeight = prev->GetHeight();
mInitialUpperActualHeight = prev->GetActualHeight();
SetCapturedTrack(t, IsResizingBelowLinkedTracks);
}
else if (next && t->GetLink() == next) {
// mCapturedTrack is the upper track
mInitialTrackHeight = next->GetHeight();
mInitialActualHeight = next->GetActualHeight();
mInitialMinimized = next->GetMinimized();
mInitialUpperTrackHeight = t->GetHeight();
mInitialUpperActualHeight = t->GetActualHeight();
SetCapturedTrack(t, IsResizingBetweenLinkedTracks);
}
else {
// DM: Save the initial mouse location and the initial height
mInitialTrackHeight = t->GetHeight();
mInitialActualHeight = t->GetActualHeight();
mInitialMinimized = t->GetMinimized();
SetCapturedTrack(t, IsResizing);
}
#endif // EXPERIMENTAL_OUTPUT_DISPLAY

View File

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