2015-02-15 18:50 GMT+01:00 David Nalesnik <david.nales...@gmail.com>:
> On Sun, Feb 15, 2015 at 7:58 AM, Urs Liska <u...@openlilylib.org> wrote:
>
>> Can't judge the code but the idea looks great :-)
>>
>>
> Thanks--I'm noticing that bits of code get reused on the lists, so there's
> a need.   This will help tuck away some of the code gobbledygook that is so
> off-putting..
>
> It occurs to me that it shouldn't be any trouble to add something like
> ly:item-location later on.  It could return (global-timestep . (measure .
> measure-position))..
>
> David



Hi David,

I can't review C++ code, though it looks like the C++-version of your:

#(define (get-paper-column grob)
   (if (not (ly:grob? grob))
       (ly:message "column not found")
       (if (grob::has-interface grob 'paper-column-interface)
           grob
           (get-paper-column (ly:grob-parent grob X)))))

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?


Cheers,
  Harm

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to