lilypond-devel
[Top][All Lists]
Advanced

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

Re: Add Scheme function to return column associated with Item. (issue 20


From: David Nalesnik
Subject: Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden)
Date: Sun, 15 Feb 2015 13:09:50 -0600

Hi Harm,

On Sun, Feb 15, 2015 at 12:28 PM, Thomas Morley <address@hidden>
wrote:

>
>
> Some time ago I wrote a more generic code:
>
> #(define (look-up-for-parent name-symbol axis grob)
> "
>  Return the parent of @var{grob}, specified by it's @var{name-symbol} in
>  axis @var{axis}.
>  If not found, look up for the next parent.
> "
>  (let* ((parent (ly:grob-parent grob axis)))
>  (cond
>    ((not (ly:grob? parent))
>     (ly:error
>        (_"Perhaps typing error for \"~a\" or \"~a\" is not in the
> parent-tree.")
>        name-symbol name-symbol))
>    ((not (equal? name-symbol (grob-name parent)))
>     (look-up-for-parent name-symbol axis parent))
>    (else parent))))
>
>
> I wonder whether something like this may be implemented at C++ level
> and your "ly:item-get-column" as a special case of it.
>
> What do you think?


The patch simply makes a commonly used C++ function available through
Scheme, on the model of functions like ly:grob-system.  Now I couldn't say
whether the function it wraps--Paper_column::get_column--could benefit from
a different approach.  In any case, this patch just provides an interface
for it, whatever its implementation details are.

 I do think that what you're describing would be very useful as another
function usable in C++ and Scheme: given a grob, check whether it related
by parentage to some other grob.  (I know that ly:grob-extent and
ly:grob-relative-coordinate require this, so your function would help
finding appropriate input for them.)

I wonder if it should operate by the actual grob pointer instead of its
name, in line with the way other functions work.

This is so useful, that I wonder if there's a C++ function which just
hasn't been made accessible yet!


reply via email to

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