"Width" of Special Barlines

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

"Width" of Special Barlines

Martin Marris

When I change default barlines to special barlines, at a certain point (after applying, say, a dozen special barlines on a range of contiguous bars) the score will reformat (the number of measures on each system will change).

 

For the sake of the argument let's say we do this:

 

sys = score.SystemStaff;

for i = 1 to (sys.NumBars + 1)

     {

     bar = sys.NthBar(i);

     bar.AddSpecialBarline(SpecialBarlineInvisible);

     }

 

This works fine: all the barlines become invisible. But the score layout has completely changed. So apparently these “special barlines” have more “width” than default barlines and this triggers the automatic respacing. The reformatting happens even if you change the barline type in the above code snippet to SpecialBarlineNormal which is pretty strange when you think about it.

 

The reformatting can be prevented if you do Select All and then Layout => Lock Format beforehand. But there doesn’t seem to be a way to lock the score format in ManuScript, it has to be done by the user. (I think the most that can be done in ManuScript is to add system breaks and page breaks if they are missing; but this doesn’t prevent a reformatting.)

 

Interestingly, if instead of applying special barlines “barline by barline,” you go into Engraving Rules/Barlines and change the global default barline to (for instance) Invisible, there is no reformatting of the measure breaks in the score. So it really does seem that only “changes of barline” have “width” in these scenarios.

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev
Reply | Threaded
Open this post in threaded view
|

Re: "Width" of Special Barlines

Bob Zawalich

None of this really surprises me. Though I can’t really justify what is happening. But be aware that when you create a barline, either in the UI or in a plugin you are adding a SpecialBarline object in the system staff. Even when using the Special Normal barline, which is notorious for breaking multirests.

 

Changing the default barline is different – it does not add a special barline object it just changes a property in the underlying barline property.

 

You should really only use Special Normal if the underlying default barline is not Normal; otherwise you delete any added Special Barline to get back to the default barline.

 

My guess is that all special barlines have the same width, and it is the width of the widest one, like a start or end repeat barline. And empirically, as you have discovered, adding a barline object takes up some additional space.

 

So the question becomes: is there anything to do about it.

 

Here is a block of code I have used to lock format. I note that this particular code works on a per-system basis, where I have gathered the start and end bar numbers for each system on a page, and have already figure out if a system is the last one on a page.

 

Ignoring all that, you can see that it sets the breaktype to  MiddleOfSystem if it had been Default.

 

I can’t remember why I don’t change anything  on the last bar on a page, but I am sure that I am doing what I am doing here intentionally. Ah, looking into it, I see that I handle the last bar on a page separately so I do not overwrite an explicit user Page Break with the internal page break type. So you should assume that this is handled elsewhere and that the last bar on a page with have some form of End of Page break.

 

This code is from the download page plugin Reset Spacing in Score and Parts in Engravers Tools. Look there to see the full context.

 

            DoLockFormat "(score, iSystem, arrSysFirst, arrSysLast, fLastSystemOnPage) {

if (dlg_fLockFormat = False)

{

            return False;

}

 

barnumFirst = 0 + arrSysFirst[iSystem];

barnumLast = 0 + arrSysLast[iSystem];

 

sysStaff = score.SystemStaff;

for barnum = barnumFirst to (barnumLast + 1)

{

            bar = sysStaff.NthBar(barnum);

            if (barnum = barnumLast) // end of system or page

            {

                        if (fLastSystemOnPage = False)

                        {

                                    bar.BreakType = EndOfSystem; // special lockformat setting

                        }

            }

            else

            {

                        if (bar.BreakType = Default)

                        {

                                    bar.BreakType = MiddleOfSystem;

                        }

            }

}

}"

 

 

If I select a small score and do Lock Format at the UI, I see

 

bar1 break type: Middle Of System (1) split multirest: false

bar2 break type: Middle Of System (1) split multirest: false

bar3 break type: Middle Of System (1) split multirest: false

bar4 break type: End of System (2) split multirest: false

 

bar5 break type: Middle Of System (1) split multirest: false

bar6 break type: Middle Of System (1) split multirest: false

bar7 break type: Middle Of System (1) split multirest: false

bar8 break type: End of System (2) split multirest: false

 

bar9 break type: Middle Of System (1) split multirest: false

bar10 break type: Middle Of System (1) split multirest: false

bar11 break type: Middle Of System (1) split multirest: false

bar12 break type: End of System (2) split multirest: false

 

bar13 break type: Middle Of System (1) split multirest: false

bar14 break type: Middle Of System (1) split multirest: false

bar15 break type: Middle Of System (1) split multirest: false

bar16 break type: End of System (2) split multirest: false

 

bar17 break type: Middle Of System (1) split multirest: false

bar18 break type: Middle Of System (1) split multirest: false

bar19 break type: Middle Of System (1) split multirest: false

bar20 break type: End Of Page (4) split multirest: false

 

 

