Skip to content

Commit

Permalink
Fixes the wrong Undo message when stretching with mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
crsib committed Sep 25, 2023
1 parent 36a3b38 commit e3d5fcb
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "ViewInfo.h"
#include "ProjectHistory.h"
#include "UndoManager.h"
#include "WaveClipUtilities.h"

namespace {

Expand Down Expand Up @@ -125,6 +126,7 @@ class AdjustClipBorder final : public WaveClipAdjustBorderHandle::AdjustPolicy
std::shared_ptr<WaveTrack::Interval> mInterval;
int mDragStartX{ };
const bool mAdjustingLeftBorder;
const bool mIsStretchMode;
const double mInitialBorderPosition;
double mBorderPosition;
const std::pair<double, double> mRange;
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit e3d5fcb

Please sign in to comment.