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 "musx/util/Logger.h"
25#include "musx/util/Fraction.h"
26
27#include "BaseClasses.h"
28#include "CommonClasses.h"
29 // do not add other dom class dependencies. Use Implementations.cpp for implementations that need total class access.
30
31namespace musx {
32namespace dom {
33namespace others {
34
35class StaffStyle;
42class Staff : public OthersBase
43{
44public:
57
62 enum class StemDirection
63 {
64 Default,
65 AlwaysUp,
67 };
68
73 enum class NotationStyle
74 {
75 Standard,
77 Tablature
78 };
79
84 enum class HideMode
85 {
86 None,
87 Cutaway,
89 Score
90 };
91
97 {
98 Normal,
100 Rhythmic,
101 Blank,
105 };
106
112 {
113 public:
114 int interval{};
115 int adjust{};
116
118 };
119
132
141 {
142 public:
143 bool setToClef{};
145
147 std::shared_ptr<KeySigTransposition> keysig;
148
150 std::shared_ptr<ChromaticTransposition> chromatic;
151
153 };
154
156 explicit Staff(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
157 : OthersBase(document, partId, shareMode, cmper) {}
158
159 // WARNING: Any fields added here must have a mask added in StaffStyle (if it does not already exist)
160 // and must be added to StaffComposite::applyStyle.
161
162 // Public properties corresponding to the XML structure
164 std::shared_ptr<FontInfo> noteFont;
165 bool useNoteFont{};
168 std::optional<int> staffLines{};
169 std::optional<std::vector<int>> customStaff;
171 std::string instUuid;
172 int capoPos{};
174 bool floatKeys{};
175 bool floatTime{};
176 bool blineBreak{};
177 bool rbarBreak{};
178 bool hasStyles{};
181 std::shared_ptr<Transposition> transposition;
198 bool flatBeams{};
202 bool hideLyrics{};
203 bool noOptimize{};
206 bool hideRepeats{};
208 bool hideRptBars{};
209 bool hideKeySigs{};
211 bool hideClefs{};
213 bool hideChords{};
214 bool noKey{};
219 bool hideRests{};
220 bool hideTies{};
221 bool hideDots{};
231 bool hideTuplets{};
233 bool hideStems{};
235 bool hideBeams{};
253
254 // The following values are not in xml but computed by the factory.
255
266 std::optional<int> autoNumberValue;
267 std::optional<Cmper> percussionMapId;
268
272
276
279
282
286 util::EnigmaParsingContext getFullInstrumentNameCtx(Cmper forPartId, bool preferStaffName = false) const;
287
291 util::EnigmaParsingContext getAbbreviatedInstrumentNameCtx(Cmper forPartId, bool preferStaffName = false) const;
292
297 std::string getFullInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle = util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName = false) const;
298
303 std::string getAbbreviatedInstrumentName(util::EnigmaString::AccidentalStyle accidentalStyle = util::EnigmaString::AccidentalStyle::Ascii, bool preferStaffName = false) const;
304
307
310
312 bool showNamesForPart(Cmper partId) const
313 { return partId == SCORE_PARTID ? !hideNameInScore : showNameInParts; }
314
324 static void calcAllAutoNumberValues(const DocumentPtr& document);
325
331 template <typename SubType>
332 static void calcAllRuntimeValues(const DocumentPtr& document);
333
338 std::pair<std::string, bool> calcAutoNumberingAffix() const;
339
343 std::string addAutoNumbering(const std::string& plainName) const;
344
349 ClefIndex calcClefIndexAt(MeasCmper measureId, Edu position, bool forWrittenPitch = false) const;
350
352 ClefIndex calcFirstClefIndex(bool forWrittenPitch = false) const
353 { return calcClefIndexAt(1, 0, forWrittenPitch); }
354
359 static ClefIndex calcFirstClefIndex(const DocumentPtr& document, Cmper partId, StaffCmper staffCmper);
360
362 int calcNumberOfStafflines() const;
363
365 int calcMiddleStaffPosition() const;
366
368 int calcToplinePosition() const;
369
371 bool hasInstrumentAssigned() const;
372
378 std::pair<int, int> calcTranspositionInterval() const;
379
382 MusxInstanceList<PartDefinition> getContainingParts(bool includeScore = true) const;
383
387
388 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
389 {
391 if (!staffLines && !customStaff) {
392 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has neither a standard nor a custom staff definition.");
393 } else if (staffLines && customStaff) {
394 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has both a standard and a custom staff definition.");
395 }
396 if (customStaff) { // guarantee ascending order of staves.
397 std::sort(customStaff.value().begin(), customStaff.value().end(),
398 [](const auto& a, const auto& b) { return a < b; });
399 }
400 if (transposition) {
401 if (!transposition->chromatic && !transposition->keysig) {
402 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has transposition with neither keysig nor chromatic transposition defined.");
403 } else if (transposition->chromatic && transposition->keysig) {
404 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " has transposition with both keysig and chromatic transposition defined.");
405 }
406 }
407 if (useNoteFont && !noteFont) {
408 noteFont = std::make_shared<FontInfo>(getDocument()); // do this first to avoid unreachable code warning, since MUSX_INTEGRITY_ERROR might throw
409 MUSX_INTEGRITY_ERROR("Staff or StaffStyle " + std::to_string(getCmper()) + " specifies to use a custom notehead font, but no custom font was provided.");
410 }
411 }
412
413 bool requireAllFields() const override { return false; }
414
415 constexpr static std::string_view XmlNodeName = "staffSpec";
417
418private:
419 template <typename NamePositionType>
420 MusxInstance<NamePositioning> getNamePosition() const;
421};
422
430class StaffStyle : public Staff
431{
432protected:
434 explicit StaffStyle(const MusxInstance<Staff>& staff)
435 : Staff(*staff) {}
436
439 void createMasks(const MusxInstance<Base>& ptrToSelf)
440 {
441 masks = std::make_shared<Masks>(ptrToSelf);
442 }
443
444public:
446 explicit StaffStyle(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
447 : Staff(document, partId, shareMode, cmper) {}
448
451 {
452 public:
454
456 bool flatBeams{};
458 bool noOptimize{};
460 bool defaultClef{};
461 bool staffType{};
463 bool blineBreak{};
464 bool rbarBreak{};
465 bool negMnumb{};
466 bool negRepeat{};
469 bool fullName{};
470 bool abrvName{};
471 bool floatKeys{};
472 bool floatTime{};
473 bool hideRptBars{};
474 bool negKey{};
475 bool negTime{};
476 bool negClef{};
477 bool hideStaff{};
478 bool noKey{};
479 bool fullNamePos{};
480 bool abrvNamePos{};
481 bool altNotation{};
482 bool showTies{};
483 bool showDots{};
484 bool showRests{};
485 bool showStems{};
486 bool hideChords{};
488 bool hideLyrics{};
495
496 bool requireAllFields() const override { return false; }
497
499 };
500
501 std::string styleName;
503 std::shared_ptr<Masks> masks;
505
514 Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition);
515
516 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
517 {
518 if (!masks) {
519 // Finale allows creation of staff styles with no masks, so this is just a verbose comment
521 + " (" + std::to_string(getCmper()) + ") does not override anything.");
522 createMasks(ptrToThis);
523 }
524 if (useNoteFont && !masks->floatNoteheadFont && !noteFont) {
525 useNoteFont = false; // silence integrity check in Staff.
526 }
527 Staff::integrityCheck(ptrToThis);
528 }
529
530 constexpr static std::string_view XmlNodeName = "staffStyle";
532};
533
541{
542public:
544 explicit StaffStyleAssign(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
545 : MusicRange(document, partId, shareMode, cmper, inci) {}
546
548
553
554 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
555 {
557 if (!styleId) {
558 MUSX_INTEGRITY_ERROR(std::string("Staff style assignment has no staff style id:")
559 + " Part " + std::to_string(getSourcePartId())
560 + " Staff " + std::to_string(getCmper())
561 );
562 }
563 }
564
565 constexpr static std::string_view XmlNodeName = "staffStyleAssign";
567};
568
577{
578private:
580 explicit StaffComposite(const MusxInstance<Staff>& staff, MeasCmper measId, Edu eduPosition)
581 : StaffStyle(staff), m_measureId(measId), m_eduPosition(eduPosition) {}
582
585 void applyStyle(const MusxInstance<StaffStyle>& staffStyle);
586
587 const MeasCmper m_measureId;
588 const Edu m_eduPosition;
589
590public:
602 static MusxInstance<StaffComposite> createCurrent(const DocumentPtr& document, Cmper partId, StaffCmper staffId, MeasCmper measId, Edu eduPosition);
603
605 MeasCmper getMeasureId() const { return m_measureId; }
606
608 Edu eduPosition() const { return m_eduPosition; }
609
612};
613
614} // namespace others
615} // namespace dom
616} // 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
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:96
Base class for all "others" types.
Definition BaseClasses.h:283
Cmper getCmper() const
Gets the cmper key value.
Definition BaseClasses.h:328
Represents a range of music using measure and EDUs.
Definition CommonClasses.h:582
Represents a composite of an underlying Staff instance with any applicable StaffStyle instances appli...
Definition Staff.h:577
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:755
MusxInstance< others::Staff > getRawStaff() const
Returns the underlying staff without any staff styles applied.
Definition Staff.cpp:746
MeasCmper getMeasureId() const
Returns the measure this staff composite was created with.
Definition Staff.h:605
Edu eduPosition() const
Returns the Edu position this staff composite was created with.
Definition Staff.h:608
Represents an assignment.
Definition Staff.h:541
Cmper styleId
The cmper of the assigned StaffStyle.
Definition Staff.h:547
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:554
StaffStyleAssign(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
Constructor function.
Definition Staff.h:544
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:565
MusxInstance< StaffStyle > getStaffStyle() const
Returns the StaffStyle instance for this assignment.
Definition Staff.cpp:803
lists the masks that deterimine if this staff style overrides the staff settings
Definition Staff.h:451
bool rbarBreak
overrides Staff::rbarBreak
Definition Staff.h:464
bool requireAllFields() const override
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class...
Definition Staff.h:496
bool blineBreak
overrides Staff::blineBreak
Definition Staff.h:463
bool hideRptBars
overrides Staff::hideRptBars
Definition Staff.h:473
bool showTies
overrides Staff::hideTies
Definition Staff.h:482
bool negTimeParts
overrides Staff::hideTimeSigsInParts
Definition Staff.h:493
bool hideStaffLines
overrides Staff::hideStaffLines
Definition Staff.h:491
bool fullName
overrides Staff::fullNameTextId
Definition Staff.h:469
bool floatNoteheadFont
overrides notehead font settings
Definition Staff.h:455
bool negKey
overrides Staff::hideKeySigs
Definition Staff.h:474
bool negClef
overrides Staff::hideClefs
Definition Staff.h:476
bool negRepeat
overrides Staff::hideRepeats
Definition Staff.h:466
bool flatBeams
overrides Staff::flatBeams
Definition Staff.h:456
bool showNameParts
overrides Staff::showNameInParts
Definition Staff.h:489
bool hideChords
overrides Staff::hideChords
Definition Staff.h:486
bool hideBarlines
overrides Staff::hideBarlines
Definition Staff.h:468
bool noOptimize
overrides Staff::noOptimize
Definition Staff.h:458
bool blankMeasureRest
overrides Staff::blankMeasure
Definition Staff.h:457
bool staffType
overrides staff properties (see StaffComposite::applyStyle)
Definition Staff.h:461
bool negMnumb
overrides Staff::hideMeasNums
Definition Staff.h:465
bool hideKeySigsShowAccis
overrides Staff::hideKeySigsShowAccis
Definition Staff.h:494
bool redisplayLayerAccis
overrides Staff::redisplayLayerAccis
Definition Staff.h:492
bool negNameScore
overrides Staff::hideNameInScore
Definition Staff.h:467
static const xml::XmlElementArray< Masks > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool hideFretboards
overrides Staff::hideFretboards
Definition Staff.h:487
bool hideLyrics
overrides Staff::hideLyrics
Definition Staff.h:488
bool fullNamePos
overrides presence, absence of NamePositionStyleFull instance.
Definition Staff.h:479
bool transposition
overrides transposition fields
Definition Staff.h:462
bool abrvName
overrides Staff::abbrvNameTextId
Definition Staff.h:470
bool negTime
overrides Staff::hideTimeSigs (in Score)
Definition Staff.h:475
bool altNotation
overrides alternate notation properties (see StaffComposite::applyStyle)
Definition Staff.h:481
bool showNoteColors
overrides Staff::showNoteColors
Definition Staff.h:490
bool showStems
overrides stem properties (see StaffComposite::applyStyle)
Definition Staff.h:485
bool abrvNamePos
overrides presence, absence of NamePositionStyleAbbreviated instance.
Definition Staff.h:480
bool floatKeys
overrides Staff::floatKeys
Definition Staff.h:471
bool notationStyle
overrides notations style
Definition Staff.h:459
bool showRests
overrides Staff::hideRests
Definition Staff.h:484
bool floatTime
overrides Staff::floatTime
Definition Staff.h:472
bool hideStaff
overrides Staff::hideMode
Definition Staff.h:477
bool defaultClef
overrides Staff::defaultClef
Definition Staff.h:460
bool noKey
overrides Staff::noKey
Definition Staff.h:478
bool showDots
overrides Staff::hideDots
Definition Staff.h:483
Represents a Finale staff style.
Definition Staff.h:431
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:516
std::shared_ptr< Masks > masks
Definition Staff.h:503
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:434
StaffStyle(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Staff.h:446
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:530
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:779
std::string styleName
name of staff style
Definition Staff.h:501
void createMasks(const MusxInstance< Base > &ptrToSelf)
Separate creator for masks.
Definition Staff.h:439
bool addToMenu
add this staff style to the context menu for staff styles
Definition Staff.h:502
Represents chromatic transposition details.
Definition Staff.h:125
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:128
int alteration
The alteration that defines the chromatic interval (in chromatic half-steps). See music_theory::Trans...
Definition Staff.h:127
Represents key signature transposition details.
Definition Staff.h:112
int adjust
The adjustment to the number of sharps or flats in the key signature.
Definition Staff.h:115
static const xml::XmlElementArray< KeySigTransposition > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
int interval
The diatonic transposition interval.
Definition Staff.h:114
Encapsulates transposition options for a staff.
Definition Staff.h:141
std::shared_ptr< ChromaticTransposition > chromatic
Shared pointer to the chromatic transposition details, if any.
Definition Staff.h:150
std::shared_ptr< KeySigTransposition > keysig
Shared pointer to the key signature transposition details, if any.
Definition Staff.h:147
bool noSimplifyKey
Inverse of "Simplify Key" (xml node is <noKeyOpt>)
Definition Staff.h:144
static const xml::XmlElementArray< Transposition > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool setToClef
If true, forces the clef in Staff::transposedClef.
Definition Staff.h:143
Represents the definition of a Finale staff.
Definition Staff.h:43
bool altHideOtherLyrics
Hide lyrics in other layers in alternate notation.
Definition Staff.h:194
bool hideDots
Inverse of "Display Augmentation Dots".
Definition Staff.h:221
AutoNumberingStyle
Enum for auto-numbering style. Auto-numbering is based on instUuid.
Definition Staff.h:50
@ 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, ...
Evpu dwRestOffset
Offset for downstem rests.
Definition Staff.h:215
bool hideRepeats
Inverse of "Display Endings and Text Repeats".
Definition Staff.h:206
ClefIndex defaultClef
Index of default clef for the staff.
Definition Staff.h:166
AlternateNotation
Enum for alternate notation styles.
Definition Staff.h:97
@ 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:325
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:388
bool hideClefs
Inverse of "Display Clefs".
Definition Staff.h:211
MusxInstanceList< PartDefinition > getContainingParts(bool includeScore=true) const
Gets a list of all parts that contain this staff.
Definition Staff.cpp:486
bool altRhythmStemsUp
Show stems up in alternate Rhythmic Notation mode.
Definition Staff.h:189
Efix horzStemOffDown
Horizontal Stem Offsets: Down Stem.
Definition Staff.h:242
std::pair< std::string, bool > calcAutoNumberingAffix() const
Calculate the auto numbering prefix or suffix, if needed.
Definition Staff.cpp:228
int calcToplinePosition() const
Calculates the position of the top staff line, relative to the reference line.
Definition Staff.cpp:450
bool hideRepeatTopDot
Inverse of "Top Repeat Dot" in Staff Setup dialog.
Definition Staff.h:201
Evpu hRestOffset
Offset for half rests.
Definition Staff.h:217
std::optional< int > staffLines
Number of lines in the staff (if no custom staff)
Definition Staff.h:168
Efix vertStemStartOffUp
Vertical Stem Offsets For Notehead End: Up Stem.
Definition Staff.h:243
bool hideKeySigs
Inverse of "Display Key Signatures".
Definition Staff.h:209
Cmper multiStaffInstId
Definition Staff.h:264
NotationStyle
Enum for notation style.
Definition Staff.h:74
bool hideStaffLines
Inverse of "Display Staff Lines".
Definition Staff.h:212
bool hideTimeSigs
Inverse of "Display Time Signatures in Score".
Definition Staff.h:210
bool noOptimize
Inverse of "Allow Hiding When Empty".
Definition Staff.h:203
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:169
Efix vertTabNumOff
Vertical offset for tab number. (Tablature Staff Attributes)
Definition Staff.h:227
int calcNumberOfStafflines() const
Calculates the number of staff lines on this staff.
Definition Staff.cpp:425
bool noKey
"Ignore Key Signatures"
Definition Staff.h:214
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:164
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:473
bool hideRepeatBottomDot
Inverse of "Bottom Repeat Dot" in Staff Setup dialog.
Definition Staff.h:197
bool altSlashDots
Show dots on beat slashes in compound meter.
Definition Staff.h:190
int capoPos
"Capo Position" (Tablature Staff Attributes)
Definition Staff.h:172
bool fullNamePosFromStyle
Definition Staff.h:258
bool hasStyles
Indicates that this staff has staff style assignments.
Definition Staff.h:178
Cmper abrvNamePosId
Definition Staff.h:260
Efix vertStemEndOffUp
Vertical Stem Offsets For Stem End: Up Stem.
Definition Staff.h:245
bool altHideArtics
Hide Articulations in alternate notation (in Apply-To Layer)
Definition Staff.h:186
MusxInstance< MultiStaffInstrumentGroup > getMultiStaffInstGroup() const
Returns the MultiStaffInstrumentGroup for this staff if it is part of one in the data....
Definition Staff.cpp:272
std::string addAutoNumbering(const std::string &plainName) const
Add auto numbering as a prefix or suffix, if needed.
Definition Staff.cpp:250
StemDirection stemDirection
stem direction for staff (xml node is <stemDir>)
Definition Staff.h:234
bool hideStems
Inverse of "Display Stems".
Definition Staff.h:233
Evpu otherRestOffset
Offset for other rests.
Definition Staff.h:218
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:317
std::optional< int > autoNumberValue
Calculated autonumbering value. It is computed by calcAllAutoNumberValues.
Definition Staff.h:266
Efix horzStemOffUp
Horizontal Stem Offsets: Up Stem.
Definition Staff.h:241
bool abrvNamePosFromStyle
Definition Staff.h:262
Efix vertStemStartOffDown
Vertical Stem Offsets For Notehead End: Down Stem.
Definition Staff.h:244
Evpu lineSpace
Distance between staff lines.
Definition Staff.h:170
Evpu wRestOffset
Offset for whole rests.
Definition Staff.h:216
bool stemStartFromStaff
Definition Staff.h:236
bool altHideSmartShapes
Hide Smart Shapes (in Apply-To layer: probably only affects entry-attached shapes)
Definition Staff.h:188
AlternateNotation altNotation
Alternate notation on the staff.
Definition Staff.h:184
bool stemsFixedEnd
"Use Vertical Offset For Beam End Of Stems (Offset From Staff)"
Definition Staff.h:239
HideMode hideMode
"Force Hide Staff" option
Definition Staff.h:247
bool hideTuplets
Inverse of "Show Tuplets" (Tablature Staff Attributes)
Definition Staff.h:231
Staff(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Staff.h:156
bool hideBarlines
Inverse of "Display Barlines".
Definition Staff.h:207
int lowestFret
"Default Lowest Fret" (Tablature Staff Attributes)
Definition Staff.h:173
bool hasInstrumentAssigned() const
Return true if this staff has an instrument assigned.
Definition Staff.cpp:465
LayerIndex altLayer
Alternate notation Apply To Layer index (0..3)
Definition Staff.h:185
bool floatKeys
"Independent Key Signature"
Definition Staff.h:174
Cmper fullNameTextId
Full name TextBlock ID. (xml node is <fullName>)
Definition Staff.h:223
NotationStyle notationStyle
Standard, percussion, or tablature.
Definition Staff.h:163
StemDirection
Enum for staff-level stem direction override.
Definition Staff.h:63
@ 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:251
bool hideTies
Inverse of "Display Ties".
Definition Staff.h:220
util::EnigmaParsingContext getFullInstrumentNameCtx(Cmper forPartId, bool preferStaffName=false) const
Returns the parsing context for the full name.
Definition Staff.cpp:297
bool showNameInParts
"Display Staff Name in Parts" (xml node is <showNameParts>)
Definition Staff.h:179
ClefIndex transposedClef
Index of transposed clef for the staff. Only used if Transposition::setToClef is true.
Definition Staff.h:167
bool floatTime
"Independent Time Signature"
Definition Staff.h:175
bool altHideOtherSmartShapes
Hide Smart Shapes in other layers in alternate notation.
Definition Staff.h:195
std::optional< Cmper > percussionMapId
Calculated percussion map Id for a percussion staff. (Populated by in calcAllRuntimeValues....
Definition Staff.h:267
int calcMiddleStaffPosition() const
Calculates the middle staff position. For staves with even numbers of lines, it is the middle space.
Definition Staff.cpp:435
bool requireAllFields() const override
Specifies if the parser should alert (print or throw) when an unknown xml tag is found for this class...
Definition Staff.h:413
Evpu botBarlineOffset
Offset for the bottom barline.
Definition Staff.h:183
bool hideLyrics
Inverse of "Display Lyrics".
Definition Staff.h:202
Efix vertStemEndOffDown
Vertical Stem Offsets For Stem End: Down Stem.
Definition Staff.h:246
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:262
Cmper abbrvNameTextId
Abbreviated name TextBlock ID. (xml node is <abbrvName>)
Definition Staff.h:224
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:267
bool hideFretboards
Inverse of "Display Fretboards".
Definition Staff.h:199
MusxInstance< details::StaffGroup > getMultiStaffInstVisualGroup() const
Returns the details::StaffGroup for this staff if it is part of a multistaff instrument (as defined i...
Definition Staff.cpp:283
bool rbarBreak
"Break Repeat Barlines Between Staves"
Definition Staff.h:177
Cmper fretInstrumentId
Cmper of fret instrument. (Tablature Staff Attributes)
Definition Staff.h:232
Evpu topRepeatDotOff
Offset for top repeat dots.
Definition Staff.h:226
HideMode
Enum for hide mode.
Definition Staff.h:85
@ Score
Collapse in score only.
@ ScoreParts
Collapse in score and parts.
bool showNoteColors
"Color Noteheads" (Score Manager)
Definition Staff.h:180
bool redisplayLayerAccis
"Redisplay Accidentals in Other Layers Within Measures"
Definition Staff.h:248
bool altHideExpressions
Hide Expressions in alternate notation (in Apply-To Layer)
Definition Staff.h:193
bool useNoteFont
Indicates if noteFont should be used.
Definition Staff.h:165
Evpu topBarlineOffset
Offset for the top barline.
Definition Staff.h:204
bool hideBeams
Inverse of "Show Beams".
Definition Staff.h:235
bool hideTimeSigsInParts
Inverse of "Display Time Signatures in Parts".
Definition Staff.h:249
MusxInstance< NamePositioning > getFullNamePosition() const
Returns the full name positioning in effect for this staff instance.
Definition Staff.cpp:385
bool hideChords
Inverse of "Display Chords".
Definition Staff.h:213
Cmper fullNamePosId
Definition Staff.h:256
bool showNamesForPart(Cmper partId) const
Returns if names should be shown for the specified part.
Definition Staff.h:312
bool hideRests
Inverse of "Display Rests".
Definition Staff.h:219
bool breakTabLinesAtNotes
"Break Tablature Lines At Numbers" (Tablature Staff Attributes)
Definition Staff.h:230
int stemReversal
Stem reversal value.
Definition Staff.h:222
bool blankMeasure
Inverse of "Display Rests in Empty Measures".
Definition Staff.h:200
Evpu botRepeatDotOff
Offset for bottom repeat dots.
Definition Staff.h:225
bool altHideOtherArtics
Hide articulations in other layers in alternate notation.
Definition Staff.h:192
bool altHideOtherNotes
Hide notes in other layers in alternate notation.
Definition Staff.h:191
bool blineBreak
"Break Barlines Between Staves"
Definition Staff.h:176
MusxInstance< NamePositioning > getAbbreviatedNamePosition() const
Returns the abbreviated name positioning in effect for this staff instance.
Definition Staff.cpp:393
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:505
ClefIndex calcClefIndexAt(MeasCmper measureId, Edu position, bool forWrittenPitch=false) const
Returns the clef in this staff at the specified location.
Definition Staff.cpp:401
ClefIndex calcFirstClefIndex(bool forWrittenPitch=false) const
Returns the first clef in this staff.
Definition Staff.h:352
bool useTabLetters
"Use Letters" (Tablature Staff Attributes)
Definition Staff.h:229
bool hideRptBars
Inverse of "Display Repeat Bars".
Definition Staff.h:208
std::shared_ptr< Transposition > transposition
Transposition details, if non-null.
Definition Staff.h:181
bool hideKeySigsShowAccis
"Hide Key Signature and Show Accidentals" transposition option.
Definition Staff.h:252
AutoNumberingStyle autoNumbering
Autonumbering style if useAutoNumbering is true. (xml node is <autoNum>)
Definition Staff.h:250
bool hideNameInScore
Inverse of "Display Staff Name in Score" (xml node is <hideStfNameInScore>)
Definition Staff.h:182
std::string instUuid
Unique identifier for the type of instrument.
Definition Staff.h:171
bool altHideOtherExpressions
Hide Expressions in other layers in alternate notation.
Definition Staff.h:196
bool stemsFixedStart
"Use Vertical Offset For Notehead End Of Stems"
Definition Staff.h:240
bool hideMeasNums
Inverse of "Display Measure Numbers".
Definition Staff.h:205
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:345
bool flatBeams
"Flat Beams"
Definition Staff.h:198
bool altHideLyrics
Hide Lyrics in alternate notation (in Apply-To Layer)
Definition Staff.h:187
bool showTabClefAllSys
Inverse of "Show Clef Only On First Measure" (Tablature Staff Attributes)
Definition Staff.h:228
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Staff.h:415
Wrapper class for interpreting and rendering Enigma-style strings with insert handling.
Definition EnigmaString.h:415
AccidentalStyle
Enumeration to specify the type of accidental substitution representation.
Definition EnigmaString.h:191
@ 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:35
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
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