MUSX Document Model
Loading...
Searching...
No Matches
CommonClasses.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 <numeric>
25#include <filesystem>
26#include <array>
27
28#include "musx/util/Fraction.h"
29#include "BaseClasses.h"
30
31namespace music_theory {
32class Transposer;
33enum class DiatonicMode : int;
34} // namespace music_theory
35
36namespace musx {
37namespace dom {
38
39namespace details { // forward declarations
41class LyricAssign;
42} // namespace details
43
44namespace others { // forward declarations
45class Measure;
46class OssiaHeader;
47class Staff;
48} // namespace others
49
50// This file contains common classes that are shared among Options, Others, and Details.
51
58enum class NoteType : Edu
59{
60 Maxima = 0x8000,
61 Longa = 0x4000,
62 Breve = 0x2000,
63 Whole = EDU_PER_WHOLE_NOTE,
64 Half = 0x0800,
65 Quarter = 0x0400,
66 Eighth = 0x0200,
67 Note16th = 0x0100,
68 Note32nd = 0x0080,
69 Note64th = 0x0040,
70 Note128th = 0x0020,
71 Note256th = 0x0010,
72 Note512th = 0x0008,
73 Note1024th = 0x0004,
74 Note2048th = 0x0002,
75 Note4096th = 0x0001
76};
77
84{
85 Treble = 0,
86 Alto = 1,
87 Tenor = 2,
88 Bass = 3,
89 Percussion = 4,
90 Treble8vb = 5,
91 Bass8vb = 6,
92 Baritone = 7,
93 FrenchViolin = 8,
94 BaritoneC = 9,
95 MezzoSoprano = 10,
96 Soprano = 11,
97 AltPercussion = 12,
98 Treble8va = 13,
99 Bass8va = 14,
100 Blank = 15,
101 Tab1 = 16,
102 Tab2 = 17
103};
104
109enum class ShowClefMode
110{
111 WhenNeeded,
112 Never,
113 Always
114};
115
124{
125public:
131 FontInfo(const DocumentWeakPtr& document, bool sizeIsPercent = false)
132 : CommonClassBase(document), m_sizeIsPercent(sizeIsPercent)
133 {
134 }
135
137 int fontSize{};
138 bool bold{};
139 bool italic{};
140 bool underline{};
141 bool strikeout{};
142 bool absolute{};
143 bool hidden{};
144
146 bool getSizeIsPercent() const { return m_sizeIsPercent; }
147
151 inline static constexpr uint16_t EnigmaStyleBold = 0x01;
152 inline static constexpr uint16_t EnigmaStyleItalic = 0x02;
153 inline static constexpr uint16_t EnigmaStyleUnderline = 0x04;
154 inline static constexpr uint16_t EnigmaStyleStrikeout = 0x20;
155 inline static constexpr uint16_t EnigmaStyleAbsolute = 0x40;
156 inline static constexpr uint16_t EnigmaStyleHidden = 0x80;
158
163 std::string getName() const;
164
170 void setFontIdByName(const std::string& name);
171
178 void setEnigmaStyles(uint16_t efx)
179 {
180 bold = efx & EnigmaStyleBold;
186 }
187
189 uint16_t getEnigmaStyles() const
190 {
191 uint16_t result = 0;
192 if (bold) result |= EnigmaStyleBold;
193 if (italic) result |= EnigmaStyleItalic;
194 if (underline) result |= EnigmaStyleUnderline;
195 if (strikeout) result |= EnigmaStyleStrikeout;
196 if (absolute) result |= EnigmaStyleAbsolute;
197 if (hidden) result |= EnigmaStyleHidden;
198 return result;
199 }
200
203 { return fontId == 0; }
204
206 bool calcIsSymbolFont() const;
207
210 static std::optional<std::filesystem::path> calcSMuFLMetaDataPath(const std::string& fontName);
211
213 std::optional<std::filesystem::path> calcSMuFLMetaDataPath() const
215
219 bool calcIsSMuFL() const;
220
226 static std::vector<std::filesystem::path> calcSMuFLPaths();
227
229
230private:
231 bool m_sizeIsPercent;
232};
233
239{
240public:
242
253 enum class KeyContext {
254 Concert,
255 Written
256 };
257
264 uint16_t key{};
265 bool keyless{};
267
282 Cmper getKeyMode() const { return isLinear() ? key >> 8 : key; }
283
288 { return isLinear() ? int(int8_t(key & 0xff)) + getAlterationOffset(ctx) : 0; }
289
290 bool isLinear() const { return (key & 0xC000) == 0; }
291 bool isNonLinear() const { return (key & 0xC000) != 0; }
292 bool isBuiltIn() const { return isLinear() && getKeyMode() <= 1; }
293 bool isMajor() const { return getKeyMode() == 0; }
294 bool isMinor() const { return getKeyMode() == 1; }
295
299 std::optional<music_theory::DiatonicMode> calcDiatonicMode() const;
300
302 bool isSame(const KeySignature& src) const
303 {
304 return isSameConcert(src) && m_alterationOffset == src.m_alterationOffset && m_octaveDisplacement == src.m_octaveDisplacement;
305 }
306
308 bool isSameConcert(const KeySignature& src) const
309 {
310 return key == src.key && keyless == src.keyless && hideKeySigShowAccis == src.hideKeySigShowAccis;
311 }
312
316 int calcScaleDegree(int displacement) const;
317
334 void setTransposition(int interval, int keyAdjustment, bool simplify);
335
338
342 int calcTonalCenterIndex(KeyContext ctx) const;
343
347 int calcAlterationOnNote(unsigned noteIndex, KeyContext ctx ) const;
348
352 { return ctx == KeyContext::Written ? m_octaveDisplacement : 0; }
353
355 int calcEDODivisions() const;
356
358 std::optional<std::vector<int>> calcKeyMap() const;
359
364 std::unique_ptr<music_theory::Transposer> createTransposer(int displacement, int alteration) const;
365
366 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
367 {
368 this->CommonClassBase::integrityCheck(ptrToThis);
369 if (key >= 0x8000) {
370 MUSX_INTEGRITY_ERROR("Key signature has invalid key value: " + std::to_string(key));
371 }
372 }
373
375
376private:
377 std::vector<unsigned> calcTonalCenterArrayForSharps() const;
378 std::vector<unsigned> calcTonalCenterArrayForFlats() const;
379 std::vector<unsigned> calcTonalCenterArray(KeyContext ctx) const;
380 std::vector<int> calcAcciAmountsArray(KeyContext ctx) const;
381 std::vector<unsigned> calcAcciOrderArray(KeyContext ctx) const;
382
383 int m_octaveDisplacement{};
384 int m_alterationOffset{};
385
386 int getAlterationOffset(KeyContext ctx) const
387 { return ctx == KeyContext::Written ? m_alterationOffset : 0; }
388
389};
390
391namespace texts {
392class LyricsTextBase; // forward delcaration
393} // namespace texts
394
400{
401public:
408 LyricsLineInfo(const DocumentWeakPtr& document, Cmper requestedPartId, std::string_view type, Cmper lyricNo, Evpu baseline) :
409 CommonClassBase(document), baselinePosition(baseline), lyricsType(type), lyricNumber(lyricNo), assignments(document, requestedPartId)
410 {
411 }
412
414 std::string_view lyricsType;
417};
418
424{
425public:
426 std::string syllable;
430
431private:
436 class StyleSpan
437 {
438 public:
439 size_t start; // start byte
440 size_t end; // end byte (exclusive)
441 size_t styleIndex; // index into LyricsTextBase's style table
442 };
443
451 LyricsSyllableInfo(const DocumentWeakPtr& document, const std::string text, bool before, bool after, int underscores, std::vector<StyleSpan>&& enigmaStyleMap)
452 : CommonClassBase(document), syllable(text), hasHyphenBefore(before), hasHyphenAfter(after), strippedUnderscores(underscores), m_enigmaStyleMap(std::move(enigmaStyleMap))
453 {
454 }
455
456 std::vector<StyleSpan> m_enigmaStyleMap;
457
458 friend class texts::LyricsTextBase;
459};
460
466{
467public:
468
471 {
472 std::vector<util::Fraction> counts;
474 std::vector<Edu> units;
477
479 bool operator==(const TimeSigComponent& src) const
480 { return counts == src.counts && units == src.units; }
481
484 { return std::accumulate(counts.begin(), counts.end(), util::Fraction{}); }
485
487 Edu sumUnits() const
488 { return std::accumulate(units.begin(), units.end(), Edu{}); }
489 };
490
491 std::vector<TimeSigComponent> components;
492
497 std::pair<util::Fraction, NoteType> calcSimplified() const;
498
501 {
502 util::Fraction result = std::accumulate(components.begin(), components.end(), util::Fraction{},
503 [](const util::Fraction& acc, const TimeSigComponent& comp)
504 { return acc + (comp.sumCounts() * comp.sumUnits()); }
505 );
506 return result / Edu(NoteType::Whole);
507 }
508
510 bool isSame(const TimeSignature& src) const
511 {
512 return components == src.components && m_abbreviate == src.m_abbreviate;
513 }
514
519 {
520 checkIndex(index);
521 return MusxInstance<TimeSignature>(new TimeSignature(getDocument(), components[index], m_abbreviate));
522 }
523
528 std::optional<char32_t> getAbbreviatedSymbol() const;
529
531 bool isCommonTime() const;
533 bool isCutTime() const;
534
535private:
536 void checkIndex(size_t index) const
537 {
538 if (index > components.size()) {
539 throw std::invalid_argument("Index out of range. The time signature has " + std::to_string(components.size())
540 + " elements. The index requested was " + std::to_string(index) + ".");
541 }
542 }
543
548 explicit TimeSignature(const DocumentWeakPtr& document, int beats, Edu unit, bool hasCompositeTop, bool hasCompositeBottom,
549 std::optional<bool> abbreviate = std::nullopt);
550
555 explicit TimeSignature(const DocumentWeakPtr& document, const TimeSigComponent& timeSigUnit, std::optional<bool> abbreviate)
556 : CommonClassBase(document), m_abbreviate(abbreviate)
557 {
558 components.push_back(timeSigUnit);
559 }
560
561 std::optional<bool> m_abbreviate;
562
563 friend class others::Measure;
564 friend class others::OssiaHeader;
565 friend class details::IndependentStaffDetails;
566};
567
568namespace others {
569
570// The following classes are defined here because they are shared by multiple subclasses and container classes.
571
576class Enclosure : public OthersBase
577{
578public:
583 enum class Shape : uint8_t
584 {
585 NoEnclosure = 0,
586 Rectangle = 1,
587 Ellipse = 2,
588 Triangle = 3,
589 Diamond = 4,
590 Pentagon = 5,
591 Hexagon = 6,
592 Heptagon = 7,
593 Octogon = 8
594 };
595
603 explicit Enclosure(const DocumentWeakPtr& document, Cmper partId = SCORE_PARTID, ShareMode shareMode = ShareMode::All, Cmper cmper = 0)
604 : OthersBase(document, partId, shareMode, cmper) {}
605
613 bool fixedSize{};
614 bool equalAspect{};
615 bool notTall{};
616 bool opaque{};
618
620};
621
629class MusicRange : public OthersBase
630{
631public:
640 explicit MusicRange(const DocumentWeakPtr& document, Cmper partId = SCORE_PARTID, ShareMode shareMode = ShareMode::All,
641 Cmper cmper = 0, std::optional<Inci> inci = std::nullopt)
642 : OthersBase(document, partId, shareMode, cmper, inci)
643 {
644 }
645
650
654 bool contains(MeasCmper measId, Edu eduPosition) const
655 {
656 return (startMeas < measId || (startMeas == measId && startEdu <= eduPosition)) &&
657 (endMeas > measId || (endMeas == measId && endEdu >= eduPosition));
658 }
659
666 std::optional<std::pair<MeasCmper, Edu>> nextLocation(const std::optional<StaffCmper>& forStaff = std::nullopt) const;
667
669};
670
679{
680public:
681
689 explicit NamePositioning(const DocumentWeakPtr& document, Cmper partId = SCORE_PARTID, ShareMode shareMode = ShareMode::All, Cmper cmper = 0)
690 : OthersBase(document, partId, shareMode, cmper) {}
691
694 enum class AlignJustify
695 {
696 Left,
697 Right,
698 Center
699 };
700
704 bool indivPos{};
706 bool expand{};
707
709};
710
711} // namespace others
712} // namespace dom
713} // namespace mux
DocumentPtr getDocument() const
Gets a reference to the Document.
Definition BaseClasses.h:108
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 commonly used among others, details, entries, and/or texts....
Definition BaseClasses.h:200
CommonClassBase(const DocumentWeakPtr &document)
Constructs a CommonClassBase object.
Definition BaseClasses.h:209
Represents the default font settings for a particular element type.
Definition CommonClasses.h:124
static constexpr uint16_t EnigmaStyleHidden
Hidden text bit.
Definition CommonClasses.h:156
static constexpr uint16_t EnigmaStyleItalic
Italic style bit.
Definition CommonClasses.h:152
FontInfo(const DocumentWeakPtr &document, bool sizeIsPercent=false)
constructor
Definition CommonClasses.h:131
static constexpr uint16_t EnigmaStyleStrikeout
Strikeout style bit.
Definition CommonClasses.h:154
bool calcIsSymbolFont() const
Calculates if this is a symbol font. (See others::FontDefinition::calcIsSymbolFont....
Definition CommonClasses.cpp:109
static constexpr uint16_t EnigmaStyleUnderline
Underline style bit.
Definition CommonClasses.h:153
uint16_t getEnigmaStyles() const
Returns the font styles as an nfx bitmask.
Definition CommonClasses.h:189
static constexpr uint16_t EnigmaStyleAbsolute
Fixed-size (absolute) bit.
Definition CommonClasses.h:155
static constexpr uint16_t EnigmaStyleBold
Bold style bit.
Definition CommonClasses.h:151
bool strikeout
Strikeout effect.
Definition CommonClasses.h:141
void setFontIdByName(const std::string &name)
Sets the id of the font from a string name.
Definition CommonClasses.cpp:60
Cmper fontId
Font identifier. This is a Cmper for others::FontDefinition.
Definition CommonClasses.h:136
static std::vector< std::filesystem::path > calcSMuFLPaths()
Returns the standard SMuFL font folder.
Definition CommonClasses.cpp:117
bool calcIsSMuFL() const
Calculates whether this is a SMuFL font.
Definition CommonClasses.cpp:87
std::string getName() const
Get the name of the font.
Definition CommonClasses.cpp:52
static const xml::XmlElementArray< FontInfo > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool getSizeIsPercent() const
If true, the size of this font is calculated as a percent of the preceding font size (in an Enigma st...
Definition CommonClasses.h:146
void setEnigmaStyles(uint16_t efx)
Set style effects based on a bitmask. This is mainly useful for capturing text styles from enigma str...
Definition CommonClasses.h:178
bool italic
Italic effect.
Definition CommonClasses.h:139
bool hidden
Hidden effect.
Definition CommonClasses.h:143
bool calcIsDefaultMusic() const
Calculates if this is the default music font.
Definition CommonClasses.h:202
int fontSize
Font size or percent (where 100 is 100%) of preceding font size. (See getSizeIsPercent....
Definition CommonClasses.h:137
bool underline
Underline effect.
Definition CommonClasses.h:140
bool absolute
Fixed size effect.
Definition CommonClasses.h:142
std::optional< std::filesystem::path > calcSMuFLMetaDataPath() const
Returns the filepath of the SMuFL font's metadata json file, if any.
Definition CommonClasses.h:213
bool bold
Bold effect.
Definition CommonClasses.h:138
Shared key signature class that is contained in other classes. (See others::Measure)
Definition CommonClasses.h:239
Cmper getKeyMode() const
Returns the key mode.
Definition CommonClasses.h:282
bool isSame(const KeySignature &src) const
returns whether the two key signatures represent the same key signature, taking into account transpos...
Definition CommonClasses.h:302
int getAlteration(KeyContext ctx) const
For linear keys, returns the number of sharps or flats from -7..7 (if any).
Definition CommonClasses.h:287
bool hideKeySigShowAccis
Instead of a key signature, show accidentals for the key on the notes where they occur.
Definition CommonClasses.h:266
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 CommonClasses.h:366
int calcScaleDegree(int displacement) const
Calculates the scale degree for the given displacement, where 0 is the tonic.
Definition CommonClasses.cpp:345
bool isLinear() const
whether this is a linear key
Definition CommonClasses.h:290
int calcEDODivisions() const
Calculates the number of EDO division for the key. (The standard value is 12.)
Definition CommonClasses.cpp:429
bool isBuiltIn() const
whether this is a built-in key
Definition CommonClasses.h:292
KeyContext
Indicates whether to compute key signature values in concert or written pitch.
Definition CommonClasses.h:253
@ Written
Use written pitch (with transposition)
@ Concert
Use concert pitch (untransposed)
int calcTonalCenterIndex(KeyContext ctx) const
Calculates the tonal center index for the key, where C=0, D=1, E=2, ...
Definition CommonClasses.cpp:302
int getOctaveDisplacement(KeyContext ctx) const
The octave displacement if this key is a transposed key.
Definition CommonClasses.h:351
uint16_t key
16-bit value intepreted as follows:
Definition CommonClasses.h:264
std::unique_ptr< music_theory::Transposer > createTransposer(int displacement, int alteration) const
Creates a transposer for this KeySignature instance.
Definition CommonClasses.cpp:437
std::optional< music_theory::DiatonicMode > calcDiatonicMode() const
If this key specifies a diatonic mode, returns the mode. This value is independent of EDO divisions....
Definition CommonClasses.cpp:442
void setTransposition(int interval, int keyAdjustment, bool simplify)
Transposes the key by the specified amounts. Set them to zero to remove transposition.
Definition CommonClasses.cpp:356
int calcAlterationOnNote(unsigned noteIndex, KeyContext ctx) const
Calculates the amount of alteration on a note int the key.
Definition CommonClasses.cpp:313
bool isMinor() const
whether this is a built-in minor key
Definition CommonClasses.h:294
bool isNonLinear() const
whether this is a non-linear key
Definition CommonClasses.h:291
static const xml::XmlElementArray< KeySignature > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool isSameConcert(const KeySignature &src) const
returns whether the two key signatures represent the same concert key signature, ignoring transpositi...
Definition CommonClasses.h:308
bool isMajor() const
whether this is a built-in major key
Definition CommonClasses.h:293
std::optional< std::vector< int > > calcKeyMap() const
Calculates the key's diatonic key map.
Definition CommonClasses.cpp:391
bool keyless
Indicates the absence of a key signature.
Definition CommonClasses.h:265
Contains information about a line of lyrics on a system.
Definition CommonClasses.h:400
std::string_view lyricsType
the type of lyric ("chorus", "verse", or "section", corresponding to the xml tags for lyrics text)
Definition CommonClasses.h:414
MusxInstanceList< details::LyricAssign > assignments
The lyric assignments on this line. The all should share the same lyricNumber value.
Definition CommonClasses.h:416
Evpu baselinePosition
baseline position of this line on this system, relative to the staff's reference line
Definition CommonClasses.h:413
Cmper lyricNumber
the text number for all lyric assignments on this line.
Definition CommonClasses.h:415
LyricsLineInfo(const DocumentWeakPtr &document, Cmper requestedPartId, std::string_view type, Cmper lyricNo, Evpu baseline)
Constructor function.
Definition CommonClasses.h:408
Contains the syllable information for a single syllable. (See texts::LyricsTextBase)
Definition CommonClasses.h:424
bool hasHyphenAfter
indicates the syllable if followed by a hyphen.
Definition CommonClasses.h:428
int strippedUnderscores
indicates the number of trailing underscores stripped (because smart wort extensions convert them to ...
Definition CommonClasses.h:429
std::string syllable
the syllable text with no hyphenation or font information.
Definition CommonClasses.h:426
bool hasHyphenBefore
indicates the syllable is preceded by a hyphen.
Definition CommonClasses.h:427
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:96
Base class for all "others" types.
Definition BaseClasses.h:283
Shared time signature class that is derived from other classes. (See others::Measure)
Definition CommonClasses.h:466
bool isSame(const TimeSignature &src) const
returns whether the two time signatures represent the same time signature
Definition CommonClasses.h:510
bool isCutTime() const
Returns if this time signature is cut time.
Definition CommonClasses.cpp:540
std::vector< TimeSigComponent > components
the components in the time signature
Definition CommonClasses.h:491
util::Fraction calcTotalDuration() const
Calculates the total duration of the time signature as a fraction of a whole note.
Definition CommonClasses.h:500
std::optional< char32_t > getAbbreviatedSymbol() const
Returns the abbreviated symbol (code point) for this time signature, or std::nullopt if none.
Definition CommonClasses.cpp:509
bool isCommonTime() const
Returns if this time signature is common time.
Definition CommonClasses.cpp:532
MusxInstance< TimeSignature > createComponent(size_t index) const
Creates a time signature corresponding to the component at index.
Definition CommonClasses.h:518
std::pair< util::Fraction, NoteType > calcSimplified() const
Calculates the simplest form of of this time signature, expressed as a fractional count of NoteType u...
Definition CommonClasses.cpp:548
Represents independent time and key signature overrides for a staff.
Definition Details.h:1081
Contains assignment data for a lyric assignment (a single syllable)
Definition Details.h:1172
Represents the enclosure settings for text expressions.
Definition CommonClasses.h:577
bool notTall
"Enforce Minimum Width": don't let shape get taller than it is wide
Definition CommonClasses.h:615
Enclosure(const DocumentWeakPtr &document, Cmper partId=SCORE_PARTID, ShareMode shareMode=ShareMode::All, Cmper cmper=0)
Constructs an Enclosure object.
Definition CommonClasses.h:603
Evpu yAdd
Center Y offset - offsets text from center (in EVPU).
Definition CommonClasses.h:607
bool roundCorners
Whether the enclosure has rounded corners.
Definition CommonClasses.h:617
Efix lineWidth
Line thickness in 64ths of an EVPU (EFIX).
Definition CommonClasses.h:610
static const xml::XmlElementArray< Enclosure > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool opaque
Whether the enclosure is opaque.
Definition CommonClasses.h:616
Shape
Enumeration for enclosure shapes.
Definition CommonClasses.h:584
Evpu yMargin
Half height - extra space on top/bottom sides (in EVPU).
Definition CommonClasses.h:609
Shape shape
Enclosure shape (default: NoEnclosure).
Definition CommonClasses.h:611
bool fixedSize
Whether the enclosure is fixed size (ignore text bounding box)
Definition CommonClasses.h:613
bool equalAspect
"Match Height and Width"
Definition CommonClasses.h:614
Efix cornerRadius
Corner radius (in EFIX).
Definition CommonClasses.h:612
Evpu xMargin
Half width - extra space on left/right sides (in EVPU).
Definition CommonClasses.h:608
Evpu xAdd
Center X offset - offsets text from center (in EVPU).
Definition CommonClasses.h:606
Represents the attributes of a measure.
Definition Others.h:1090
Represents a range of music using measure and EDUs.
Definition CommonClasses.h:630
Edu startEdu
Starting EDU (Elapsed Durational Unit) in the range.
Definition CommonClasses.h:647
MeasCmper endMeas
Ending measure in the range.
Definition CommonClasses.h:648
std::optional< std::pair< MeasCmper, Edu > > nextLocation(const std::optional< StaffCmper > &forStaff=std::nullopt) const
Returns the next metric location following the music range.
Definition Others.cpp:306
static const xml::XmlElementArray< MusicRange > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Edu endEdu
Ending EDU (Elapsed Durational Unit) in the range.
Definition CommonClasses.h:649
MusicRange(const DocumentWeakPtr &document, Cmper partId=SCORE_PARTID, ShareMode shareMode=ShareMode::All, Cmper cmper=0, std::optional< Inci > inci=std::nullopt)
Constructs a MusicRange object.
Definition CommonClasses.h:640
MeasCmper startMeas
Starting measure in the range.
Definition CommonClasses.h:646
bool contains(MeasCmper measId, Edu eduPosition) const
Returns true of the given metric location is contained in this MusicRange instance.
Definition CommonClasses.h:654
Contains horizontal and vertical offsets, alignment, and expansion settings for name positioning.
Definition CommonClasses.h:679
bool indivPos
Indicates that this positioning overrides the default positioning. (Not used by options::StaffOptions...
Definition CommonClasses.h:704
NamePositioning(const DocumentWeakPtr &document, Cmper partId=SCORE_PARTID, ShareMode shareMode=ShareMode::All, Cmper cmper=0)
Constructs an NamePositioning object.
Definition CommonClasses.h:689
bool expand
"Expand Single Word"
Definition CommonClasses.h:706
AlignJustify
Alignment and justification options for staff and group names.
Definition CommonClasses.h:695
@ Left
Left alignment or justification (the default value.)
Evpu horzOff
Horizontal distance from staff in Evpu.
Definition CommonClasses.h:701
AlignJustify hAlign
Horizontal alignment for the name text. (xml node is <halign>)
Definition CommonClasses.h:705
AlignJustify justify
Justification for the name text.
Definition CommonClasses.h:703
Evpu vertOff
Vertical offset from staff in Evpu.
Definition CommonClasses.h:702
static const xml::XmlElementArray< NamePositioning > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Header properties for an ossia passage (clef, key, time, grouping).
Definition Ossia.h:71
Represents the definition of a Finale staff.
Definition Staff.h:52
Base class for lyrics text.
Definition Texts.h:123
A class to represent fractions with integer m_numerator and m_denominator, automatically reduced to s...
Definition Fraction.h:38
A dependency-free, header-only collection of useful functions for music theory.
DiatonicMode
Represents the seven standard diatonic musical modes.
Definition music_theory.hpp:85
ShowClefMode
Enum representing the clef display mode for a frame.
Definition CommonClasses.h:110
@ WhenNeeded
Clef is displayed only when needed (the default).
@ Always
Clef is always displayed. (xml value is "forced")
@ Never
Clef is never displayed. (xml value is "hidden")
NoteType
Enum class representing note types based on EDU values.
Definition CommonClasses.h:59
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
constexpr Cmper SCORE_PARTID
The part id of the score.
Definition Fundamentals.h:79
int32_t Evpu
EVPU value (288 per inch)
Definition Fundamentals.h:57
uint16_t Cmper
Enigma "comperator" key type.
Definition Fundamentals.h:55
DefaultClefType
Clef types used by default in Finale documents. The values correspond to indices into musx::dom::opti...
Definition CommonClasses.h:84
@ Bass8vb
F clef, sounds one octave lower (8vb).
@ Alto
C clef, centered on third line (Alto clef).
@ BaritoneC
C clef on fifth line (Baritone clef).
@ Tab1
Tablature clef (5 lines).
@ Treble
G clef, standard treble.
@ FrenchViolin
G clef placed on first line (French violin clef).
@ Treble8va
G clef, sounds one octave higher (8va).
@ Bass8va
F clef, sounds one octave higher (8va).
@ AltPercussion
Alternate percussion clef, heavy vertical hash marks (no pitch).
@ Soprano
C clef on first line (Soprano clef).
@ Bass
F clef, standard bass.
@ Percussion
Percussion clef, open rectangle (no pitch).
@ Baritone
F clef on third line (Baritone clef).
@ Tab2
Tablature clef (5 lines, alternative style).
@ Treble8vb
G clef, sounds one octave lower (8vb).
@ Blank
Blank clef (invisible, no symbol).
@ MezzoSoprano
C clef on second line (Mezzo-soprano clef).
@ Tenor
C clef, centered on fourth line (Tenor clef).
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::vector< XmlElementDescriptor< T > > XmlElementArray
an array type for XmlElementDescriptor instances.
Definition XmlInterface.h:127
object model for musx file (enigmaxml)
Definition BaseClasses.h:36
A single time signature component.
Definition CommonClasses.h:471
std::vector< util::Fraction > counts
Definition CommonClasses.h:472
std::vector< Edu > units
Definition CommonClasses.h:474
util::Fraction sumCounts() const
Compute the sum of all counts.
Definition CommonClasses.h:483
Edu sumUnits() const
Compute the sum of all units.
Definition CommonClasses.h:487
bool operator==(const TimeSigComponent &src) const
Test if two TimeSigComponent values are the same.
Definition CommonClasses.h:479