All the bars at the end of a system are End of System, the one at the end of the page is End Of Page, and the others are Middle of System. So that is consistent with what I have. And it does explain why I do the locking system by system, because the key is the EndOfSystem breaks.

 

Hope that helps

 

Bob

 

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Marris
Sent: Monday, October 19, 2015 8:03 PM
To: 'A mailing list for Sibelius plug-in developers'
Subject: [Plugin-dev] "Width" of Special Barlines

 

When I change default barlines to special barlines, at a certain point (after applying, say, a dozen special barlines on a range of contiguous bars) the score will reformat (the number of measures on each system will change).

 

For the sake of the argument let's say we do this:

 

sys = score.SystemStaff;

for i = 1 to (sys.NumBars + 1)

     {

     bar = sys.NthBar(i);

     bar.AddSpecialBarline(SpecialBarlineInvisible);

     }

 

This works fine: all the barlines become invisible. But the score layout has completely changed. So apparently these “special barlines” have more “width” than default barlines and this triggers the automatic respacing. The reformatting happens even if you change the barline type in the above code snippet to SpecialBarlineNormal which is pretty strange when you think about it.

 

The reformatting can be prevented if you do Select All and then Layout => Lock Format beforehand. But there doesn’t seem to be a way to lock the score format in ManuScript, it has to be done by the user. (I think the most that can be done in ManuScript is to add system breaks and page breaks if they are missing; but this doesn’t prevent a reformatting.)

 

Interestingly, if instead of applying special barlines “barline by barline,” you go into Engraving Rules/Barlines and change the global default barline to (for instance) Invisible, there is no reformatting of the measure breaks in the score. So it really does seem that only “changes of barline” have “width” in these scenarios.

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev
Reply | Threaded
Open this post in threaded view
|

Re: "Width" of Special Barlines

Martin Marris

Thanks Bob, that is very helpful.

 

I had in fact already written code to “Lock Format” which did almost exactly the same thing as your code, but left out one crucial bit. Namely, I had not understood the purpose of the “MiddleOfSystem” bar “break” type and therefore hadn’t bothered to use it. Now that I’ve added it to my code, it’s working perfectly. So this is my version, which is “standalone” (doesn’t require any values to be passed to it). All it does is lock the entire score. It has no error-handling mechanism and will probably fail when presented with certain cases – this is something I don’t have to worry about here because I am using it only on known, selected scores.

 

score = Sibelius.ActiveScore;

score.Redraw = false;

sys = score.SystemStaff;

for i = 2 to (sys.NumBars + 1)

     {

     bar = sys.NthBar(i);

     previousbar = sys.NthBar(bar.BarNumber-1);

     currentpage = bar.OnNthPage;

     if (bar.NthBarInSystem = 0)

           {

           if (previousbar.OnNthPage != currentpage)

                {

                previousbar.BreakType = EndOfPage;

                }

           else

                {

                previousbar.BreakType = EndOfSystem;

                }

           }

     else      //4 lines added here after seeing code from BobZ

           {

           previousbar.BreakType = MiddleOfSystem;

           }

     }

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev
Reply | Threaded
Open this post in threaded view
|

Re: "Width" of Special Barlines

Bob Zawalich

Yeah, that is nice and compact. I don’t see any obvious problems with it that would cause it to fail.

 

Glad it’s working.

 

From: Martin Marris [mailto:[hidden email]]
Sent: Monday, October 19, 2015 11:38 PM
To: [hidden email]; 'A mailing list for Sibelius plug-in developers'
Subject: RE: [Plugin-dev] "Width" of Special Barlines

 

Thanks Bob, that is very helpful.

 

I had in fact already written code to “Lock Format” which did almost exactly the same thing as your code, but left out one crucial bit. Namely, I had not understood the purpose of the “MiddleOfSystem” bar “break” type and therefore hadn’t bothered to use it. Now that I’ve added it to my code, it’s working perfectly. So this is my version, which is “standalone” (doesn’t require any values to be passed to it). All it does is lock the entire score. It has no error-handling mechanism and will probably fail when presented with certain cases – this is something I don’t have to worry about here because I am using it only on known, selected scores.

 

score = Sibelius.ActiveScore;

score.Redraw = false;

sys = score.SystemStaff;

for i = 2 to (sys.NumBars + 1)

     {

     bar = sys.NthBar(i);

     previousbar = sys.NthBar(bar.BarNumber-1);

     currentpage = bar.OnNthPage;

     if (bar.NthBarInSystem = 0)

           {

           if (previousbar.OnNthPage != currentpage)

                {

                previousbar.BreakType = EndOfPage;

                }

           else

                {

                previousbar.BreakType = EndOfSystem;

                }

           }

     else      //4 lines added here after seeing code from BobZ

           {

           previousbar.BreakType = MiddleOfSystem;

           }

     }

 


_______________________________________________
Plugin-dev mailing list
[hidden email]
http://avid-listsrv1.avid.com/mailman/listinfo/plugin-dev