Skip to content

Commit

Permalink
fix #40846: require Ctrl+drag to create staff-only barline change
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcSabatella committed Dec 6, 2014
1 parent e76f2c7 commit d3b8157
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions libmscore/barline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,17 +575,17 @@ Element* BarLine::drop(const DropData& data)
return 0;
}

//parent is a segment
// parent is a segment
Measure* m = static_cast<Segment*>(parent())->measure();

// check if the new property can apply to this single bar line
bool oldRepeat = (barLineType() == BarLineType::START_REPEAT || barLineType() == BarLineType::END_REPEAT
|| barLineType() == BarLineType::END_START_REPEAT);
bool newRepeat = (bl->barLineType() == BarLineType::START_REPEAT || bl->barLineType() == BarLineType::END_REPEAT
|| bl->barLineType() == BarLineType::END_START_REPEAT);
// if repeats are not involved or drop refers to span rather than subtype =>
// if ctrl was used and repeats are not involved,
// or if drop refers to span rather than subtype =>
// single bar line drop
if( (!oldRepeat && !newRepeat) || (bl->spanFrom() != 0 || bl->spanTo() != DEFAULT_BARLINE_TO) ) {
if (((data.modifiers & Qt::ControlModifier) && !oldRepeat && !newRepeat) || (bl->spanFrom() != 0 || bl->spanTo() != DEFAULT_BARLINE_TO) ) {
// if drop refers to span, update this bar line span
if(bl->spanFrom() != 0 || bl->spanTo() != DEFAULT_BARLINE_TO) {
// if dropped spanFrom or spanTo are below the middle of standard staff (5 lines)
Expand All @@ -595,7 +595,7 @@ Element* BarLine::drop(const DropData& data)
int spanTo = bl->spanTo() > 4 ? bottomSpan - (8 - bl->spanTo()) : bl->spanTo();
score()->undoChangeSingleBarLineSpan(this, 1, spanFrom, spanTo);
}
// if drop refer to subtype, update this bar line subtype
// if drop refers to subtype, update this bar line subtype
else {
// score()->undoChangeBarLine(m, bl->barLineType());
score()->undoChangeProperty(this, P_ID::SUBTYPE, int(bl->barLineType()));
Expand All @@ -612,7 +612,9 @@ Element* BarLine::drop(const DropData& data)
return 0;
}
}
m->drop(data);
score()->undoChangeBarLine(m, bl->barLineType());
delete e;
return 0;
}
else if (type == Element::Type::ARTICULATION) {
Articulation* atr = static_cast<Articulation*>(e);
Expand Down
3 changes: 2 additions & 1 deletion libmscore/measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,8 @@ qDebug("drop staffList");
{
BarLine* bl = static_cast<BarLine*>(e);
// if dropped bar line refers to span rather than to subtype
if (bl->spanFrom() != 0 && bl->spanTo() != DEFAULT_BARLINE_TO) {
// or if Ctrl key used
if ((bl->spanFrom() != 0 && bl->spanTo() != DEFAULT_BARLINE_TO) || (data.modifiers & Qt::ControlModifier)) {
// get existing bar line for this staff, and drop the change to it
Segment* seg = undoGetSegment(Segment::Type::EndBarLine, tick() + ticks());
BarLine* cbl = static_cast<BarLine*>(seg->element(staffIdx * VOICES));
Expand Down

0 comments on commit d3b8157

Please sign in to comment.