| 1756 | } |
| 1757 | |
| 1758 | void AdornedRulerPanel::HandleQPClick(wxMouseEvent &evt, wxCoord mousePosX) |
| 1759 | { |
| 1760 | // Temporarily inactivate play region |
| 1761 | if (mOldPlayRegion.Active() && evt.LeftDown()) { |
| 1762 | //mPlayRegionLock = true; |
| 1763 | SelectUtilities::InactivatePlayRegion(*mProject); |
| 1764 | } |
| 1765 | |
| 1766 | mLeftDownClickUnsnapped[0] = mQuickPlayPosUnsnapped[0]; |
| 1767 | mLeftDownClick = mQuickPlayPos[0]; |
| 1768 | bool isWithinStart = IsWithinMarker(mousePosX, mOldPlayRegion.GetStart()); |
| 1769 | bool isWithinEnd = IsWithinMarker(mousePosX, mOldPlayRegion.GetEnd()); |
| 1770 | |
| 1771 | if (isWithinStart || isWithinEnd) { |
| 1772 | // If Quick-Play is playing from a point, we need to treat it as a click |
| 1773 | // not as dragging. |
| 1774 | if (mOldPlayRegion.Empty()) |
| 1775 | mMouseEventState = mesSelectingPlayRegionClick; |
| 1776 | // otherwise check which marker is nearer |
| 1777 | else { |
| 1778 | // Don't compare times, compare positions. |
| 1779 | //if (fabs(mQuickPlayPos[0] - mPlayRegionStart) < fabs(mQuickPlayPos[0] - mPlayRegionEnd)) |
| 1780 | auto start = mOldPlayRegion.GetStart(); |
| 1781 | auto end = mOldPlayRegion.GetEnd(); |
| 1782 | if (abs(Time2Pos(mQuickPlayPos[0]) - Time2Pos(start)) < |
| 1783 | abs(Time2Pos(mQuickPlayPos[0]) - Time2Pos(end))) |
| 1784 | mMouseEventState = mesDraggingPlayRegionStart; |
| 1785 | else |
| 1786 | mMouseEventState = mesDraggingPlayRegionEnd; |
| 1787 | } |
| 1788 | } |
| 1789 | else { |
| 1790 | // Clicked but not yet dragging |
| 1791 | mMouseEventState = mesSelectingPlayRegionClick; |
| 1792 | } |
| 1793 | } |
| 1794 | |
| 1795 | auto AdornedRulerPanel::QPHandle::Drag( |
| 1796 | const TrackPanelMouseEvent &event, AudacityProject *pProject) -> Result |
no test coverage detected