Skip to content

Commit

Permalink
Add an option to separate layout of similarly stemmed voices
Browse files Browse the repository at this point in the history
  • Loading branch information
miiizen committed Jun 5, 2024
1 parent e65e963 commit 5a0e2a0
Show file tree
Hide file tree
Showing 19 changed files with 250 additions and 97 deletions.
13 changes: 10 additions & 3 deletions src/engraving/dom/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ Chord::Chord(Segment* parent)
m_playEventType = PlayEventType::Auto;
m_spaceLw = 0.;
m_spaceRw = 0.;
m_crossMeasure = CrossMeasure::UNKNOWN;
m_graceIndex = 0;
m_crossMeasure = CrossMeasure::UNKNOWN;
m_graceIndex = 0;
m_combineVoice = true;
}

Chord::Chord(const Chord& c, bool link)
Expand Down Expand Up @@ -316,7 +317,8 @@ Chord::Chord(const Chord& c, bool link)
m_playEventType = c.m_playEventType;
m_stemDirection = c.m_stemDirection;
m_noteType = c.m_noteType;
m_crossMeasure = CrossMeasure::UNKNOWN;
m_crossMeasure = CrossMeasure::UNKNOWN;
m_combineVoice = c.m_combineVoice;

if (c.m_stem) {
add(Factory::copyStem(*(c.m_stem)));
Expand Down Expand Up @@ -2101,6 +2103,7 @@ PropertyValue Chord::getProperty(Pid propertyId) const
case Pid::SMALL: return isSmall();
case Pid::STEM_DIRECTION: return PropertyValue::fromValue<DirectionV>(stemDirection());
case Pid::PLAY: return isChordPlayable();
case Pid::COMBINE_VOICE: return combineVoice();
default:
return ChordRest::getProperty(propertyId);
}
Expand All @@ -2118,6 +2121,7 @@ PropertyValue Chord::propertyDefault(Pid propertyId) const
case Pid::SMALL: return false;
case Pid::STEM_DIRECTION: return PropertyValue::fromValue<DirectionV>(DirectionV::AUTO);
case Pid::PLAY: return true;
case Pid::COMBINE_VOICE: return true;
default:
return ChordRest::propertyDefault(propertyId);
}
Expand Down Expand Up @@ -2145,6 +2149,9 @@ bool Chord::setProperty(Pid propertyId, const PropertyValue& v)
case Pid::PLAY:
setIsChordPlayable(v.toBool());
break;
case Pid::COMBINE_VOICE:
setCombineVoice(v.toBool());
break;
default:
return ChordRest::setProperty(propertyId, v);
}
Expand Down
6 changes: 6 additions & 0 deletions src/engraving/dom/chord.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ class Chord final : public ChordRest
double spaceRw() { return m_spaceRw; }
void setSpaceRw(double rw) { m_spaceRw = rw; }

bool combineVoice() const { return m_combineVoice; }
void setCombineVoice(bool v) { m_combineVoice = v; }
inline static bool combineVoice(const Chord* chord1, const Chord* chord2) { return chord1->combineVoice() && chord2->combineVoice(); }

PlayEventType playEventType() const { return m_playEventType; }
void setPlayEventType(PlayEventType v) { m_playEventType = v; }
std::vector<NoteEventList> getNoteEventLists();
Expand Down Expand Up @@ -390,6 +394,8 @@ class Chord final : public ChordRest
bool m_allowKerningAbove = true;
bool m_allowKerningBelow = true;

bool m_combineVoice = true;

std::vector<Articulation*> m_articulations;
};
} // namespace mu::engraving
Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ static constexpr PropertyMetaData propertyList[] = {
{ Pid::MIRROR_HEAD, false, "mirror", P_TYPE::DIRECTION_H, PropertyGroup::POSITION, DUMMY_QT_TR_NOOP("propertyName", "mirror") },
{ Pid::HEAD_HAS_PARENTHESES, true , "parentheses", P_TYPE::BOOL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "parentheses") },
{ Pid::DOT_POSITION, false, "dotPosition", P_TYPE::DIRECTION_V, PropertyGroup::POSITION, DUMMY_QT_TR_NOOP("propertyName", "dot position") },
{ Pid::COMBINE_VOICE, true, "combineVoice", P_TYPE::BOOL, PropertyGroup::POSITION, DUMMY_QT_TR_NOOP("propertyName", "combine voice") },
{ Pid::TUNING, false, "tuning", P_TYPE::REAL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "tuning") },
{ Pid::PAUSE, true, "pause", P_TYPE::REAL, PropertyGroup::APPEARANCE, DUMMY_QT_TR_NOOP("propertyName", "pause") },

Expand Down
1 change: 1 addition & 0 deletions src/engraving/dom/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ enum class Pid {
MIRROR_HEAD,
HEAD_HAS_PARENTHESES,
DOT_POSITION,
COMBINE_VOICE,
TUNING,
PAUSE,

Expand Down
Loading

0 comments on commit 5a0e2a0

Please sign in to comment.