lilypond-1.3.65
[lilypond.git] / lily / output-property-engraver.hh
blobef30fdf091f43e4145add5d631bbd58fd7181bf2
1 /*
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>
8 */
10 #include "output-property.hh"
11 #include "engraver.hh"
13 class Output_property_engraver : public Engraver
15 public:
16 Output_property_engraver();
17 VIRTUAL_COPY_CONS(Translator);
18 protected:
20 Link_array<Output_property> props_;
22 virtual void do_acknowledge_element (Score_element_info);
23 virtual bool do_try_music (Music*);
27 Output_property_engraver::do_try_music (Music* m)
29 if (Output_property * o = dynamic_cast<Output_property*> (m))
31 props_.push (m);
32 return true;
34 return false;
37 void
38 Output_property_engraver::do_acknowledge_element (Score_element_info i)
40 for (int i=props_.size (); i--; )
42 Output_property * o = props_[i];
43 SCM pred = gh_car (o->pred_sym_val_list_);
45 should typecheck pred.
47 SCM result=gh_apply (pred,
48 gh_listify (i.elem_l_->self_scm_, SCM_UNDEFINED));
49 if (to_boolean (result))
51 i.elem_l_->set_elt_property (gh_cadr (o->pred_sym_val_list_),
52 gh_caddr (o->pred_sym_val_list_));
57 void
58 Output_property_engraver::do_pre_move_processing ()
60 props_.clear ();