@@ -763,6 +763,15 @@ TextBase* Score::addText(TextStyleType type, EngravingItem* destinationElement)
763763 chordRest->undoAddAnnotation (textBox);
764764 break ;
765765 }
766+ case TextStyleType::DYNAMICS: {
767+ ChordRest* chordRest = chordOrRest (destinationElement);
768+ if (!chordRest) {
769+ break ;
770+ }
771+ textBox = Factory::createDynamic (dummy ()->segment ());
772+ chordRest->undoAddAnnotation (textBox);
773+ break ;
774+ }
766775 case TextStyleType::EXPRESSION: {
767776 ChordRest* chordRest = chordOrRest (destinationElement);
768777 if (!chordRest) {
@@ -955,15 +964,6 @@ TextBase* Score::addText(TextStyleType type, EngravingItem* destinationElement)
955964 undoAddElement (textBox);
956965 break ;
957966 }
958- case TextStyleType::DYNAMICS: {
959- ChordRest* chordRest = chordOrRest (destinationElement);
960- if (!chordRest) {
961- break ;
962- }
963- textBox = Factory::createDynamic (dummy ()->segment ());
964- chordRest->undoAddAnnotation (textBox);
965- break ;
966- }
967967 case TextStyleType::HARP_PEDAL_DIAGRAM:
968968 case TextStyleType::HARP_PEDAL_TEXT_DIAGRAM: {
969969 ChordRest* chordRest = getSelectedChordRest ();
@@ -2459,6 +2459,38 @@ void Score::cmdFlip()
24592459 }
24602460}
24612461
2462+ void Score::cmdFlipHorizontally ()
2463+ {
2464+ const std::vector<EngravingItem*>& el = selection ().elements ();
2465+ if (el.empty ()) {
2466+ MScore::setError (MsError::NO_FLIPPABLE_SELECTED);
2467+ return ;
2468+ }
2469+
2470+ std::set<const EngravingItem*> alreadyFlippedElements;
2471+ auto flipOnce = [&alreadyFlippedElements](const EngravingItem* element, std::function<void ()> flipFunction) -> void {
2472+ if (alreadyFlippedElements.insert (element).second ) {
2473+ flipFunction ();
2474+ }
2475+ };
2476+
2477+ for (EngravingItem* e : el) {
2478+ if (e->isHairpinSegment ()) {
2479+ e = toHairpinSegment (e)->hairpin ();
2480+ }
2481+ if (e->isHairpin ()) {
2482+ Hairpin* h = toHairpin (e);
2483+ flipOnce (h, [h] {
2484+ if (h->hairpinType () == HairpinType::CRESC_HAIRPIN) {
2485+ h->undoChangeProperty (Pid::HAIRPIN_TYPE, int (HairpinType::DECRESC_HAIRPIN));
2486+ } else if (h->hairpinType () == HairpinType::DECRESC_HAIRPIN) {
2487+ h->undoChangeProperty (Pid::HAIRPIN_TYPE, int (HairpinType::CRESC_HAIRPIN));
2488+ }
2489+ });
2490+ }
2491+ }
2492+ }
2493+
24622494// ---------------------------------------------------------
24632495// deleteItem
24642496// ---------------------------------------------------------
0 commit comments