]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #223.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 6 Jan 2007 22:32:21 +0000 (23:32 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 6 Jan 2007 22:32:21 +0000 (23:32 +0100)
Set a callback for Dots #'staff-position, depending on duration-log of
the rest.  This fixes the longest standing regression in Lily as yet,
as this did work in Lily 2.0.

lily/dot-column-engraver.cc
lily/dot-column.cc
lily/dots.cc
lily/rest.cc
scm/define-grobs.scm
scm/output-lib.scm

index ede002049f7358318fe54954fe430a0567c91a7f..620328ed33a8a842c1ea775da6f331a025f7457e 100644 (file)
@@ -16,7 +16,6 @@
 class Dot_column_engraver : public Engraver
 {
   Grob *dotcol_;
-  vector<Item*> heads_;
 public:
   TRANSLATOR_DECLARATIONS (Dot_column_engraver);
 
@@ -36,7 +35,6 @@ void
 Dot_column_engraver::stop_translation_timestep ()
 {
   dotcol_ = 0;
-  heads_.clear ();
 }
 
 void
index a07dfcde116c132bd7aa1e64958ca22896da9dd2..6e967f34890e10f21370ee62f154df327ba23b88 100644 (file)
@@ -256,6 +256,10 @@ Dot_column::calc_positioning_done (SCM smob)
        }
 
       int p = Staff_symbol_referencer::get_rounded_position (dp.dot_);
+
+      /* icky, since this should go via a Staff_symbol_referencer
+        offset callback but adding a dot overwrites Y-offset. */
+      p += (int) robust_scm2double (dp.dot_->get_property ("staff-position"), 0.0);
       dp.pos_ = p;
 
       if (dp.extremal_head_)
index afa82868a83f95afb6a4b8fc86462593f93ab087..ed2d8d563605b2539fd8e25d3dc2336f43b3ba42 100644 (file)
@@ -13,7 +13,6 @@
 #include "font-interface.hh"
 #include "lookup.hh"
 #include "staff-symbol-referencer.hh"
-#include "directional-element-interface.hh"
 #include "international.hh"
 
 MAKE_SCHEME_CALLBACK (Dots, print, 1);
index 64a3eb87cdb01bf4bbacbd739d7106523f983e69..61dd18b6c74aff052f2a3a991c592616adbb7076 100644 (file)
@@ -40,18 +40,6 @@ Rest::y_offset_callback (SCM smob)
   else
     amount += ss / 2;
 
-  Grob *dot = unsmob_grob (me->get_object ("dot"));
-  if (dot && duration_log > 4) // UGH.
-    {
-      dot->set_property ("staff-position",
-                      scm_from_int ((duration_log == 7) ? 4 : 3));
-    }
-  if (dot && duration_log >= -1 && duration_log <= 1) // UGH again.
-    {
-      dot->set_property ("staff-position",
-                        scm_from_int ((duration_log == 0) ? -1 : 1));
-    }
-
   if (!position_override)
     amount += 2 * ss * get_grob_direction (me);; 
   
index 4d06aa3a03bb2172c55acda651343e35bf6837fb..35ed14771297a1a667ac22895fcd93856b9b5cf9 100644 (file)
      . (
        (stencil . ,ly:dots::print)
        (dot-count . ,dots::calc-dot-count)
+       (staff-position . ,dots::calc-staff-position)
        (meta . ((class . Item)
                 (interfaces . (font-interface
                                staff-symbol-referencer-interface
index 19f3c613459ad8f0f3aef8e5e5a00d1f1801984d..f66a78bcbc7bf42082f35d66831dbd64c5e58c70 100644 (file)
   (ly:duration-dot-count
    (ly:event-property (event-cause grob) 'duration)))
 
+(define-public (dots::calc-staff-position grob)
+  (let*
+      ((head (ly:grob-parent grob Y))
+       (log (ly:grob-property head 'duration-log)))
+
+    (cond
+     ((or (not (grob::has-interface head 'rest-interface))
+        (not (integer? log))) 0)
+     ((= log 7) 4)
+     ((> log 4) 3)
+     ((= log 0) -1)
+     ((= log 1) 1)
+     ((= log -1) 1)
+     (else 0))))
+
 (define (note-head::calc-tablature-stem-attachment grob)
   (cons 0.0 1.35))