lilypond-1.4.4
[lilypond.git] / lily / engraver-group-engraver.cc
blob0a47bb8420dec903fce1706a8ce937063f42f409
1 /*
2 engravergroup.cc -- implement Engraver_group_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "flower-proto.hh"
10 #include "engraver-group-engraver.hh"
11 #include "engraver.hh"
12 #include "debug.hh"
13 #include "paper-score.hh"
14 #include "grob.hh"
17 ADD_THIS_TRANSLATOR (Engraver_group_engraver);
19 void
20 Engraver_group_engraver::announce_grob (Grob_info info)
22 announce_info_arr_.push (info);
23 Engraver::announce_grob (info);
27 void
28 Engraver_group_engraver::create_grobs ()
31 for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p))
33 Translator * t = unsmob_translator (gh_car (p));
34 Engraver * eng = dynamic_cast<Engraver*> (t);
35 if (eng)
36 eng->create_grobs ();
40 void
41 Engraver_group_engraver::acknowledge_grobs ()
43 for (int j =0; j < announce_info_arr_.size (); j++)
45 Grob_info info = announce_info_arr_[j];
46 for (SCM p = simple_trans_list_; gh_pair_p (p); p = gh_cdr (p))
48 Translator * t = unsmob_translator (gh_car (p));
49 Engraver * eng = dynamic_cast<Engraver*> (t);
50 if (eng && eng!= info.origin_trans_l_)
51 eng->acknowledge_grob (info);
56 void
57 Engraver_group_engraver::do_announces ()
59 for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr (p))
61 Translator * t = unsmob_translator (gh_car (p));
62 dynamic_cast<Engraver_group_engraver*> (t)->do_announces ();
65 create_grobs ();
67 while (announce_info_arr_.size ())
69 acknowledge_grobs ();
70 announce_info_arr_.clear ();
71 create_grobs ();
75 #include <iostream.h>
78 order is : top to bottom (as opposed to do_announces)
80 void
81 Engraver_group_engraver::process_music ()
83 for (SCM p = simple_trans_list_; gh_pair_p (p); p =gh_cdr (p))
85 Translator * t = unsmob_translator (gh_car (p));
86 Engraver * eng = dynamic_cast<Engraver*> (t);
88 if (eng)
89 eng->process_music ();
91 for (SCM p = trans_group_list_; gh_pair_p (p); p =gh_cdr (p))
93 Translator * t = unsmob_translator (gh_car (p));
94 Engraver*eng = dynamic_cast<Engraver*> (t);
95 if (eng)
96 eng->process_music ();