Skip to content

Commit

Permalink
Merge pull request #4659 from MarcSabatella/279178-flip-hairpin
Browse files Browse the repository at this point in the history
fix #279178: commands for flip/mirror hairpin
  • Loading branch information
anatoly-os committed Feb 19, 2019
1 parent 1167316 commit e141f98
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
25 changes: 23 additions & 2 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2303,8 +2303,8 @@ Element* Score::selectMove(const QString& cmd)
void Score::cmdMirrorNoteHead()
{
const QList<Element*>& el = selection().elements();
foreach(Element* e, el) {
if (e->type() == ElementType::NOTE) {
for (Element* e : el) {
if (e->isNote()) {
Note* note = toNote(e);
if (note->staff() && note->staff()->isTabStaff(note->chord()->tick()))
e->undoChangeProperty(Pid::GHOST, !note->ghost());
Expand All @@ -2317,6 +2317,27 @@ void Score::cmdMirrorNoteHead()
undoChangeUserMirror(note, d);
}
}
else if (e->isHairpinSegment()) {
Hairpin* h = toHairpinSegment(e)->hairpin();
HairpinType st = h->hairpinType();
switch (st) {
case HairpinType::CRESC_HAIRPIN:
st = HairpinType::DECRESC_HAIRPIN;
break;
case HairpinType::DECRESC_HAIRPIN:
st = HairpinType::CRESC_HAIRPIN;
break;
case HairpinType::CRESC_LINE:
st = HairpinType::DECRESC_LINE;
break;
case HairpinType::DECRESC_LINE:
st = HairpinType::CRESC_LINE;
break;
case HairpinType::INVALID:
break;
}
h->undoChangeProperty(Pid::HAIRPIN_TYPE, int(st));
}
}
}

Expand Down
22 changes: 1 addition & 21 deletions libmscore/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1387,27 +1387,6 @@ void Score::cmdFlip()
slurTieSegment->undoChangeProperty(Pid::SLUR_DIRECTION, QVariant::fromValue<Direction>(dir));
});
}
else if (e->isHairpinSegment()) {
Hairpin* h = toHairpinSegment(e)->hairpin();
HairpinType st = h->hairpinType();
switch (st) {
case HairpinType::CRESC_HAIRPIN:
st = HairpinType::DECRESC_HAIRPIN;
break;
case HairpinType::DECRESC_HAIRPIN:
st = HairpinType::CRESC_HAIRPIN;
break;
case HairpinType::CRESC_LINE:
st = HairpinType::DECRESC_LINE;
break;
case HairpinType::DECRESC_LINE:
st = HairpinType::CRESC_LINE;
break;
case HairpinType::INVALID:
break;
}
h->undoChangeProperty(Pid::HAIRPIN_TYPE, int(st));
}
else if (e->isArticulation()) {
auto articulation = toArticulation(e);
flipOnce(articulation, [articulation](){
Expand Down Expand Up @@ -1448,6 +1427,7 @@ void Score::cmdFlip()
|| e->isStaffText()
|| e->isDynamic()
|| e->isHairpin()
|| e->isHairpinSegment()
|| e->isOttavaSegment()
|| e->isTextLineSegment()
|| e->isPedalSegment()
Expand Down

0 comments on commit e141f98

Please sign in to comment.