From a3bd8185d03967d967574e9743637fe3bbdc6def Mon Sep 17 00:00:00 2001 From: hanwen Date: Sun, 4 Jul 2004 12:33:05 +0000 Subject: [PATCH] (process_acknowledged_grobs): catch cyclic parents when two axis-group-engravers are present. --- ChangeLog | 6 ++++++ lily/axis-group-engraver.cc | 42 +++++++++++++++++++++++++------------ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9fa5fee63..8c3fd6af00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2004-07-04 Han-Wen Nienhuys + * lily/axis-group-engraver.cc (process_acknowledged_grobs): catch + cyclic parents when two axis-group-engravers are + present. Backportme? + + * input/test/volta-chord-names.ly: new file. + * scm/define-context-properties.scm (all-user-translation-properties): change voltaOnThisStaff definition. Backport? diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index f62de7f1de..ffd0dd3a0e 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -101,23 +101,38 @@ Axis_group_engraver::acknowledge_grob (Grob_info i) void Axis_group_engraver::process_acknowledged_grobs () { - /* UGH UGH UGH */ + if (!staffline_) + return ; + for (int i=0; i < elts_.size (); i++) { Grob *par = elts_[i]->get_parent (Y_AXIS); if (!par || !Axis_group_interface::has_interface (par)) - if (elts_[i]->is_empty (Y_AXIS)) - { - /* - We have to do _something_, otherwise staff objects will - end up with System as parent. + { + if (staffline_->get_parent (Y_AXIS) + && staffline_->get_parent (Y_AXIS) == elts_[i]) + { + String msg = _("Axis_group_engraver: vertical group already has a parent.\n" + "Do you have two Axis_group_engravers?\n" + "Killing this vertical group."); + staffline_->warning (msg); + staffline_->suicide (); + staffline_ = 0; + break ; + } + else if (elts_[i]->is_empty (Y_AXIS)) + { + /* + We have to do _something_, otherwise staff objects will + end up with System as parent. - */ - elts_[i]->set_parent (staffline_, Y_AXIS); - } - else - add_element (elts_[i]); + */ + elts_[i]->set_parent (staffline_, Y_AXIS); + } + else + add_element (elts_[i]); + } } elts_.clear (); } @@ -169,8 +184,9 @@ void Hara_kiri_engraver::acknowledge_grob (Grob_info i) { Axis_group_engraver::acknowledge_grob (i); - if (i.grob_->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface")) - || i.grob_->internal_has_interface (ly_symbol2scm ("lyric-interface")) + if (staffline_ + && (i.grob_->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface")) + || i.grob_->internal_has_interface (ly_symbol2scm ("lyric-interface"))) ) { Hara_kiri_group_spanner::add_interesting_item (staffline_, i.grob_); -- 2.39.5