clearing enum type Placement

This commit is contained in:
Igor Korsukov 2021-11-19 18:41:54 +02:00
parent 296c00267b
commit 5199c804e8
55 changed files with 249 additions and 246 deletions

View file

@ -321,7 +321,7 @@ public:
void tag(const QString&, QVariant data);
void tag(const char* name, const char* s) { tag(name, QVariant(s)); }
void tag(const char* name, const QString& s) { tag(name, QVariant(s)); }
void tag(const char* name, const mu::PointF& s);
void tag(const char* name, const mu::PointF& s, bool isPutLevel = true);
void comment(const QString&);

View file

@ -238,7 +238,7 @@ void XmlWriter::tagProperty(const char* name, const mu::engraving::PropertyValue
// geometry
case P_TYPE::POINT: {
PointF p = data.value<PointF>();
tag(name, p);
tag(name, p, false);
}
break;
case P_TYPE::SIZE: {
@ -294,29 +294,29 @@ void XmlWriter::tagProperty(const char* name, const mu::engraving::PropertyValue
*this << QString("<%1>%2,%3</%1>\n").arg(name).arg(h, v);
}
break;
case P_TYPE::PLACEMENT: {
case P_TYPE::PLACEMENT_V: {
*this << "<" << name << ">";
switch (data.value<Placement>()) {
case Placement::ABOVE:
switch (data.value<PlacementV>()) {
case PlacementV::ABOVE:
*this << "above";
break;
case Placement::BELOW:
case PlacementV::BELOW:
*this << "below";
break;
}
*this << "</" << ename << ">\n";
}
break;
case P_TYPE::HPLACEMENT: {
case P_TYPE::PLACEMENT_H: {
*this << "<" << name << ">";
switch (data.value<HPlacement>()) {
case HPlacement::LEFT:
switch (data.value<PlacementH>()) {
case PlacementH::LEFT:
*this << "left";
break;
case HPlacement::CENTER:
case PlacementH::CENTER:
*this << "center";
break;
case HPlacement::RIGHT:
case PlacementH::RIGHT:
*this << "right";
break;
}
@ -384,8 +384,12 @@ void XmlWriter::tagProperty(const char* name, const mu::engraving::PropertyValue
}
}
void XmlWriter::tag(const char* name, const mu::PointF& p)
void XmlWriter::tag(const char* name, const mu::PointF& p, bool isPutLevel)
{
if (isPutLevel) {
putLevel();
}
*this << QString("<%1 x=\"%2\" y=\"%3\"/>\n").arg(name).arg(p.x()).arg(p.y());
}

View file

@ -229,7 +229,7 @@ void LayoutLyrics::layoutLyrics(const LayoutOptions& options, const Score* score
for (Lyrics* l : cr->lyrics()) {
// user adjusted offset can possibly change placement
if (l->offsetChanged() != OffsetChange::NONE) {
Placement p = l->placement();
PlacementV p = l->placement();
l->rebaseOffset();
if (l->placement() != p) {
l->undoResetProperty(Pid::AUTOPLACE);

View file

@ -900,11 +900,11 @@ std::set<SymId> updateArticulations(const std::set<SymId>& articulationSymbolIds
return joinArticulations(splittedArticulations);
}
std::set<SymId> flipArticulations(const std::set<SymId>& articulationSymbolIds, Placement placement)
std::set<SymId> flipArticulations(const std::set<SymId>& articulationSymbolIds, PlacementV placement)
{
std::set<SymId> result;
switch (placement) {
case Placement::ABOVE:
case PlacementV::ABOVE:
for (const SymId& articulationSymbolId: articulationSymbolIds) {
bool found = false;
for (auto it = articulationPlacements.begin(); it != articulationPlacements.end(); ++it) {
@ -920,7 +920,7 @@ std::set<SymId> flipArticulations(const std::set<SymId>& articulationSymbolIds,
}
}
break;
case Placement::BELOW:
case PlacementV::BELOW:
for (const SymId& articulationSymbolId: articulationSymbolIds) {
bool found = false;
for (auto it = articulationPlacements.begin(); it != articulationPlacements.end(); ++it) {

View file

@ -77,7 +77,7 @@ std::set<SymId> updateArticulations(const std::set<SymId>& articulationSymbolIds
ArticulationsUpdateMode updateMode = ArticulationsUpdateMode::Insert);
std::set<SymId> splitArticulations(const std::set<SymId>& articulationSymbolIds);
std::set<SymId> joinArticulations(const std::set<SymId>& articulationSymbolIds);
std::set<SymId> flipArticulations(const std::set<SymId>& articulationSymbolIds, Placement placement);
std::set<SymId> flipArticulations(const std::set<SymId>& articulationSymbolIds, PlacementV placement);
//---------------------------------------------------------
// @@ Articulation

View file

@ -975,7 +975,7 @@ EngravingItem* BarLine::drop(EditData& data)
score()->undoAddElement(e);
return e;
} else if (e->isFermata()) {
e->setPlacement(track() & 1 ? Placement::BELOW : Placement::ABOVE);
e->setPlacement(track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
for (EngravingItem* el: segment()->annotations()) {
if (el->isFermata() && (el->track() == track())) {
if (el->subtype() == e->subtype()) {

View file

@ -226,7 +226,7 @@ PropertyValue Breath::propertyDefault(Pid id) const
case Pid::PAUSE:
return 0.0;
case Pid::PLACEMENT:
return track() & 1 ? int(Placement::BELOW) : int(Placement::ABOVE);
return track() & 1 ? int(PlacementV::BELOW) : int(PlacementV::ABOVE);
default:
return EngravingItem::propertyDefault(id);
}

View file

@ -2859,10 +2859,10 @@ void Chord::updateArticulations(const std::set<SymId>& newArticulationIds, Artic
score()->undoRemoveElement(artic);
}
std::set<SymId> articulationIds = flipArticulations(currentArticulationIds, Placement::ABOVE);
std::set<SymId> articulationIds = flipArticulations(currentArticulationIds, PlacementV::ABOVE);
articulationIds = splitArticulations(articulationIds);
std::set<SymId> _newArticulationIds = flipArticulations(newArticulationIds, Placement::ABOVE);
std::set<SymId> _newArticulationIds = flipArticulations(newArticulationIds, PlacementV::ABOVE);
_newArticulationIds = splitArticulations(_newArticulationIds);
for (const SymId& articulationId: _newArticulationIds) {

View file

@ -427,7 +427,7 @@ EngravingItem* ChordRest::drop(EditData& data)
b->setPos(PointF());
// allow breath marks in voice > 1
b->setTrack(this->track());
b->setPlacement(b->track() & 1 ? Placement::BELOW : Placement::ABOVE);
b->setPlacement(b->track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
Fraction bt = tick() + actualTicks();
bt = tick() + actualTicks();
@ -492,7 +492,7 @@ EngravingItem* ChordRest::drop(EditData& data)
}
case ElementType::FERMATA:
e->setPlacement(track() & 1 ? Placement::BELOW : Placement::ABOVE);
e->setPlacement(track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
for (EngravingItem* el: segment()->annotations()) {
if (el->isFermata() && (el->track() == track())) {
if (el->subtype() == e->subtype()) {
@ -1379,7 +1379,7 @@ Shape ChordRest::shape() const
// lyrics
//---------------------------------------------------------
Lyrics* ChordRest::lyrics(int no, Placement p) const
Lyrics* ChordRest::lyrics(int no, PlacementV p) const
{
for (Lyrics* l : _lyrics) {
if (l->placement() == p && l->no() == no) {
@ -1395,7 +1395,7 @@ Lyrics* ChordRest::lyrics(int no, Placement p) const
// return -1 if there are no lyrics;
//---------------------------------------------------------
int ChordRest::lastVerse(Placement p) const
int ChordRest::lastVerse(PlacementV p) const
{
int lastVerse = -1;

View file

@ -157,8 +157,8 @@ public:
const std::vector<Lyrics*>& lyrics() const { return _lyrics; }
std::vector<Lyrics*>& lyrics() { return _lyrics; }
Lyrics* lyrics(int verse, Placement) const;
int lastVerse(Placement) const;
Lyrics* lyrics(int verse, PlacementV) const;
int lastVerse(PlacementV) const;
bool isMelismaEnd() const;
void setMelismaEnd(bool v);

View file

@ -621,7 +621,7 @@ TextBase* Score::addText(Tid type)
break;
}
textBox = new StaffText(this->dummy()->segment(), Tid::EXPRESSION);
textBox->setPlacement(Placement::BELOW);
textBox->setPlacement(PlacementV::BELOW);
textBox->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
chordRest->undoAddAnnotation(textBox);
break;
@ -1880,7 +1880,7 @@ void Score::cmdAddOttava(OttavaType type)
Ottava* ottava = new Ottava(this->dummy());
ottava->setOttavaType(type);
if (type == OttavaType::OTTAVA_8VB /*|| type == OttavaType::OTTAVA_15MB || type == OttavaType::OTTAVA_22MB*/) {
ottava->setPlacement(Placement::BELOW);
ottava->setPlacement(PlacementV::BELOW);
ottava->styleChanged();
}
ottava->setTrack(cr1->track());
@ -1903,7 +1903,7 @@ void Score::cmdAddOttava(OttavaType type)
Ottava* ottava = new Ottava(this->dummy());
ottava->setOttavaType(type);
if (type == OttavaType::OTTAVA_8VB /*|| type == OttavaType::OTTAVA_15MB || type == OttavaType::OTTAVA_22MB*/) {
ottava->setPlacement(Placement::BELOW);
ottava->setPlacement(PlacementV::BELOW);
ottava->styleChanged();
}
ottava->setTrack(cr1->track());
@ -2139,8 +2139,8 @@ void Score::cmdFlip()
|| e->isBreath()) {
e->undoChangeProperty(Pid::AUTOPLACE, true);
// getProperty() delegates call from spannerSegment to Spanner
Placement p = Placement(e->getProperty(Pid::PLACEMENT).toInt());
p = (p == Placement::ABOVE) ? Placement::BELOW : Placement::ABOVE;
PlacementV p = PlacementV(e->getProperty(Pid::PLACEMENT).toInt());
p = (p == PlacementV::ABOVE) ? PlacementV::BELOW : PlacementV::ABOVE;
// TODO: undoChangeProperty() should probably do this directly
// see https://musescore.org/en/node/281432
EngravingItem* ee = e->propertyDelegate(Pid::PLACEMENT);

View file

@ -1342,7 +1342,7 @@ bool EngravingItem::setProperty(Pid propertyId, const PropertyValue& v)
setMinDistance(v.value<Spatium>());
break;
case Pid::PLACEMENT:
setPlacement(Placement(v.toInt()));
setPlacement(PlacementV(v.toInt()));
break;
case Pid::AUTOPLACE:
setAutoplace(v.toBool());
@ -1401,7 +1401,7 @@ PropertyValue EngravingItem::propertyDefault(Pid pid) const
if (v.isValid()) { // if it's a styled property
return v;
}
return int(Placement::BELOW);
return int(PlacementV::BELOW);
}
case Pid::SELECTED:
return false;
@ -2149,7 +2149,7 @@ QVector<LineF> EngravingItem::genericDragAnchorLines() const
System* system = toSegment(parent())->measure()->system();
const int stIdx = staffIdx();
yp = system ? system->staffCanvasYpage(stIdx) : 0.0;
if (placement() == Placement::BELOW) {
if (placement() == PlacementV::BELOW) {
yp += system ? system->staff(stIdx)->bbox().height() : 0.0;
}
//adjust anchor Y positions to staffType offset
@ -2327,7 +2327,7 @@ qreal EngravingItem::rebaseOffset(bool nox)
if (pf == PropertyFlags::STYLED) {
pf = PropertyFlags::UNSTYLED;
}
Placement place = above ? Placement::BELOW : Placement::ABOVE;
PlacementV place = above ? PlacementV::BELOW : PlacementV::ABOVE;
e->undoChangeProperty(Pid::PLACEMENT, int(place), pf);
undoResetProperty(Pid::MIN_DISTANCE);
return 0.0;

View file

@ -286,10 +286,10 @@ public:
void setSizeIsSpatiumDependent(bool v) { setFlag(ElementFlag::SIZE_SPATIUM_DEPENDENT, !v); }
bool offsetIsSpatiumDependent() const override;
Placement placement() const { return Placement(!flag(ElementFlag::PLACE_ABOVE)); }
void setPlacement(Placement val) { setFlag(ElementFlag::PLACE_ABOVE, !bool(val)); }
bool placeAbove() const { return placement() == Placement::ABOVE; }
bool placeBelow() const { return placement() == Placement::BELOW; }
PlacementV placement() const { return PlacementV(!flag(ElementFlag::PLACE_ABOVE)); }
void setPlacement(PlacementV val) { setFlag(ElementFlag::PLACE_ABOVE, !bool(val)); }
bool placeAbove() const { return placement() == PlacementV::ABOVE; }
bool placeBelow() const { return placement() == PlacementV::BELOW; }
virtual bool placeMultiple() const { return true; }
bool generated() const { return flag(ElementFlag::GENERATED); }

View file

@ -53,7 +53,7 @@ static const ElementStyle fermataStyle {
Fermata::Fermata(EngravingItem* parent)
: EngravingItem(ElementType::FERMATA, parent, ElementFlag::MOVABLE | ElementFlag::ON_STAFF)
{
setPlacement(Placement::ABOVE);
setPlacement(PlacementV::ABOVE);
_symId = SymId::noSym;
_timeStretch = 1.0;
setPlay(true);
@ -285,7 +285,7 @@ bool Fermata::setProperty(Pid propertyId, const PropertyValue& v)
setSymId(v.value<SymId>());
break;
case Pid::PLACEMENT: {
Placement p = Placement(v.toInt());
PlacementV p = PlacementV(v.toInt());
if (p != placement()) {
QString s = SymNames::nameForSymId(_symId);
bool up = placeAbove();
@ -319,7 +319,7 @@ PropertyValue Fermata::propertyDefault(Pid propertyId) const
{
switch (propertyId) {
case Pid::PLACEMENT:
return int(track() & 1 ? Placement::BELOW : Placement::ABOVE);
return int(track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
case Pid::TIME_STRETCH:
return 1.0; // articulationList[int(articulationType())].timeStretch;
case Pid::PLAY:

View file

@ -54,7 +54,7 @@ static const ElementStyle fingeringStyle {
Fingering::Fingering(Note* parent, Tid tid, ElementFlags ef)
: TextBase(ElementType::FINGERING, parent, tid, ef)
{
setPlacement(Placement::ABOVE);
setPlacement(PlacementV::ABOVE);
initElementStyle(&fingeringStyle);
}
@ -83,11 +83,11 @@ ElementType Fingering::layoutType()
// calculatePlacement
//---------------------------------------------------------
Placement Fingering::calculatePlacement() const
PlacementV Fingering::calculatePlacement() const
{
Note* n = note();
if (!n) {
return Placement::ABOVE;
return PlacementV::ABOVE;
}
Chord* chord = n->chord();
Staff* staff = chord->staff();
@ -95,7 +95,7 @@ Placement Fingering::calculatePlacement() const
int nstaves = part->nstaves();
bool voices = chord->measure()->hasVoices(staff->idx(), chord->tick(), chord->actualTicks());
bool below = voices ? !chord->up() : (nstaves > 1) && (staff->rstaff() == nstaves - 1);
return below ? Placement::BELOW : Placement::ABOVE;
return below ? PlacementV::BELOW : PlacementV::ABOVE;
}
//---------------------------------------------------------

View file

@ -40,7 +40,7 @@ public:
Note* note() const { return toNote(parent()); }
ElementType layoutType();
Placement calculatePlacement() const;
PlacementV calculatePlacement() const;
void draw(mu::draw::Painter*) const override;
void layout() override;

View file

@ -2022,7 +2022,7 @@ const ParsedChord* Harmony::parsedForm()
void Harmony::setHarmonyType(HarmonyType val)
{
_harmonyType = val;
setPlacement(Placement(propertyDefault(Pid::PLACEMENT).toInt()));
setPlacement(PlacementV(propertyDefault(Pid::PLACEMENT).toInt()));
switch (_harmonyType) {
case HarmonyType::STANDARD:
initTid(Tid::HARMONY_A);

View file

@ -166,7 +166,7 @@ void InputState::update(Selection& selection)
}
articulationsIds = Ms::splitArticulations(articulationsIds);
articulationsIds = Ms::flipArticulations(articulationsIds, Ms::Placement::ABOVE);
articulationsIds = Ms::flipArticulations(articulationsIds, Ms::PlacementV::ABOVE);
for (const SymId& articulationSymbolId: articulationsIds) {
if (std::find(articulationSymbolIds.begin(), articulationSymbolIds.end(),
articulationSymbolId) == articulationSymbolIds.end()) {
@ -180,7 +180,7 @@ void InputState::update(Selection& selection)
for (Articulation* artic: n->chord()->articulations()) {
articulationsIds.insert(artic->symId());
}
articulationSymbolIds = Ms::flipArticulations(articulationsIds, Ms::Placement::ABOVE);
articulationSymbolIds = Ms::flipArticulations(articulationsIds, Ms::PlacementV::ABOVE);
n1 = n;
}

View file

@ -251,7 +251,7 @@ PropertyValue Jump::propertyDefault(Pid propertyId) const
case Pid::PLAY_REPEATS:
return false;
case Pid::PLACEMENT:
return int(Placement::ABOVE);
return int(PlacementV::ABOVE);
default:
break;
}

View file

@ -177,7 +177,7 @@ QVector<LineF> LineSegment::gripAnchorLines(Grip grip) const
} else {
const int stIdx = staffIdx();
y = system()->staffYpage(stIdx);
if (line()->placement() == Placement::BELOW) {
if (line()->placement() == PlacementV::BELOW) {
y += system()->staff(stIdx)->bbox().height();
}
// adjust Y to staffType offset

View file

@ -570,7 +570,7 @@ bool Lyrics::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::PLACEMENT:
setPlacement(Placement(v.toInt()));
setPlacement(PlacementV(v.toInt()));
break;
case Pid::SYLLABIC:
_syllabic = Syllabic(v.toInt());
@ -660,7 +660,7 @@ void Lyrics::undoChangeProperty(Pid id, const PropertyValue& v, PropertyFlags ps
if (l->no() == v.toInt()) {
// verse already exists, swap
l->TextBase::undoChangeProperty(id, no(), ps);
Placement p = l->placement();
PlacementV p = l->placement();
l->TextBase::undoChangeProperty(Pid::PLACEMENT, int(placement()), ps);
TextBase::undoChangeProperty(Pid::PLACEMENT, int(p), ps);
break;

View file

@ -41,7 +41,7 @@ namespace Ms {
// searchNextLyrics
//---------------------------------------------------------
static Lyrics* searchNextLyrics(Segment* s, int staffIdx, int verse, Placement p)
static Lyrics* searchNextLyrics(Segment* s, int staffIdx, int verse, PlacementV p)
{
Lyrics* l = 0;
while ((s = s->next1(SegmentType::ChordRest))) {

View file

@ -305,7 +305,7 @@ PropertyValue Marker::propertyDefault(Pid propertyId) const
case Pid::MARKER_TYPE:
return int(Type::FINE);
case Pid::PLACEMENT:
return int(Placement::ABOVE);
return int(PlacementV::ABOVE);
default:
break;
}

View file

@ -45,7 +45,7 @@ MeasureNumber::MeasureNumber(Measure* parent, Tid tid)
{
initElementStyle(&measureNumberStyle);
setHPlacement(score()->styleV(Sid::measureNumberHPlacement).value<HPlacement>());
setHPlacement(score()->styleV(Sid::measureNumberHPlacement).value<PlacementH>());
}
//---------------------------------------------------------

View file

@ -74,7 +74,7 @@ bool MeasureNumberBase::setProperty(Pid id, const PropertyValue& val)
{
switch (id) {
case Pid::HPLACEMENT:
setHPlacement(HPlacement(val.toInt()));
setHPlacement(PlacementH(val.toInt()));
setLayoutInvalid();
triggerLayout();
return true;
@ -152,7 +152,7 @@ void MeasureNumberBase::layout()
rypos() = yoff;
}
if (hPlacement() == HPlacement::CENTER) {
if (hPlacement() == PlacementH::CENTER) {
// measure numbers should be centered over where there can be notes.
// This means that header and trailing segments should be ignored,
// which includes all timesigs, clefs, keysigs, etc.
@ -193,7 +193,7 @@ void MeasureNumberBase::layout()
qreal x2 = s2 ? s2->x() - s2->minLeft() : mea->width();
rxpos() = (x1 + x2) * 0.5;
} else if (hPlacement() == HPlacement::RIGHT) {
} else if (hPlacement() == PlacementH::RIGHT) {
rxpos() = measure()->width();
}
}

View file

@ -34,8 +34,6 @@ namespace Ms {
class MeasureNumberBase : public TextBase
{
M_PROPERTY(HPlacement, hPlacement, setHPlacement) // Horizontal Placement
public:
MeasureNumberBase(const ElementType& type, Measure* parent = nullptr, Tid = Tid::DEFAULT);
MeasureNumberBase(const MeasureNumberBase& other);
@ -50,6 +48,12 @@ public:
Measure* measure() const { return toMeasure(parent()); }
bool isEditable() const override { return false; } // The measure numbers' text should not be editable
PlacementH hPlacement() const { return m_placementH; }
void setHPlacement(PlacementH p) { m_placementH = p; }
private:
PlacementH m_placementH = PlacementH::LEFT;
};
} // namespace Ms

View file

@ -114,7 +114,7 @@ void Ottava::setNumbersOnly(bool val)
// setPlacement
//---------------------------------------------------------
void Ottava::setPlacement(Placement p)
void Ottava::setPlacement(PlacementV p)
{
TextLineBase::setPlacement(p);
}
@ -212,7 +212,7 @@ Sid Ottava::getPropertyStyle(Pid pid) const
return ss[idx + 2]; // CONTINUE_TEXT
case Pid::END_HOOK_HEIGHT:
if (isStyled(Pid::PLACEMENT)) {
return score()->styleI(ss[idx]) == int(Placement::ABOVE) ? Sid::ottavaHookAbove : Sid::ottavaHookBelow;
return score()->styleI(ss[idx]) == int(PlacementV::ABOVE) ? Sid::ottavaHookAbove : Sid::ottavaHookBelow;
} else {
return placeAbove() ? Sid::ottavaHookAbove : Sid::ottavaHookBelow;
}

View file

@ -119,7 +119,7 @@ public:
bool numbersOnly() const { return _numbersOnly; }
void setNumbersOnly(bool val);
void setPlacement(Placement);
void setPlacement(PlacementV);
LineSegment* createLineSegment(System* parent) override;
int pitchShift() const;

View file

@ -399,7 +399,7 @@ bool Score::pasteStaff(XmlReader& e, Segment* dst, int dstStaff, Fraction scale)
EngravingItem* el = Factory::createItemByName(tag, this->dummy());
el->setTrack(e.track()); // a valid track might be necessary for el->read() to work
if (el->isFermata()) {
el->setPlacement(el->track() & 1 ? Placement::BELOW : Placement::ABOVE);
el->setPlacement(el->track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
}
el->read(e);
@ -434,7 +434,7 @@ bool Score::pasteStaff(XmlReader& e, Segment* dst, int dstStaff, Fraction scale)
Segment* segment = m->undoGetSegment(SegmentType::Breath, tick);
Breath* breath = Factory::createBreath(segment);
breath->setTrack(e.track());
breath->setPlacement(breath->track() & 1 ? Placement::BELOW : Placement::ABOVE);
breath->setPlacement(breath->track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
breath->read(e);
breath->setParent(segment);
undoChangeElement(segment->element(e.track()), breath);

View file

@ -186,8 +186,8 @@ static constexpr PropertyMetaData propertyList[] = {
{ Pid::SINGLE_NOTE_DYNAMICS, true, "singleNoteDynamics", P_TYPE::BOOL, DUMMY_QT_TR_NOOP("propertyName", "single note dynamics") },
{ Pid::CHANGE_METHOD, true, "changeMethod", P_TYPE::CHANGE_METHOD, DUMMY_QT_TR_NOOP("propertyName", "change method") }, // the new, more general version of VELO_CHANGE_METHOD
{ Pid::PLACEMENT, false, "placement", P_TYPE::PLACEMENT, DUMMY_QT_TR_NOOP("propertyName", "placement") },
{ Pid::HPLACEMENT, false, "hplacement", P_TYPE::HPLACEMENT, DUMMY_QT_TR_NOOP("propertyName", "horizontal placement") },
{ Pid::PLACEMENT, false, "placement", P_TYPE::PLACEMENT_V, DUMMY_QT_TR_NOOP("propertyName", "placement") },
{ Pid::HPLACEMENT, false, "hplacement", P_TYPE::PLACEMENT_H, DUMMY_QT_TR_NOOP("propertyName", "horizontal placement") },
{ Pid::MMREST_RANGE_BRACKET_TYPE, false, "mmrestRangeBracketType", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "multimeasure rest range bracket type") },
{ Pid::VELOCITY, false, "velocity", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "velocity") },
{ Pid::JUMP_TO, true, "jumpTo", P_TYPE::STRING, DUMMY_QT_TR_NOOP("propertyName", "jump to") },
@ -548,21 +548,21 @@ PropertyValue propertyFromString(Pid id, QString value)
}
}
break;
case P_TYPE::PLACEMENT: {
case P_TYPE::PLACEMENT_V: {
if (value == "above") {
return PropertyValue(int(Placement::ABOVE));
return PropertyValue(int(PlacementV::ABOVE));
} else if (value == "below") {
return PropertyValue(int(Placement::BELOW));
return PropertyValue(int(PlacementV::BELOW));
}
}
break;
case P_TYPE::HPLACEMENT: {
case P_TYPE::PLACEMENT_H: {
if (value == "left") {
return PropertyValue(int(HPlacement::LEFT));
return PropertyValue(int(PlacementH::LEFT));
} else if (value == "center") {
return PropertyValue(int(HPlacement::CENTER));
return PropertyValue(int(PlacementH::CENTER));
} else if (value == "right") {
return PropertyValue(int(HPlacement::RIGHT));
return PropertyValue(int(PlacementH::RIGHT));
}
}
break;
@ -687,8 +687,8 @@ PropertyValue readProperty(Pid id, XmlReader& e)
case P_TYPE::DIRECTION_H:
case P_TYPE::LAYOUT_BREAK:
case P_TYPE::VALUE_TYPE:
case P_TYPE::PLACEMENT:
case P_TYPE::HPLACEMENT:
case P_TYPE::PLACEMENT_V:
case P_TYPE::PLACEMENT_H:
case P_TYPE::TEXT_PLACE:
case P_TYPE::BARLINE_TYPE:
case P_TYPE::SYMID:
@ -838,21 +838,21 @@ QString propertyToString(Pid id, const PropertyValue& value, bool mscx)
return "user";
}
break;
case P_TYPE::PLACEMENT:
switch (Placement(value.toInt())) {
case Placement::ABOVE:
case P_TYPE::PLACEMENT_V:
switch (PlacementV(value.toInt())) {
case PlacementV::ABOVE:
return "above";
case Placement::BELOW:
case PlacementV::BELOW:
return "below";
}
break;
case P_TYPE::HPLACEMENT:
switch (HPlacement(value.toInt())) {
case HPlacement::LEFT:
case P_TYPE::PLACEMENT_H:
switch (PlacementH(value.toInt())) {
case PlacementH::LEFT:
return "left";
case HPlacement::CENTER:
case PlacementH::CENTER:
return "center";
case HPlacement::RIGHT:
case PlacementH::RIGHT:
return "right";
}
break;

View file

@ -4561,7 +4561,7 @@ QString Score::extractLyrics()
if (playCount >= int(cr->lyrics().size())) {
continue;
}
Lyrics* l = cr->lyrics(playCount, Placement::BELOW); // TODO: ABOVE
Lyrics* l = cr->lyrics(playCount, PlacementV::BELOW); // TODO: ABOVE
if (!l) {
continue;
}
@ -4596,7 +4596,7 @@ QString Score::extractLyrics()
if (lyricsNumber >= cr->lyrics().size()) {
continue;
}
Lyrics* l = cr->lyrics(lyricsNumber, Placement::BELOW); // TODO
Lyrics* l = cr->lyrics(lyricsNumber, PlacementV::BELOW); // TODO
if (!l) {
continue;
}

View file

@ -334,7 +334,7 @@ bool TextLine::setProperty(Pid id, const engraving::PropertyValue& v)
{
switch (id) {
case Pid::PLACEMENT:
setPlacement(Placement(v.toInt()));
setPlacement(PlacementV(v.toInt()));
break;
default:
return TextLineBase::setProperty(id, v);

View file

@ -301,7 +301,7 @@ void TextLineBaseSegment::layout()
_text->setStrike(tl->continueFontStyle() & FontStyle::Strike);
break;
}
_text->setPlacement(Placement::ABOVE);
_text->setPlacement(PlacementV::ABOVE);
_text->setTrack(track());
_text->layout();
@ -315,7 +315,7 @@ void TextLineBaseSegment::layout()
_endText->setItalic(tl->endFontStyle() & FontStyle::Italic);
_endText->setUnderline(tl->endFontStyle() & FontStyle::Underline);
_endText->setStrike(tl->endFontStyle() & FontStyle::Strike);
_endText->setPlacement(Placement::ABOVE);
_endText->setPlacement(PlacementV::ABOVE);
_endText->setTrack(track());
_endText->layout();
} else {

View file

@ -419,26 +419,6 @@ enum class HarmonyType {
///\}
};
//---------------------------------------------------------
// Placement
//---------------------------------------------------------
enum class Placement {
///.\{
ABOVE, BELOW
///\}
};
//---------------------------------------------------------
// HPlacement
//---------------------------------------------------------
enum class HPlacement {
///.\{
LEFT, CENTER, RIGHT
///\}
};
//---------------------------------------------------------
// MMRestRangeBracketType
//---------------------------------------------------------
@ -677,8 +657,6 @@ Q_ENUM_NS(ElementType);
Q_ENUM_NS(Direction);
Q_ENUM_NS(GlissandoType);
Q_ENUM_NS(GlissandoStyle);
Q_ENUM_NS(Placement);
Q_ENUM_NS(HPlacement);
Q_ENUM_NS(SegmentType);
Q_ENUM_NS(Tid);
Q_ENUM_NS(NoteType);
@ -708,7 +686,6 @@ Q_DECLARE_METATYPE(Ms::PlayEventType);
Q_DECLARE_METATYPE(Ms::AccidentalType);
Q_DECLARE_METATYPE(Ms::HPlacement);
Q_DECLARE_METATYPE(Ms::DynamicType)
#endif

View file

@ -100,7 +100,7 @@ EngravingItem* VoltaSegment::propertyDelegate(Pid pid)
Volta::Volta(EngravingItem* parent)
: TextLineBase(ElementType::VOLTA, parent, ElementFlag::SYSTEM)
{
setPlacement(Placement::ABOVE);
setPlacement(PlacementV::ABOVE);
initElementStyle(&voltaStyle);
setBeginTextPlace(PlaceText::BELOW);
@ -325,7 +325,7 @@ PropertyValue Volta::propertyDefault(Pid propertyId) const
return int(PlaceText::ABOVE);
case Pid::PLACEMENT:
return int(Placement::ABOVE);
return int(PlacementV::ABOVE);
default:
return TextLineBase::propertyDefault(propertyId);

View file

@ -108,11 +108,6 @@ PropertyValue::PropertyValue(Ms::HookType v)
{
}
PropertyValue::PropertyValue(Ms::HPlacement v)
: m_type(P_TYPE::HPLACEMENT), m_val(v)
{
}
PropertyValue::PropertyValue(const Ms::PitchValues& v)
: m_type(P_TYPE::PITCH_VALUES), m_val(v)
{
@ -223,8 +218,8 @@ QVariant PropertyValue::toQVariant() const
// draw
case P_TYPE::COLOR: return value<draw::Color>().toQColor();
case P_TYPE::ALIGN: return QVariant::fromValue(int(value<Align>()));
case P_TYPE::PLACEMENT: return static_cast<int>(value<Ms::Placement>());
case P_TYPE::HPLACEMENT: return static_cast<int>(value<Ms::HPlacement>());
case P_TYPE::PLACEMENT_V: return static_cast<int>(value<PlacementV>());
case P_TYPE::PLACEMENT_H: return static_cast<int>(value<PlacementH>());
case P_TYPE::DIRECTION: return QVariant::fromValue(value<Ms::Direction>());
case P_TYPE::DIRECTION_H: {
UNREACHABLE; //! TODO
@ -275,8 +270,8 @@ PropertyValue PropertyValue::fromQVariant(const QVariant& v, P_TYPE type)
// Layout
case P_TYPE::ALIGN: return PropertyValue(Align(v.toInt()));
case P_TYPE::PLACEMENT: return PropertyValue(Ms::Placement(v.toInt()));
case P_TYPE::HPLACEMENT: return PropertyValue(Ms::HPlacement(v.toInt()));
case P_TYPE::PLACEMENT_V: return PropertyValue(PlacementV(v.toInt()));
case P_TYPE::PLACEMENT_H: return PropertyValue(PlacementH(v.toInt()));
case P_TYPE::DIRECTION: return PropertyValue(Ms::Direction(v.toInt()));
case P_TYPE::DIRECTION_H: {
UNREACHABLE; //! TODO

View file

@ -69,8 +69,8 @@ enum class P_TYPE {
// Layout
ALIGN,
PLACEMENT, // ABOVE or BELOW
HPLACEMENT, // LEFT, CENTER or RIGHT
PLACEMENT_V, // ABOVE or BELOW
PLACEMENT_H, // LEFT, CENTER or RIGHT
DIRECTION, // enum class Direction
DIRECTION_H, // enum class MScore::DirectionH
@ -137,9 +137,10 @@ public:
// Layout
PropertyValue(Align v);
PropertyValue(Ms::HPlacement v);
PropertyValue(Ms::Placement v)
: m_type(P_TYPE::PLACEMENT), m_val(v) {}
PropertyValue(PlacementV v)
: m_type(P_TYPE::PLACEMENT_V), m_val(v) {}
PropertyValue(PlacementH v)
: m_type(P_TYPE::PLACEMENT_H), m_val(v) {}
PropertyValue(Ms::Direction v);
PropertyValue(Ms::SymId v);
@ -187,8 +188,8 @@ public:
if constexpr (std::is_same<T, int>::value) {
switch (m_type) {
case P_TYPE::ALIGN: return static_cast<int>(value<Align>());
case P_TYPE::HPLACEMENT: return static_cast<int>(value<Ms::HPlacement>());
case P_TYPE::PLACEMENT: return static_cast<int>(value<Ms::Placement>());
case P_TYPE::PLACEMENT_H: return static_cast<int>(value<PlacementH>());
case P_TYPE::PLACEMENT_V: return static_cast<int>(value<PlacementV>());
case P_TYPE::DIRECTION: return static_cast<int>(value<Ms::Direction>());
case P_TYPE::SYMID: return static_cast<int>(value<Ms::SymId>());
case P_TYPE::BARLINE_TYPE: return static_cast<int>(value<Ms::BarLineType>());
@ -298,7 +299,7 @@ private:
Color,
// Layout
Align, Ms::HPlacement, Ms::Placement, Ms::Direction,
Align, PlacementV, PlacementH, Ms::Direction,
// time
Ms::Fraction,

View file

@ -1711,7 +1711,7 @@ static void readMeasure(Measure* m, int staffIdx, XmlReader& e, ReadContext& ctx
Breath* breath = Factory::createBreath(segment);
breath->setTrack(e.track());
Fraction tick = e.tick();
breath->setPlacement(breath->track() & 1 ? Placement::BELOW : Placement::ABOVE);
breath->setPlacement(breath->track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
breath->read(e);
// older scores placed the breath segment right after the chord to which it applies
// rather than before the next chordrest segment with an element for the staff

View file

@ -124,7 +124,7 @@ void Read206::readTextStyle206(MStyle* style, XmlReader& e, std::map<QString, st
mu::draw::Color foregroundColor = mu::draw::Color::black;
mu::draw::Color backgroundColor = mu::draw::Color::transparent;
Placement placement = Placement::ABOVE;
PlacementV placement = PlacementV::ABOVE;
bool placementValid = false;
QString name = e.attribute("name");
@ -244,9 +244,9 @@ void Read206::readTextStyle206(MStyle* style, XmlReader& e, std::map<QString, st
} else if (tag == "placement") {
QString value(e.readElementText());
if (value == "above") {
placement = Placement::ABOVE;
placement = PlacementV::ABOVE;
} else if (value == "below") {
placement = Placement::BELOW;
placement = PlacementV::BELOW;
}
placementValid = true;
} else if (tag == "lineWidth") {
@ -892,22 +892,22 @@ static void adjustPlacement(EngravingItem* e)
qreal staffHeight = e->staff()->height();
qreal threshold = staffHeight;
qreal offsetAdjust = 0.0;
Placement defaultPlacement = Placement(e->propertyDefault(Pid::PLACEMENT).toInt());
Placement newPlacement;
PlacementV defaultPlacement = PlacementV(e->propertyDefault(Pid::PLACEMENT).toInt());
PlacementV newPlacement;
// most offsets will be recorded as relative to top staff line
// exceptions are styled offsets on elements with default placement below
qreal normalize;
if (defaultPlacement == Placement::BELOW && ee->propertyFlags(Pid::OFFSET) == PropertyFlags::STYLED) {
if (defaultPlacement == PlacementV::BELOW && ee->propertyFlags(Pid::OFFSET) == PropertyFlags::STYLED) {
normalize = staffHeight;
} else {
normalize = 0.0;
}
qreal ypos = ee->offset().y() + normalize;
if (ypos >= threshold) {
newPlacement = Placement::BELOW;
newPlacement = PlacementV::BELOW;
offsetAdjust -= staffHeight;
} else {
newPlacement = Placement::ABOVE;
newPlacement = PlacementV::ABOVE;
}
// set placement
@ -922,7 +922,7 @@ static void adjustPlacement(EngravingItem* e)
for (auto a : spanner->spannerSegments()) {
// spanner segments share the placement setting of the spanner
// just adjust offset
if (defaultPlacement == Placement::BELOW && a->propertyFlags(Pid::OFFSET) == PropertyFlags::STYLED) {
if (defaultPlacement == PlacementV::BELOW && a->propertyFlags(Pid::OFFSET) == PropertyFlags::STYLED) {
normalize = staffHeight;
} else {
normalize = 0.0;
@ -935,9 +935,9 @@ static void adjustPlacement(EngravingItem* e)
// disable autoplace
bool disableAutoplace;
if (yp + a->height() <= 0.0) {
disableAutoplace = (newPlacement == Placement::BELOW);
disableAutoplace = (newPlacement == PlacementV::BELOW);
} else if (yp > staffHeight) {
disableAutoplace = (newPlacement == Placement::ABOVE);
disableAutoplace = (newPlacement == PlacementV::ABOVE);
} else {
disableAutoplace = true;
}
@ -1517,7 +1517,7 @@ static void readLyrics(Lyrics* lyrics, XmlReader& e, const ReadContext& ctx)
//lyrics->ryoffset() -= lyrics->placeBelow() && lyrics->staff() ? lyrics->staff()->height() : 0.0;
// temporarily set placement to above, since the original offset is relative to top of staff
// depend on adjustPlacement() to change the placement if appropriate
lyrics->setPlacement(Placement::ABOVE);
lyrics->setPlacement(PlacementV::ABOVE);
adjustPlacement(lyrics);
}
}
@ -2207,19 +2207,19 @@ void Read206::readTextLine206(XmlReader& e, const ReadContext& ctx, TextLineBase
static void setFermataPlacement(EngravingItem* el, ArticulationAnchor anchor, Direction direction)
{
if (direction == Direction::UP) {
el->setPlacement(Placement::ABOVE);
el->setPlacement(PlacementV::ABOVE);
} else if (direction == Direction::DOWN) {
el->setPlacement(Placement::BELOW);
el->setPlacement(PlacementV::BELOW);
} else {
switch (anchor) {
case ArticulationAnchor::TOP_STAFF:
case ArticulationAnchor::TOP_CHORD:
el->setPlacement(Placement::ABOVE);
el->setPlacement(PlacementV::ABOVE);
break;
case ArticulationAnchor::BOTTOM_STAFF:
case ArticulationAnchor::BOTTOM_CHORD:
el->setPlacement(Placement::BELOW);
el->setPlacement(PlacementV::BELOW);
break;
case ArticulationAnchor::CHORD:
@ -2357,7 +2357,7 @@ EngravingItem* Read206::readArticulation(EngravingItem* parent, XmlReader& e, co
el->setProperty(Pid::TIME_STRETCH, timeStretch);
}
if (useDefaultPlacement) {
el->setPlacement(track & 1 ? Placement::BELOW : Placement::ABOVE);
el->setPlacement(track & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
} else {
setFermataPlacement(el, anchor, direction);
}
@ -2505,7 +2505,7 @@ static void readMeasure206(Measure* m, int staffIdx, XmlReader& e, ReadContext&
} else if (t == "Articulation") {
EngravingItem* el = Read206::readArticulation(bl, e, ctx);
if (el->isFermata()) {
if (el->placement() == Placement::ABOVE) {
if (el->placement() == PlacementV::ABOVE) {
fermataAbove = toFermata(el);
} else {
fermataBelow = toFermata(el);
@ -2592,7 +2592,7 @@ static void readMeasure206(Measure* m, int staffIdx, XmlReader& e, ReadContext&
} else if (tag == "Breath") {
Breath* breath = Factory::createBreath(ctx.dummy()->segment());
breath->setTrack(e.track());
breath->setPlacement(Placement::ABOVE);
breath->setPlacement(PlacementV::ABOVE);
Fraction tick = e.tick();
breath->read(e);
// older scores placed the breath segment right after the chord to which it applies
@ -3212,10 +3212,10 @@ static void readStyle206(MStyle* style, XmlReader& e, ReadChordListHook& readCho
} else if (tag == "harmonyY") {
qreal val = -e.readDouble();
if (val > 0.0) {
style->set(Sid::harmonyPlacement, int(Placement::BELOW));
style->set(Sid::harmonyPlacement, int(PlacementV::BELOW));
style->set(Sid::chordSymbolAPosBelow, PointF(.0, val));
} else {
style->set(Sid::harmonyPlacement, int(Placement::ABOVE));
style->set(Sid::harmonyPlacement, int(PlacementV::ABOVE));
style->set(Sid::chordSymbolAPosBelow, PointF(.0, val));
}
} else {

View file

@ -318,7 +318,7 @@ void MeasureRW::readVoice(Measure* measure, XmlReader& e, ReadContext& ctx, int
segment = measure->getSegment(SegmentType::Breath, e.tick());
Breath* breath = Factory::createBreath(segment);
breath->setTrack(e.track());
breath->setPlacement(breath->track() & 1 ? Placement::BELOW : Placement::ABOVE);
breath->setPlacement(breath->track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
breath->read(e);
segment->add(breath);
} else if (tag == "Spanner") {
@ -451,7 +451,7 @@ void MeasureRW::readVoice(Measure* measure, XmlReader& e, ReadContext& ctx, int
} else if (tag == "Fermata") {
fermata = Factory::createFermata(ctx.dummy());
fermata->setTrack(e.track());
fermata->setPlacement(fermata->track() & 1 ? Placement::BELOW : Placement::ABOVE);
fermata->setPlacement(fermata->track() & 1 ? PlacementV::BELOW : PlacementV::ABOVE);
fermata->read(e);
} else if (tag == "Image") {
if (MScore::noImages) {

View file

@ -156,8 +156,10 @@ bool MStyle::readProperties(XmlReader& e)
c.setAlpha(e.intAttribute("a", 255));
set(idx, c);
e.readElementText();
} else if (P_TYPE::HPLACEMENT == type) {
set(idx, Ms::HPlacement(e.readElementText().toInt()));
} else if (P_TYPE::PLACEMENT_V == type) {
set(idx, Ms::PlacementV(e.readElementText().toInt()));
} else if (P_TYPE::PLACEMENT_H == type) {
set(idx, Ms::PlacementH(e.readElementText().toInt()));
} else if (P_TYPE::HOOK_TYPE == type) {
set(idx, Ms::HookType(e.readElementText().toInt()));
} else {

View file

@ -62,7 +62,7 @@ public:
QString styleSt(Sid idx) const { Q_ASSERT(MStyle::valueType(idx) == mu::engraving::P_TYPE::STRING); return value(idx).toString(); }
bool styleB(Sid idx) const { Q_ASSERT(MStyle::valueType(idx) == mu::engraving::P_TYPE::BOOL); return value(idx).toBool(); }
qreal styleD(Sid idx) const { Q_ASSERT(MStyle::valueType(idx) == mu::engraving::P_TYPE::REAL); return value(idx).toReal(); }
int styleI(Sid idx) const { Q_ASSERT(MStyle::valueType(idx) == mu::engraving::P_TYPE::INT); return value(idx).toInt(); }
int styleI(Sid idx) const { /* can be int or enum, so no assert */ return value(idx).toInt(); }
const mu::engraving::PropertyValue& value(Sid idx) const;
Milimetre valueMM(Sid idx) const;

View file

@ -76,7 +76,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::maxAkkoladeDistance, "maxAkkoladeDistance", Spatium(6.5) },
{ Sid::maxPageFillSpread, "maxPageFillSpread", Spatium(6.0) },
{ Sid::lyricsPlacement, "lyricsPlacement", int(Placement::BELOW) },
{ Sid::lyricsPlacement, "lyricsPlacement", PlacementV::BELOW },
{ Sid::lyricsPosAbove, "lyricsPosAbove", PointF(0.0, -2.0) },
{ Sid::lyricsPosBelow, "lyricsPosBelow", PointF(.0, 3.0) },
{ Sid::lyricsMinTopDistance, "lyricsMinTopDistance", Spatium(1.0) },
@ -223,7 +223,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::articulationAnchorOther, "articulationAnchorOther", int(ArticulationAnchor::TOP_STAFF) },
{ Sid::lastSystemFillLimit, "lastSystemFillLimit", PropertyValue(0.3) },
{ Sid::hairpinPlacement, "hairpinPlacement", int(Placement::BELOW) },
{ Sid::hairpinPlacement, "hairpinPlacement", PlacementV::BELOW },
{ Sid::hairpinPosAbove, "hairpinPosAbove", PointF(0.0, -2.0) },
{ Sid::hairpinPosBelow, "hairpinPosBelow", PointF(.0, 2) },
{ Sid::hairpinLinePosAbove, "hairpinLinePosAbove", PointF(0.0, -3.0) },
@ -252,7 +252,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::hairpinLineStyle, "hairpinLineStyle", PropertyValue(static_cast<int>(mu::draw::PenStyle::SolidLine)) },
{ Sid::hairpinLineLineStyle, "hairpinLineLineStyle", PropertyValue(static_cast<int>(mu::draw::PenStyle::CustomDashLine)) },
{ Sid::pedalPlacement, "pedalPlacement", int(Placement::BELOW) },
{ Sid::pedalPlacement, "pedalPlacement", PlacementV::BELOW },
{ Sid::pedalPosAbove, "pedalPosAbove", PointF(.0, -1) },
{ Sid::pedalPosBelow, "pedalPosBelow", PointF(.0, 2.5) },
{ Sid::pedalLineWidth, "pedalLineWidth", Spatium(0.11) },
@ -273,11 +273,11 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::pedalFrameFgColor, "pedalFrameFgColor", draw::Color::black },
{ Sid::pedalFrameBgColor, "pedalFrameBgColor", draw::Color::transparent },
{ Sid::trillPlacement, "trillPlacement", int(Placement::ABOVE) },
{ Sid::trillPlacement, "trillPlacement", PlacementV::ABOVE },
{ Sid::trillPosAbove, "trillPosAbove", PointF(.0, -0.5) },
{ Sid::trillPosBelow, "trillPosBelow", PointF(.0, 2) },
{ Sid::vibratoPlacement, "vibratoPlacement", int(Placement::ABOVE) },
{ Sid::vibratoPlacement, "vibratoPlacement", PlacementV::ABOVE },
{ Sid::vibratoPosAbove, "vibratoPosAbove", PointF(.0, -1) },
{ Sid::vibratoPosBelow, "vibratoPosBelow", PointF(.0, 1) },
@ -287,9 +287,9 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::maxChordShiftAbove, "maxChordShiftAbove", Spatium(0.0) },
{ Sid::maxChordShiftBelow, "maxChordShiftBelow", Spatium(0.0) },
{ Sid::harmonyPlacement, "harmonyPlacement", int(Placement::ABOVE) },
{ Sid::romanNumeralPlacement, "romanNumeralPlacement", int(Placement::BELOW) },
{ Sid::nashvilleNumberPlacement, "nashvilleNumberPlacement", int(Placement::ABOVE) },
{ Sid::harmonyPlacement, "harmonyPlacement", PlacementV::ABOVE },
{ Sid::romanNumeralPlacement, "romanNumeralPlacement", PlacementV::BELOW },
{ Sid::nashvilleNumberPlacement, "nashvilleNumberPlacement", PlacementV::ABOVE },
{ Sid::harmonyPlay, "harmonyPlay", true },
{ Sid::harmonyVoiceLiteral, "harmonyVoiceLiteral", true },
{ Sid::harmonyVoicing, "harmonyVoicing", int(Voicing::AUTO) },
@ -369,7 +369,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::fretY, "fretY", Spatium(1.0) },
{ Sid::fretMinDistance, "fretMinDistance", Spatium(0.5) },
{ Sid::fretMag, "fretMag", PropertyValue(1.0) },
{ Sid::fretPlacement, "fretPlacement", int(Placement::ABOVE) },
{ Sid::fretPlacement, "fretPlacement", PlacementV::ABOVE },
{ Sid::fretStrings, "fretStrings", 6 },
{ Sid::fretFrets, "fretFrets", 5 },
{ Sid::fretNut, "fretNut", true },
@ -500,12 +500,12 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::voltaFrameFgColor, "voltaFrameFgColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::voltaFrameBgColor, "voltaFrameBgColor", PropertyValue::fromValue(draw::Color::transparent) },
{ Sid::ottava8VAPlacement, "ottava8VAPlacement", int(Placement::ABOVE) },
{ Sid::ottava8VBPlacement, "ottava8VBPlacement", int(Placement::BELOW) },
{ Sid::ottava15MAPlacement, "ottava15MAPlacement", int(Placement::ABOVE) },
{ Sid::ottava15MBPlacement, "ottava15MBPlacement", int(Placement::BELOW) },
{ Sid::ottava22MAPlacement, "ottava22MAPlacement", int(Placement::ABOVE) },
{ Sid::ottava22MBPlacement, "ottava22MBPlacement", int(Placement::BELOW) },
{ Sid::ottava8VAPlacement, "ottava8VAPlacement", PlacementV::ABOVE },
{ Sid::ottava8VBPlacement, "ottava8VBPlacement", PlacementV::BELOW },
{ Sid::ottava15MAPlacement, "ottava15MAPlacement", PlacementV::ABOVE },
{ Sid::ottava15MBPlacement, "ottava15MBPlacement", PlacementV::BELOW },
{ Sid::ottava22MAPlacement, "ottava22MAPlacement", PlacementV::ABOVE },
{ Sid::ottava22MBPlacement, "ottava22MBPlacement", PlacementV::BELOW },
{ Sid::ottava8VAText, "ottava8VAText", QString("<sym>ottavaAlta</sym>") },
{ Sid::ottava8VAContinueText, "ottava8VAContinueText", QString("<sym>ottavaAlta</sym>") },
@ -604,14 +604,14 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::autoplaceHairpinDynamicsDistance, "autoplaceHairpinDynamicsDistance", Spatium(0.5) },
{ Sid::dynamicsPlacement, "dynamicsPlacement", int(Placement::BELOW) },
{ Sid::dynamicsPlacement, "dynamicsPlacement", PlacementV::BELOW },
{ Sid::dynamicsPosAbove, "dynamicsPosAbove", PointF(.0, -1.5) },
{ Sid::dynamicsPosBelow, "dynamicsPosBelow", PointF(.0, 2.5) },
{ Sid::dynamicsMinDistance, "dynamicsMinDistance", Spatium(0.5) },
{ Sid::autoplaceVerticalAlignRange, "autoplaceVerticalAlignRange", int(VerticalAlignRange::SYSTEM) },
{ Sid::textLinePlacement, "textLinePlacement", int(Placement::ABOVE) },
{ Sid::textLinePlacement, "textLinePlacement", PlacementV::ABOVE },
{ Sid::textLinePosAbove, "textLinePosAbove", PointF(.0, -1.0) },
{ Sid::textLinePosBelow, "textLinePosBelow", PointF(.0, 1.0) },
{ Sid::textLineFrameType, "textLineFrameType", int(FrameType::NO_FRAME) },
@ -621,7 +621,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::textLineFrameFgColor, "textLineFrameFgColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::textLineFrameBgColor, "textLineFrameBgColor", PropertyValue::fromValue(draw::Color::transparent) },
{ Sid::systemTextLinePlacement, "systemTextLinePlacement", int(Placement::ABOVE) },
{ Sid::systemTextLinePlacement, "systemTextLinePlacement", PlacementV::ABOVE },
{ Sid::systemTextLinePosAbove, "systemTextLinePosAbove", PointF(.0, -1.0) },
{ Sid::systemTextLinePosBelow, "systemTextLinePosBelow", PointF(.0, 1.0) },
{ Sid::systemTextLineFrameType, "systemTextLineFrameType", int(FrameType::NO_FRAME) },
@ -843,7 +843,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::expressionFontStyle, "expressionFontStyle", int(FontStyle::Italic) },
{ Sid::expressionColor, "expressionColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::expressionAlign, "expressionAlign", PropertyValue::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::expressionPlacement, "expressionPlacement", int(Placement::BELOW) },
{ Sid::expressionPlacement, "expressionPlacement", PlacementV::BELOW },
{ Sid::expressionOffset, "expressionOffset", PointF(.0, 2.5) },
{ Sid::expressionFrameType, "expressionFrameType", int(FrameType::NO_FRAME) },
{ Sid::expressionFramePadding, "expressionFramePadding", 0.2 },
@ -860,7 +860,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::tempoColor, "tempoColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::tempoAlign, "tempoAlign", PropertyValue::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::tempoSystemFlag, "tempoSystemFlag", true },
{ Sid::tempoPlacement, "tempoPlacement", int(Placement::ABOVE) },
{ Sid::tempoPlacement, "tempoPlacement", PlacementV::ABOVE },
{ Sid::tempoPosAbove, "tempoPosAbove", PointF(.0, -2.0) },
{ Sid::tempoPosBelow, "tempoPosBelow", PointF(.0, 3.0) },
{ Sid::tempoMinDistance, "tempoMinDistance", Spatium(.5) },
@ -877,7 +877,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::metronomeFontSpatiumDependent, "metronomeFontSpatiumDependent", false },
{ Sid::metronomeFontStyle, "metronomeFontStyle", int(FontStyle::Normal) },
{ Sid::metronomeColor, "metronomeColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::metronomePlacement, "metronomePlacement", int(Placement::ABOVE) },
{ Sid::metronomePlacement, "metronomePlacement", PlacementV::ABOVE },
{ Sid::metronomeAlign, "metronomeAlign", PropertyValue::fromValue(Align::LEFT) },
{ Sid::metronomeOffset, "metronomeOffset", PointF() },
{ Sid::metronomeFrameType, "metronomeFrameType", int(FrameType::NO_FRAME) },
@ -896,8 +896,8 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::measureNumberPosAbove, "measureNumberOffset", PointF(0.0, -2.0) }, // This measureNumberOffset cannot be renamed to measureNumberPosAbove for backward compatibility
{ Sid::measureNumberPosBelow, "measureNumberPosBelow", PointF(0.0, 2.0) },
{ Sid::measureNumberOffsetType, "measureNumberOffsetType", int(OffsetType::SPATIUM) },
{ Sid::measureNumberVPlacement, "measureNumberVPlacement", int(Placement::ABOVE) },
{ Sid::measureNumberHPlacement, "measureNumberHPlacement", HPlacement::LEFT },
{ Sid::measureNumberVPlacement, "measureNumberVPlacement", PlacementV::ABOVE },
{ Sid::measureNumberHPlacement, "measureNumberHPlacement", PlacementH::LEFT },
{ Sid::measureNumberAlign, "measureNumberAlign", PropertyValue::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::measureNumberFrameType, "measureNumberFrameType", int(FrameType::NO_FRAME) },
{ Sid::measureNumberFramePadding, "measureNumberFramePadding", 0.2 },
@ -917,8 +917,8 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::mmRestRangePosAbove, "measureNumberPosAbove", PointF(0.0, -3.0) },
{ Sid::mmRestRangePosBelow, "measureNumberPosBelow", PointF(0.0, 1.0) },
{ Sid::mmRestRangeOffsetType, "mmRestRangeOffsetType", int(OffsetType::SPATIUM) },
{ Sid::mmRestRangeVPlacement, "mmRestRangeVPlacement", int(Placement::BELOW) },
{ Sid::mmRestRangeHPlacement, "mmRestRangeHPlacement", HPlacement::CENTER },
{ Sid::mmRestRangeVPlacement, "mmRestRangeVPlacement", PlacementV::BELOW },
{ Sid::mmRestRangeHPlacement, "mmRestRangeHPlacement", PlacementH::CENTER },
{ Sid::mmRestRangeAlign, "mmRestRangeAlign", PropertyValue::fromValue(Align::HCENTER | Align::BASELINE) },
{ Sid::mmRestRangeFrameType, "mmRestRangeFrameType", int(FrameType::NO_FRAME) },
{ Sid::mmRestRangeFramePadding, "mmRestRangeFramePadding", 0.2 },
@ -950,7 +950,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::systemTextColor, "systemTextColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::systemTextAlign, "systemAlign", PropertyValue::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::systemTextOffsetType, "systemOffsetType", int(OffsetType::SPATIUM) },
{ Sid::systemTextPlacement, "systemPlacement", int(Placement::ABOVE) },
{ Sid::systemTextPlacement, "systemPlacement", PlacementV::ABOVE },
{ Sid::systemTextPosAbove, "systemPosAbove", PointF(.0, -2.0) },
{ Sid::systemTextPosBelow, "systemPosBelow", PointF(.0, 3.5) },
{ Sid::systemTextMinDistance, "systemMinDistance", Spatium(0.5) },
@ -969,7 +969,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::staffTextColor, "staffTextColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::staffTextAlign, "staffAlign", PropertyValue::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::staffTextOffsetType, "systemOffsetType", int(OffsetType::SPATIUM) },
{ Sid::staffTextPlacement, "staffPlacement", int(Placement::ABOVE) },
{ Sid::staffTextPlacement, "staffPlacement", PlacementV::ABOVE },
{ Sid::staffTextPosAbove, "staffPosAbove", PointF(.0, -1.0) },
{ Sid::staffTextPosBelow, "staffPosBelow", PointF(.0, 2.5) },
{ Sid::staffTextMinDistance, "staffMinDistance", Spatium(0.5) },
@ -993,7 +993,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::rehearsalMarkFrameRound, "rehearsalMarkFrameRound", 0 },
{ Sid::rehearsalMarkFrameFgColor, "rehearsalMarkFrameFgColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::rehearsalMarkFrameBgColor, "rehearsalMarkFrameBgColor", PropertyValue::fromValue(draw::Color::transparent) },
{ Sid::rehearsalMarkPlacement, "rehearsalMarkPlacement", int(Placement::ABOVE) },
{ Sid::rehearsalMarkPlacement, "rehearsalMarkPlacement", PlacementV::ABOVE },
{ Sid::rehearsalMarkPosAbove, "rehearsalMarkPosAbove", PointF(.0, -3.0) },
{ Sid::rehearsalMarkPosBelow, "rehearsalMarkPosBelow", PointF(.0, 4.0) },
{ Sid::rehearsalMarkMinDistance, "rehearsalMarkMinDistance", Spatium(0.5) },
@ -1005,7 +1005,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::repeatLeftFontStyle, "repeatLeftFontStyle", int(FontStyle::Normal) },
{ Sid::repeatLeftColor, "repeatLeftColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::repeatLeftAlign, "repeatLeftAlign", PropertyValue::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::repeatLeftPlacement, "repeatLeftPlacement", int(Placement::ABOVE) },
{ Sid::repeatLeftPlacement, "repeatLeftPlacement", PlacementV::ABOVE },
{ Sid::repeatLeftFrameType, "repeatLeftFrameType", int(FrameType::NO_FRAME) },
{ Sid::repeatLeftFramePadding, "repeatLeftFramePadding", 0.2 },
{ Sid::repeatLeftFrameWidth, "repeatLeftFrameWidth", 0.1 },
@ -1020,7 +1020,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::repeatRightFontStyle, "repeatRightFontStyle", int(FontStyle::Normal) },
{ Sid::repeatRightColor, "repeatRightColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::repeatRightAlign, "repeatRightAlign", PropertyValue::fromValue(Align::RIGHT | Align::BASELINE) },
{ Sid::repeatRightPlacement, "repeatRightPlacement", int(Placement::ABOVE) },
{ Sid::repeatRightPlacement, "repeatRightPlacement", PlacementV::ABOVE },
{ Sid::repeatRightFrameType, "repeatRightFrameType", int(FrameType::NO_FRAME) },
{ Sid::repeatRightFramePadding, "repeatRightFramePadding", 0.2 },
{ Sid::repeatRightFrameWidth, "repeatRightFrameWidth", 0.1 },
@ -1133,7 +1133,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::instrumentChangeColor, "instrumentChangeColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::instrumentChangeAlign, "instrumentChangeAlign", PropertyValue::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::instrumentChangeOffset, "instrumentChangeOffset", PointF() },
{ Sid::instrumentChangePlacement, "instrumentChangePlacement", int(Placement::ABOVE) },
{ Sid::instrumentChangePlacement, "instrumentChangePlacement", PlacementV::ABOVE },
{ Sid::instrumentChangePosAbove, "instrumentChangePosAbove", PointF(.0, -2.0) },
{ Sid::instrumentChangePosBelow, "instrumentChangePosBelow", PointF(.0, 3.5) },
{ Sid::instrumentChangeMinDistance, "instrumentChangeMinDistance", Spatium(0.5) },
@ -1152,7 +1152,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::stickingColor, "stickingColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::stickingAlign, "stickingAlign", PropertyValue::fromValue(Align::LEFT | Align::BASELINE) },
{ Sid::stickingOffset, "stickingOffset", PointF() },
{ Sid::stickingPlacement, "stickingPlacement", int(Placement::BELOW) },
{ Sid::stickingPlacement, "stickingPlacement", PlacementV::BELOW },
{ Sid::stickingPosAbove, "stickingPosAbove", PointF(.0, -2.0) },
{ Sid::stickingPosBelow, "stickingPosBelow", PointF(.0, 2.0) },
{ Sid::stickingMinDistance, "stickingMinDistance", Spatium(0.5) },
@ -1382,7 +1382,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::letRingColor, "letRingColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::letRingTextAlign, "letRingTextAlign", PropertyValue::fromValue(Align::LEFT | Align::VCENTER) },
{ Sid::letRingHookHeight, "letRingHookHeight", Spatium(0.6) },
{ Sid::letRingPlacement, "letRingPlacement", int(Placement::BELOW) },
{ Sid::letRingPlacement, "letRingPlacement", PlacementV::BELOW },
{ Sid::letRingPosAbove, "letRingPosAbove", PointF(.0, 0.0) },
{ Sid::letRingPosBelow, "letRingPosBelow", PointF(.0, 0.0) },
{ Sid::letRingLineWidth, "letRingLineWidth", Spatium(0.15) },
@ -1405,7 +1405,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::palmMuteColor, "palmMuteColor", PropertyValue::fromValue(draw::Color::black) },
{ Sid::palmMuteTextAlign, "palmMuteTextAlign", PropertyValue::fromValue(Align::LEFT | Align::VCENTER) },
{ Sid::palmMuteHookHeight, "palmMuteHookHeight", Spatium(0.6) },
{ Sid::palmMutePlacement, "palmMutePlacement", int(Placement::BELOW) },
{ Sid::palmMutePlacement, "palmMutePlacement", PlacementV::BELOW },
{ Sid::palmMutePosAbove, "palmMutePosAbove", PointF(.0, -4.0) },
{ Sid::palmMutePosBelow, "palmMutePosBelow", PointF(.0, 4.0) },
{ Sid::palmMuteLineWidth, "palmMuteLineWidth", Spatium(0.15) },
@ -1424,7 +1424,7 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue
{ Sid::fermataPosBelow, "fermataPosBelow", PointF(.0, 0.5) },
{ Sid::fermataMinDistance, "fermataMinDistance", Spatium(0.4) },
{ Sid::fingeringPlacement, "fingeringPlacement", int(Placement::ABOVE) },
{ Sid::fingeringPlacement, "fingeringPlacement", PlacementV::ABOVE },
{ Sid::articulationMinDistance, "articulationMinDistance", Spatium(0.5) },
{ Sid::fingeringMinDistance, "fingeringMinDistance", Spatium(0.5) },

View file

@ -66,8 +66,8 @@ using Color = draw::Color; // P_TYPE::COLOR
/// `if ((static_cast<char>(align()) & static_cast<char>(Align::VMASK)) == Align::Top) { doSomething(); }`
/// Same applies to Align::Left.
//---------------------------------------------------------
enum class Align : char { // P_TYPE::ALIGN
// P_TYPE::ALIGN
enum class Align : char {
///.\{
LEFT = 0,
RIGHT = 1,
@ -96,11 +96,23 @@ constexpr Align operator~(Align a)
{
return static_cast<Align>(~static_cast<char>(a));
}
}
// P_TYPE::PLACEMENT_V
enum class PlacementV {
ABOVE, BELOW
};
// P_TYPE::PLACEMENT_H
enum class PlacementH {
LEFT, CENTER, RIGHT
};
} // mu::engraving
//! NOTE compat
namespace Ms {
using Align = mu::engraving::Align;
using PlacementV = mu::engraving::PlacementV;
using PlacementH = mu::engraving::PlacementH;
}
#endif // MU_ENGRAVING_TYPES_H

View file

@ -48,28 +48,28 @@ TEST_F(DynamicTests, test1)
Dynamic* d;
dynamic->setPlacement(Placement::ABOVE);
dynamic->setPlacement(PlacementV::ABOVE);
dynamic->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
d = toDynamic(ScoreRW::writeReadElement(dynamic));
EXPECT_EQ(d->placement(), Placement::ABOVE);
EXPECT_EQ(d->placement(), PlacementV::ABOVE);
delete d;
dynamic->setPlacement(Placement::BELOW);
dynamic->setPlacement(PlacementV::BELOW);
dynamic->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
d = static_cast<Dynamic*>(ScoreRW::writeReadElement(dynamic));
EXPECT_EQ(d->placement(), Placement::BELOW);
EXPECT_EQ(d->placement(), PlacementV::BELOW);
delete d;
dynamic->setProperty(Pid::PLACEMENT, int(Placement::ABOVE));
dynamic->setProperty(Pid::PLACEMENT, int(PlacementV::ABOVE));
dynamic->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
d = static_cast<Dynamic*>(ScoreRW::writeReadElement(dynamic));
EXPECT_EQ(d->placement(), Placement::ABOVE);
EXPECT_EQ(d->placement(), PlacementV::ABOVE);
delete d;
dynamic->setProperty(Pid::PLACEMENT, int(Placement::BELOW));
dynamic->setProperty(Pid::PLACEMENT, int(PlacementV::BELOW));
dynamic->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
d = static_cast<Dynamic*>(ScoreRW::writeReadElement(dynamic));
EXPECT_EQ(d->placement(), Placement::BELOW);
EXPECT_EQ(d->placement(), PlacementV::BELOW);
delete d;
dynamic->setVelocity(23);

View file

@ -497,22 +497,22 @@ TEST_F(MeasureTests, measureNumbers)
MeasureNumber* measureNumber = new MeasureNumber(score->dummy()->measure());
// horizontal placement
measureNumber->setHPlacement(HPlacement::CENTER);
measureNumber->setHPlacement(PlacementH::CENTER);
measureNumber->setPropertyFlags(Pid::HPLACEMENT, PropertyFlags::UNSTYLED);
MeasureNumber* mn = static_cast<MeasureNumber*>(ScoreRW::writeReadElement(measureNumber));
EXPECT_EQ(mn->hPlacement(), HPlacement::CENTER);
EXPECT_EQ(mn->hPlacement(), PlacementH::CENTER);
delete mn;
// Place measure numbers below
score->startCmd();
score->undo(new ChangeStyleVal(score, Sid::measureNumberVPlacement, int(Placement::BELOW)));
score->undo(new ChangeStyleVal(score, Sid::measureNumberVPlacement, int(PlacementV::BELOW)));
score->setLayoutAll();
score->endCmd();
EXPECT_TRUE(ScoreComp::saveCompareScore(score, "measurenumber-1.mscx", MEASURE_DATA_DIR + "measurenumber-1-ref.mscx"));
// center measure numbers
score->startCmd();
score->undo(new ChangeStyleVal(score, Sid::measureNumberHPlacement, int(HPlacement::CENTER)));
score->undo(new ChangeStyleVal(score, Sid::measureNumberHPlacement, int(PlacementH::CENTER)));
score->setLayoutAll();
score->endCmd();
EXPECT_TRUE(ScoreComp::saveCompareScore(score, "measurenumber-2.mscx", MEASURE_DATA_DIR + "measurenumber-2-ref.mscx"));

View file

@ -1852,7 +1852,7 @@ QString ExportMusicXml::fermataPosition(const Fermata* const fermata)
static void fermata(const Fermata* const a, XmlWriter& xml)
{
QString tagName = "fermata";
tagName += QString(" type=\"%1\"").arg(a->placement() == Placement::ABOVE ? "upright" : "inverted");
tagName += QString(" type=\"%1\"").arg(a->placement() == PlacementV::ABOVE ? "upright" : "inverted");
tagName += ExportMusicXml::fermataPosition(a);
tagName += color2xml(a);
SymId id = a->symId();
@ -3271,8 +3271,8 @@ static void writeFingering(XmlWriter& xml, Notations& notations, Technical& tech
technical.tag(xml);
QString t = MScoreTextToMXML::toPlainText(f->xmlText());
QString attr;
if (!f->isStyled(Pid::PLACEMENT) || f->placement() == Placement::BELOW) {
attr = QString(" placement=\"%1\"").arg((f->placement() == Placement::BELOW) ? "below" : "above");
if (!f->isStyled(Pid::PLACEMENT) || f->placement() == PlacementV::BELOW) {
attr = QString(" placement=\"%1\"").arg((f->placement() == PlacementV::BELOW) ? "below" : "above");
}
if (!f->isStyled(Pid::FONT_FACE)) {
attr += QString(" font-family=\"%1\"").arg(f->getProperty(Pid::FONT_FACE).toString());
@ -3959,14 +3959,14 @@ static void directionTag(XmlWriter& xml, Attributes& attr, EngravingItem const*
// actual position info is in the segments
// compare the segment's canvas ypos with the staff's center height
// if (seg->pagePos().y() < sys->pagePos().y() + bb.y() + bb.height() / 2)
if (el->placement() == Placement::ABOVE) {
if (el->placement() == PlacementV::ABOVE) {
tagname += " placement=\"above\"";
} else {
tagname += " placement=\"below\"";
}
} else if (el->isDynamic()) {
tagname += " placement=\"";
tagname += el->placement() == Placement::ABOVE ? "above" : "below";
tagname += el->placement() == PlacementV::ABOVE ? "above" : "below";
tagname += "\"";
} else {
/*
@ -3975,7 +3975,7 @@ static void directionTag(XmlWriter& xml, Attributes& attr, EngravingItem const*
bb.y(), bb.height());
*/
// if (el->y() + el->height() / 2 < /*bb.y() +*/ bb.height() / 2)
if (el->placement() == Placement::ABOVE) {
if (el->placement() == PlacementV::ABOVE) {
tagname += " placement=\"above\"";
} else {
tagname += " placement=\"below\"";
@ -4277,7 +4277,7 @@ void ExportMusicXml::tempoText(TempoText const* const text, int staff)
qPrintable(text->xmlText()));
*/
_attr.doAttr(_xml, false);
_xml.startObject(QString("direction placement=\"%1\"").arg((text->placement() == Placement::BELOW) ? "below" : "above"));
_xml.startObject(QString("direction placement=\"%1\"").arg((text->placement() == PlacementV::BELOW) ? "below" : "above"));
wordsMetrome(_xml, _score, text, offset);
if (staff) {
@ -5053,7 +5053,7 @@ static void directionJump(XmlWriter& xml, const Jump* const jp)
}
if (sound != "") {
xml.startObject(QString("direction placement=\"%1\"").arg((jp->placement() == Placement::BELOW) ? "below" : "above"));
xml.startObject(QString("direction placement=\"%1\"").arg((jp->placement() == PlacementV::BELOW) ? "below" : "above"));
xml.startObject("direction-type");
QString positioning = ExportMusicXml::positioningAttributes(jp);
if (type != "") {
@ -5180,7 +5180,7 @@ static void directionMarker(XmlWriter& xml, const Marker* const m, const std::ve
}
if (sound != "") {
xml.startObject(QString("direction placement=\"%1\"").arg((m->placement() == Placement::BELOW) ? "below" : "above"));
xml.startObject(QString("direction placement=\"%1\"").arg((m->placement() == PlacementV::BELOW) ? "below" : "above"));
xml.startObject("direction-type");
QString positioning = ExportMusicXml::positioningAttributes(m);
if (type != "") {

View file

@ -111,7 +111,7 @@ static std::shared_ptr<mu::iex::musicxml::IMusicXmlConfiguration> configuration(
//---------------------------------------------------------
MusicXmlTupletDesc::MusicXmlTupletDesc()
: type(MxmlStartStop::NONE), placement(Placement::BELOW),
: type(MxmlStartStop::NONE), placement(PlacementV::BELOW),
bracket(TupletBracketType::AUTO_BRACKET), shownumber(TupletNumberType::SHOW_NUMBER)
{
// nothing
@ -882,7 +882,7 @@ static void addElemOffset(EngravingItem* el, int track, const QString& placement
return;
}
el->setPlacement(placement == "above" ? Placement::ABOVE : Placement::BELOW);
el->setPlacement(placement == "above" ? PlacementV::ABOVE : PlacementV::BELOW);
el->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
el->setTrack(el->isTempoText() ? 0 : track); // TempoText must be in track 0
@ -1050,7 +1050,7 @@ static void addFermataToChord(const Notation& notation, ChordRest* cr)
na->setSymId(articSym);
na->setTrack(cr->track());
if (!direction.isNull()) { // Only for case where XML attribute is present (isEmpty wouldn't work)
na->setPlacement(direction == "inverted" ? Placement::BELOW : Placement::ABOVE);
na->setPlacement(direction == "inverted" ? PlacementV::BELOW : PlacementV::ABOVE);
}
setElementPropertyFlags(na, Pid::PLACEMENT, direction);
if (cr->segment() == nullptr && cr->isGrace()) {
@ -1230,7 +1230,7 @@ static void addTextToNote(int l, int c, QString txt, QString placement, QString
t->setPropertyFlags(Pid::FONT_STYLE, PropertyFlags::UNSTYLED);
}
if (!placement.isEmpty()) {
t->setPlacement(placement == "below" ? Placement::BELOW : Placement::ABOVE);
t->setPlacement(placement == "below" ? PlacementV::BELOW : PlacementV::ABOVE);
t->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
}
note->add(t);
@ -1252,7 +1252,7 @@ static void addTextToNote(int l, int c, QString txt, QString placement, QString
static void setSLinePlacement(SLine* sli, const QString placement)
{
sli->setPlacement(placement == "above" ? Placement::ABOVE : Placement::BELOW);
sli->setPlacement(placement == "above" ? PlacementV::ABOVE : PlacementV::BELOW);
sli->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
}
@ -2582,7 +2582,7 @@ void MusicXMLParserDirection::direction(const QString& partId,
}
t->setXmlText(_rehearsalText);
if (!_hasDefaultY) {
t->setPlacement(Placement::ABOVE); // crude way to force placement TODO improve ?
t->setPlacement(PlacementV::ABOVE); // crude way to force placement TODO improve ?
t->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
}
}

View file

@ -72,7 +72,7 @@ enum class MusicXmlSlash : char {
struct MusicXmlTupletDesc {
MusicXmlTupletDesc();
MxmlStartStop type;
Placement placement;
PlacementV placement;
TupletBracketType bracket;
TupletNumberType shownumber;
};

View file

@ -1615,7 +1615,7 @@ bool NotationInteraction::notesHaveActiculation(const std::vector<Note*>& notes,
Chord* chord = note->chord();
std::set<SymbolId> chordArticulations = chord->articulationSymbolIds();
chordArticulations = Ms::flipArticulations(chordArticulations, Ms::Placement::ABOVE);
chordArticulations = Ms::flipArticulations(chordArticulations, Ms::PlacementV::ABOVE);
chordArticulations = Ms::splitArticulations(chordArticulations);
if (chordArticulations.find(articulationSymbolId) == chordArticulations.end()) {
@ -3179,7 +3179,7 @@ void NotationInteraction::nextLyrics(bool back, bool moveOnly, bool end)
int track = lyrics->track();
Ms::Segment* segment = lyrics->segment();
int verse = lyrics->no();
Ms::Placement placement = lyrics->placement();
Ms::PlacementV placement = lyrics->placement();
Ms::PropertyFlags pFlags = lyrics->propertyFlags(Ms::Pid::PLACEMENT);
Ms::Segment* nextSegment = segment;
@ -3302,7 +3302,7 @@ void NotationInteraction::nextSyllable()
int track = lyrics->track();
Ms::Segment* segment = lyrics->segment();
int verse = lyrics->no();
Ms::Placement placement = lyrics->placement();
Ms::PlacementV placement = lyrics->placement();
Ms::PropertyFlags pFlags = lyrics->propertyFlags(Ms::Pid::PLACEMENT);
// search next chord
@ -3397,7 +3397,7 @@ void NotationInteraction::nextLyricsVerse(bool back)
int track = lyrics->track();
ChordRest* cr = lyrics->chordRest();
int verse = lyrics->no();
Ms::Placement placement = lyrics->placement();
Ms::PlacementV placement = lyrics->placement();
Ms::PropertyFlags pFlags = lyrics->propertyFlags(Ms::Pid::PLACEMENT);
if (back) {
@ -3448,7 +3448,7 @@ void NotationInteraction::addMelisma()
int track = lyrics->track();
Ms::Segment* segment = lyrics->segment();
int verse = lyrics->no();
Ms::Placement placement = lyrics->placement();
Ms::PlacementV placement = lyrics->placement();
Ms::PropertyFlags pFlags = lyrics->propertyFlags(Ms::Pid::PLACEMENT);
Fraction endTick = segment->tick(); // a previous melisma cannot extend beyond this point

View file

@ -419,7 +419,7 @@ std::set<SymbolId> NoteInputBarModel::resolveCurrentArticulations() const
result.insert(articulation->symId());
}
result = Ms::flipArticulations(result, Ms::Placement::ABOVE);
result = Ms::flipArticulations(result, Ms::PlacementV::ABOVE);
return Ms::splitArticulations(result);
};

View file

@ -475,8 +475,8 @@ EditStyle::EditStyle(QWidget* parent)
for (QComboBox* cb : verticalPlacementComboBoxes) {
cb->clear();
cb->addItem(tr("Above"), int(Ms::Placement::ABOVE));
cb->addItem(tr("Below"), int(Ms::Placement::BELOW));
cb->addItem(tr("Above"), int(Ms::PlacementV::ABOVE));
cb->addItem(tr("Below"), int(Ms::PlacementV::BELOW));
}
horizontalPlacementComboBoxes = {
@ -486,9 +486,9 @@ EditStyle::EditStyle(QWidget* parent)
for (QComboBox* cb : horizontalPlacementComboBoxes) {
cb->clear();
cb->addItem(tr("Left"), int(Ms::HPlacement::LEFT));
cb->addItem(tr("Center"), int(Ms::HPlacement::CENTER));
cb->addItem(tr("Right"), int(Ms::HPlacement::RIGHT));
cb->addItem(tr("Left"), int(Ms::PlacementH::LEFT));
cb->addItem(tr("Center"), int(Ms::PlacementH::CENTER));
cb->addItem(tr("Right"), int(Ms::PlacementH::RIGHT));
}
mmRestRangeBracketType->clear();
@ -1498,8 +1498,8 @@ void EditStyle::setValues()
}
}
} break;
case P_TYPE::HPLACEMENT:
case P_TYPE::PLACEMENT:
case P_TYPE::PLACEMENT_H:
case P_TYPE::PLACEMENT_V:
case P_TYPE::BARLINE_TYPE:
case P_TYPE::HOOK_TYPE:
case P_TYPE::DYNAMIC_TYPE:

View file

@ -1009,7 +1009,7 @@ PalettePtr PaletteCreator::newLinesPalette()
ottava = makeElement<Ottava>(gpaletteScore);
ottava->setOttavaType(OttavaType::OTTAVA_8VB);
ottava->setLen(w);
ottava->setPlacement(Placement::BELOW);
ottava->setPlacement(PlacementV::BELOW);
ottava->styleChanged();
sp->appendElement(ottava, QT_TRANSLATE_NOOP("palette", "8va bassa"));
@ -1022,7 +1022,7 @@ PalettePtr PaletteCreator::newLinesPalette()
ottava = makeElement<Ottava>(gpaletteScore);
ottava->setOttavaType(OttavaType::OTTAVA_15MB);
ottava->setLen(w);
ottava->setPlacement(Placement::BELOW);
ottava->setPlacement(PlacementV::BELOW);
ottava->styleChanged();
sp->appendElement(ottava, QT_TRANSLATE_NOOP("palette", "15ma bassa"));
@ -1034,7 +1034,7 @@ PalettePtr PaletteCreator::newLinesPalette()
ottava = makeElement<Ottava>(gpaletteScore);
ottava->setOttavaType(OttavaType::OTTAVA_22MB);
ottava->setPlacement(Placement::BELOW);
ottava->setPlacement(PlacementV::BELOW);
ottava->setLen(w);
ottava->styleChanged();
sp->appendElement(ottava, QT_TRANSLATE_NOOP("palette", "22ma bassa"));
@ -1241,7 +1241,7 @@ PalettePtr PaletteCreator::newTextPalette(bool defaultPalette)
st = makeElement<StaffText>(gpaletteScore);
st->setTid(Tid::EXPRESSION);
st->setXmlText(QT_TRANSLATE_NOOP("palette", "Expression"));
st->setPlacement(Placement::BELOW);
st->setPlacement(PlacementV::BELOW);
st->setPropertyFlags(Pid::PLACEMENT, PropertyFlags::UNSTYLED);
sp->appendElement(st, QT_TRANSLATE_NOOP("palette", "Expression text"))->setElementTranslated(true);

View file

@ -44,6 +44,13 @@ enum class Align : char {
};
Q_ENUM_NS(Align);
//! NOTE just Placement for compatibility
enum class Placement {
ABOVE = int(mu::engraving::PlacementV::ABOVE),
BELOW = int(mu::engraving::PlacementV::BELOW),
};
Q_ENUM_NS(Placement);
//! HACK to force the build system to run moc on this file
class Mops : public QObject
{
@ -52,5 +59,6 @@ class Mops : public QObject
}
Q_DECLARE_METATYPE(Ms::PluginAPI::Align);
Q_DECLARE_METATYPE(Ms::PluginAPI::Placement);
#endif // MU_PLUGINS_APITYPES_H

View file

@ -124,7 +124,7 @@ class PluginAPI : public Ms::QmlPlugin
/// Contains Ms::Placement enumeration values
/// \note In MuseScore 2.X this enumeration was available as
/// EngravingItem.ABOVE and EngravingItem.BELOW.
DECLARE_API_ENUM(Placement, placementEnum, Ms::Placement)
DECLARE_API_ENUM(Placement, placementEnum, Ms::PluginAPI::Placement)
/// Contains Ms::GlissandoType enumeration values
DECLARE_API_ENUM(Glissando, glissandoTypeEnum, Ms::GlissandoType) // was probably absent in 2.X
/// Contains Ms::LayoutBreak::Type enumeration values