2 output-property-engraver.cc -- implement Output_property_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "engraver.hh"
11 #include "score-element.hh"
13 class Output_property_engraver : public Engraver
16 VIRTUAL_COPY_CONS(Translator);
20 should do this with \once and \push ?
23 \property Voice.outputProperties \push #pred = #modifier
25 where both MODIFIER and PRED are functions taking a
31 Link_array<Music> props_;
33 virtual void do_pre_move_processing ();
34 virtual void acknowledge_element (Score_element_info);
35 virtual bool do_try_music (Music*);
40 Output_property_engraver::do_try_music (Music* m)
42 if (m->get_mus_property ("type") == ly_symbol2scm ("output-property"))
51 Output_property_engraver::acknowledge_element (Score_element_info inf)
53 for (int i=props_.size (); i--; )
55 Music * o = props_[i];
56 SCM pred = o->get_mus_property ("predicate");
59 should typecheck pred.
61 SCM result=gh_apply (pred,
62 gh_list (inf.elem_l_->self_scm (), SCM_UNDEFINED));
63 if (to_boolean (result))
65 SCM sym = o->get_mus_property ("symbol");
66 SCM val = o->get_mus_property ("value");
67 inf.elem_l_->set_elt_property (sym, val);
73 Output_property_engraver::do_pre_move_processing ()
78 ADD_THIS_TRANSLATOR(Output_property_engraver);