lilypond-devel
[Top][All Lists]
Advanced

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

Re: cleanup: infinity, get property (issue 6310043)


From: David Kastrup
Subject: Re: cleanup: infinity, get property (issue 6310043)
Date: Fri, 15 Jun 2012 17:04:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Janek Warchoł <address@hidden> writes:

> I forgot that my git-cl is configured to add -devel to cc!
> This is a draft which i was discussing with Mike, but since it got
> public, i welcome any comments!
>
> On 2012/06/15 09:42:03, dak wrote:
>> On 2012/06/15 09:22:28, janek wrote:
>> > How do you like this?
>> >
>> > I've tried to define a new property lyricDefaultAlignment (similar to
>> > lyricMelismaAlignment) and use it in line 47, but i got an error:
>> > 'internal_get_property' was not declared in this scope
>> >
>> > I'll investigate when i get back home.
>>
>> What makes you think Lyric_text has properties?  It is a class you defined
>> yourself.
>>
>> I really can't figure out what you are trying to do here.
>
> I'm trying to define a new context property lyricDefaultAlignment
> similarly to how lyricMelismaAlignment is defined.
> (did i use the right name? lyricMelismaAlignment is a context
> property, i.e. a property that doesn't belong to a specific grob?)
> Look at Lyric_engraver, lines 76-77:
>
> last_text_->set_property ("self-alignment-X",
>                                       get_property ("lyricMelismaAlignment"));
>
> unless i'm totally wrong, last_text_ is a pointer to a LyricText item.
>  These two lines set that LyricText's self-alignment-X to what is
> inside lyricMelismaAlignment.

But this is inside of a member function of an _Engraver_.  An engraver
has an associated context, and get_property inside of an engraver will
access the respective context property.

> I want to do something similar: in Lyric_text, i have a pointer to
> LyricText item and i want to set its self-alignment to what's inside
> another property: lyricDefaultAlignment.
>
>> What makes you think Lyric_text has properties?
>
> Does it need any?  I'm trying to read a context property (or at least
> that's what i think i'm trying), i thought that they don't need to be
> "owned".

What do you think the word "context" in "context property" means?  How
should the C++ compiler guess what context you are talking about when
you just write get_property ("lyricMelismaAlignment") ?

>> It is a class you defined yourself.
>
> I've looked at other class definitions (in particular, flag.cc) and
> tried to define Lyric_text accordingly to what i saw.  Apparently i
> missed something, but i don't know what :(

You call a member function get_property (or rather via a macro
definition internal_get_property) but don't define it.

> I thought that ADD_INTERFACE is responsible for connecting my class
> with the rest of the code, and MAKE_SCHEME_CALLBACK makes a method
> available in Scheme "layer".  I don't have any idea what else is
> necessary...
> I'd be grateful for an explanation.

Again: how should LilyPond guess the context from which you want the
property read?  The code will, of course, depend on the answer to that
question.

-- 
David Kastrup



reply via email to

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