@@ -257,15 +257,13 @@ void System::adjustStavesNumber(int nstaves)
257
257
// systemNamesWidth
258
258
// ---------------------------------------------------------
259
259
260
- qreal System::systemNamesWidth (bool getTotalWidth) {
260
+ qreal System::systemNamesWidth ()
261
+ {
261
262
qreal instrumentNameOffset = score ()->styleP (Sid::instrumentNameOffset);
262
263
263
264
qreal namesWidth = 0.0 ;
264
265
265
266
for (const Part* part : score ()->parts ()) {
266
- if (!getTotalWidth && firstVisibleSysStaffOfPart (part) < 0 ) {
267
- continue ;
268
- }
269
267
for (int staffIdx = firstSysStaffOfPart (part); staffIdx <= lastSysStaffOfPart (part); ++staffIdx) {
270
268
SysStaff* staff = this ->staff (staffIdx);
271
269
if (!staff) {
@@ -287,7 +285,8 @@ qreal System::systemNamesWidth(bool getTotalWidth) {
287
285
// layoutBrackets
288
286
// ---------------------------------------------------------
289
287
290
- qreal System::layoutBrackets (const LayoutContext& ctx) {
288
+ qreal System::layoutBrackets (const LayoutContext& ctx)
289
+ {
291
290
int nstaves = _staves.size ();
292
291
int columns = getBracketsColumnsCount ();
293
292
@@ -340,7 +339,8 @@ qreal System::layoutBrackets(const LayoutContext& ctx) {
340
339
// totalBracketOffset
341
340
// ---------------------------------------------------------
342
341
343
- qreal System::totalBracketOffset (const LayoutContext& ctx) {
342
+ qreal System::totalBracketOffset (const LayoutContext& ctx)
343
+ {
344
344
bool hideEmptyStaves = score ()->styleB (Sid::hideEmptyStaves);
345
345
score ()->setStyleValue (Sid::hideEmptyStaves, false );
346
346
@@ -368,7 +368,7 @@ void System::layoutSystem(const LayoutContext& ctx, qreal xo1, const bool isFirs
368
368
// ---------------------------------------------------
369
369
// find x position of staves
370
370
// ---------------------------------------------------
371
- qreal maxNamesWidth = systemNamesWidth (true );
371
+ qreal maxNamesWidth = systemNamesWidth ();
372
372
373
373
if (isFirstSystem && firstSystemIndent) {
374
374
maxNamesWidth = qMax (maxNamesWidth, styleP (Sid::firstSystemIndentationValue) * mag ());
@@ -377,8 +377,17 @@ void System::layoutSystem(const LayoutContext& ctx, qreal xo1, const bool isFirs
377
377
qreal maxBracketsWidth = totalBracketOffset (ctx);
378
378
qreal bracketsWidth = layoutBrackets (ctx);
379
379
qreal bracketWidthDifference = maxBracketsWidth - bracketsWidth;
380
- _leftMargin = maxNamesWidth + bracketWidthDifference + instrumentNameOffset;
381
- qreal nameOffset = _leftMargin - bracketsWidth - instrumentNameOffset;
380
+ qreal nameOffset = 0.0 ;
381
+ if (maxNamesWidth == 0.0 ) {
382
+ if (score ()->styleB (Sid::alignSystemToMargin)) {
383
+ _leftMargin = bracketWidthDifference;
384
+ } else {
385
+ _leftMargin = maxBracketsWidth;
386
+ }
387
+ } else {
388
+ _leftMargin = maxNamesWidth + bracketWidthDifference + instrumentNameOffset;
389
+ nameOffset = _leftMargin - bracketsWidth - instrumentNameOffset;
390
+ }
382
391
383
392
int nVisible = 0 ;
384
393
for (int staffIdx = 0 ; staffIdx < nstaves; ++staffIdx) {
0 commit comments