From 3930746d3e6cab846a02332c39510c48027c6006 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Mon, 19 Sep 2011 08:32:58 -0700 Subject: [PATCH 1/1] Fix 1896: chord names can have instrument names. This fixes a problem in the fix for issue 1598, which disabled instrument names for non-spaceable staves. Now we include non-spaceable staves, but not if there are some spaceable ones. --- lily/instrument-name-engraver.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc index c453e95411..cfeed05d53 100644 --- a/lily/instrument-name-engraver.cc +++ b/lily/instrument-name-engraver.cc @@ -40,6 +40,7 @@ protected: SCM short_text_; vector axis_groups_; + vector backup_axis_groups_; virtual void finalize (); DECLARE_ACKNOWLEDGER (axis_group); @@ -126,7 +127,6 @@ Instrument_name_engraver::acknowledge_axis_group (Grob_info info) { if (dynamic_cast (info.grob ()) && Axis_group_interface::has_axis (info.grob (), Y_AXIS) - && Page_layout_problem::is_spaceable (info.grob ()) /* ugh. */ @@ -135,7 +135,13 @@ Instrument_name_engraver::acknowledge_axis_group (Grob_info info) && !info.grob ()->internal_has_interface (ly_symbol2scm ("volta-interface")) && (!Align_interface::has_interface (info.grob ()))) { - axis_groups_.push_back (info.grob ()); + if (Page_layout_problem::is_spaceable (info.grob ())) + axis_groups_.push_back (info.grob ()); + else + // By default, don't include non-spaceable staves in the + // support of an instrument name. However, if the only staves + // are non-spaceable, we'll fall back to using them. + backup_axis_groups_.push_back (info.grob ()); } } @@ -149,6 +155,9 @@ Instrument_name_engraver::finalize () void Instrument_name_engraver::stop_spanner () { + if (axis_groups_.empty ()) + axis_groups_ = backup_axis_groups_; + for (vsize i = 0; i < axis_groups_.size (); i++) Pointer_group_interface::add_grob (text_spanner_, ly_symbol2scm ("elements"), -- 2.39.2