From e3d5fcb575a14de02213e356e2520d4a3292927b Mon Sep 17 00:00:00 2001 From: Dmitry Vedenko Date: Mon, 25 Sep 2023 14:23:09 +0300 Subject: [PATCH] Fixes the wrong Undo message when stretching with mouse --- .../wavetrack/ui/WaveClipAdjustBorderHandle.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tracks/playabletrack/wavetrack/ui/WaveClipAdjustBorderHandle.cpp b/src/tracks/playabletrack/wavetrack/ui/WaveClipAdjustBorderHandle.cpp index 885f4f27bb68..e07f39484718 100644 --- a/src/tracks/playabletrack/wavetrack/ui/WaveClipAdjustBorderHandle.cpp +++ b/src/tracks/playabletrack/wavetrack/ui/WaveClipAdjustBorderHandle.cpp @@ -26,6 +26,7 @@ #include "ViewInfo.h" #include "ProjectHistory.h" #include "UndoManager.h" +#include "WaveClipUtilities.h" namespace { @@ -125,6 +126,7 @@ class AdjustClipBorder final : public WaveClipAdjustBorderHandle::AdjustPolicy std::shared_ptr mInterval; int mDragStartX{ }; const bool mAdjustingLeftBorder; + const bool mIsStretchMode; const double mInitialBorderPosition; double mBorderPosition; const std::pair mRange; @@ -191,6 +193,7 @@ class AdjustClipBorder final : public WaveClipAdjustBorderHandle::AdjustPolicy : mTrack { std::move(track) } , mInterval { std::move(interval) } , mAdjustingLeftBorder { adjustLeftBorder } + , mIsStretchMode { isStretchMode } , mInitialBorderPosition { adjustLeftBorder ? mInterval->Start() : mInterval->End() } , mBorderPosition { mInitialBorderPosition } @@ -256,7 +259,12 @@ class AdjustClipBorder final : public WaveClipAdjustBorderHandle::AdjustPolicy const auto dt = std::abs(mInitialBorderPosition - mBorderPosition); if (dt != 0) { - if (mAdjustingLeftBorder) + if (mIsStretchMode) + { + PushClipSpeedChangedUndoState( + project, 100.0 / mInterval->GetStretchRatio()); + } + else if (mAdjustingLeftBorder) { /*i18n-hint: This is about trimming a clip, a length in seconds like "2.4 seconds" is shown*/ ProjectHistory::Get(project).PushState(XO("Adjust left trim by %.02f seconds").Format(dt),