MCPcopy Create free account
hub / github.com/audacity/audacity / HandleQPRelease

Method HandleQPRelease

src/AdornedRulerPanel.cpp:1978–2029  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1976}
1977
1978void AdornedRulerPanel::HandleQPRelease(wxMouseEvent &evt)
1979{
1980 auto &viewInfo = ViewInfo::Get(*GetProject());
1981 auto &playRegion = viewInfo.playRegion;
1982 playRegion.Order();
1983
1984 const double t0 = mTracks->GetStartTime();
1985 const double t1 = mTracks->GetEndTime();
1986 const auto &selectedRegion = viewInfo.selectedRegion;
1987 const double sel0 = selectedRegion.t0();
1988 const double sel1 = selectedRegion.t1();
1989
1990 // We want some audio in the selection, but we allow a dragged
1991 // region to include selected white-space and space before audio start.
1992 if (evt.ShiftDown() && playRegion.Empty()) {
1993 // Looping the selection or project.
1994 // Disable if track selection is in white-space beyond end of tracks and
1995 // play position is outside of track contents.
1996 if (((sel1 < t0) || (sel0 > t1)) &&
1997 ((playRegion.GetStart() < t0) || (playRegion.GetStart() > t1))) {
1998 ClearPlayRegion();
1999 }
2000 }
2001 // Disable if beyond end.
2002 else if (playRegion.GetStart() >= t1) {
2003 ClearPlayRegion();
2004 }
2005 // Disable if empty selection before start.
2006 // (allow Quick-Play region to include 'pre-roll' white space)
2007 else if (
2008 playRegion.GetEnd() - playRegion.GetStart() > 0.0 &&
2009 playRegion.GetEnd() < t0
2010 ) {
2011 ClearPlayRegion();
2012 }
2013
2014 mMouseEventState = mesNone;
2015 mIsDragging = false;
2016 mLeftDownClick = -1;
2017
2018 auto cleanup = finally( [&] {
2019 if (mOldPlayRegion.Active()) {
2020 // Restore Locked Play region
2021 SetPlayRegion(mOldPlayRegion.GetStart(), mOldPlayRegion.GetEnd());
2022 SelectUtilities::ActivatePlayRegion(*mProject);
2023 // and release local lock
2024 mOldPlayRegion.SetActive( false );
2025 }
2026 } );
2027
2028 StartQPPlay(!evt.ShiftDown(), evt.ControlDown());
2029}
2030
2031auto AdornedRulerPanel::QPHandle::Cancel(AudacityProject *pProject) -> Result
2032{

Callers 1

ReleaseMethod · 0.80

Calls 9

GetFunction · 0.85
ClearPlayRegionFunction · 0.85
finallyFunction · 0.85
ActivatePlayRegionFunction · 0.85
OrderMethod · 0.80
GetStartTimeMethod · 0.45
GetEndTimeMethod · 0.45
EmptyMethod · 0.45
SetActiveMethod · 0.45

Tested by

no test coverage detected