MCPcopy Create free account
hub / github.com/StrangeLoopsAudio/gRainbow / updatePointMarker

Method updatePointMarker

Source/Components/TrimSelection.cpp:196–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196void 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
222void TrimSelection::cleanup() { mParamUI.playingTrimSelection = false; }

Callers

nothing calls this directly

Calls 1

getHeightMethod · 0.80

Tested by

no test coverage detected