I'll take the issue http://musescore.org/en/node/30941 as an example (but other examples exist and more or less anybody met this anomaly once) and specifically the sample score posted in the thread last comment ( http://musescore.org/en/node/30941#comment-129056 ):
I think (part of?) the problem resides in the *Score::layoutSystem()* function (file libmscore/layout.cpp); it uses *Measure::minWidth1()* and *Measure::minWidth2()* to compute the measure width, accumulate them into a total width and stop when the system width is exceeded. A measure might require courtesy elements after itself (clef, key sig., time sig.), if system-final, but obviously does not if not system-final. Occasionally, the bare width of the measure does fit in the system, but the width of the measure + court. elements does not. This happens with measure 7 of the sample score quoted above. *Measure::minWidth1()* and *Measure::minWidth2()* do not take any cautionary / courtesy element at the end of the system into account to compute the measure width; nor should they, as these functions are agnostic about the context the measure is in. Also *Score::layoutSystem()* does not look for courtesy elements: it only accumulates measure bare widths against the total system width. Courtesy elements are added afterwards by *Score::layoutSystemRow()*, once *Score::layoutSystem()* returns. At this point, the measures belonging to the systems are defined and *Score::layoutSystemRow()* 'squeezes' courtesy elements in, without noticing this exceeds the system width. At next layout, the system final courtesy elements will be there and will be accounted for, resulting in the last system measure being moved to the next system (which in turns removes the courtesy elements, no longer needed)... and so on... I see two possible strategies: 1) *Score::layoutSystem()* checks for potential courtesy elements before adding another measure to the system. 2) *Score::layoutSystemRow()* checks for available room before adding the courtesy elements it sees needed and removes the last system measure if they do not fit. Any suggestion? Anyone volunteering to pick up the task? Thanks, M. -- View this message in context: http://dev-list.musescore.org/On-ping-pong-ing-layout-tp7578972.html Sent from the MuseScore Developer mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Mscore-developer mailing list Mscore-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mscore-developer