applying Normal barline won't remove pre-existing barline.

• Mar 6, 2017 - 22:07
Reported version
3.0
Type
Functional
Severity
S4 - Minor
Status
closed
Project

This is on 3.0-dev c231be2 but not on 2.1 or 2.0.3:

  1. have any barline other than NORMAL
  2. drop a NORMAL barline onto the measure before that barline (or ontop of that barline)

Observe that the barline remains as was before.


Comments

The problem is that when ScoreView::dropEvent() gets invoked, dragElement is set to a Barline of type UNKNOWN (0) when it should be of type NORMAL (1). I'm looking into this now...

in ScoreView::dragEnterEvent(), Element* el = Element::create(type, score()); is producing a BarLine element of type UNKNOWN when it should be NORMAL...

Actually that is fine. But the problem is that dragElement->read(e); is not reading the barline type as NORMAL.

Now there is also the problem that dropping a NORMAL barline onto a START_REPEAT barline is not doing anything...most likely the drop logic is not taking into account the fact that the START_REPEAT barline is the first segment of the *next* measure.

That's because BarLine::drop() is not actually performing any flag updating, since both if blocks are ignored:

            Measure* m  = segment()->measure();
            if (segment()->isEndBarLineType()) {
                  if (st == BarLineType::START_REPEAT) {
                        if (m->nextMeasureMM())
                              score()->undoChangeBarLine(m->nextMeasureMM(), st);
                        }
                  else
                        score()->undoChangeBarLine(m, st);
                  }
            else if (segment()->isBeginBarLineType())
                  score()->undoChangeBarLine(m, st);

I believe that:

else if (segment()->isBeginBarLineType())

needs to be changed into:

else if (segment()->isBeginBarLineType() || segment()->isStartRepeatBarLineType())

well not quite.

Anyway, it seems I would want to remove the start repeat from the beginning of that measure. Questions becomes if the START_REPEAT drop target is actually part of an END_START_REPEAT which straddle a line break...then I would say to remove it. But of course if there are linked parts that aren't straddling a line break, then would want to take special care to convert them all into an END_REPEAT. I'll take a look at this some more tomorrow.

one thing I noticed is that there is not symettric behavior between the following actions when an END_START_REPEAT straddles a newline:

1. dropping a NORMAL barline on the END_REPEAT element will remove both the END_REPEAT and START_REPEAT.

2. dropping a NORMAL barline on the START_REPEAT element will remove the START_REPEAT but will leave the END_REPEAT intact.

I don't want to call this behavior "wrong" but I think it would be better to have it symmetric, such that (1.) would only remove the END_REPEAT but leave the START_REPEAT intact.

Anyway, I will make test case, but I'm not going to QVERIFY that (1.) removes the START_REPEAT nor that (2.) would leave the END_REPEAT intact. I don't want to enforce that behavior just yet...

I changed the behaviour as you suggested. In addition if there is a end-start-repeat barline:
- if you drop a normal barline onto the end-start-repeat its replaced by a normal barline
- if you drop a normal barline onto the measure, the end-start-repeat is replaced by a start-repeat

Thanks. I made a PR https://github.com/musescore/MuseScore/pull/3043 which added the following verification to the mtest if an END_START_REPEAT straddles a newline:
1. dropping a NORMAL barline on the END_REPEAT will turn the END_REPEAT into NORMAL, but keep the START_REPEAT.
2. dropping a NORMAL barline on the START_REPEAT will remove the START_REPEAT, but keep the END_REPEAT.

note that:

- if you drop a normal barline onto the end-start-repeat its replaced by a normal barline

behavior was already present in your prior commit and that the mtest already had covered that.

But I am not going to have the mtest verify the following behavior just yet:

- if you drop a normal barline onto the measure, the end-start-repeat is replaced by a start-repeat

The reason I don't like it is because the user sees *one* selectable element (the END_START_REPEAT) and would think that element would be replaced with the one that is being dragged from the palette: the NORMAL barline. But the behavior you set has that element being turned into a different element. Although I do like one positive aspect of your behavior, which is the that the behavior would be consistent across parts and main score regardless of the presence of line/page breaks. So I'm undecided.

Anyway, I found some separate issues.