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"
12 #include "output-property-music-iterator.hh"
14 class Output_property_engraver : public Engraver
17 VIRTUAL_COPY_CONS(Translator);
21 should do this with \once and \push ?
24 \property Voice.outputProperties \push #pred = #modifier
26 where both MODIFIER and PRED are functions taking a
32 Link_array<Music> props_;
34 virtual void do_pre_move_processing ();
35 virtual void acknowledge_element (Score_element_info);
36 virtual bool do_try_music (Music*);
41 Output_property_engraver::do_try_music (Music* m)
43 if (m->get_mus_property ("type") ==
44 Output_property_music_iterator::constructor_cxx_function)
53 Output_property_engraver::acknowledge_element (Score_element_info inf)
55 for (int i=props_.size (); i--; )
57 Music * o = props_[i];
58 SCM pred = o->get_mus_property ("predicate");
61 should typecheck pred.
63 SCM result=gh_apply (pred,
64 gh_list (inf.elem_l_->self_scm (), SCM_UNDEFINED));
65 if (to_boolean (result))
67 SCM sym = o->get_mus_property ("symbol");
68 SCM val = o->get_mus_property ("value");
69 inf.elem_l_->set_elt_property (sym, val);
75 Output_property_engraver::do_pre_move_processing ()
80 ADD_THIS_TRANSLATOR(Output_property_engraver);