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 "output-property.hh"
11 #include "engraver.hh"
12 #include "score-element.hh"
14 class Output_property_engraver : public Engraver
17 VIRTUAL_COPY_CONS(Translator);
20 Link_array<Output_property> props_;
22 virtual void do_pre_move_processing ();
23 virtual void acknowledge_element (Score_element_info);
24 virtual bool do_try_music (Music*);
29 Output_property_engraver::do_try_music (Music* m)
31 if (Output_property * o = dynamic_cast<Output_property*> (m))
40 Output_property_engraver::acknowledge_element (Score_element_info inf)
42 for (int i=props_.size (); i--; )
44 Output_property * o = props_[i];
45 SCM pred = gh_car (o->pred_sym_val_list_);
47 should typecheck pred.
49 SCM result=gh_apply (pred,
50 gh_list (inf.elem_l_->self_scm_, SCM_UNDEFINED));
51 if (to_boolean (result))
53 Score_element::ly_set_elt_property (inf.elem_l_->self_scm_,
54 gh_cadr (o->pred_sym_val_list_),
55 gh_caddr (o->pred_sym_val_list_));
61 Output_property_engraver::do_pre_move_processing ()
66 ADD_THIS_TRANSLATOR(Output_property_engraver);