|
MUSX Document Model
|
A context wrapper for GFrameHold associated with a specific part and location. More...
#include <Entries.h>
Public Member Functions | |
| GFrameHoldContext (const DocumentPtr &document, Cmper partId, Cmper staffId, Cmper meas) | |
| Constructs a context-aware GFrameHold wrapper. | |
| Cmper | getRequestedPartId () const |
| Returns the requested part ID associated with this context. | |
| const GFrameHold * | operator-> () const |
| Provides const pointer-style access to the underlying GFrameHold. | |
| operator bool () const | |
| Returns true if the internal GFrameHold is valid. | |
| ClefIndex | calcClefIndexAt (Edu position) const |
| Returns the clef index in effect for at the specified Edu position. This function does not take into account transposing clefs. Those are addressed in createEntryFrame. | |
| ClefIndex | calcClefIndexAt (util::Fraction position) const |
| Returns the clef index in effect for at the specified util::Fraction position (as a fraction of whole notes). This function does not take into account transposing clefs. Those are addressed in createEntryFrame. | |
| std::shared_ptr< const EntryFrame > | createEntryFrame (LayerIndex layerIndex, util::Fraction timeOffset=0) const |
| Returns the EntryFrame for all entries in the given layer. | |
| bool | iterateEntries (LayerIndex layerIndex, std::function< bool(const EntryInfoPtr &)> iterator) const |
| iterates the entries for the specified layer in this GFrameHold from left to right | |
| bool | iterateEntries (std::function< bool(const EntryInfoPtr &)> iterator) const |
| iterates the entries for this GFrameHold from left to right for each layer in order | |
| std::map< LayerIndex, bool > | calcVoices () const |
| Calculates the number of voices used by the GFrameHold instance. | |
| bool | calcIsCuesOnly (bool includeVisibleInScore=false) const |
| Calculates if this staff in this measure contains only a cue layer and full-measure rest layers. | |
| EntryInfoPtr | calcNearestEntry (Edu eduPosition, bool findExact=true, std::optional< LayerIndex > matchLayer=std::nullopt, std::optional< bool > matchVoice2=std::nullopt, util::Fraction atGraceNoteDuration=0) const |
Calculates the nearest non-grace-note entry at the given eduPosition. | |
| util::Fraction | calcMinLegacyPickupSpacer () const |
| Calculates the minimum legacy pickup spacer, if any. | |
A context wrapper for GFrameHold associated with a specific part and location.
This class retrieves the appropriate GFrameHold from a Document using part, instrument, and measure IDs, and enables part-aware operations like iterating over EntryFrame objects.
| musx::dom::details::GFrameHoldContext::GFrameHoldContext | ( | const DocumentPtr & | document, |
| Cmper | partId, | ||
| Cmper | staffId, | ||
| Cmper | meas | ||
| ) |
Constructs a context-aware GFrameHold wrapper.
| document | Weak pointer to the owning Document. |
| partId | The requested part ID. |
| staffId | The instrument ID for. |
| meas | The measure ID for. |
Returns the clef index in effect for at the specified Edu position. This function does not take into account transposing clefs. Those are addressed in createEntryFrame.
| position | The Edu position of the clef in staff-level Edus. (The staff-level matters for Independent Key Signature staves.) |
|
inline |
Returns the clef index in effect for at the specified util::Fraction position (as a fraction of whole notes). This function does not take into account transposing clefs. Those are addressed in createEntryFrame.
| position | The staff-level position of the clef. (The staff-level matters for Independent Key Signature staves.) |
| bool musx::dom::details::GFrameHoldContext::calcIsCuesOnly | ( | bool | includeVisibleInScore = false | ) | const |
Calculates if this staff in this measure contains only a cue layer and full-measure rest layers.
| includeVisibleInScore | If true, include cues that are visible in the score. |
| util::Fraction musx::dom::details::GFrameHoldContext::calcMinLegacyPickupSpacer | ( | ) | const |
Calculates the minimum legacy pickup spacer, if any.
Legacy pickup spacers, created by the legacy Mirror Tool, can differ for each staff and layer. The spacer takes away time from the beginning of the layer, leaving the time at the end for the pickup to the next measure.
| EntryInfoPtr musx::dom::details::GFrameHoldContext::calcNearestEntry | ( | Edu | eduPosition, |
| bool | findExact = true, |
||
| std::optional< LayerIndex > | matchLayer = std::nullopt, |
||
| std::optional< bool > | matchVoice2 = std::nullopt, |
||
| util::Fraction | atGraceNoteDuration = 0 |
||
| ) | const |
Calculates the nearest non-grace-note entry at the given eduPosition.
| eduPosition | The EDU position to find. |
| findExact | If true, only find an entry that matches to within 1 evpu. Otherwise find the closest entry in the measure. |
| matchLayer | If specified, only find entries in this 0-based layer index. (Values 0..3) |
| matchVoice2 | If specified, the value of Entry::voice2 must match the specified value. |
| atGraceNoteDuration | Match on this grace note duration. When it is zero, grace notes are skipped. |
nullptr. | std::map< LayerIndex, bool > musx::dom::details::GFrameHoldContext::calcVoices | ( | ) | const |
Calculates the number of voices used by the GFrameHold instance.
| std::shared_ptr< const EntryFrame > musx::dom::details::GFrameHoldContext::createEntryFrame | ( | LayerIndex | layerIndex, |
| util::Fraction | timeOffset = 0 |
||
| ) | const |
Returns the EntryFrame for all entries in the given layer.
| layerIndex | The layer index (0..3) to iterate. |
| timeOffset | Subtract this amount from elapsed durations. A common usage might be to pass in here the value returned by others::Measure::calcMinLegacyPickupSpacer. |
|
inline |
Returns the requested part ID associated with this context.
| bool musx::dom::details::GFrameHoldContext::iterateEntries | ( | LayerIndex | layerIndex, |
| std::function< bool(const EntryInfoPtr &)> | iterator | ||
| ) | const |
iterates the entries for the specified layer in this GFrameHold from left to right
| layerIndex | The layer index (0..3) to iterate. |
| iterator | The callback function for each iteration. |
| std::invalid_argument | if the layer index is out of range |
| bool musx::dom::details::GFrameHoldContext::iterateEntries | ( | std::function< bool(const EntryInfoPtr &)> | iterator | ) | const |
iterates the entries for this GFrameHold from left to right for each layer in order
| iterator | The callback function for each iteration. |
|
inlineexplicit |
Returns true if the internal GFrameHold is valid.
|
inline |
Provides const pointer-style access to the underlying GFrameHold.