| 194 | } |
| 195 | |
| 196 | void TrimSelection::updatePointMarker() { |
| 197 | const int halfWidth = 7; |
| 198 | const int startX = juce::roundToInt(timeToXPosition(mSelectedRange.getStart()) - halfWidth); |
| 199 | const int endX = juce::roundToInt(timeToXPosition(mSelectedRange.getEnd()) - halfWidth); |
| 200 | // PointMarkers start at the top to draw the line over the thumbnail |
| 201 | const int y = mThumbnailRect.getY(); |
| 202 | const int width = halfWidth * 2; |
| 203 | // The PointerMarker height is the triangle height under the thumbnail |
| 204 | const int height = mThumbnailRect.getHeight() + PointMarker::height(); |
| 205 | // prevent from going outside thumbnail bounds |
| 206 | const int minX = mThumbnailRect.getX() - halfWidth; |
| 207 | const int maxX = mThumbnailRect.getRight() - halfWidth; |
| 208 | mStartMarker.setBounds(juce::jmax(startX, minX), y, width, height); |
| 209 | mEndMarker.setBounds(juce::jmin(endX, maxX), y, width, height); |
| 210 | |
| 211 | const int startTotal = static_cast<int>(mSelectedRange.getStart()); |
| 212 | const int startMinute = startTotal / 60; |
| 213 | const int startSecond = startTotal % 60; |
| 214 | const int endTotal = static_cast<int>(mSelectedRange.getEnd()); |
| 215 | const int endMinute = endTotal / 60; |
| 216 | const int endSecond = endTotal % 60; |
| 217 | mStartTimeString = juce::String::formatted("%02d:%02d", startMinute, startSecond); |
| 218 | mEndTimeString = juce::String::formatted("%02d:%02d", endMinute, endSecond); |
| 219 | } |
| 220 | |
| 221 | // There is a single instance of TrimSelection so clean up between uses |
| 222 | void TrimSelection::cleanup() { mParamUI.playingTrimSelection = false; } |