]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #459.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 11 Sep 2007 23:08:58 +0000 (01:08 +0200)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 11 Sep 2007 23:08:58 +0000 (01:08 +0200)
Add end-on-note detail property to line spanner. Use this to make a
trill spanner start on the note iso. paper column on the left broken
edge.

input/regression/trill-spanner-broken.ly [new file with mode: 0644]
lily/line-spanner.cc
lily/trill-spanner-engraver.cc
scm/define-grobs.scm

diff --git a/input/regression/trill-spanner-broken.ly b/input/regression/trill-spanner-broken.ly
new file mode 100644 (file)
index 0000000..6d4d0fb
--- /dev/null
@@ -0,0 +1,15 @@
+\version "2.11.32"
+
+\header {
+  texidoc = "
+A TrillSpanner crossing a line break should restart exactly above
+the first note on the new line. "
+}
+
+{ c'1\startTrillSpan \break
+  c' c'\stopTrillSpan
+}
+
+\paper {
+  ragged-right = ##t
+}
index 08dfbe700137233a033f3bab69074f15863930b7..7d8cea10d6d702977057c59bccaf263285098bd3 100644 (file)
@@ -6,21 +6,21 @@
   (c) 2000--2007 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
+#include "align-interface.hh"
 #include "axis-group-interface.hh"
-#include "spanner.hh"
-#include "output-def.hh"
-#include "item.hh"
-#include "staff-symbol-referencer.hh"
 #include "font-interface.hh"
-#include "warn.hh"
-#include "align-interface.hh"
+#include "grob-interface.hh"
+#include "item.hh"
+#include "lily-proto.hh"
 #include "line-interface.hh"
 #include "moment.hh"
+#include "output-def.hh"
+#include "pointer-group-interface.hh"
+#include "spanner.hh"
+#include "staff-symbol-referencer.hh"
 #include "system.hh"
-
-#include "lily-proto.hh"
-#include "grob-interface.hh"
 #include "text-interface.hh"
+#include "warn.hh"
 
 class Line_spanner
 {
@@ -88,8 +88,19 @@ Line_spanner::calc_bound_info (SCM smob, Direction dir)
                                                     details, SCM_BOOL_F),
                        CENTER);
 
+      Item *bound_item = me->get_bound (dir);
+      Grob *bound_grob = bound_item;
+      if (to_boolean (ly_assoc_get (ly_symbol2scm ("end-on-note"), details, SCM_BOOL_F))
+         && bound_item->break_status_dir ())
+       {
+         extract_grob_set (me, "note-columns", columns);
+         if (columns.size ())
+           bound_grob = (dir == LEFT)
+             ? columns[0] : columns.back();
+       }
+      
       details = scm_acons (ly_symbol2scm ("X"),
-                          scm_from_double (me->get_bound (dir)->extent (commonx, X_AXIS)
+                          scm_from_double (bound_grob->extent (commonx, X_AXIS)
                                            .linear_combination (attach)),
                           details);
     }
@@ -336,11 +347,12 @@ ADD_INTERFACE (Line_spanner,
               "@code{dotted-line} or @code{zigzag}.\n"
               "\n",
 
+              "bound-details " 
               "extra-dy "
               "gap "
-              "thickness "
-              "bound-details " 
-              "left-bound-info " 
+              "left-bound-info "
+              "note-columns "
               "right-bound-info " 
+              "thickness "
               );
 
index d2ef7e1eb8045c836316aa3c838ed8ebe3667374..857c03051d0f0eefa93ae68355aba0aae19a2096 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "international.hh"
 #include "note-column.hh"
+#include "pointer-group-interface.hh"
 #include "side-position-interface.hh"
 #include "stream-event.hh"
 #include "spanner.hh"
@@ -30,6 +31,8 @@ public:
 protected:
   virtual void finalize ();
   DECLARE_TRANSLATOR_LISTENER (trill_span);
+  DECLARE_ACKNOWLEDGER (note_column);
+
   void stop_translation_timestep ();
   void process_music ();
 
@@ -58,6 +61,20 @@ Trill_spanner_engraver::listen_trill_span (Stream_event *ev)
   ASSIGN_EVENT_ONCE (event_drul_[d], ev);
 }
 
+void
+Trill_spanner_engraver::acknowledge_note_column (Grob_info info)
+{
+  if (!span_)
+    return;
+
+  Pointer_group_interface::add_grob (span_,
+                                    ly_symbol2scm ("note-columns"),
+                                    info.grob());
+}
+
+ADD_ACKNOWLEDGER (Trill_spanner_engraver, note_column);
+
+
 void
 Trill_spanner_engraver::process_music ()
 {
index ba600479635ff0e4f28d4c2c14996b720ba53aa7..cd2c337b8823ce0a408780279d6908d334fc3f5d 100644 (file)
                                   (padding . 1.5)
                                   (attach-dir . ,LEFT)
                                   ))
+                         (left-broken . ((end-on-note . #t)))
                          (right . ((Y . 0)))
                          ))