MUSX Document Model
Loading...
Searching...
No Matches
Ossia.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 "BaseClasses.h"
25#include "CommonClasses.h"
26#include "Others.h"
27 // do not add other dom class dependencies. Use .cpp files for implementations that need total class access.
28
29namespace musx {
30namespace dom {
31
32namespace details {
33class Bracket;
34}
35
36namespace others {
37
45class OssiaBounds : public OthersBase
46{
47public:
49 explicit OssiaBounds(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
50 : OthersBase(document, partId, shareMode, cmper)
51 {
52 }
53
58
59 constexpr static std::string_view XmlNodeName = "ossiaBounds";
61};
62
70class OssiaHeader : public OthersBase
71{
72public:
74 explicit OssiaHeader(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
75 : OthersBase(document, partId, shareMode, cmper)
76 {
77 }
78
80 std::shared_ptr<KeySignature> keySig;
87
90
94
95 void integrityCheck(const std::shared_ptr<Base>& ptrToThis) override
96 {
97 this->OthersBase::integrityCheck(ptrToThis);
98 if (!keySig) {
99 keySig = std::make_shared<KeySignature>(getDocument());
100 }
101 }
102
103 constexpr static std::string_view XmlNodeName = "ossiaHeader";
105};
106
114class OssiaMusic : public OthersBase
115{
116public:
118 explicit OssiaMusic(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper)
119 : OthersBase(document, partId, shareMode, cmper)
120 {
121 }
122
123 int percent{};
127 bool hideKey{};
128 bool hideTime{};
129 bool hideDynamic{};
130 bool hideStaff{};
131 bool hideRepeat{};
132 bool hideClef{};
133 // posMode: Positioning behavior for the ossia (xml node is `<posMode>`).
134 // posMode appears to be an unused legacy spacing feature and is intentionally not stored. The only value ever seen
135 // is "ossiaDefault".
136
137 constexpr static std::string_view XmlNodeName = "ossiaMusic";
139};
140
149{
150public:
152 explicit PageOssiaAssign(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
153 : OthersBase(document, partId, shareMode, cmper, inci)
154 {
155 }
156
161 bool hidden{};
162
163 constexpr static std::string_view XmlNodeName = "pageOssiaAssign";
165};
166
167} //namespace others
168
169namespace details {
170
179{
180public:
182 explicit MeasureOssiaAssign(const DocumentWeakPtr& document, Cmper partId, ShareMode shareMode, Cmper staffId, Cmper measureId, Inci inci)
183 : DetailsBase(document, partId, shareMode, staffId, measureId, inci)
184 {
185 }
186
190 bool hidden{};
191
192 constexpr static std::string_view XmlNodeName = "measOssiaAssign";
194};
195
196} //namespace details
197
198} //namespace dom
199} //namespace musx
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 all "details" types.
Definition BaseClasses.h:407
Provides optional per-type extension methods for MusxInstanceList.
Definition MusxInstance.h:96
Base class for all "others" types.
Definition BaseClasses.h:283
Assigns an ossia passage to a specific staff/measure location.
Definition Ossia.h:179
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Ossia.h:192
MeasureOssiaAssign(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper staffId, Cmper measureId, Inci inci)
Constructor function.
Definition Ossia.h:182
Evpu xOffset
Horizontal offset (xml node is <topAdd>)
Definition Ossia.h:188
static const xml::XmlElementArray< MeasureOssiaAssign > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Evpu yOffset
Vertical offset (xml node is <leftAdd>)
Definition Ossia.h:189
Cmper ossiaId
Cmper of related others::OssiaBounds, others::OssiaHeader, and others::OssiaMusic classes....
Definition Ossia.h:187
bool hidden
Whether the ossia is hidden.
Definition Ossia.h:190
BarlineType
Barline type for left and right barlines.
Definition Others.h:1110
Stores additional positioning offsets for ossia passages.
Definition Ossia.h:46
Evpu centerPull
Centering adjustment,.
Definition Ossia.h:57
OssiaBounds(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Ossia.h:49
Evpu topMargin
Top margin (negative moves music down) (xml node is <topAdd>)
Definition Ossia.h:54
Evpu rightMargin
Right margin (xml node is <rightAdd>)
Definition Ossia.h:56
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Ossia.h:59
Evpu leftMargin
Left margin (xml node is <leftAdd>)
Definition Ossia.h:55
static const xml::XmlElementArray< OssiaBounds > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Header properties for an ossia passage (clef, key, time, grouping).
Definition Ossia.h:71
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 Ossia.h:95
bool compositeNumerator
Indicates a composite numerator for the time signature (xml node is <altNumTsig>)
Definition Ossia.h:84
Measure::BarlineType barlineType
Barline type. (xml node is <barline>)
Definition Ossia.h:86
ClefIndex clefId
Clef index (xml node is <clef>)
Definition Ossia.h:79
MusxInstanceList< details::Bracket > getBrackets() const
Gets the brackets associated with this ossia. The are in the order created. The details::Bracket::hor...
Definition Ossia.cpp:46
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Ossia.h:103
OssiaHeader(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Ossia.h:74
MusxInstance< TimeSignature > createTimeSignature() const
Create a shared pointer to an instance of the TimeSignature for this ossia.
Definition Ossia.cpp:37
bool compositeDenominator
Indicates a composite denominator for the time signature (xml node is <altDenTsig>)
Definition Ossia.h:85
Cmper beats
Time signature numerator or beats per measure (xml node is <beats>)
Definition Ossia.h:81
static const xml::XmlElementArray< OssiaHeader > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
Cmper divBeat
Time signature denominator division unit (xml node is <divbeat>)
Definition Ossia.h:82
Cmper bracketGroup
Ossia bracket group number (xml node is <group>)
Definition Ossia.h:83
std::shared_ptr< KeySignature > keySig
Display the music with this key signature. It does not transpose. The factory guarantees this is not ...
Definition Ossia.h:80
Stores display and source options for an ossia passage.
Definition Ossia.h:115
bool hideStaff
Hide staff lines (xml node is <negStaff>)
Definition Ossia.h:130
bool hideClef
Hide clef (xml node is <negClef>)
Definition Ossia.h:132
static const xml::XmlElementArray< OssiaMusic > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
bool hideLeftLine
Hide the left bar/line (xml node is <negLeftLine>)
Definition Ossia.h:126
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Ossia.h:137
int percent
Percent size of the ossia relative to normal (100 = 100%)
Definition Ossia.h:123
bool hideDynamic
Hide dynamics (xml node is <negDynamic>)
Definition Ossia.h:129
bool hideRepeat
Hide repeat marks (xml node is <negRepeat>)
Definition Ossia.h:131
bool hideKey
Hide the key signature (xml node is <negKey>)
Definition Ossia.h:127
StaffCmper sourceStaffId
Source staff (xml node is <qinst>)
Definition Ossia.h:124
OssiaMusic(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper)
Constructor function.
Definition Ossia.h:118
MeasCmper sourceMeasureId
Source measure (xml node is <qmeasure>)
Definition Ossia.h:125
bool hideTime
Hide the time signature (xml node is <negTime>)
Definition Ossia.h:128
Represents the assignment of an ossia passage to a specific page.
Definition Ossia.h:149
static constexpr std::string_view XmlNodeName
The XML node name for this type.
Definition Ossia.h:163
Cmper ossiaId
Cmper of related OssiaBounds, OssiaHeader, and OssiaMusic classes. (xml node is <arbnum>)
Definition Ossia.h:157
Evpu xOffset
Horizontal offset (xml node is <topAdd>)
Definition Ossia.h:158
Evpu yOffset
Vertical offset (xml node is <leftAdd>)
Definition Ossia.h:159
bool hidden
Whether the ossia is hidden.
Definition Ossia.h:161
PageOssiaAssign(const DocumentWeakPtr &document, Cmper partId, ShareMode shareMode, Cmper cmper, Inci inci)
Constructor function.
Definition Ossia.h:152
Evpu measureWidth
Measure width for this ossia (xml node is <mwidth>)
Definition Ossia.h:160
static const xml::XmlElementArray< PageOssiaAssign > & xmlMappingArray()
Required for musx::factory::FieldPopulator.
int16_t MeasCmper
Enigma meas Cmper (may be negative when not applicable)
Definition Fundamentals.h:64
std::shared_ptr< const T > MusxInstance
Defines the type of a musx instance stored in a pool.
Definition MusxInstance.h:35
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
uint16_t ClefIndex
Index into options::ClefOptions::clefDefs.
Definition Fundamentals.h:68
std::weak_ptr< Document > DocumentWeakPtr
Shared weak Document pointer.
Definition BaseClasses.h:57
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