[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: |
Thomas Morley |
Subject: |
Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden) |
Date: |
Sun, 15 Feb 2015 19:28:40 +0100 |
2015-02-15 18:50 GMT+01:00 David Nalesnik <address@hidden>:
> On Sun, Feb 15, 2015 at 7:58 AM, Urs Liska <address@hidden> 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
- Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), david . nalesnik, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), Urs Liska, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), David Nalesnik, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden),
Thomas Morley <=
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), Thomas Morley, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), David Nalesnik, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), David Nalesnik, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), Thomas Morley, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), David Nalesnik, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), Thomas Morley, 2015/02/15
- Re: Add Scheme function to return column associated with Item. (issue 203910043 by address@hidden), David Nalesnik, 2015/02/15