From d36ac2cedbee316a8298e239b02846b4aff9b544 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 18 May 2017 07:06:22 -0400 Subject: [PATCH] Revert "Fix for keyboard commands for time shifting clips" This reverts commit b91160795dedce54745102027f8bb0908828772a. --- src/Menus.cpp | 24 ++++++------------------ src/Menus.h | 4 ++-- src/TrackPanel.cpp | 23 ++--------------------- src/TrackPanel.h | 4 +--- 4 files changed, 11 insertions(+), 44 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index fa1829805..1883194ac 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -1438,8 +1438,8 @@ void AudacityProject::CreateMenusAndCommands() c->AddItem(wxT("CursorLongJumpLeft"), _("Cursor Long Jump Left"), FN(OnCursorLongJumpLeft), wxT("Shift+,")); c->AddItem(wxT("CursorLongJumpRight"), _("Cursor Long Jump Right"), FN(OnCursorLongJumpRight), wxT("Shift+.")); - c->AddItem(wxT("ClipLeft"), _("Clip Left"), FN(OnClipLeft), wxT("\twantKeyup")); - c->AddItem(wxT("ClipRight"), _("Clip Right"), FN(OnClipRight), wxT("\twantKeyup")); + c->AddItem(wxT("ClipLeft"), _("Clip Left"), FN(OnClipLeft), wxT("")); + c->AddItem(wxT("ClipRight"), _("Clip Right"), FN(OnClipRight), wxT("")); c->EndSubMenu(); ////////////////////////////////////////////////////////////////////////// @@ -3081,26 +3081,14 @@ void AudacityProject::OnSelContractRight(const wxEvent * evt) OnCursorLeft( true, true, bKeyUp ); } -void AudacityProject::OnClipLeft(const wxEvent* evt) +void AudacityProject::OnClipLeft() { - if (evt) { - mTrackPanel->OnClipMove(false, evt->GetEventType() == wxEVT_KEY_UP); - } - else { // called from menu item, so simulate keydown and keyup - mTrackPanel->OnClipMove(false, false); - mTrackPanel->OnClipMove(false, true); - } + mTrackPanel->OnClipMove(false); } -void AudacityProject::OnClipRight(const wxEvent* evt) +void AudacityProject::OnClipRight() { - if (evt) { - mTrackPanel->OnClipMove(true, evt->GetEventType() == wxEVT_KEY_UP); - } - else { // called from menu item, so simulate keydown and keyup - mTrackPanel->OnClipMove(true, false); - mTrackPanel->OnClipMove(true, true); - } + mTrackPanel->OnClipMove(true); } //this pops up a dialog which allows the left selection to be set. diff --git a/src/Menus.h b/src/Menus.h index f4828db7a..8291c2ba3 100644 --- a/src/Menus.h +++ b/src/Menus.h @@ -160,8 +160,8 @@ void OnSelExtendRight(const wxEvent * evt); void OnSelContractLeft(const wxEvent * evt); void OnSelContractRight(const wxEvent * evt); -void OnClipLeft(const wxEvent* evt); -void OnClipRight(const wxEvent* evt); +void OnClipLeft(); +void OnClipRight(); void OnCursorShortJumpLeft(); void OnCursorShortJumpRight(); diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 99bc6cd87..088b78fa7 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -455,7 +455,6 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id, mMouseCapture = IsUncaptured; mSlideUpDownOnly = false; - mHSlideAmountTotal = 0.0; mLabelTrackStartXPos=-1; mCircularTrackNavigation = false; @@ -3984,28 +3983,11 @@ void TrackPanel::DoSlideHorizontal() } } -void TrackPanel::OnClipMove(bool right, bool keyUp) +void TrackPanel::OnClipMove(bool right) { - if (keyUp) { - if (mHSlideAmountTotal != 0.0) { - wxString message; - message.Printf(wxT("%s %s %.03f %s"), - _("Time shifted clips"), - mHSlideAmountTotal > 0 ? - /* i18n-hint: a direction as in left or right */ - _("right") : - /* i18n-hint: a direction as in left or right */ - _("left"), - fabs(mHSlideAmountTotal), - _("seconds")); - MakeParentPushState(message, _("Time-Shift"), UndoPush::CONSOLIDATE); - mHSlideAmountTotal = 0.0; - } - return; - } - auto track = GetFocusedTrack(); + // just dealing with clips in wave tracks for the moment. Note tracks?? if (track && track->GetKind() == Track::Wave) { auto wt = static_cast(track); @@ -4034,7 +4016,6 @@ void TrackPanel::OnClipMove(bool right, bool keyUp) mHSlideAmount = desiredSlideAmount; DoSlideHorizontal(); - mHSlideAmountTotal += mHSlideAmount; // update t0 and t1. There is the possibility that the updated // t0 may no longer be within the clip due to rounding errors, diff --git a/src/TrackPanel.h b/src/TrackPanel.h index d9b30de03..6c765f9a6 100644 --- a/src/TrackPanel.h +++ b/src/TrackPanel.h @@ -256,7 +256,7 @@ class AUDACITY_DLL_API TrackPanel final : public OverlayPanel { // (ignoring any fisheye) virtual double GetScreenEndTime() const; - virtual void OnClipMove(bool right, bool keyUp); + virtual void OnClipMove(bool right); protected: virtual MixerBoard* GetMixerBoard(); @@ -682,8 +682,6 @@ protected: // us to undo the slide and then slide it by another amount double mHSlideAmount; - double mHSlideAmountTotal; // used for sliding horizontally using the keyboard - bool mDidSlideVertically; bool mRedrawAfterStop;