MUSX Document Model
Loading...
Searching...
No Matches
Staff.h
1/*
2 * Copyright (C) 2025, Robert Patterson
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22#pragma once
23
24#include <type_traits>
25
26#include "musx/util/Logger.h"
27#include "musx/util/Fraction.h"
28
29#include "BaseClasses.h"
30#include "CommonClasses.h"
31 // do not add other dom class dependencies. Use .cpp files for implementations that need total class access.
32
33namespace musx {
34namespace dom {
35
36namespace details {
37class Baseline;
38class BaselineNoInci;
39class ShapeNoteBase;
40}
41
42namespace others {
43
44class StaffStyle;
51class Staff : public OthersBase
52{
53public:
66
71 enum class StemDirection
72 {
73 Default,
74 AlwaysUp,
76 };
77
82 enum class NotationStyle
83 {
84 Standard,
86 Tablature
87 };
88
93 enum class HideMode
94 {
95 None,
96 Cutaway,
98 Score
99 };
100
106 {
107 Normal,
108 SlashBeats,
109 Rhythmic,
110 Blank,
114 };
115
121 {
122 public:
123 int interval{};
124 int adjust{};
125
127 };
128
141
150 {
151 public:
153
154 bool setToClef{};
156
158 std::shared_ptr<KeySigTransposition> keysig;
159
161 std::shared_ptr<ChromaticTransposition> chromatic;
162
164 bool isSame(const Transposition& other) const;
165
166 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
167 {
169 Cmper thisCmper = 0;
170 if (const auto parent = getParent<others::Staff>()) {
171 thisCmper = parent->getCmper();
172 }
173 if (!keysig && !chromatic) {
174 MUSX_INTEGRITY_ERROR("Transposition settings " + std::to_string(thisCmper) + " has neither a key signature nor chromatic settings.");
175 } else if (keysig && chromatic) {
176 MUSX_INTEGRITY_ERROR("Transposition settings " + std::to_string(thisCmper) + " has both key signature and chromatic settings.");
177 }
178 }
179
181 };
182
184 explicit Staff(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
185 : OthersBase(document, partId, shareMode, cmper) {}
186
187 // WARNING: Any fields added here must have a mask added in StaffStyle (if it does not already exist)
188 // and must be added to StaffComposite::applyStyle.
189
190 // Public properties corresponding to the XML structure
192 std::shared_ptr<FontInfo> noteFont;
194 bool useNoteFont{};
197 std::optional<int> staffLines{};
198 std::optional<std::vector<int>> customStaff;
200 std::string instUuid;
201 int capoPos{};
203 bool floatKeys{};
204 bool floatTime{};
205 bool blineBreak{};
206 bool rbarBreak{};
207 bool hasStyles{};
210 std::shared_ptr<Transposition> transposition;
227 bool flatBeams{};
231 bool hideLyrics{};
232 bool noOptimize{};
235 bool hideRepeats{};
237 bool hideRptBars{};
238 bool hideKeySigs{};
240 bool hideClefs{};
242 bool hideChords{};
243 bool noKey{};
248 bool hideRests{};
249 bool hideTies{};
250 bool hideDots{};
260 bool hideTuplets{};
262 bool hideStems{};
264 bool hideBeams{};
282
283 // The following values are not in xml but computed by the factory.
284
298 std::optional<int> autoNumberValue;
299 std::optional<Cmper> percussionMapId;
300
304
308
310 bool calcShowName() const;
311
314
318
322 util::EnigmaParsingContext getFullInstrumentNameCtx(Cmper forPartId, bool preferStaffName = false) const;
323
327 util::EnigmaParsingContext getAbbreviatedInstrumentNameCtx(Cmper forPartId, bool preferStaffName = false) const;
328
333 std::string getFullInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle = util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName = false) const;
334
339 std::string getAbbreviatedInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle = util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName = false) const;
340
342 bool calcShowInstrumentName() const;
343
346
349
352
354 bool showNamesForPart(Cmper partId) const
355 { return partId == SCORE_PARTID ? !hideNameInScore : showNameInParts; }
356
366 static void calcAllAutoNumberValues(const DocumentPtr& document);
367
373 template <typename SubType>
374 static void calcAllRuntimeValues(const DocumentPtr& document);
375
380 std::pair<std::string, bool> calcAutoNumberingAffix() const;
381
385 std::string addAutoNumbering(const std::string& plainName) const;
386
391 ClefIndex calcClefIndexAt(MeasCmper measureId, Edu position, bool forWrittenPitch = false) const;
392
394 ClefIndex calcFirstClefIndex(bool forWrittenPitch = false) const
395 { return calcClefIndexAt(1, 0, forWrittenPitch); }
396
401 static ClefIndex calcFirstClefIndex(const DocumentPtr& document, Cmper partId, StaffCmper staffCmper);
402
404 int calcNumberOfStafflines() const;
405
407 int calcMiddleStaffPosition() const;
408
415
420 template<typename BaselineType,
421 std::enable_if_t<std::is_base_of<details::BaselineNoInci, BaselineType>::value, int> = 0>
423 {
424 return calcBaselinePositionImpl<BaselineType>(systemId, std::nullopt);
425 }
426
432 template<typename BaselineType,
433 std::enable_if_t<std::is_base_of<details::Baseline, BaselineType>::value &&
434 !std::is_base_of<details::BaselineNoInci, BaselineType>::value, int> = 0>
435 Evpu calcBaselinePosition(SystemCmper systemId, Cmper lyricNumber) const
436 {
437 return calcBaselinePositionImpl<BaselineType>(systemId, lyricNumber);
438 }
439
443 std::vector<LyricsLineInfo> createLyricsLineInfo(SystemCmper systemId) const;
444
446 int calcTopLinePosition() const;
447
449 int calcBottomLinePosition() const;
450
452 bool hasInstrumentAssigned() const;
453
459 std::pair<int, int> calcTranspositionInterval() const;
460
463 MusxInstanceList<PartDefinition> getContainingParts(bool includeScore = true) const;
464
468
471 bool calcAlternateNotationHidesEntries(LayerIndex forLayerIndex) const;
472
476 bool iterateEntries(std::function<bool(const EntryInfoPtr&)> iterator) const;
477
480 bool calcIsSameNotationStyle(const Staff& other) const;
481
482 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
483 {
485 if (!staffLines && !customStaff) {
486 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has neither a standard nor a custom staff definition.");
487 } else if (staffLines && customStaff) {
488 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has both a standard and a custom staff definition.");
489 }
490 if (customStaff) { // guarantee ascending order of staves.
491 std::sort(customStaff.value().begin(), customStaff.value().end(),
492 [](const auto& a, const auto& b) { return a < b; });
493 }
494 if (transposition) {
495 if (!transposition->chromatic && !transposition->keysig) {
496 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has transposition with neither keysig nor chromatic transposition defined.");
497 } else if (transposition->chromatic && transposition->keysig) {
498 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has transposition with both keysig and chromatic transposition defined.");
499 }
500 }
501 if (useNoteFont && !noteFont) {
502 noteFont = std::make_shared<FontInfo>(getDocument()); // do this first to avoid unreachable code warning, since MUSX_INTEGRITY_ERROR might throw
503 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " specifies to use a custom notehead font, but no custom font was provided.");
504 }
505 }
506
507 constexpr static std::string_view XmlNodeName = "staffSpec";
509
510private:
511 template <typename NamePositionType>
512 MusxInstance<NamePositioning> getNamePosition() const;
513
514 template<typename BaselineType>
515 Evpu calcBaselinePositionImpl(SystemCmper systemId, std::optional<Cmper> lyricNumber) const;
516};
517
525class StaffStyle : public Staff
526{
527protected:
529 explicit StaffStyle(const MusxInstance<Staff>& staff)
530 : Staff(*staff) {}
531
534 void createMasks(const MusxInstance<Base>& ptrToSelf)
535 {
536 masks = std::make_shared<Masks>(ptrToSelf);
537 }
538
539public:
541 explicit StaffStyle(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
542 : Staff(document, partId, shareMode, cmper) {}
543
594
595 std::string styleName;
596 bool copyable{};
597 bool addToMenu{};
598 std::shared_ptr<Masks> masks;
600
623 bool containsInstrumentChange() const;
624
633 Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition);
634
635 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
636 {
637 if (!masks) {
638 // Finale allows creation of staff styles with no masks, so this is just a verbose comment
640 + " (" + std::to_string(getCmper()) + ") does not override anything.");
641 createMasks(ptrToThis);
642 }
643 if (useNoteFont && !masks->floatNoteheadFont && !noteFont) {
644 useNoteFont = false; // silence integrity check in Staff.
645 }
646 Staff::integrityCheck(ptrToThis);
647 }
648
649 constexpr static std::string_view XmlNodeName = "staffStyle";
651};
652
663{
664public:
666 explicit StaffStyleAssign(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
667 : EnigmaMusicRange(document, partId, shareMode, cmper, inci) {}
668
670
675
676 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
677 {
679 if (!styleId) {
680 MUSX_INTEGRITY_ERROR(std::string("Staff style assignment has no staff style id:")
681 + " Part " + std::to_string(getSourcePartId())
682 + " Staff " + std::to_string(getCmper())
683 );
684 }
685 }
686
687 constexpr static std::string_view XmlNodeName = "staffStyleAssign";
689};
690
699{
700private:
702 explicit StaffComposite(const MusxInstance<Staff>& staff, MeasCmper measId, Edu eduPosition)
703 : StaffStyle(staff), m_measureId(measId), m_eduPosition(eduPosition) {}
704
707 void applyStyle(const MusxInstance<StaffStyle>& staffStyle);
708
709 const MeasCmper m_measureId;
710 const Edu m_eduPosition;
711 bool m_instUuidChanged{};
712
713public:
725 static MusxInstance<StaffComposite> createCurrent(const DocumentPtr& document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition);
726
728 MeasCmper getMeasureId() const { return m_measureId; }
729
731 Edu getEduPosition() const { return m_eduPosition; }
732
734 bool getInstrumentUuidChanged() const { return m_instUuidChanged; }
735
738 ClefIndex calcClefIndex(bool forWrittenPitch = false) const
739 { return this->calcClefIndexAt(m_measureId, m_eduPosition, forWrittenPitch); }
740
743};
744
745} // namespace others
746} // namespace dom
747} // namespace musx
DocumentPtr getDocument() const
Gets a reference to the Document.
Definition BaseClasses.h:108
Cmper getSourcePartId() const
Gets the source partId for this instance. If an instance is fully shared with the score,...
Definition BaseClasses.h:124
virtual void integrityCheck(const std::shared_ptr< Base > &ptrToThis)
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition BaseClasses.h:154
ShareMode
Describes how this instance is shared between part and score.
Definition BaseClasses.h:91
Base class for classes that are contained by other classes.
Definition BaseClasses.h:224
ContainedClassBase(const MusxInstance< Base > &parent)
Constructs a ContainedClassBase object.
Definition BaseClasses.h:233
Wraps a frame of shared_ptr<const EntryInfo> and an index for per entry access. This class manages ow...
Definition Entries.h:492
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:103
Base class for all "others" types.
Definition BaseClasses.h:283
Cmper getCmper() const
Gets the cmper key value.
Definition BaseClasses.h:328
The representation of a range of music used by Enigma files.
Definition CommonClasses.h:643
Represents a composite of an underlying Staff instance with any applicable StaffStyle instances appli...
Definition Staff.h:699
static MusxInstance< StaffComposite > createCurrent(const DocumentPtr &document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition)
Calculates the current staff at the specified metric position by applying all relevant staff styles,...
Definition Staff.cpp:1065
bool getInstrumentUuidChanged() const
Returns if this composite staff includes an instrument uuid changed by a staff style.
Definition Staff.h:734
ClefIndex calcClefIndex(bool forWrittenPitch=false) const
Returns the clef in this staff at the location of the composite staff.
Definition Staff.h:738
Edu getEduPosition() const
Returns the Edu position this staff composite was created with.
Definition Staff.h:731
MusxInstance< others::Staff > getRawStaff() const
Returns the underlying staff without any staff styles applied.
Definition Staff.cpp:1056
MeasCmper getMeasureId() const
Returns the measure this staff composite was created with.
Definition Staff.h:728
Represents an assignment.
Definition Staff.h:663
Cmper styleId
The cmper of the assigned StaffStyle.
Definition Staff.h:669
void integrityCheck(const std::shared_ptr< Base > &ptrToThis) override
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition Staff.h:676
StaffStyleAssign(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
Constructor function.
Definition Staff.h:666
static const xml::XmlElementArray< StaffStyleAssign > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:687
MusxInstance< StaffStyle > getStaffStyle() const
Returns the StaffStyle instance for this assignment.
Definition Staff.cpp:1121
lists the masks that deterimine if this staff style overrides the staff settings
Definition Staff.h:546
bool rbarBreak
overrides Staff::rbarBreak
Definition Staff.h:560
bool blineBreak
overrides Staff::blineBreak
Definition Staff.h:559
bool hideRptBars
overrides Staff::hideRptBars
Definition Staff.h:569
bool showTies
overrides Staff::hideTies
Definition Staff.h:578
bool negTimeParts
overrides Staff::hideTimeSigsInParts
Definition Staff.h:589
bool hideStaffLines
overrides Staff::hideStaffLines
Definition Staff.h:587
bool fullName
overrides Staff::fullNameTextId
Definition Staff.h:565
bool floatNoteheadFont
overrides notehead font settings
Definition Staff.h:550
bool negKey
overrides Staff::hideKeySigs
Definition Staff.h:570
bool negClef
overrides Staff::hideClefs
Definition Staff.h:572
bool negRepeat
overrides Staff::hideRepeats
Definition Staff.h:562
bool flatBeams
overrides Staff::flatBeams
Definition Staff.h:552
bool showNameParts
overrides Staff::showNameInParts
Definition Staff.h:585
bool hideChords
overrides Staff::hideChords
Definition Staff.h:582
bool hideBarlines
overrides Staff::hideBarlines
Definition Staff.h:564
bool noOptimize
overrides Staff::noOptimize
Definition Staff.h:554
bool blankMeasureRest
overrides Staff::blankMeasure
Definition Staff.h:553
bool staffType
overrides staff properties (see StaffComposite::applyStyle)
Definition Staff.h:557
bool negMnumb
overrides Staff::hideMeasNums
Definition Staff.h:561
bool hideKeySigsShowAccis
overrides Staff::hideKeySigsShowAccis
Definition Staff.h:590
bool redisplayLayerAccis
overrides Staff::redisplayLayerAccis
Definition Staff.h:588
bool negNameScore
overrides Staff::hideNameInScore
Definition Staff.h:563
static const xml::XmlElementArray< Masks > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool hideFretboards
overrides Staff::hideFretboards
Definition Staff.h:583
bool hideLyrics
overrides Staff::hideLyrics
Definition Staff.h:584
bool fullNamePos
overrides presence, absence of NamePositionStyleFull instance.
Definition Staff.h:575
bool transposition
overrides transposition fields
Definition Staff.h:558
bool abrvName
overrides Staff::abbrvNameTextId
Definition Staff.h:566
bool negTime
overrides Staff::hideTimeSigs (in Score)
Definition Staff.h:571
bool altNotation
overrides alternate notation properties (see StaffComposite::applyStyle)
Definition Staff.h:577
bool showNoteColors
overrides Staff::showNoteColors
Definition Staff.h:586
bool showStems
overrides stem properties (see StaffComposite::applyStyle)
Definition Staff.h:581
bool abrvNamePos
overrides presence, absence of NamePositionStyleAbbreviated instance.
Definition Staff.h:576
bool floatKeys
overrides Staff::floatKeys
Definition Staff.h:567
bool notationStyle
overrides notations style
Definition Staff.h:555
bool showRests
overrides Staff::hideRests
Definition Staff.h:580
bool useNoteShapes
overrides Staff::useNoteShapes
Definition Staff.h:551
bool floatTime
overrides Staff::floatTime
Definition Staff.h:568
bool hideStaff
overrides Staff::hideMode
Definition Staff.h:573
bool defaultClef
overrides Staff::defaultClef
Definition Staff.h:556
bool noKey
overrides Staff::noKey
Definition Staff.h:574
bool showDots
overrides Staff::hideDots
Definition Staff.h:579
Represents a Finale staff style.
Definition Staff.h:526
void integrityCheck(const std::shared_ptr< Base > &ptrToThis) override
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition Staff.h:635
std::shared_ptr< Masks > masks
Definition Staff.h:598
static const xml::XmlElementArray< StaffStyle > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
StaffStyle(const MusxInstance< Staff > &staff)
protected constructor for StaffComposite. This constructor must be followed by a call to createMasks.
Definition Staff.h:529
StaffStyle(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Staff.h:541
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:649
bool containsInstrumentChange() const
Determines whether this staff style represents or includes an instrument change.
Definition Staff.cpp:1089
static MusxInstanceList< StaffStyle > findAllOverlappingStyles(const DocumentPtr &document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition)
Finds a subset from all StaffStyle instances that overlap with the specified metric position on a giv...
Definition Staff.cpp:1097
bool copyable
whether the staff style assignments for this style should be copied when copy/pasting music
Definition Staff.h:596
std::string styleName
name of staff style
Definition Staff.h:595
void createMasks(const MusxInstance< Base > &ptrToSelf)
Separate creator for masks.
Definition Staff.h:534
bool addToMenu
add this staff style to the context menu for staff styles
Definition Staff.h:597
Represents chromatic transposition details.
Definition Staff.h:134
static const xml::XmlElementArray< ChromaticTransposition > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
int diatonic
The diatonic interval. See music_theory::Transposer for more information.
Definition Staff.h:137
int alteration
The alteration that defines the chromatic interval (in chromatic half-steps). See music_theory::Trans...
Definition Staff.h:136
Represents key signature transposition details.
Definition Staff.h:121
int adjust
The adjustment to the number of sharps or flats in the key signature.
Definition Staff.h:124
static const xml::XmlElementArray< KeySigTransposition > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
int interval
The diatonic transposition interval.
Definition Staff.h:123
Encapsulates transposition options for a staff.
Definition Staff.h:150
std::shared_ptr< ChromaticTransposition > chromatic
Shared pointer to the chromatic transposition details, if any.
Definition Staff.h:161
std::shared_ptr< KeySigTransposition > keysig
Shared pointer to the key signature transposition details, if any.
Definition Staff.h:158
void integrityCheck(const std::shared_ptr< Base > &ptrToThis) override
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition Staff.h:166
bool noSimplifyKey
Inverse of "Simplify Key" (xml node is <noKeyOpt>)
Definition Staff.h:155
static const xml::XmlElementArray< Transposition > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool isSame(const Transposition &other) const
Returns true if the input has the same contents as this.
Definition Staff.cpp:778
bool setToClef
If true, forces the clef in Staff::transposedClef.
Definition Staff.h:154
Represents the definition of a Finale staff.
Definition Staff.h:52
bool altHideOtherLyrics
Hide lyrics in other layers in alternate notation.
Definition Staff.h:223
bool hideDots
Inverse of "Display Augmentation Dots".
Definition Staff.h:250
AutoNumberingStyle
Enum for auto-numbering style. Auto-numbering is based on instUuid.
Definition Staff.h:59
@ ArabicSuffix
Arabic numeral suffix (default). May not appear in xml.
@ ArabicPrefix
Arabic numeral prefix (with dot): 1. 2. 3. ...
@ OrdinalPrefix
Ordinal number prefix: 1st 2nd 3rd, ...
bool noteShapesFromStyle
True if noteShapesId is for a staff style. (Determines which note shapes class to retrieve....
Definition Staff.h:287
Evpu dwRestOffset
Offset for downstem rests.
Definition Staff.h:244
bool hideRepeats
Inverse of "Display Endings and Text Repeats".
Definition Staff.h:235
ClefIndex defaultClef
Index of default clef for the staff.
Definition Staff.h:195
AlternateNotation
Enum for alternate notation styles.
Definition Staff.h:106
@ BlankWithRests
Blank Notation with Rests.
@ SlashBeats
Slash Notation (on beats)
util::EnigmaParsingContext getAbbreviatedInstrumentNameCtx(Cmper forPartId, bool preferStaffName=false) const
Returns the parsing context for the abbreviated name.
Definition Staff.cpp:358
void integrityCheck(const std::shared_ptr< Base > &ptrToThis) override
Allows a class to determine if it has been properly contructed by the factory and fix issues that it ...
Definition Staff.h:482
bool hideClefs
Inverse of "Display Clefs".
Definition Staff.h:240
MusxInstanceList< PartDefinition > getContainingParts(bool includeScore=true) const
Gets a list of all parts that contain this staff.
Definition Staff.cpp:687
bool altRhythmStemsUp
Show stems up in alternate Rhythmic Notation mode.
Definition Staff.h:218
Efix horzStemOffDown
Horizontal Stem Offsets: Down Stem.
Definition Staff.h:271
std::pair< std::string, bool > calcAutoNumberingAffix() const
Calculate the auto numbering prefix or suffix, if needed.
Definition Staff.cpp:243
std::vector< LyricsLineInfo > createLyricsLineInfo(SystemCmper systemId) const
Creates a vector of LyricsLineInfo for the current requested part.
Definition Staff.cpp:598
bool hideRepeatTopDot
Inverse of "Top Repeat Dot" in Staff Setup dialog.
Definition Staff.h:230
Evpu hRestOffset
Offset for half rests.
Definition Staff.h:246
std::optional< int > staffLines
Number of lines in the staff (if no custom staff)
Definition Staff.h:197
Efix vertStemStartOffUp
Vertical Stem Offsets For Notehead End: Up Stem.
Definition Staff.h:272
bool hideKeySigs
Inverse of "Display Key Signatures".
Definition Staff.h:238
Cmper multiStaffInstId
Definition Staff.h:296
NotationStyle
Enum for notation style.
Definition Staff.h:83
bool hideStaffLines
Inverse of "Display Staff Lines".
Definition Staff.h:241
bool hideTimeSigs
Inverse of "Display Time Signatures in Score".
Definition Staff.h:239
bool noOptimize
Inverse of "Allow Hiding When Empty".
Definition Staff.h:232
std::optional< std::vector< int > > customStaff
A list of stafflines from 0..26 where a standard 5-line staff is values 11, 12, 13,...
Definition Staff.h:198
Efix vertTabNumOff
Vertical offset for tab number. (Tablature Staff Attributes)
Definition Staff.h:256
int calcNumberOfStafflines() const
Calculates the number of staff lines on this staff.
Definition Staff.cpp:485
bool noKey
"Ignore Key Signatures"
Definition Staff.h:243
static void calcAllRuntimeValues(const DocumentPtr &document)
Populate runtime values for all staves or staffstyles, such as percussion map Id if any.
Definition Staff.cpp:118
std::shared_ptr< FontInfo > noteFont
The custom font to use for noteheads. Guaranteed non-null by integrityCheck if useNoteFont is true.
Definition Staff.h:192
static void calcAllAutoNumberValues(const DocumentPtr &document)
Get the auto-numbering value for this staff, if applicable.
Definition Staff.cpp:37
std::pair< int, int > calcTranspositionInterval() const
Calculates the transposition interval for this staff or staff composite.
Definition Staff.cpp:674
bool hideRepeatBottomDot
Inverse of "Bottom Repeat Dot" in Staff Setup dialog.
Definition Staff.h:226
bool altSlashDots
Show dots on beat slashes in compound meter.
Definition Staff.h:219
int capoPos
"Capo Position" (Tablature Staff Attributes)
Definition Staff.h:201
bool fullNamePosFromStyle
Definition Staff.h:290
bool hasStyles
Indicates that this staff has staff style assignments.
Definition Staff.h:207
Cmper abrvNamePosId
Definition Staff.h:292
Evpu calcBaselinePosition(SystemCmper systemId, Cmper lyricNumber) const
Returns the baseline position for the staff at the given system. The staff should be the staff at the...
Definition Staff.h:435
Efix vertStemEndOffUp
Vertical Stem Offsets For Stem End: Up Stem.
Definition Staff.h:274
int calcTopLinePosition() const
Calculates the position of the top staff line, relative to the reference line.
Definition Staff.cpp:510
bool altHideArtics
Hide Articulations in alternate notation (in Apply-To Layer)
Definition Staff.h:215
MusxInstance< MultiStaffInstrumentGroup > getMultiStaffInstGroup() const
Returns the MultiStaffInstrumentGroup for this staff if it is part of one in the data....
Definition Staff.cpp:295
std::string addAutoNumbering(const std::string &plainName) const
Add auto numbering as a prefix or suffix, if needed.
Definition Staff.cpp:265
StemDirection stemDirection
stem direction for staff (xml node is <stemDir>)
Definition Staff.h:263
bool hideStems
Inverse of "Display Stems".
Definition Staff.h:262
Evpu otherRestOffset
Offset for other rests.
Definition Staff.h:247
std::string getFullInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName=false) const
Returns the full instrument name for this staff without Enigma tags and with autonumbering (if any)
Definition Staff.cpp:350
std::optional< int > autoNumberValue
Calculated autonumbering value. It is computed by calcAllAutoNumberValues.
Definition Staff.h:298
Efix horzStemOffUp
Horizontal Stem Offsets: Up Stem.
Definition Staff.h:270
bool abrvNamePosFromStyle
Definition Staff.h:294
bool iterateEntries(std::function< bool(const EntryInfoPtr &)> iterator) const
Iterate all entries in the document by staff and then measure. This function wraps MusxInstanceList<S...
Definition Staff.cpp:728
Efix vertStemStartOffDown
Vertical Stem Offsets For Notehead End: Down Stem.
Definition Staff.h:273
Evpu lineSpace
Distance between staff lines.
Definition Staff.h:199
Evpu wRestOffset
Offset for whole rests.
Definition Staff.h:245
bool stemStartFromStaff
Definition Staff.h:265
bool calcShowInstrumentName() const
Returns true if the staff shows its full or abbreviated instrument name for the current requested par...
Definition Staff.cpp:386
bool altHideSmartShapes
Hide Smart Shapes (in Apply-To layer: probably only affects entry-attached shapes)
Definition Staff.h:217
AlternateNotation altNotation
Alternate notation on the staff.
Definition Staff.h:213
bool stemsFixedEnd
"Use Vertical Offset For Beam End Of Stems (Offset From Staff)"
Definition Staff.h:268
MusxInstance< details::ShapeNoteBase > getNoteShapes() const
Returns the note shape record in effect for this staff instance.
Definition Staff.cpp:394
HideMode hideMode
"Force Hide Staff" option
Definition Staff.h:276
bool hideTuplets
Inverse of "Show Tuplets" (Tablature Staff Attributes)
Definition Staff.h:260
Staff(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Staff.h:184
bool hideBarlines
Inverse of "Display Barlines".
Definition Staff.h:236
int lowestFret
"Default Lowest Fret" (Tablature Staff Attributes)
Definition Staff.h:202
bool useNoteShapes
Indicates that note shapes should be used. It is ignored is no staff- or staffstyle-specific note sha...
Definition Staff.h:193
bool hasInstrumentAssigned() const
Return true if this staff has an instrument assigned.
Definition Staff.cpp:666
LayerIndex altLayer
Alternate notation Apply To Layer index (0..3)
Definition Staff.h:214
bool floatKeys
"Independent Key Signature"
Definition Staff.h:203
Cmper fullNameTextId
Full name TextBlock ID. (xml node is <fullName>)
Definition Staff.h:252
NotationStyle notationStyle
Standard, percussion, or tablature.
Definition Staff.h:191
StemDirection
Enum for staff-level stem direction override.
Definition Staff.h:72
@ AlwaysDown
stems are always down on this staff
@ Default
the default (may not occur in xml)
@ AlwaysUp
stems are always up on this staff
bool useAutoNumbering
Whether names should be auto-numbered. (xml node is <useAutoNum>)
Definition Staff.h:280
bool hideTies
Inverse of "Display Ties".
Definition Staff.h:249
util::EnigmaParsingContext getFullInstrumentNameCtx(Cmper forPartId, bool preferStaffName=false) const
Returns the parsing context for the full name.
Definition Staff.cpp:330
bool showNameInParts
"Display Staff Name in Parts" (xml node is <showNameParts>)
Definition Staff.h:208
ClefIndex transposedClef
Index of transposed clef for the staff. Only used if Transposition::setToClef is true.
Definition Staff.h:196
bool floatTime
"Independent Time Signature"
Definition Staff.h:204
bool altHideOtherSmartShapes
Hide Smart Shapes in other layers in alternate notation.
Definition Staff.h:224
std::optional< Cmper > percussionMapId
Calculated percussion map Id for a percussion staff. (Populated by in calcAllRuntimeValues....
Definition Staff.h:299
int calcMiddleStaffPosition() const
Calculates the middle staff position. For staves with even numbers of lines, it is the middle space.
Definition Staff.cpp:495
Evpu botBarlineOffset
Offset for the bottom barline.
Definition Staff.h:212
Evpu calcBaselinePosition(SystemCmper systemId) const
Returns the baseline position for the staff at the given system. The staff should be the staff at the...
Definition Staff.h:422
bool calcAlternateNotationHidesEntries(LayerIndex forLayerIndex) const
Returns true if the given layer is hidden by alternate notation.
Definition Staff.cpp:722
bool hideLyrics
Inverse of "Display Lyrics".
Definition Staff.h:231
Efix vertStemEndOffDown
Vertical Stem Offsets For Stem End: Down Stem.
Definition Staff.h:275
std::string getFullName(util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii) const
Returns the full staff name without Enigma tags. If the full name contains part-specific tags (rare),...
Definition Staff.cpp:277
Cmper abbrvNameTextId
Abbreviated name TextBlock ID. (xml node is <abbrvName>)
Definition Staff.h:253
std::string getAbbreviatedName(util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii) const
Returns the abbreviated staff name without Enigma tags. If the abbreviated name contains part-specifi...
Definition Staff.cpp:282
bool hideFretboards
Inverse of "Display Fretboards".
Definition Staff.h:228
bool calcIsSameNotationStyle(const Staff &other) const
Returns true if both instances have the same notation style settings. This is helpful for determining...
Definition Staff.cpp:739
bool rbarBreak
"Break Repeat Barlines Between Staves"
Definition Staff.h:206
bool calcShowName() const
Returns true if the staff shows its full or abbreviated name for the current requested partId.
Definition Staff.cpp:287
Evpu topRepeatDotOff
Offset for top repeat dots.
Definition Staff.h:255
HideMode
Enum for hide mode.
Definition Staff.h:94
@ Score
Collapse in score only.
@ ScoreParts
Collapse in score and parts.
bool showNoteColors
"Color Noteheads" (Score Manager)
Definition Staff.h:209
bool redisplayLayerAccis
"Redisplay Accidentals in Other Layers Within Measures"
Definition Staff.h:277
bool altHideExpressions
Hide Expressions in alternate notation (in Apply-To Layer)
Definition Staff.h:222
bool useNoteFont
Indicates if noteFont should be used.
Definition Staff.h:194
Evpu topBarlineOffset
Offset for the top barline.
Definition Staff.h:233
Cmper fretInstId
Cmper of FretInstrument for TAB strings. (Tablature Staff Attributes)
Definition Staff.h:261
bool hideBeams
Inverse of "Show Beams".
Definition Staff.h:264
bool hideTimeSigsInParts
Inverse of "Display Time Signatures in Parts".
Definition Staff.h:278
MusxInstance< NamePositioning > getFullNamePosition() const
Returns the full name positioning in effect for this staff instance.
Definition Staff.cpp:445
bool hideChords
Inverse of "Display Chords".
Definition Staff.h:242
int calcBottomLinePosition() const
Calculates the position of the top staff line, relative to the reference line.
Definition Staff.cpp:524
Cmper fullNamePosId
Definition Staff.h:288
bool showNamesForPart(Cmper partId) const
Returns if names should be shown for the specified part.
Definition Staff.h:354
bool hideRests
Inverse of "Display Rests".
Definition Staff.h:248
bool breakTabLinesAtNotes
"Break Tablature Lines At Numbers" (Tablature Staff Attributes)
Definition Staff.h:259
int stemReversal
Stem reversal value.
Definition Staff.h:251
bool blankMeasure
Inverse of "Display Rests in Empty Measures".
Definition Staff.h:229
Evpu botRepeatDotOff
Offset for bottom repeat dots.
Definition Staff.h:254
bool altHideOtherArtics
Hide articulations in other layers in alternate notation.
Definition Staff.h:221
bool altHideOtherNotes
Hide notes in other layers in alternate notation.
Definition Staff.h:220
bool blineBreak
"Break Barlines Between Staves"
Definition Staff.h:205
MusxInstance< NamePositioning > getAbbreviatedNamePosition() const
Returns the abbreviated name positioning in effect for this staff instance.
Definition Staff.cpp:453
static const xml::XmlElementArray< Staff > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
MusxInstance< PartDefinition > firstContainingPart() const
Finds the first part that contains this staff, not including the score.
Definition Staff.cpp:706
ClefIndex calcClefIndexAt(MeasCmper measureId, Edu position, bool forWrittenPitch=false) const
Returns the clef in this staff at the specified location.
Definition Staff.cpp:461
MusxInstance< details::StaffGroup > getMultiStaffInstVisualGroup(Cmper forPartId) const
Returns the details::StaffGroup for this staff if it is part of a multistaff instrument (as defined i...
Definition Staff.cpp:306
ClefIndex calcFirstClefIndex(bool forWrittenPitch=false) const
Returns the first clef in this staff.
Definition Staff.h:394
bool useTabLetters
"Use Letters" (Tablature Staff Attributes)
Definition Staff.h:258
bool hideRptBars
Inverse of "Display Repeat Bars".
Definition Staff.h:237
std::shared_ptr< Transposition > transposition
Transposition details, if non-null.
Definition Staff.h:210
bool hideKeySigsShowAccis
"Hide Key Signature and Show Accidentals" transposition option.
Definition Staff.h:281
AutoNumberingStyle autoNumbering
Autonumbering style if useAutoNumbering is true. (xml node is <autoNum>)
Definition Staff.h:279
Cmper noteShapesId
Definition Staff.h:285
bool hideNameInScore
Inverse of "Display Staff Name in Score" (xml node is <hideStfNameInScore>)
Definition Staff.h:211
std::string instUuid
Unique identifier for the type of instrument.
Definition Staff.h:200
bool altHideOtherExpressions
Hide Expressions in other layers in alternate notation.
Definition Staff.h:225
bool stemsFixedStart
"Use Vertical Offset For Notehead End Of Stems"
Definition Staff.h:269
bool hideMeasNums
Inverse of "Display Measure Numbers".
Definition Staff.h:234
std::string getAbbreviatedInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle=util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName=false) const
Returns the abbreviated instrument name for this staff without Enigma tags and with autonumbering (if...
Definition Staff.cpp:378
bool flatBeams
"Flat Beams"
Definition Staff.h:227
bool altHideLyrics
Hide Lyrics in alternate notation (in Apply-To Layer)
Definition Staff.h:216
bool showTabClefAllSys
Inverse of "Show Clef Only On First Measure" (Tablature Staff Attributes)
Definition Staff.h:257
Evpu calcBaselineZeroPosition() const
Calculates the baseline zero position for this staff, relative to the reference line,...
Definition Staff.cpp:538
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:507
Wrapper class for interpreting and rendering Enigma-style strings with insert handling.
Definition EnigmaString.h:423
AccidentalStyle
Enumeration to specify the type of accidental substitution representation.
Definition EnigmaString.h:199
@ Ascii
Use ASCII substitutions for accidentals.
@ Verbose
Informational messages that should only displayed when verbose logging is requested.
static void log(LogLevel level, const std::string &message)
Logs a message with a specific severity level.
Definition Logger.h:87
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
int32_t Efix
EFIX value (64 per EVPU, 64*288=18432 per inch)
Definition Fundamentals.h:60
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:39
unsigned int LayerIndex
Layer index (valid values are 0..3)
Definition Fundamentals.h:71
constexpr Cmper SCORE_PARTID
The part id of the score.
Definition Fundamentals.h:79
int16_t Inci
Enigma "incident" key type.
Definition Fundamentals.h:56
int32_t Evpu
EVPU value (288 per inch)
Definition Fundamentals.h:57
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
@ Percussion
Percussion clef, open rectangle (no pitch).
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:68
int32_t Edu
"Enigma Durational Units" value (1024 per quarter note)
Definition Fundamentals.h:61
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition BaseClasses.h:57
std::shared_ptr< Document > DocumentPtr
Shared Document pointer.
Definition BaseClasses.h:55
int16_t StaffCmper
Enigma staff (staffId) Cmper (may be negative when not applicable)
Definition Fundamentals.h:65
int16_t SystemCmper
Enigma systems Cmper (may be negative when not applicable)
Definition Fundamentals.h:66
std::vector< XmlElementDescriptor< T > > XmlElementArray
an array type for XmlElementDescriptor instances.
Definition XmlInterface.h:127
object model for musx file (enigmaxml)
Definition BaseClasses.h:36