2 hara-kiri-vertical-group-spanner.cc -- implement Hara_kiri_group_spanner
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
7 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "axis-group-interface.hh"
11 #include "hara-kiri-group-spanner.hh"
17 Hara_kiri_group_spanner::Hara_kiri_group_spanner(SCM s
)
20 set_elt_pointer ("items-worth-living", SCM_EOL
);
24 Hara_kiri_group_spanner::add_interesting_item (Item
* n
)
27 Pointer_group_interface (this, "items-worth-living").add_element (n
);
31 GLUE_SCORE_ELEMENT(Hara_kiri_group_spanner
,after_line_breaking
);
33 Hara_kiri_group_spanner::member_after_line_breaking ()
35 SCM worth
= get_elt_pointer ("items-worth-living");
36 if (gh_pair_p (worth
))
39 Link_array
<Score_element
> childs
= Axis_group_interface (this).get_children ();
40 for (int i
= 0; i
< childs
.size (); i
++)
42 Score_element
* s
= childs
[i
];
44 if ( line_l () != s
->line_l ())
45 programming_error ("Killing other children too");
50 very appropriate name here :-)
59 We can't rely on offsets and dimensions of elements in a hara-kiri
60 group. Use a callback to make sure that hara-kiri has been done
61 before asking for offsets. */
63 Hara_kiri_group_spanner::force_hara_kiri_callback (Score_element
const *elt
, Axis a
)
65 while (elt
&& !dynamic_cast<Hara_kiri_group_spanner
const*> (elt
))
66 elt
= elt
->parent_l(a
);
70 Hara_kiri_group_spanner
const * seppuku
= dynamic_cast<Hara_kiri_group_spanner
const*> (elt
);
72 ((Hara_kiri_group_spanner
*)seppuku
)->member_after_line_breaking ();