| 1976 | } |
| 1977 | |
| 1978 | void 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 | |
| 2031 | auto AdornedRulerPanel::QPHandle::Cancel(AudacityProject *pProject) -> Result |
| 2032 | { |
no test coverage detected