1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-03 09:09:47 +02:00

ESC key can abort certain dragging actions

For now, let it abort vertical scale zoom
(any mouse button in any tool, in the vertical ruler)
and horizontal zoom
(any mouse button in the zoom tool or right mouse button in the multi tool,
in the wave display)

Should any other drags be escapable too?
Time shifting?  That would need some more work to restore initial state.
This commit is contained in:
Paul-Licameli 2015-04-09 15:41:32 -04:00
parent 7bcba2a0b6
commit 903fcb1fc2
2 changed files with 21 additions and 0 deletions

View File

@ -1468,6 +1468,21 @@ void TrackPanel::MakeParentResize()
mListener->TP_HandleResize();
}
void TrackPanel::HandleEscapeKey()
{
switch (mMouseCapture)
{
case IsZooming:
case IsVZooming:
SetCapturedTrack(NULL, IsUncaptured);
if (HasCapture())
ReleaseCapture();
return;
default:
return;
}
}
void TrackPanel::HandleAltKey(bool down)
{
mLastMouseEvent.m_altDown = down;
@ -5963,6 +5978,11 @@ void TrackPanel::OnKeyDown(wxKeyEvent & event)
{
Track *t = GetFocusedTrack();
if (event.GetKeyCode() == WXK_ESCAPE) {
HandleEscapeKey();
return;
}
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
#ifdef SPECTRAL_EDITING_ESC_KEY
// Test for pinning and unpinning of the center frequency

View File

@ -208,6 +208,7 @@ class AUDACITY_DLL_API TrackPanel:public wxPanel {
//virtual void SetSelectionFormat(int iformat)
//virtual void SetSnapTo(int snapto)
void HandleEscapeKey();
virtual void HandleAltKey(bool down);
virtual void HandleShiftKey(bool down);
virtual void HandleControlKey(bool down);