X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fhara-kiri-group-spanner.cc;h=4cf8465f3fcc1819e0645646c1bc78be58ead8d8;hb=2be67678488b5829a52acdf36ab4278477375b6d;hp=dba478e0a30e93f2a2b54f276b1c9f49ad65a277;hpb=bfb10684605084baf1a898be8f42c0e463c5764a;p=lilypond.git diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index dba478e0a3..4cf8465f3f 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -3,14 +3,14 @@ source file of the GNU LilyPond music typesetter - (c) 1998--2002 Jan Nieuwenhuizen + (c) 1998--2004 Jan Nieuwenhuizen Han-Wen Nienhuys */ #include "axis-group-interface.hh" #include "spanner.hh" #include "hara-kiri-group-spanner.hh" -#include "debug.hh" +#include "warn.hh" #include "item.hh" @@ -19,7 +19,7 @@ SCM Hara_kiri_group_spanner::y_extent (SCM element_smob, SCM scm_axis) { Grob *me = unsmob_grob (element_smob); - Axis a = (Axis) gh_scm2int (scm_axis); + Axis a = (Axis) ly_scm2int (scm_axis); assert (a == Y_AXIS); consider_suicide (me); @@ -30,10 +30,17 @@ Hara_kiri_group_spanner::y_extent (SCM element_smob, SCM scm_axis) void Hara_kiri_group_spanner::consider_suicide (Grob*me) { - SCM worth = me->get_grob_property ("items-worth-living"); - if (gh_pair_p (worth)) + Spanner*sp = dynamic_cast (me); + SCM worth = me->get_property ("items-worth-living"); + if (ly_c_pair_p (worth)) return ; + if (!to_boolean (me->get_property ("remove-first")) + && broken_spanner_index (sp) == 0) + { + return ; + } + Link_array childs = Axis_group_interface::get_children (me); for (int i = 0; i < childs.size (); i++) childs[i]->suicide (); @@ -56,10 +63,10 @@ SCM Hara_kiri_group_spanner::force_hara_kiri_callback (SCM element_smob, SCM axis) { Grob *me = unsmob_grob (element_smob); - Axis a = (Axis) gh_scm2int (axis); + Axis a = (Axis) ly_scm2int (axis); assert (a == Y_AXIS); consider_suicide (me); - return gh_double2scm (0.0); + return scm_make_real (0.0); } @@ -68,10 +75,10 @@ SCM Hara_kiri_group_spanner::force_hara_kiri_in_parent_callback (SCM element_smob, SCM axis) { Grob *daughter = unsmob_grob (element_smob); - Axis a = (Axis) gh_scm2int (axis); + Axis a = (Axis) ly_scm2int (axis); assert (a == Y_AXIS); force_hara_kiri_callback (daughter->get_parent (a)->self_scm (), axis); - return gh_double2scm (0.0); + return scm_make_real (0.0); } void @@ -94,9 +101,9 @@ Hara_kiri_group_spanner::add_interesting_item (Grob* me,Grob* n) ADD_INTERFACE (Hara_kiri_group_spanner,"hara-kiri-group-interface", - " As Vertical_group_spanner, but keep track of interesting items. If -we don't contain any interesting items after linebreaking, then -gracefully commit suicide. Objective: don't disgrace Lily by -typesetting empty lines in orchestral scores.", - "items-worth-living"); + "A group spanner that keeps track of interesting items. If it " + "doesn't contain any after linebreaking, then it " + "will remove itself and all its children." + , + "items-worth-living remove-first");