lilypond-1.3.65
[lilypond.git] / lily / engraver-group.cc
blob4636dcad3cfcae96160fa3bb7658085a352342dd
1 /*
2 engravergroup.cc -- implement Engraver_group_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "proto.hh"
10 #include "engraver-group-engraver.hh"
11 #include "engraver.hh"
12 #include "debug.hh"
13 #include "p-score.hh"
14 #include "score-element.hh"
17 ADD_THIS_TRANSLATOR(Engraver_group_engraver);
19 void
20 Engraver_group_engraver::announce_element (Score_element_info info)
22 announce_info_arr_.push (info);
23 Engraver::announce_element (info);
26 void
27 Engraver_group_engraver::do_announces()
29 Link_array<Translator_group> groups = group_l_arr ();
30 for (int i=0; i < groups.size(); i++)
32 Engraver_group_engraver * group = dynamic_cast<Engraver_group_engraver*> (groups[i]);
33 if (group)
35 group->do_announces();
39 Request dummy_req;
41 Link_array<Translator> nongroups = nongroup_l_arr ();
42 while (announce_info_arr_.size ())
44 for (int j =0; j < announce_info_arr_.size(); j++)
46 Score_element_info info = announce_info_arr_[j];
48 if (!info.req_l_)
49 info.req_l_ = &dummy_req;
50 for (int i=0; i < nongroups.size(); i++)
51 { // Is this good enough?
52 Engraver * eng = dynamic_cast<Engraver*> (nongroups[i]);
53 if (eng && eng!= info.origin_trans_l_arr_[0])
54 eng->acknowledge_element (info);
57 announce_info_arr_.clear ();
58 for (int i=0; i < nongroups.size(); i++)
60 Engraver * eng = dynamic_cast<Engraver*> (nongroups[i]);
61 if (eng)
62 eng->process_acknowledged ();
69 Staff_info
70 Engraver_group_engraver::get_staff_info() const
72 Staff_info inf = Engraver::get_staff_info();
74 Link_array<Translator> simple_translators = nongroup_l_arr ();
75 for (int i=0; i < simple_translators.size(); i++)
77 Engraver * eng = dynamic_cast<Engraver*> (simple_translators[i]);
78 if (eng)
79 eng->fill_staff_info (inf);
81 return inf;