Show a dialog on adding instrument change, add instrument change only once for range selection

This commit is contained in:
Josh Wood 2019-06-02 15:13:53 +02:00 committed by Dmitri Ovodok
parent 81767df2f9
commit 26b5977a8a
4 changed files with 12 additions and 0 deletions

View file

@ -217,6 +217,7 @@ class Element : public ScoreElement {
void setPlacement(Placement val) { setFlag(ElementFlag::PLACE_ABOVE, !bool(val)); }
bool placeAbove() const { return placement() == Placement::ABOVE; }
bool placeBelow() const { return placement() == Placement::BELOW; }
virtual bool placeMultiple() const { return true; }
bool generated() const { return flag(ElementFlag::GENERATED); }
void setGenerated(bool val) { setFlag(ElementFlag::GENERATED, val); }

View file

@ -45,6 +45,8 @@ class InstrumentChange final : public TextBase {
Segment* segment() const { return toSegment(parent()); }
virtual QVariant propertyDefault(Pid) const override;
virtual bool placeMultiple() const override { return false; }
};

View file

@ -570,6 +570,9 @@ void ScoreView::dropEvent(QDropEvent* event)
}
Element* dropElement = el->drop(editData);
if (dropElement && dropElement->isInstrumentChange()) {
mscore->currentScoreView()->selectInstrument(toInstrumentChange(dropElement));
}
_score->addRefresh(el->canvasBoundingRect());
if (dropElement) {
if (!_score->noteEntryMode())

View file

@ -467,6 +467,9 @@ static void applyDrop(Score* score, ScoreView* viewer, Element* target, Element*
dropData.dropElement->styleChanged(); // update to local style
Element* el = target->drop(dropData);
if (el && el->isInstrumentChange()) {
mscore->currentScoreView()->selectInstrument(toInstrumentChange(el));
}
if (el && !viewer->noteEntryMode())
score->select(el, SelectType::SINGLE, 0);
dropData.dropElement = 0;
@ -722,6 +725,7 @@ bool Palette::applyPaletteElement(Element* element, Qt::KeyboardModifiers modifi
int track2 = sel.staffEnd() * VOICES;
Segment* startSegment = sel.startSegment();
Segment* endSegment = sel.endSegment(); //keep it, it could change during the loop
for (Segment* s = startSegment; s && s != endSegment; s = s->next1()) {
for (int track = track1; track < track2; ++track) {
Element* e = s->element(track);
@ -738,6 +742,8 @@ bool Palette::applyPaletteElement(Element* element, Qt::KeyboardModifiers modifi
applyDrop(score, viewer, e, element, modifiers);
}
}
if (!element->placeMultiple())
break;
}
}
}