[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to create a restricted symbols context property
From: |
Urs Liska |
Subject: |
How to create a restricted symbols context property |
Date: |
Mon, 18 Jan 2016 11:31:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
I have created a new boolean context property by
- adding an entry in define-context-properties.scm
- setting the default in engraver-init.ly
- retrieving it in a class's (Beaming_option) from_context method
However, I would like to add another context property (and modify the
added one) from boolean to accepting one out of a list of symbols.
Skimming the source code I couldn't really find how I achieve that.
I assume that I have to define a custom predicate for my property that
throws an (which?) error the argument is not in the list of accepted
symbols.
Is that right? And if so, where should I define that?
And how do I retrieve the value of the property in a C++ class?
I see this in bar-number-engraver.cc:
SCM alternative_style = get_property
("alternativeNumberingStyle");
string text_tag = "";
if (scm_is_eq (alternative_style, ly_symbol2scm
("numbers-with-letters")))
But when I try to do something comparable the compiler complains:
beaming-pattern.cc: In member function 'void
Beaming_options::from_context(Context*)':
./include/lily-guile-macros.hh:186:65: error:
'internal_get_property' was not declared in this scope
#define get_property(x) internal_get_property (ly_symbol2scm (x))
^
beaming-pattern.cc:566:39: note: in expansion of macro 'get_property'
SCM strict_beat_beaming_behaviour = get_property ("testProperty");
^
Any pointers please?
TIA
Urs
- How to create a restricted symbols context property,
Urs Liska <=