lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grob-object information


From: Marc Hohl
Subject: Re: grob-object information
Date: Tue, 11 Sep 2012 21:29:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0

Am 11.09.2012 21:08, schrieb address@hidden:
On 11 sept. 2012, at 22:02, Marc Hohl <address@hidden> wrote:

Am 11.09.2012 20:48, schrieb address@hidden:
On 11 sept. 2012, at 17:48, Marc Hohl <address@hidden> wrote:

Hello list,

for my work on the volta bracket inclusion for the new bar line interface,
I need to know how the bars are ordered in (ly:grob-object grob 'bars).

Please see the attached file.

For the \musOne, I get a grob array with eight BarLine grobs
(two for each staff) for the first volta bracket (and one for
the second volta bracket, of course):

|------volta------|
<BarLine> <BarLine>
<BarLine> <BarLine>
<BarLine> <BarLine>
<BarLine> <BarLine>


For \musTwo, I get a grob array consisting of eight BarLine grobs
(because the bracket spans eight bars in a single line) and a second
one for the second volta bracket.

|-------------------------------------volta-----------------------------------|
<BarLine> <BarLine> <BarLine> <BarLine> <BarLine> <BarLine> <BarLine> <BarLine>


Is there any chance to get to know how the grobs are arranged?
Or more formally: how can I get the 2D structure back from a 1D vector?

Thanks in advance,

Marc

<shortvoltatest.ly>_______________________________________________
lilypond-devel mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-devel
You can use Grob::get_vertical_axis_group_index (you'd have to write a Scheme 
binding).
What value does that function return? A quick glance at its definition
in lily/grob.cc does not fully reveal its return value, but as this is an 
integer,
I have a 1D -> 1D function, but I need 2D.
   Or sort the list it based on ly:grob::vertical-less? (that binding is 
already written).
IIUC, that will sort the BarLine grobs, but I think that they *are* already 
sorted
in the grob array, like this:

|---------volta---------|
<BarLine 1a> <BarLine 2a>
<BarLine 1b> <BarLine 2b>
<BarLine 1c> <BarLine 2c>
<BarLine 1d> <BarLine 2d>

is returned as <1a> <1b> <1c> <1d> <2a> <2b> <2c> <2d> (I assume),
Are you certain that every vertical axis group will always contain the same 
number of bar lines?  If not, it's possible that the matrix you're talking 
about may not have complete rows, in which case it's difficult to know how to 
break it.
I am not 100% sure – there could be corner cases where a staff line stops before the volta bracket is closed, but this could lead to an error when compiling the .ly file.

One way to check it is to look at the left or right of the spanned_rank_interval of the 
grobs (the values will be the same as you're dealing with items which only ever 
"span" one column).  Once it goes backwards, you know that you've skipped to 
the next row.
What kind of values does spanned_rank_interval return?

Regards,

Marc




reply via email to

[Prev in Thread] Current Thread [Next in Thread]