| 1055 | }; |
| 1056 | |
| 1057 | std::vector<UIHandlePtr> AdornedRulerPanel::QPCell::HitTest( |
| 1058 | const TrackPanelMouseState &state, |
| 1059 | const AudacityProject *pProject) |
| 1060 | { |
| 1061 | // Creation of overlays on demand here -- constructor of AdornedRulerPanel |
| 1062 | // is too early to do it |
| 1063 | mParent->CreateOverlays(); |
| 1064 | |
| 1065 | std::vector<UIHandlePtr> results; |
| 1066 | auto xx = state.state.m_x; |
| 1067 | |
| 1068 | { |
| 1069 | // Allow click and drag on the play head even while recording |
| 1070 | // Make this handle more prominent then the quick play handle |
| 1071 | auto result = PlayheadHandle::HitTest( pProject, *mParent, xx ); |
| 1072 | if (result) { |
| 1073 | result = AssignUIHandlePtr( mPlayheadHolder, result ); |
| 1074 | results.push_back( result ); |
| 1075 | } |
| 1076 | } |
| 1077 | |
| 1078 | // Disable mouse actions on Timeline while recording. |
| 1079 | if (!mParent->mIsRecording) { |
| 1080 | mParent->UpdateQuickPlayPos( xx ); |
| 1081 | |
| 1082 | #if 0 |
| 1083 | auto result = std::make_shared<QPHandle>( mParent, xx ); |
| 1084 | result = AssignUIHandlePtr( mHolder, result ); |
| 1085 | results.push_back( result ); |
| 1086 | #endif |
| 1087 | } |
| 1088 | |
| 1089 | // High priority hit is a handle to change the existing play region |
| 1090 | bool hitLeft = false; |
| 1091 | const auto &playRegion = ViewInfo::Get(*pProject).playRegion; |
| 1092 | if ((hitLeft = |
| 1093 | mParent->IsWithinMarker(xx, playRegion.GetLastActiveStart())) || |
| 1094 | mParent->IsWithinMarker(xx, playRegion.GetLastActiveEnd())) |
| 1095 | { |
| 1096 | auto result = |
| 1097 | std::make_shared<ResizePlayRegionHandle>( mParent, xx, hitLeft ); |
| 1098 | result = AssignUIHandlePtr( mResizePlayRegionHolder, result ); |
| 1099 | results.push_back(result); |
| 1100 | } |
| 1101 | |
| 1102 | // Middle priority hit is a handle to change the existing play region at |
| 1103 | // both ends, but only when the play region is active |
| 1104 | if (auto time = mParent->Pos2Time(xx); |
| 1105 | playRegion.Active() && |
| 1106 | time >= playRegion.GetStart() && |
| 1107 | time <= playRegion.GetEnd()) |
| 1108 | { |
| 1109 | auto result = |
| 1110 | std::make_shared<MovePlayRegionHandle>( mParent, xx ); |
| 1111 | result = AssignUIHandlePtr( mMovePlayRegionHolder, result ); |
| 1112 | results.push_back(result); |
| 1113 | } |
| 1114 |
nothing calls this directly
no test coverage detected