X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fhara-kiri-vertical-group-spanner.cc;h=21746accfd4374d45c95b67baa2e345744f82821;hb=c52973e438ce3490d688860bb71849a7b3c26fef;hp=9f09ea2d90efc8ee2f035a40a68cc10a44bb50b2;hpb=ee513a2f7d18fc8d43e1c291350ed81856b0192d;p=lilypond.git diff --git a/lily/hara-kiri-vertical-group-spanner.cc b/lily/hara-kiri-vertical-group-spanner.cc index 9f09ea2d90..21746accfd 100644 --- a/lily/hara-kiri-vertical-group-spanner.cc +++ b/lily/hara-kiri-vertical-group-spanner.cc @@ -13,24 +13,29 @@ #include "debug.hh" #include "item.hh" -Hara_kiri_group_spanner::Hara_kiri_group_spanner() +/* + */ +Hara_kiri_group_spanner::Hara_kiri_group_spanner(SCM s) + : Spanner (s) { - set_elt_property ("items-worth-living", SCM_EOL); + set_elt_pointer ("items-worth-living", SCM_EOL); } void Hara_kiri_group_spanner::add_interesting_item (Item* n) { add_dependency (n); - set_elt_property ("items-worth-living", - gh_cons (n->self_scm_, - get_elt_property ("items-worth-living"))); + Pointer_group_interface (this, "items-worth-living").add_element (n); + } void Hara_kiri_group_spanner::after_line_breaking () { - SCM worth = get_elt_property ("items-worth-living"); + SCM worth = get_elt_pointer ("items-worth-living"); + /* + worth == self_scm is a stupid way to signal that we're done. + */ if (gh_pair_p (worth)) return; @@ -41,14 +46,33 @@ Hara_kiri_group_spanner::after_line_breaking () if ( line_l () != s->line_l ()) programming_error ("Killing other children too"); - s->set_elt_property ("transparent", SCM_BOOL_T); - s->set_empty (X_AXIS); - s->set_empty (Y_AXIS); - + s->suicide (); } - set_empty (X_AXIS); - set_empty (Y_AXIS); + + /* + very appropriate name here :-) + */ + suicide (); } +/* + We can't rely on offsets and dimensions of elements in a hara-kiri + group. Use a callback to make sure that hara-kiri has been done + before asking for offsets. */ +Real +Hara_kiri_group_spanner::force_hara_kiri_callback (Score_element const *elt, Axis a) +{ + while (elt && !dynamic_cast (elt)) + elt = elt->parent_l(a); + + if (elt) + { + Hara_kiri_group_spanner const * seppuku = dynamic_cast (elt); + + ((Hara_kiri_group_spanner*)seppuku)->after_line_breaking (); + } + + return 0.0; +}