]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #580.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 23 Feb 2008 20:13:24 +0000 (17:13 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 23 Feb 2008 20:13:24 +0000 (17:13 -0300)
Acknowledge note-columns, and add a missing add_bound_item() call.
This makes trill and text spanners attach to notes (from the staff) if
possible, so objects in other staves will not influence their
attachments.

Add regression test.

input/regression/text-spanner-attachment-alignment.ly [new file with mode: 0644]
lily/text-spanner-engraver.cc
lily/trill-spanner-engraver.cc

diff --git a/input/regression/text-spanner-attachment-alignment.ly b/input/regression/text-spanner-attachment-alignment.ly
new file mode 100644 (file)
index 0000000..20f72ee
--- /dev/null
@@ -0,0 +1,23 @@
+\header {
+
+  texidoc = "Text and trill spanners are attached to note columns, so
+  attachments in other staves have no effect on them."
+  
+  }
+
+\layout {
+  ragged-right = ##t
+  }
+
+\version "2.11.22"
+<<
+   \new Staff {
+    \override TextSpanner #'bound-details #'left #'text = "*"
+      c'16 \startTrillSpan c' c' c' \stopTrillSpan 
+      c'16 \startTextSpan c' c' c' \stopTextSpan 
+   }
+   \new Staff {
+     \override TextScript #'self-alignment-X = #RIGHT 
+     \repeat unfold 2 {c'4 _ \markup { "FAT" } } 
+   }
+>>
index f7b2576d85043c734d0dc9e55add6526ff762ddc..7d789b29735d6f1a0109fb21dcdd67274dabccd2 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "international.hh"
 #include "note-column.hh"
+#include "pointer-group-interface.hh"
 #include "side-position-interface.hh"
 #include "spanner.hh"
 #include "stream-event.hh"
@@ -23,6 +24,7 @@ public:
 protected:
   virtual void finalize ();
   DECLARE_TRANSLATOR_LISTENER (text_span);
+  DECLARE_ACKNOWLEDGER (note_column);
   void stop_translation_timestep ();
   void process_music ();
 
@@ -121,6 +123,21 @@ Text_spanner_engraver::finalize ()
     }
 }
 
+
+void
+Text_spanner_engraver::acknowledge_note_column (Grob_info info)
+{
+  if (!span_)
+    return;
+
+  Pointer_group_interface::add_grob (span_,
+                                    ly_symbol2scm ("note-columns"),
+                                    info.grob());
+  add_bound_item (span_, info.grob ());
+}
+
+ADD_ACKNOWLEDGER (Text_spanner_engraver, note_column);
+
 ADD_TRANSLATOR (Text_spanner_engraver,
                /* doc */
                "Create text spanner from an event.",
index 857c03051d0f0eefa93ae68355aba0aae19a2096..1b183d6da6358c14de8bc11d9e825af28d233a41 100644 (file)
@@ -70,11 +70,9 @@ Trill_spanner_engraver::acknowledge_note_column (Grob_info info)
   Pointer_group_interface::add_grob (span_,
                                     ly_symbol2scm ("note-columns"),
                                     info.grob());
+  add_bound_item (span_, info.grob ());
 }
 
-ADD_ACKNOWLEDGER (Trill_spanner_engraver, note_column);
-
-
 void
 Trill_spanner_engraver::process_music ()
 {
@@ -143,6 +141,8 @@ Trill_spanner_engraver::finalize ()
     }
 }
 
+ADD_ACKNOWLEDGER (Trill_spanner_engraver, note_column);
+
 ADD_TRANSLATOR (Trill_spanner_engraver,
                /* doc */ "Create trill spanner from an event.",
                /* create */