2 script-column-engraver.cc -- implement Script_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "script-column.hh"
11 #include "side-position-interface.hh"
14 #include "translator.icc"
17 Find potentially colliding scripts, and put them in a
18 Script_column, that will fix the collisions. */
19 class Script_column_engraver : public Engraver
22 vector<Grob*> scripts_;
25 TRANSLATOR_DECLARATIONS (Script_column_engraver);
27 DECLARE_ACKNOWLEDGER (side_position);
28 void process_acknowledged ();
29 void stop_translation_timestep ();
32 Script_column_engraver::Script_column_engraver ()
38 Script_column_engraver::stop_translation_timestep ()
42 for (vsize i = 0; i < scripts_.size (); i++)
43 if (Side_position_interface::get_axis (scripts_[i]) == Y_AXIS)
44 Script_column::add_side_positioned (script_column_, scripts_[i]);
52 Script_column_engraver::acknowledge_side_position (Grob_info inf)
54 Item *thing = dynamic_cast<Item *> (inf.grob ());
57 if (!Item::is_non_musical (thing))
58 scripts_.push_back (thing);
63 Script_column_engraver::process_acknowledged ()
65 if (!script_column_ && scripts_.size () > 1)
66 script_column_ = make_item ("ScriptColumn", SCM_EOL);
69 ADD_ACKNOWLEDGER (Script_column_engraver, side_position);
70 ADD_TRANSLATOR (Script_column_engraver,
72 "Find potentially colliding scripts and put them into a"
73 " @code{ScriptColumn} object; that will fix the collisions.",