Skip to content

Commit

Permalink
Use a different predicate for the "Render clip stretching" menu
Browse files Browse the repository at this point in the history
  • Loading branch information
crsib committed Sep 25, 2023
1 parent 0639ebf commit a064814
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,21 @@ const ReservedCommandFlag &SomeClipIsSelectedFlag()
return flag;
}

const ReservedCommandFlag &StretchedClipIsSelectedFlag()
{
static ReservedCommandFlag flag{
[](const AudacityProject &project){
// const_cast isn't pretty but not harmful in this case
auto result = SelectedIntervalOfFocusedTrack(
const_cast<AudacityProject&>(project));

auto interval = *result.second;
return interval != nullptr && !interval->StretchRatioEquals(1.0);
}
};
return flag;
}

}

unsigned WaveTrackAffordanceControls::CaptureKey(wxKeyEvent& event, ViewInfo& viewInfo, wxWindow* pParent, AudacityProject* project)
Expand Down Expand Up @@ -703,6 +718,6 @@ AttachedItem sAttachment2{ wxT("Edit/Other/Clip"),

AttachedItem sAttachment3{ wxT("Edit/Other/Clip"),
Command( L"RenderClipStretching", XXO("Render Clip Stretching"),
OnRenderClipStretching, SomeClipIsSelectedFlag())
OnRenderClipStretching, StretchedClipIsSelectedFlag())
};
}

0 comments on commit a064814

Please sign in to comment.