Fix SongEditor Snap Size to Adjust with Time Signature #7620
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR changes the way the snap size in the Song Editor is set up to accommodate odd time signatures. Instead of being solely powers of two, the snap sizes < 1 bar are now also multiples of the current time signature.
The snap sizes in general look like:
2^3
2^2
2^1
1
1 / (numerator)
1 / (numerator * 2^1)
1 / (numerator * 2^2)
1 / (numerator * 2^3)
The snap sizes are recalculated and the ComboBox is repopulated whenever the time signature changes.
2024-12-13.13-10-14.mp4
Changes
SongEditor
,updateSnapSizes()
, which is connected toSong::timeSignatureChanged
. This function recalculates the snap sizes given the current time signature numerator.m_snapSizes
was added toSongEditor
so that the snap sizes do not have to be recalculated whenever they are requested.SNAP_SIZES
andPROPORTIONAL_SNAP_SIZES
were removed fromSongEditor
and replaced with the integersSNAP_SIZES_SMALL
andSNAP_SIZES_LARGE
, which determine the number of divisions greater than or less than 1 bar.