2 g-script-column-engraver.cc -- implement G_script_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "engraver.hh"
11 #include "g-script-column.hh"
12 #include "g-staff-side.hh"
15 Find potentially colliding scripts, and put them in a
16 G_script_column, that will fix the collisions. */
17 class G_script_column_engraver
: public Engraver
19 G_script_column
*scol_p_
;
20 Link_array
<Item
> script_l_arr_
;
21 Link_array
<G_staff_side_item
> staff_side_l_arr_
;
23 G_script_column_engraver ();
24 VIRTUAL_COPY_CONS(Translator
);
26 virtual void acknowledge_element (Score_element_info
);
27 virtual void process_acknowledged ();
28 virtual void do_pre_move_processing ();
29 virtual void do_post_move_processing ();
33 G_script_column_engraver::G_script_column_engraver()
39 G_script_column_engraver::do_pre_move_processing ()
43 typeset_element (scol_p_
);
49 G_script_column_engraver::do_post_move_processing ()
51 script_l_arr_
.clear ();
52 staff_side_l_arr_
.clear ();
56 G_script_column_engraver::acknowledge_element( Score_element_info inf
)
58 Item
*thing
= dynamic_cast<Item
*>(inf
.elem_l_
);
62 Dimension_cache
* parcache
= thing
->dim_cache_
[Y_AXIS
]->parent_l_
;
63 if (!parcache
|| !thing
)
66 Graphical_element
*parent
= parcache
->element_l ();
68 if (G_staff_side_item
* ss
= dynamic_cast<G_staff_side_item
*>(parent
))
70 if (!ss
->breakable_b ())
72 script_l_arr_
.push (thing
);
78 G_script_column_engraver::process_acknowledged ()
80 if (!scol_p_
&& script_l_arr_
.size () > 1)
82 scol_p_
= new G_script_column
;
83 announce_element (Score_element_info (scol_p_
, 0));
88 for (int i
=0; i
< script_l_arr_
.size (); i
++)
89 scol_p_
->add_staff_sided (script_l_arr_
[i
]);
90 script_l_arr_
.clear ();
93 ADD_THIS_TRANSLATOR(G_script_column_engraver
);