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: Wed, 12 Sep 2012 15:53:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0

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

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.
What about pieces with different simultaneous time signatures?  They'd have 
different numbers of bars for a given section.

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?

The column number of a grob's left and right bound. Columns are linearly 
ordered from the beginning of a score to the end, so you can use it to know 
when a new staff is beginning in your array.  For bar lines, the grob only 
spans one column so the left and right values of the returned will be the same 
- you can use either one.
Ok, so I defined

LY_DEFINE (ly_grob_spanned_rank_interval, "ly:grob-spanned-rank-interval",
           2, 0, 0, (SCM grob, SCM dir),
           "Get the spanned rank interval of grob @var{grob}; @var{dir}"
           " may be @code{LEFT} or @code{RIGHT}.")
{
  Grob *gr = unsmob_grob (grob);

  LY_ASSERT_SMOB (Grob, grob, 1);
  LY_ASSERT_TYPE (scm_is_number, dir, 2);

  return scm_from_int (gr->Grob::spanned_rank_interval ()[to_dir (dir)]);
}

in lily/grob-scheme.cc.

Calling this function as (ly:grob-spanned-rank-interval grob dir)
returns -1 if dir = LEFT and 0 if dir = RIGHT
for *every* BarLine grob regardless of the grob's position in the
array.

Probably I made a mistake somewhere, but I don't know where.

Any hints are highly appreciated!

Regards,

Marc




reply via email to

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